├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── COPYING ├── LICENSE ├── README.md ├── appveyor.yml ├── cmake └── CXXhelpers.cmake ├── examples └── src │ ├── AudioDevice.cpp │ ├── AudioDevice.h │ ├── Main.cpp │ └── RingBuffer.h ├── include └── libnyquist │ ├── Common.h │ ├── Decoders.h │ └── Encoders.h ├── src ├── Common.cpp ├── Encoders.cpp ├── FlacDecoder.cpp ├── FlacDependencies.c ├── Mp3Decoder.cpp ├── MusepackDecoder.cpp ├── MusepackDependencies.c ├── OpusDecoder.cpp ├── OpusDependencies.c ├── VorbisDecoder.cpp ├── VorbisDependencies.c ├── WavDecoder.cpp └── WavPackDecoder.cpp ├── test_data ├── 1ch │ └── 44100 │ │ ├── 8 │ │ └── test.wav │ │ ├── 16 │ │ └── test.wav │ │ ├── 24 │ │ └── test.wav │ │ ├── 32 │ │ └── test.wav │ │ └── 64 │ │ └── test.wav ├── 2ch │ ├── 8000 │ │ ├── 8 │ │ │ └── test.wav │ │ ├── 16 │ │ │ └── test.wav │ │ ├── 24 │ │ │ └── test.wav │ │ ├── 32 │ │ │ └── test.wav │ │ └── 64 │ │ │ └── test.wav │ ├── 22050 │ │ ├── 8 │ │ │ └── test.wav │ │ ├── 16 │ │ │ └── test.wav │ │ ├── 24 │ │ │ └── test.wav │ │ ├── 32 │ │ │ └── test.wav │ │ └── 64 │ │ │ └── test.wav │ ├── 44100 │ │ ├── 8 │ │ │ └── test.wav │ │ ├── 16 │ │ │ └── test.wav │ │ ├── 24 │ │ │ └── test.wav │ │ ├── 32 │ │ │ └── test.wav │ │ └── 64 │ │ │ └── test.wav │ └── 96000 │ │ ├── 8 │ │ └── test.wav │ │ ├── 16 │ │ └── test.wav │ │ ├── 24 │ │ └── test.wav │ │ ├── 32 │ │ └── test.wav │ │ └── 64 │ │ └── test.wav ├── ad_hoc │ ├── 44_16_mono.mpc │ ├── 44_16_stereo.mpc │ ├── 6_channel_44k_16b.wav │ ├── Block-split-stereo-ima4-reaper.wav │ ├── BlockSplit_Stereo.ogg │ ├── BlockWoosh_Stereo.ogg │ ├── KittyPurr16_Mono.flac │ ├── KittyPurr16_Stereo.flac │ ├── KittyPurr24_Stereo.flac │ ├── KittyPurr8_Stereo.flac │ ├── KittyPurr8_Stereo_Dithered.flac │ ├── LR_Stereo.ogg │ ├── Sequence44k_24b.wav │ ├── TestBeat.ogg │ ├── TestBeatMono.ogg │ ├── TestBeat_44_16_mono-ima4-reaper.wav │ ├── TestBeat_44_16_stereo-ima4-reaper.wav │ ├── TestBeat_44_16_stereo-ima4.aiff │ ├── TestBeat_44_16_stereo-ima4.caf │ ├── TestBeat_44_16_stereo-ima4.wav │ ├── TestBeat_Float32.wv │ ├── TestBeat_Float32_Mono.wv │ ├── TestBeat_Int16.wv │ ├── TestBeat_Int24.wv │ ├── TestBeat_Int24_Mono.wv │ ├── TestBeat_Int32.wv │ ├── TestLaugh_44k.ogg │ ├── TestLaugh_Float32.wav │ ├── TestSine_24b.wav │ ├── TestSine_Float32.wav │ ├── TestTone_24b.wav │ ├── acetylene.mp3 │ └── detodos.opus ├── degenerate │ ├── header_larger_than_file_size.wav │ ├── junk_after_riff.wav │ └── odd_length_random_chunk.wav ├── mid │ ├── migm1.mid │ └── migm1.txt └── mod │ ├── fountain.mod │ ├── guitarou.mod │ └── tales-06-swat.s3m └── third_party ├── FLAC ├── all.h ├── assert.h ├── callback.h ├── export.h ├── format.h ├── metadata.h ├── ordinals.h ├── src │ ├── bitmath.c │ ├── bitreader.c │ ├── bitwriter.c │ ├── cpu.c │ ├── crc.c │ ├── fixed.c │ ├── fixed_intrin_sse2.c │ ├── fixed_intrin_ssse3.c │ ├── float.c │ ├── format.c │ ├── ia32 │ │ ├── cpu_asm.nasm │ │ ├── fixed_asm.nasm │ │ ├── lpc_asm.nasm │ │ └── nasm.h │ ├── include │ │ ├── private │ │ │ ├── all.h │ │ │ ├── bitmath.h │ │ │ ├── bitreader.h │ │ │ ├── bitwriter.h │ │ │ ├── cpu.h │ │ │ ├── crc.h │ │ │ ├── fixed.h │ │ │ ├── float.h │ │ │ ├── format.h │ │ │ ├── lpc.h │ │ │ ├── macros.h │ │ │ ├── md5.h │ │ │ ├── memory.h │ │ │ ├── metadata.h │ │ │ ├── ogg_decoder_aspect.h │ │ │ ├── ogg_encoder_aspect.h │ │ │ ├── ogg_helper.h │ │ │ ├── ogg_mapping.h │ │ │ ├── stream_encoder.h │ │ │ ├── stream_encoder_framing.h │ │ │ └── window.h │ │ ├── protected │ │ │ ├── all.h │ │ │ ├── stream_decoder.h │ │ │ └── stream_encoder.h │ │ └── share │ │ │ ├── alloc.h │ │ │ ├── compat.h │ │ │ ├── endswap.h │ │ │ ├── getopt.h │ │ │ ├── macros.h │ │ │ ├── private.h │ │ │ ├── safe_str.h │ │ │ ├── utf8.h │ │ │ └── win_utf8_io.h │ ├── lpc.c │ ├── lpc_intrin_avx2.c │ ├── lpc_intrin_sse.c │ ├── lpc_intrin_sse2.c │ ├── lpc_intrin_sse41.c │ ├── md5.c │ ├── memory.c │ ├── metadata_iterators.c │ ├── metadata_object.c │ ├── ogg_decoder_aspect.c │ ├── ogg_encoder_aspect.c │ ├── ogg_helper.c │ ├── ogg_mapping.c │ ├── stream_decoder.c │ ├── stream_encoder.c │ ├── stream_encoder_framing.c │ ├── stream_encoder_intrin_avx2.c │ ├── stream_encoder_intrin_sse2.c │ ├── stream_encoder_intrin_ssse3.c │ ├── win_utf8_io.c │ └── window.c ├── stream_decoder.h └── stream_encoder.h ├── libogg ├── include │ └── ogg │ │ ├── ogg.h │ │ └── os_types.h └── src │ ├── bitwise.c │ └── framing.c ├── libvorbis ├── include │ └── vorbis │ │ ├── codec.h │ │ ├── vorbisenc.h │ │ └── vorbisfile.h └── src │ ├── analysis.c │ ├── backends.h │ ├── barkmel.c │ ├── bitrate.c │ ├── bitrate.h │ ├── block.c │ ├── books │ ├── coupled │ │ ├── res_books_51.h │ │ └── res_books_stereo.h │ ├── floor │ │ └── floor_books.h │ └── uncoupled │ │ └── res_books_uncoupled.h │ ├── codebook.c │ ├── codebook.h │ ├── codec_internal.h │ ├── envelope.c │ ├── envelope.h │ ├── floor0.c │ ├── floor1.c │ ├── highlevel.h │ ├── info.c │ ├── lookup.c │ ├── lookup.h │ ├── lookup_data.h │ ├── lpc.c │ ├── lpc.h │ ├── lsp.c │ ├── lsp.h │ ├── mapping0.c │ ├── masking.h │ ├── mdct.c │ ├── mdct.h │ ├── misc.h │ ├── modes │ ├── floor_all.h │ ├── psych_11.h │ ├── psych_16.h │ ├── psych_44.h │ ├── psych_8.h │ ├── residue_16.h │ ├── residue_44.h │ ├── residue_44p51.h │ ├── residue_44u.h │ ├── residue_8.h │ ├── setup_11.h │ ├── setup_16.h │ ├── setup_22.h │ ├── setup_32.h │ ├── setup_44.h │ ├── setup_44p51.h │ ├── setup_44u.h │ ├── setup_8.h │ └── setup_X.h │ ├── os.h │ ├── psy.c │ ├── psy.h │ ├── psytune.c │ ├── registry.c │ ├── registry.h │ ├── res0.c │ ├── scales.h │ ├── sharedbook.c │ ├── smallft.c │ ├── smallft.h │ ├── synthesis.c │ ├── tone.c │ ├── vorbisenc.c │ ├── vorbisfile.c │ ├── window.c │ └── window.h ├── minimp3 ├── LICENSE ├── minimp3.h └── minimp3_ex.h ├── musepack ├── include │ └── mpc │ │ ├── datatypes.h │ │ ├── minimax.h │ │ ├── mpc_types.h │ │ ├── mpcdec.h │ │ ├── mpcmath.h │ │ ├── reader.h │ │ └── streaminfo.h ├── libmpcdec │ ├── crc32.c │ ├── decoder.h │ ├── huffman.c │ ├── huffman.h │ ├── internal.h │ ├── mpc_bits_reader.c │ ├── mpc_bits_reader.h │ ├── mpc_decoder.c │ ├── mpc_demux.c │ ├── mpc_reader.c │ ├── mpcdec_math.h │ ├── requant.c │ ├── requant.h │ ├── streaminfo.c │ └── synth_filter.c └── libmpcenc │ ├── analy_filter.c │ ├── bitstream.c │ ├── encode_sv7.c │ ├── huffsv7.c │ ├── libmpcenc.h │ └── quant.c ├── opus ├── celt │ ├── _kiss_fft_guts.h │ ├── arch.h │ ├── arm │ │ ├── arm2gnu.pl │ │ ├── arm_celt_map.c │ │ ├── armcpu.c │ │ ├── armcpu.h │ │ ├── armopts.s.in │ │ ├── celt_pitch_xcorr_arm.s │ │ ├── fixed_armv4.h │ │ ├── fixed_armv5e.h │ │ ├── kiss_fft_armv4.h │ │ ├── kiss_fft_armv5e.h │ │ └── pitch_arm.h │ ├── bands.c │ ├── bands.h │ ├── celt.c │ ├── celt.h │ ├── celt_decoder.c │ ├── celt_encoder.c │ ├── celt_lpc.c │ ├── celt_lpc.h │ ├── cpu_support.h │ ├── cwrs.c │ ├── cwrs.h │ ├── ecintrin.h │ ├── entcode.c │ ├── entcode.h │ ├── entdec.c │ ├── entdec.h │ ├── entenc.c │ ├── entenc.h │ ├── fixed_debug.h │ ├── fixed_generic.h │ ├── float_cast.h │ ├── kiss_fft.c │ ├── kiss_fft.h │ ├── laplace.c │ ├── laplace.h │ ├── mathops.c │ ├── mathops.h │ ├── mdct.c │ ├── mdct.h │ ├── mfrngcod.h │ ├── modes.c │ ├── modes.h │ ├── opus_custom_demo.c │ ├── os_support.h │ ├── pitch.c │ ├── pitch.h │ ├── quant_bands.c │ ├── quant_bands.h │ ├── rate.c │ ├── rate.h │ ├── stack_alloc.h │ ├── static_modes_fixed.h │ ├── static_modes_float.h │ ├── vq.c │ ├── vq.h │ └── x86 │ │ └── pitch_sse.h ├── libopus │ ├── include │ │ ├── opus.h │ │ ├── opus_custom.h │ │ ├── opus_defines.h │ │ ├── opus_multistream.h │ │ └── opus_types.h │ └── src │ │ ├── analysis.c │ │ ├── analysis.h │ │ ├── mlp.c │ │ ├── mlp.h │ │ ├── mlp_data.c │ │ ├── opus.c │ │ ├── opus_compare.c │ │ ├── opus_decoder.c │ │ ├── opus_demo.c │ │ ├── opus_encoder.c │ │ ├── opus_multistream.c │ │ ├── opus_multistream_decoder.c │ │ ├── opus_multistream_encoder.c │ │ ├── opus_private.h │ │ ├── repacketizer.c │ │ ├── repacketizer_demo.c │ │ └── tansig_table.h ├── opusfile │ ├── include │ │ └── opusfile.h │ └── src │ │ ├── http.c │ │ ├── include │ │ ├── internal.h │ │ └── winerrno.h │ │ ├── info.c │ │ ├── internal.c │ │ ├── opusfile.c │ │ ├── stream.c │ │ └── wincerts.c └── silk │ ├── A2NLSF.c │ ├── API.h │ ├── CNG.c │ ├── HP_variable_cutoff.c │ ├── Inlines.h │ ├── LPC_analysis_filter.c │ ├── LPC_inv_pred_gain.c │ ├── LP_variable_cutoff.c │ ├── MacroCount.h │ ├── MacroDebug.h │ ├── NLSF2A.c │ ├── NLSF_VQ.c │ ├── NLSF_VQ_weights_laroia.c │ ├── NLSF_decode.c │ ├── NLSF_del_dec_quant.c │ ├── NLSF_encode.c │ ├── NLSF_stabilize.c │ ├── NLSF_unpack.c │ ├── NSQ.c │ ├── NSQ_del_dec.c │ ├── PLC.c │ ├── PLC.h │ ├── SigProc_FIX.h │ ├── VAD.c │ ├── VQ_WMat_EC.c │ ├── ana_filt_bank_1.c │ ├── arm │ ├── SigProc_FIX_armv4.h │ ├── SigProc_FIX_armv5e.h │ ├── macros_armv4.h │ └── macros_armv5e.h │ ├── biquad_alt.c │ ├── bwexpander.c │ ├── bwexpander_32.c │ ├── check_control_input.c │ ├── code_signs.c │ ├── control.h │ ├── control_SNR.c │ ├── control_audio_bandwidth.c │ ├── control_codec.c │ ├── debug.c │ ├── debug.h │ ├── dec_API.c │ ├── decode_core.c │ ├── decode_frame.c │ ├── decode_indices.c │ ├── decode_parameters.c │ ├── decode_pitch.c │ ├── decode_pulses.c │ ├── decoder_set_fs.c │ ├── define.h │ ├── enc_API.c │ ├── encode_indices.c │ ├── encode_pulses.c │ ├── errors.h │ ├── fixed │ ├── LTP_analysis_filter_FIX.c │ ├── LTP_scale_ctrl_FIX.c │ ├── apply_sine_window_FIX.c │ ├── autocorr_FIX.c │ ├── burg_modified_FIX.c │ ├── corrMatrix_FIX.c │ ├── encode_frame_FIX.c │ ├── find_LPC_FIX.c │ ├── find_LTP_FIX.c │ ├── find_pitch_lags_FIX.c │ ├── find_pred_coefs_FIX.c │ ├── k2a_FIX.c │ ├── k2a_Q16_FIX.c │ ├── main_FIX.h │ ├── noise_shape_analysis_FIX.c │ ├── pitch_analysis_core_FIX.c │ ├── prefilter_FIX.c │ ├── process_gains_FIX.c │ ├── regularize_correlations_FIX.c │ ├── residual_energy16_FIX.c │ ├── residual_energy_FIX.c │ ├── schur64_FIX.c │ ├── schur_FIX.c │ ├── solve_LS_FIX.c │ ├── structs_FIX.h │ ├── vector_ops_FIX.c │ └── warped_autocorrelation_FIX.c │ ├── float │ ├── LPC_analysis_filter_FLP.c │ ├── LPC_inv_pred_gain_FLP.c │ ├── LTP_analysis_filter_FLP.c │ ├── LTP_scale_ctrl_FLP.c │ ├── SigProc_FLP.h │ ├── apply_sine_window_FLP.c │ ├── autocorrelation_FLP.c │ ├── burg_modified_FLP.c │ ├── bwexpander_FLP.c │ ├── corrMatrix_FLP.c │ ├── encode_frame_FLP.c │ ├── energy_FLP.c │ ├── find_LPC_FLP.c │ ├── find_LTP_FLP.c │ ├── find_pitch_lags_FLP.c │ ├── find_pred_coefs_FLP.c │ ├── inner_product_FLP.c │ ├── k2a_FLP.c │ ├── levinsondurbin_FLP.c │ ├── main_FLP.h │ ├── noise_shape_analysis_FLP.c │ ├── pitch_analysis_core_FLP.c │ ├── prefilter_FLP.c │ ├── process_gains_FLP.c │ ├── regularize_correlations_FLP.c │ ├── residual_energy_FLP.c │ ├── scale_copy_vector_FLP.c │ ├── scale_vector_FLP.c │ ├── schur_FLP.c │ ├── solve_LS_FLP.c │ ├── sort_FLP.c │ ├── structs_FLP.h │ ├── warped_autocorrelation_FLP.c │ └── wrappers_FLP.c │ ├── gain_quant.c │ ├── init_decoder.c │ ├── init_encoder.c │ ├── inner_prod_aligned.c │ ├── interpolate.c │ ├── lin2log.c │ ├── log2lin.c │ ├── macros.h │ ├── main.h │ ├── pitch_est_defines.h │ ├── pitch_est_tables.c │ ├── process_NLSFs.c │ ├── quant_LTP_gains.c │ ├── resampler.c │ ├── resampler_down2.c │ ├── resampler_down2_3.c │ ├── resampler_private.h │ ├── resampler_private_AR2.c │ ├── resampler_private_IIR_FIR.c │ ├── resampler_private_down_FIR.c │ ├── resampler_private_up2_HQ.c │ ├── resampler_rom.c │ ├── resampler_rom.h │ ├── resampler_structs.h │ ├── shell_coder.c │ ├── sigm_Q15.c │ ├── sort.c │ ├── stereo_LR_to_MS.c │ ├── stereo_MS_to_LR.c │ ├── stereo_decode_pred.c │ ├── stereo_encode_pred.c │ ├── stereo_find_predictor.c │ ├── stereo_quant_pred.c │ ├── structs.h │ ├── sum_sqr_shift.c │ ├── table_LSF_cos.c │ ├── tables.h │ ├── tables_LTP.c │ ├── tables_NLSF_CB_NB_MB.c │ ├── tables_NLSF_CB_WB.c │ ├── tables_gain.c │ ├── tables_other.c │ ├── tables_pitch_lag.c │ ├── tables_pulses_per_block.c │ ├── tuning_parameters.h │ └── typedef.h ├── rtaudio ├── RtAudio.cpp └── RtAudio.h └── wavpack ├── include └── wavpack.h └── src ├── common_utils.c ├── decorr_tables.h ├── decorr_utils.c ├── entropy_utils.c ├── extra1.c ├── extra2.c ├── open_filename.c ├── open_legacy.c ├── open_raw.c ├── open_utils.c ├── pack.c ├── pack_dns.c ├── pack_dsd.c ├── pack_floats.c ├── pack_utils.c ├── pack_x64.S ├── pack_x64.asm ├── pack_x86.S ├── pack_x86.asm ├── read_words.c ├── tag_utils.c ├── tags.c ├── unpack.c ├── unpack3.c ├── unpack3.h ├── unpack3_open.c ├── unpack3_seek.c ├── unpack_armv7.S ├── unpack_dsd.c ├── unpack_floats.c ├── unpack_seek.c ├── unpack_utils.c ├── unpack_x64.S ├── unpack_x64.asm ├── unpack_x86.S ├── unpack_x86.asm ├── wavpack_local.h ├── wavpack_version.h └── write_words.c /.gitignore: -------------------------------------------------------------------------------- 1 | # User-specific files 2 | *.suo 3 | *.user 4 | 5 | # Build results 6 | [Dd]ebug/ 7 | [Rr]elease/ 8 | [Oo]bj/ 9 | 10 | *.ilk 11 | *.obj 12 | *.pch 13 | *.pdb 14 | *.log 15 | 16 | # Visual C++ cache files 17 | ipch/ 18 | *.opensdf 19 | *.sdf 20 | 21 | # Visual Studio profiler 22 | *.psess 23 | *.vsp 24 | *.vspx 25 | 26 | # XCode 27 | .DS_Store 28 | build/ 29 | *.pbxuser 30 | !default.pbxuser 31 | *.mode1v3 32 | !default.mode1v3 33 | *.mode2v3 34 | !default.mode2v3 35 | *.perspectivev3 36 | !default.perspectivev3 37 | xcuserdata 38 | *.xccheckout 39 | *.moved-aside 40 | DerivedData 41 | *.xcuserstate 42 | 43 | *.reapeaks 44 | 45 | *.opendb 46 | 47 | encoded.wav 48 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | sudo: true 3 | 4 | matrix: 5 | include: 6 | - os: linux 7 | env: CXXFLAGS="-std=c++11" 8 | - os: osx 9 | env: CXXFLAGS="-std=c++11" 10 | 11 | install: 12 | # install latest cmake 13 | - | 14 | if [ "$TRAVIS_OS_NAME" == "linux" ]; then 15 | CMAKE_URL="https://cmake.org/files/v3.13/cmake-3.13.1-Linux-x86_64.tar.gz"; 16 | mkdir cmake_latest && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake_latest; 17 | export PATH=$(pwd)/cmake_latest/bin:${PATH}; 18 | fi 19 | 20 | - | 21 | if [ "${TRAVIS_OS_NAME}" = "osx" ]; then 22 | brew update; 23 | brew uninstall cmake; 24 | brew install cmake; 25 | fi 26 | - which ${CC} 27 | - which ${CXX} 28 | - which cmake 29 | 30 | script: 31 | - mkdir build 32 | - cd build 33 | - cmake -DBUILD_EXAMPLE=FALSE .. 34 | - cmake --build . -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019, Dimitri Diakopoulos All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Libnyquist 2 | 3 | 4 | Platform | Build Status | 5 | -------- | ------------ | 6 | Microsoft VS2017 x64 | [![Build status](https://ci.appveyor.com/api/projects/status/2xeuyuxy618ndf4r?svg=true)](https://ci.appveyor.com/project/ddiakopoulos/libnyquist) | 7 | Clang (OSX) & GCC (Linux) | [![Build Status](https://travis-ci.org/ddiakopoulos/libnyquist.svg?branch=master)](https://travis-ci.org/ddiakopoulos/libnyquist) | 8 | 9 | Libnyquist is a small C++11 library for reading sampled audio data from disk or memory. It is intended to be used an audio loading frontend for games, audio sequencers, music players, and more. 10 | 11 | The library does not include patent or license encumbered formats (such as AAC). For portability, libnyquist does not link against platform-specific APIs like Windows Media Foundation or CoreAudio, and instead bundles the source code of reference decoders as an implementation detail. 12 | 13 | Libnyquist is meant to be statically linked, which is not the case with other popular libraries like libsndfile (which is licensed under the LGPL). Furthermore, the library is not concerned with supporting very rare encodings (for instance, A-law PCM or the SND format). 14 | 15 | While untested, there are no technical conditions that preclude compilation on other platforms with C++11 support (Android NDK r10e+, Linux, iOS, etc). 16 | 17 | ## Format Support 18 | 19 | Regardless of input bit depth, the library produces a channel-interleaved float vector, normalized between [-1.0,+1.0]. At present, the library does not provide comprehensive resampling functionality. 20 | 21 | * Wave (+ IMA-ADPCM encoding) 22 | * MP3 23 | * Ogg Vorbis 24 | * Ogg Opus 25 | * FLAC 26 | * WavPack 27 | * Musepack 28 | 29 | ## Known Issues & Bugs 30 | * See the Github issue tracker. 31 | 32 | ## License 33 | This library is released under the simplied 2 clause BSD license. All included dependencies have been released under identical or similarly permissive licenses. 34 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # appveyor file 2 | # http://www.appveyor.com/docs/appveyor-yml 3 | 4 | os: Visual Studio 2017 5 | 6 | platform: 7 | - x64 8 | 9 | build_script: 10 | - mkdir build 11 | - cd build 12 | - cmake -G "Visual Studio 15 2017 Win64" .. 13 | - cmake --build . --config Release -------------------------------------------------------------------------------- /cmake/CXXhelpers.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(_add_define definition) 3 | list(APPEND _NQR_CXX_DEFINITIONS "-D${definition}") 4 | set(_NQR_CXX_DEFINITIONS ${_NQR_CXX_DEFINITIONS} PARENT_SCOPE) 5 | endfunction() 6 | 7 | function(_disable_warning flag) 8 | if(MSVC) 9 | list(APPEND _NQR_CXX_WARNING_FLAGS "/wd${flag}") 10 | else() 11 | list(APPEND _NQR_CXX_WARNING_FLAGS "-Wno-${flag}") 12 | endif() 13 | set(_NQR_CXX_WARNING_FLAGS ${_NQR_CXX_WARNING_FLAGS} PARENT_SCOPE) 14 | endfunction() 15 | 16 | function(_set_compile_options proj) 17 | if(MSVC) 18 | option(LIBNYQUIST_ENABLE_AVX "Enable the use of the AVX instruction set (MSVC only)" ON) 19 | 20 | target_compile_options(${proj} PRIVATE $<$:/arch:AVX> /Zi ) 21 | endif() 22 | endfunction() 23 | 24 | function(set_cxx_version proj) 25 | target_compile_features(${proj} INTERFACE cxx_std_14) 26 | endfunction() 27 | -------------------------------------------------------------------------------- /examples/src/AudioDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019, Dimitri Diakopoulos All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | // This file implements a simple sound file player based on RtAudio for testing / example purposes. 27 | 28 | #ifndef AUDIO_DEVICE_H 29 | #define AUDIO_DEVICE_H 30 | 31 | #include "RingBuffer.h" 32 | #include "rtaudio/RtAudio.h" 33 | #include 34 | #include 35 | 36 | static const uint32_t FRAME_SIZE = 512; 37 | static const int32_t CHANNELS = 2; 38 | static const int32_t BUFFER_LENGTH = FRAME_SIZE * CHANNELS; 39 | 40 | struct AudioDeviceInfo 41 | { 42 | uint32_t id; 43 | uint32_t numChannels; 44 | uint32_t sampleRate; 45 | uint32_t frameSize; 46 | bool isPlaying = false; 47 | }; 48 | 49 | class AudioDevice 50 | { 51 | std::unique_ptr rtaudio; 52 | protected: 53 | AudioDevice(const AudioDevice& r) = delete; 54 | AudioDevice & operator = (const AudioDevice& r) = delete; 55 | public: 56 | AudioDeviceInfo info; 57 | AudioDevice(int numChannels, int sampleRate, int deviceId = -1); 58 | ~AudioDevice(); 59 | static void ListAudioDevices(); 60 | bool Open(const int deviceId); 61 | bool Play(const std::vector & data); 62 | bool Record(const uint32_t lengthInSamples, std::vector & recordingBuffer); 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /include/libnyquist/Encoders.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019, Dimitri Diakopoulos All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef NYQUIST_ENCODERS_H 27 | #define NYQUIST_ENCODERS_H 28 | 29 | #include "Common.h" 30 | 31 | namespace nqr 32 | { 33 | // A simplistic encoder that takes a buffer of audio, conforms it to the user's 34 | // EncoderParams preference, and writes to disk. Be warned, does not support resampling! 35 | // @todo support dithering, samplerate conversion, etc. 36 | int encode_wav_to_disk(const EncoderParams p, const AudioData * d, const std::string & path); 37 | 38 | // Assume data adheres to EncoderParams, except for bit depth and fmt which are re-formatted 39 | // to satisfy the Ogg/Opus spec. 40 | int encode_opus_to_disk(const EncoderParams p, const AudioData * d, const std::string & path); 41 | 42 | } // end namespace nqr 43 | 44 | #endif // end NYQUIST_ENCODERS_H 45 | -------------------------------------------------------------------------------- /src/Common.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/src/Common.cpp -------------------------------------------------------------------------------- /src/MusepackDependencies.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019, Dimitri Diakopoulos All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #if (_MSC_VER) 27 | #pragma warning (push) 28 | #pragma warning (disable: 181 111 4267 4996 4244 4701 4702 4133 4100 4127 4206 4312 4505 4365 4005 4013 4334) 29 | #endif 30 | 31 | #ifdef __clang__ 32 | #pragma clang diagnostic push 33 | #pragma clang diagnostic ignored "-Wconversion" 34 | #pragma clang diagnostic ignored "-Wshadow" 35 | #pragma clang diagnostic ignored "-Wdeprecated-register" 36 | #endif 37 | 38 | #include "musepack/libmpcdec/huffman.c" 39 | #include "musepack/libmpcdec/requant.c" 40 | #include "musepack/libmpcdec/streaminfo.c" 41 | #include "musepack/libmpcdec/synth_filter.c" 42 | #include "musepack/libmpcdec/crc32.c" 43 | #include "musepack/libmpcdec/mpc_reader.c" 44 | #include "musepack/libmpcdec/mpc_decoder.c" 45 | #include "musepack/libmpcdec/mpc_demux.c" 46 | #include "musepack/libmpcdec/mpc_bits_reader.c" 47 | 48 | #ifdef __clang__ 49 | #pragma clang diagnostic pop 50 | #endif 51 | 52 | #if (_MSC_VER) 53 | #pragma warning (pop) 54 | #endif 55 | -------------------------------------------------------------------------------- /src/VorbisDependencies.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019, Dimitri Diakopoulos All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #if (_MSC_VER) 27 | #pragma warning (push) 28 | #pragma warning (disable: 181 111 4267 4996 4244 4701 4702 4133 4100 4127 4206 4312 4505 4365 4005 4013 4334) 29 | #endif 30 | 31 | #ifdef __clang__ 32 | #pragma clang diagnostic push 33 | #pragma clang diagnostic ignored "-Wconversion" 34 | #pragma clang diagnostic ignored "-Wshadow" 35 | #pragma clang diagnostic ignored "-Wdeprecated-register" 36 | #endif 37 | 38 | #include "libvorbis/include/vorbis/vorbisenc.h" 39 | #include "libvorbis/include/vorbis/codec.h" 40 | #include "libvorbis/include/vorbis/vorbisfile.h" 41 | 42 | #include "libogg/src/bitwise.c" 43 | #include "libogg/src/framing.c" 44 | 45 | #include "libvorbis/src/analysis.c" 46 | #include "libvorbis/src/bitrate.c" 47 | #include "libvorbis/src/block.c" 48 | #include "libvorbis/src/codebook.c" 49 | #include "libvorbis/src/envelope.c" 50 | #include "libvorbis/src/floor0.c" 51 | #include "libvorbis/src/floor1.c" 52 | #include "libvorbis/src/info.c" 53 | #include "libvorbis/src/lpc.c" 54 | #include "libvorbis/src/lsp.c" 55 | #include "libvorbis/src/mapping0.c" 56 | #include "libvorbis/src/psy.c" 57 | #include "libvorbis/src/registry.c" 58 | #include "libvorbis/src/res0.c" 59 | #include "libvorbis/src/sharedbook.c" 60 | #include "libvorbis/src/smallft.c" 61 | #include "libvorbis/src/synthesis.c" 62 | #include "libvorbis/src/vorbisenc.c" 63 | #include "libvorbis/src/vorbisfile.c" 64 | #include "libvorbis/src/window.c" 65 | #include "libvorbis/src/mdct.c" 66 | 67 | #ifdef __clang__ 68 | #pragma clang diagnostic pop 69 | #endif 70 | 71 | #if (_MSC_VER) 72 | #pragma warning (pop) 73 | #endif 74 | -------------------------------------------------------------------------------- /test_data/1ch/44100/16/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/1ch/44100/16/test.wav -------------------------------------------------------------------------------- /test_data/1ch/44100/24/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/1ch/44100/24/test.wav -------------------------------------------------------------------------------- /test_data/1ch/44100/32/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/1ch/44100/32/test.wav -------------------------------------------------------------------------------- /test_data/1ch/44100/64/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/1ch/44100/64/test.wav -------------------------------------------------------------------------------- /test_data/1ch/44100/8/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/1ch/44100/8/test.wav -------------------------------------------------------------------------------- /test_data/2ch/22050/16/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/22050/16/test.wav -------------------------------------------------------------------------------- /test_data/2ch/22050/24/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/22050/24/test.wav -------------------------------------------------------------------------------- /test_data/2ch/22050/32/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/22050/32/test.wav -------------------------------------------------------------------------------- /test_data/2ch/22050/64/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/22050/64/test.wav -------------------------------------------------------------------------------- /test_data/2ch/22050/8/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/22050/8/test.wav -------------------------------------------------------------------------------- /test_data/2ch/44100/16/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/44100/16/test.wav -------------------------------------------------------------------------------- /test_data/2ch/44100/24/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/44100/24/test.wav -------------------------------------------------------------------------------- /test_data/2ch/44100/32/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/44100/32/test.wav -------------------------------------------------------------------------------- /test_data/2ch/44100/64/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/44100/64/test.wav -------------------------------------------------------------------------------- /test_data/2ch/44100/8/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/44100/8/test.wav -------------------------------------------------------------------------------- /test_data/2ch/8000/16/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/8000/16/test.wav -------------------------------------------------------------------------------- /test_data/2ch/8000/24/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/8000/24/test.wav -------------------------------------------------------------------------------- /test_data/2ch/8000/32/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/8000/32/test.wav -------------------------------------------------------------------------------- /test_data/2ch/8000/64/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/8000/64/test.wav -------------------------------------------------------------------------------- /test_data/2ch/8000/8/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/8000/8/test.wav -------------------------------------------------------------------------------- /test_data/2ch/96000/16/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/96000/16/test.wav -------------------------------------------------------------------------------- /test_data/2ch/96000/24/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/96000/24/test.wav -------------------------------------------------------------------------------- /test_data/2ch/96000/32/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/96000/32/test.wav -------------------------------------------------------------------------------- /test_data/2ch/96000/64/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/96000/64/test.wav -------------------------------------------------------------------------------- /test_data/2ch/96000/8/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/2ch/96000/8/test.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/44_16_mono.mpc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/44_16_mono.mpc -------------------------------------------------------------------------------- /test_data/ad_hoc/44_16_stereo.mpc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/44_16_stereo.mpc -------------------------------------------------------------------------------- /test_data/ad_hoc/6_channel_44k_16b.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/6_channel_44k_16b.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/Block-split-stereo-ima4-reaper.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/Block-split-stereo-ima4-reaper.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/BlockSplit_Stereo.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/BlockSplit_Stereo.ogg -------------------------------------------------------------------------------- /test_data/ad_hoc/BlockWoosh_Stereo.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/BlockWoosh_Stereo.ogg -------------------------------------------------------------------------------- /test_data/ad_hoc/KittyPurr16_Mono.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/KittyPurr16_Mono.flac -------------------------------------------------------------------------------- /test_data/ad_hoc/KittyPurr16_Stereo.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/KittyPurr16_Stereo.flac -------------------------------------------------------------------------------- /test_data/ad_hoc/KittyPurr24_Stereo.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/KittyPurr24_Stereo.flac -------------------------------------------------------------------------------- /test_data/ad_hoc/KittyPurr8_Stereo.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/KittyPurr8_Stereo.flac -------------------------------------------------------------------------------- /test_data/ad_hoc/KittyPurr8_Stereo_Dithered.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/KittyPurr8_Stereo_Dithered.flac -------------------------------------------------------------------------------- /test_data/ad_hoc/LR_Stereo.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/LR_Stereo.ogg -------------------------------------------------------------------------------- /test_data/ad_hoc/Sequence44k_24b.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/Sequence44k_24b.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat.ogg -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeatMono.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeatMono.ogg -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_44_16_mono-ima4-reaper.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_44_16_mono-ima4-reaper.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_44_16_stereo-ima4-reaper.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_44_16_stereo-ima4-reaper.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_44_16_stereo-ima4.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_44_16_stereo-ima4.aiff -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_44_16_stereo-ima4.caf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_44_16_stereo-ima4.caf -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_44_16_stereo-ima4.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_44_16_stereo-ima4.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_Float32.wv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_Float32.wv -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_Float32_Mono.wv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_Float32_Mono.wv -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_Int16.wv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_Int16.wv -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_Int24.wv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_Int24.wv -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_Int24_Mono.wv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_Int24_Mono.wv -------------------------------------------------------------------------------- /test_data/ad_hoc/TestBeat_Int32.wv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestBeat_Int32.wv -------------------------------------------------------------------------------- /test_data/ad_hoc/TestLaugh_44k.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestLaugh_44k.ogg -------------------------------------------------------------------------------- /test_data/ad_hoc/TestLaugh_Float32.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestLaugh_Float32.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/TestSine_24b.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestSine_24b.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/TestSine_Float32.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestSine_Float32.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/TestTone_24b.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/TestTone_24b.wav -------------------------------------------------------------------------------- /test_data/ad_hoc/acetylene.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/acetylene.mp3 -------------------------------------------------------------------------------- /test_data/ad_hoc/detodos.opus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/ad_hoc/detodos.opus -------------------------------------------------------------------------------- /test_data/degenerate/header_larger_than_file_size.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/degenerate/header_larger_than_file_size.wav -------------------------------------------------------------------------------- /test_data/degenerate/junk_after_riff.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/degenerate/junk_after_riff.wav -------------------------------------------------------------------------------- /test_data/degenerate/odd_length_random_chunk.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/degenerate/odd_length_random_chunk.wav -------------------------------------------------------------------------------- /test_data/mid/migm1.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/mid/migm1.mid -------------------------------------------------------------------------------- /test_data/mid/migm1.txt: -------------------------------------------------------------------------------- 1 | QUEST STUDIOS 2 | SOFTWARE SOUNDTRACK SERIES 3 | ==================================================== 4 | THE SECRET OF MONKEY ISLAND 5 | 6 | 7 | "INTRODUCTION/OPENING THEMES" 8 | Michael Z. Land 9 | ==================================================== 10 | Copyright (c)1989 LucasArts Entertainment Co. 11 | ==================================================== 12 | 13 | G E N E R A L M I D I V E R S I O N 14 | 15 | 16 | 17 | System Requirements: 18 | 19 | - MIDI Playback Software capable of reading Type 1 Standard 20 | MIDI File format 21 | - General MIDI sound device (Wave Table recommended.) 22 | 23 | 24 | This Standard MIDI File was recorded directly from LucasFilm Game's 25 | "The Secret of Monkey Island" adventure game. It has been converted 26 | from the MT-32 version for playback on General MIDI sound cards. A 27 | Wave Table sound card is highly recommended for optimal playback. 28 | 29 | Recorded/Converted to Standard MIDI File format by Tom Lewandowski. 30 | Address questions or comments to: 31 | 32 | QUEST STUDIOS 33 | Tom Lewandowski 34 | tom+di@netnet.net 35 | 36 | 37 | 38 | THE ROLAND MT-32 SOUND MODULE RESOURCE CENTER 39 | THE SIERRA SOUNDTRACK SERIES/SOFTWARE SOUNDTRACK SERIES 40 | http://bayland.net/~tom+di/sierra/roland.html 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /test_data/mod/fountain.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/mod/fountain.mod -------------------------------------------------------------------------------- /test_data/mod/guitarou.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/mod/guitarou.mod -------------------------------------------------------------------------------- /test_data/mod/tales-06-swat.s3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddiakopoulos/libnyquist/767efd97cdd7a281d193296586e708490eb6e54f/test_data/mod/tales-06-swat.s3m -------------------------------------------------------------------------------- /third_party/FLAC/assert.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2001-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__ASSERT_H 34 | #define FLAC__ASSERT_H 35 | 36 | /* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */ 37 | #ifdef DEBUG 38 | #include 39 | #define FLAC__ASSERT(x) assert(x) 40 | #define FLAC__ASSERT_DECLARATION(x) x 41 | #else 42 | #define FLAC__ASSERT(x) 43 | #define FLAC__ASSERT_DECLARATION(x) 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/private/all.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__ALL_H 34 | #define FLAC__PRIVATE__ALL_H 35 | 36 | #include "bitmath.h" 37 | #include "bitreader.h" 38 | #include "bitwriter.h" 39 | #include "cpu.h" 40 | #include "crc.h" 41 | #include "fixed.h" 42 | #include "float.h" 43 | #include "format.h" 44 | #include "lpc.h" 45 | #include "md5.h" 46 | #include "memory.h" 47 | #include "metadata.h" 48 | #include "stream_encoder_framing.h" 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/private/crc.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__CRC_H 34 | #define FLAC__PRIVATE__CRC_H 35 | 36 | #include "FLAC/ordinals.h" 37 | 38 | /* 8 bit CRC generator, MSB shifted first 39 | ** polynomial = x^8 + x^2 + x^1 + x^0 40 | ** init = 0 41 | */ 42 | extern FLAC__byte const FLAC__crc8_table[256]; 43 | #define FLAC__CRC8_UPDATE(data, crc) (crc) = FLAC__crc8_table[(crc) ^ (data)]; 44 | void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc); 45 | void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc); 46 | FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len); 47 | 48 | /* 16 bit CRC generator, MSB shifted first 49 | ** polynomial = x^16 + x^15 + x^2 + x^0 50 | ** init = 0 51 | */ 52 | extern unsigned const FLAC__crc16_table[256]; 53 | 54 | #define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) 55 | /* this alternate may be faster on some systems/compilers */ 56 | #if 0 57 | #define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) & 0xffff) 58 | #endif 59 | 60 | unsigned FLAC__crc16(const FLAC__byte *data, unsigned len); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/private/format.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__FORMAT_H 34 | #define FLAC__PRIVATE__FORMAT_H 35 | 36 | #include "FLAC/format.h" 37 | 38 | unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order); 39 | unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize); 40 | unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order); 41 | void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object); 42 | void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object); 43 | FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/private/macros.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2012-2014 Xiph.org Foundation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * - Neither the name of the Xiph.org Foundation nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef FLAC__PRIVATE__MACROS_H 33 | #define FLAC__PRIVATE__MACROS_H 34 | 35 | #if defined(__GNUC__) && (__GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3)) 36 | 37 | #define flac_max(a,b) \ 38 | ({ __typeof__ (a) _a = (a); \ 39 | __typeof__ (b) _b = (b); \ 40 | _a > _b ? _a : _b; }) 41 | 42 | #define MIN_PASTE(A,B) A##B 43 | #define MIN_IMPL(A,B,L) ({ \ 44 | __typeof__(A) MIN_PASTE(__a,L) = (A); \ 45 | __typeof__(B) MIN_PASTE(__b,L) = (B); \ 46 | MIN_PASTE(__a,L) < MIN_PASTE(__b,L) ? MIN_PASTE(__a,L) : MIN_PASTE(__b,L); \ 47 | }) 48 | 49 | #define flac_min(A,B) MIN_IMPL(A,B,__COUNTER__) 50 | 51 | /* Whatever other unix that has sys/param.h */ 52 | #elif defined(HAVE_SYS_PARAM_H) 53 | #include 54 | #define flac_max(a,b) MAX(a,b) 55 | #define flac_min(a,b) MIN(a,b) 56 | 57 | /* Windows VS has them in stdlib.h.. XXX:Untested */ 58 | #elif defined(_MSC_VER) 59 | #include 60 | #define flac_max(a,b) __max(a,b) 61 | #define flac_min(a,b) __min(a,b) 62 | #endif 63 | 64 | #ifndef flac_min 65 | #define flac_min(x,y) ((x) <= (y) ? (x) : (y)) 66 | #endif 67 | 68 | #ifndef flac_max 69 | #define flac_max(x,y) ((x) >= (y) ? (x) : (y)) 70 | #endif 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/private/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef FLAC__PRIVATE__MD5_H 2 | #define FLAC__PRIVATE__MD5_H 3 | 4 | /* 5 | * This is the header file for the MD5 message-digest algorithm. 6 | * The algorithm is due to Ron Rivest. This code was 7 | * written by Colin Plumb in 1993, no copyright is claimed. 8 | * This code is in the public domain; do with it what you wish. 9 | * 10 | * Equivalent code is available from RSA Data Security, Inc. 11 | * This code has been tested against that, and is equivalent, 12 | * except that you don't need to include two pages of legalese 13 | * with every copy. 14 | * 15 | * To compute the message digest of a chunk of bytes, declare an 16 | * MD5Context structure, pass it to MD5Init, call MD5Update as 17 | * needed on buffers full of bytes, and then call MD5Final, which 18 | * will fill a supplied 16-byte array with the digest. 19 | * 20 | * Changed so as no longer to depend on Colin Plumb's `usual.h' 21 | * header definitions; now uses stuff from dpkg's config.h 22 | * - Ian Jackson . 23 | * Still in the public domain. 24 | * 25 | * Josh Coalson: made some changes to integrate with libFLAC. 26 | * Still in the public domain, with no warranty. 27 | */ 28 | 29 | #include "FLAC/ordinals.h" 30 | 31 | typedef union { 32 | FLAC__byte *p8; 33 | FLAC__int16 *p16; 34 | FLAC__int32 *p32; 35 | } FLAC__multibyte; 36 | 37 | typedef struct { 38 | FLAC__uint32 in[16]; 39 | FLAC__uint32 buf[4]; 40 | FLAC__uint32 bytes[2]; 41 | FLAC__multibyte internal_buf; 42 | size_t capacity; 43 | } FLAC__MD5Context; 44 | 45 | void FLAC__MD5Init(FLAC__MD5Context *context); 46 | void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context); 47 | 48 | FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/private/metadata.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2002-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__METADATA_H 34 | #define FLAC__PRIVATE__METADATA_H 35 | 36 | #include "FLAC/metadata.h" 37 | 38 | /* WATCHOUT: all malloc()ed data in the block is free()ed; this may not 39 | * be a consistent state (e.g. PICTURE) or equivalent to the initial 40 | * state after FLAC__metadata_object_new() 41 | */ 42 | void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object); 43 | 44 | void FLAC__metadata_object_cuesheet_track_delete_data(FLAC__StreamMetadata_CueSheet_Track *object); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/private/ogg_helper.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec 2 | * Copyright (C) 2004-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__OGG_HELPER_H 34 | #define FLAC__PRIVATE__OGG_HELPER_H 35 | 36 | #include 37 | #include "FLAC/stream_encoder.h" /* for FLAC__StreamEncoder */ 38 | 39 | void simple_ogg_page__init(ogg_page *page); 40 | void simple_ogg_page__clear(ogg_page *page); 41 | 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); 42 | 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); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/private/stream_encoder_framing.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__STREAM_ENCODER_FRAMING_H 34 | #define FLAC__PRIVATE__STREAM_ENCODER_FRAMING_H 35 | 36 | #include "FLAC/format.h" 37 | #include "bitwriter.h" 38 | 39 | FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw); 40 | FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw); 41 | FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); 42 | FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); 43 | FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); 44 | FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/protected/all.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2001-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PROTECTED__ALL_H 34 | #define FLAC__PROTECTED__ALL_H 35 | 36 | #include "stream_decoder.h" 37 | #include "stream_encoder.h" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/protected/stream_decoder.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PROTECTED__STREAM_DECODER_H 34 | #define FLAC__PROTECTED__STREAM_DECODER_H 35 | 36 | #include "FLAC/stream_decoder.h" 37 | #if FLAC__HAS_OGG 38 | #include "private/ogg_decoder_aspect.h" 39 | #endif 40 | 41 | typedef struct FLAC__StreamDecoderProtected { 42 | FLAC__StreamDecoderState state; 43 | FLAC__StreamDecoderInitStatus initstate; 44 | unsigned channels; 45 | FLAC__ChannelAssignment channel_assignment; 46 | unsigned bits_per_sample; 47 | unsigned sample_rate; /* in Hz */ 48 | unsigned blocksize; /* in samples (per channel) */ 49 | FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */ 50 | #if FLAC__HAS_OGG 51 | FLAC__OggDecoderAspect ogg_decoder_aspect; 52 | #endif 53 | } FLAC__StreamDecoderProtected; 54 | 55 | /* 56 | * return the number of input bytes consumed 57 | */ 58 | unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/share/endswap.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2012-2014 Xiph.org Foundation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * - Neither the name of the Xiph.org Foundation nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /* It is assumed that this header will be included after "config.h". */ 33 | 34 | #if HAVE_BSWAP32 /* GCC and Clang */ 35 | 36 | /* GCC prior to 4.8 didn't provide bswap16 on x86_64 */ 37 | #if ! HAVE_BSWAP16 38 | static inline unsigned short __builtin_bswap16(unsigned short a) 39 | { 40 | return (a<<8)|(a>>8); 41 | } 42 | #endif 43 | 44 | #define ENDSWAP_16(x) (__builtin_bswap16 (x)) 45 | #define ENDSWAP_32(x) (__builtin_bswap32 (x)) 46 | 47 | #elif defined _MSC_VER /* Windows. Apparently in . */ 48 | 49 | #define ENDSWAP_16(x) (_byteswap_ushort (x)) 50 | #define ENDSWAP_32(x) (_byteswap_ulong (x)) 51 | 52 | #elif defined HAVE_BYTESWAP_H /* Linux */ 53 | 54 | #include 55 | 56 | #define ENDSWAP_16(x) (bswap_16 (x)) 57 | #define ENDSWAP_32(x) (bswap_32 (x)) 58 | 59 | #else 60 | 61 | #define ENDSWAP_16(x) ((((x) >> 8) & 0xFF) | (((x) & 0xFF) << 8)) 62 | #define ENDSWAP_32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) & 0xFF00) << 8) | (((x) & 0xFF) << 24)) 63 | 64 | #endif 65 | 66 | 67 | /* Host to little-endian byte swapping. */ 68 | #if CPU_IS_BIG_ENDIAN 69 | 70 | #define H2LE_16(x) ENDSWAP_16 (x) 71 | #define H2LE_32(x) ENDSWAP_32 (x) 72 | 73 | #else 74 | 75 | #define H2LE_16(x) (x) 76 | #define H2LE_32(x) (x) 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/share/macros.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2013-2014 Xiph.org Foundation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * - Neither the name of the Xiph.org Foundation nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #include 33 | 34 | /* FLAC_CHECK_RETURN : Check the return value of of the provided function and 35 | * print and error message if it fails (ie returns a value < 0). 36 | */ 37 | 38 | #define FLAC_CHECK_RETURN(x) \ 39 | { if ((x) < 0) \ 40 | printf ("%s : %s\n", #x, strerror (errno)) ; \ 41 | } 42 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/share/private.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2013-2014 Xiph.org Foundation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * - Neither the name of the Xiph.org Foundation nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef FLAC__SHARE__PRIVATE_H 33 | #define FLAC__SHARE__PRIVATE_H 34 | 35 | /* 36 | * Unpublished debug routines from libFLAC> This should not be used from any 37 | * client code other than code shipped with the FLAC sources. 38 | */ 39 | FLAC_API FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); 40 | FLAC_API FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); 41 | FLAC_API FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); 42 | FLAC_API FLAC__bool FLAC__stream_encoder_set_do_md5(FLAC__StreamEncoder *encoder, FLAC__bool value); 43 | FLAC_API FLAC__bool FLAC__stream_encoder_get_do_md5(const FLAC__StreamEncoder *encoder); 44 | 45 | #endif /* FLAC__SHARE__PRIVATE_H */ 46 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/share/safe_str.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2013-2014 Xiph.org Foundation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * - Neither the name of the Xiph.org Foundation nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /* Safe string handling functions to replace things like strcpy, strncpy, 33 | * strcat, strncat etc. 34 | * All of these functions guarantee a correctly NUL terminated string but 35 | * the string may be truncated if the destination buffer was too short. 36 | */ 37 | 38 | #ifndef FLAC__SHARE_SAFE_STR_H 39 | #define FLAC__SHARE_SAFE_STR_H 40 | 41 | static inline char * 42 | safe_strncat(char *dest, const char *src, size_t dest_size) 43 | { 44 | char * ret; 45 | 46 | if (dest_size < 1) 47 | return dest; 48 | 49 | ret = strncat(dest, src, dest_size - strlen (dest)); 50 | dest [dest_size - 1] = 0; 51 | 52 | return ret; 53 | } 54 | 55 | static inline char * 56 | safe_strncpy(char *dest, const char *src, size_t dest_size) 57 | { 58 | char * ret; 59 | 60 | if (dest_size < 1) 61 | return dest; 62 | 63 | ret = strncpy(dest, src, dest_size); 64 | dest [dest_size - 1] = 0; 65 | 66 | return ret; 67 | } 68 | 69 | #endif /* FLAC__SHARE_SAFE_STR_H */ 70 | -------------------------------------------------------------------------------- /third_party/FLAC/src/include/share/utf8.h: -------------------------------------------------------------------------------- 1 | #ifndef SHARE__UTF8_H 2 | #define SHARE__UTF8_H 3 | 4 | /* 5 | * Convert a string between UTF-8 and the locale's charset. 6 | * Invalid bytes are replaced by '#', and characters that are 7 | * not available in the target encoding are replaced by '?'. 8 | * 9 | * If the locale's charset is not set explicitly then it is 10 | * obtained using nl_langinfo(CODESET), where available, the 11 | * environment variable CHARSET, or assumed to be US-ASCII. 12 | * 13 | * Return value of conversion functions: 14 | * 15 | * -1 : memory allocation failed 16 | * 0 : data was converted exactly 17 | * 1 : valid data was converted approximately (using '?') 18 | * 2 : input was invalid (but still converted, using '#') 19 | * 3 : unknown encoding (but still converted, using '?') 20 | */ 21 | 22 | int utf8_encode(const char *from, char **to); 23 | int utf8_decode(const char *from, char **to); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /third_party/FLAC/src/ogg_mapping.c: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec 2 | * Copyright (C) 2004-2009 Josh Coalson 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifdef HAVE_CONFIG_H 34 | # include 35 | #endif 36 | 37 | #include "private/ogg_mapping.h" 38 | 39 | const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN = 8; /* bits */ 40 | 41 | const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE = 0x7f; 42 | 43 | const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC = (const FLAC__byte * const)"FLAC"; 44 | 45 | const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN = 8; /* bits */ 46 | const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN = 8; /* bits */ 47 | 48 | const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN = 16; /* bits */ 49 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/barkmel.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: bark scale utility 14 | last mod: $Id: barkmel.c 19454 2015-03-02 22:39:28Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #include 19 | #include "scales.h" 20 | int main(){ 21 | int i; 22 | double rate; 23 | for(i=64;i<32000;i*=2){ 24 | rate=48000.f; 25 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", 26 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); 27 | 28 | rate=44100.f; 29 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", 30 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); 31 | 32 | rate=32000.f; 33 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", 34 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); 35 | 36 | rate=22050.f; 37 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", 38 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); 39 | 40 | rate=16000.f; 41 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", 42 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); 43 | 44 | rate=11025.f; 45 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", 46 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); 47 | 48 | rate=8000.f; 49 | fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n", 50 | rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); 51 | 52 | 53 | } 54 | { 55 | float i; 56 | int j; 57 | for(i=0.,j=0;i<28;i+=1,j++){ 58 | fprintf(stderr,"(%d) bark=%f %gHz (%d of 128)\n", 59 | j,i,fromBARK(i),(int)(fromBARK(i)/22050.*128.)); 60 | } 61 | } 62 | return(0); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/bitrate.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: bitrate tracking and management 14 | last mod: $Id: bitrate.h 13293 2007-07-24 00:09:47Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_BITRATE_H_ 19 | #define _V_BITRATE_H_ 20 | 21 | #include "vorbis/codec.h" 22 | #include "codec_internal.h" 23 | #include "os.h" 24 | 25 | /* encode side bitrate tracking */ 26 | typedef struct bitrate_manager_state { 27 | int managed; 28 | 29 | long avg_reservoir; 30 | long minmax_reservoir; 31 | long avg_bitsper; 32 | long min_bitsper; 33 | long max_bitsper; 34 | 35 | long short_per_long; 36 | double avgfloat; 37 | 38 | vorbis_block *vb; 39 | int choice; 40 | } bitrate_manager_state; 41 | 42 | typedef struct bitrate_manager_info{ 43 | long avg_rate; 44 | long min_rate; 45 | long max_rate; 46 | long reservoir_bits; 47 | double reservoir_bias; 48 | 49 | double slew_damp; 50 | 51 | } bitrate_manager_info; 52 | 53 | extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs); 54 | extern void vorbis_bitrate_clear(bitrate_manager_state *bs); 55 | extern int vorbis_bitrate_managed(vorbis_block *vb); 56 | extern int vorbis_bitrate_addblock(vorbis_block *vb); 57 | extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/envelope.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: PCM data envelope analysis and manipulation 14 | last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_ENVELOPE_ 19 | #define _V_ENVELOPE_ 20 | 21 | #include "mdct.h" 22 | 23 | #define VE_PRE 16 24 | #define VE_WIN 4 25 | #define VE_POST 2 26 | #define VE_AMP (VE_PRE+VE_POST-1) 27 | 28 | #define VE_BANDS 7 29 | #define VE_NEARDC 15 30 | 31 | #define VE_MINSTRETCH 2 /* a bit less than short block */ 32 | #define VE_MAXSTRETCH 12 /* one-third full block */ 33 | 34 | typedef struct { 35 | float ampbuf[VE_AMP]; 36 | int ampptr; 37 | 38 | float nearDC[VE_NEARDC]; 39 | float nearDC_acc; 40 | float nearDC_partialacc; 41 | int nearptr; 42 | 43 | } envelope_filter_state; 44 | 45 | typedef struct { 46 | int begin; 47 | int end; 48 | float *window; 49 | float total; 50 | } envelope_band; 51 | 52 | typedef struct { 53 | int ch; 54 | int winlength; 55 | int searchstep; 56 | float minenergy; 57 | 58 | vbs_mdct_lookup mdct; 59 | float *mdct_win; 60 | 61 | envelope_band band[VE_BANDS]; 62 | envelope_filter_state *filter; 63 | int stretch; 64 | 65 | int *mark; 66 | 67 | long storage; 68 | long current; 69 | long curmark; 70 | long cursor; 71 | } envelope_lookup; 72 | 73 | extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi); 74 | extern void _ve_envelope_clear(envelope_lookup *e); 75 | extern long _ve_envelope_search(vorbis_dsp_state *v); 76 | extern void _ve_envelope_shift(envelope_lookup *e,long shift); 77 | extern int _ve_envelope_mark(vorbis_dsp_state *v); 78 | 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/highlevel.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: highlevel encoder setup struct separated out for vorbisenc clarity 14 | last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $ 15 | 16 | ********************************************************************/ 17 | 18 | typedef struct highlevel_byblocktype { 19 | double tone_mask_setting; 20 | double tone_peaklimit_setting; 21 | double noise_bias_setting; 22 | double noise_compand_setting; 23 | } highlevel_byblocktype; 24 | 25 | typedef struct highlevel_encode_setup { 26 | int set_in_stone; 27 | const void *setup; 28 | double base_setting; 29 | 30 | double impulse_noisetune; 31 | 32 | /* bitrate management below all settable */ 33 | float req; 34 | int managed; 35 | long bitrate_min; 36 | long bitrate_av; 37 | double bitrate_av_damp; 38 | long bitrate_max; 39 | long bitrate_reservoir; 40 | double bitrate_reservoir_bias; 41 | 42 | int impulse_block_p; 43 | int noise_normalize_p; 44 | int coupling_p; 45 | 46 | double stereo_point_setting; 47 | double lowpass_kHz; 48 | int lowpass_altered; 49 | 50 | double ath_floating_dB; 51 | double ath_absolute_dB; 52 | 53 | double amplitude_track_dBpersec; 54 | double trigger_setting; 55 | 56 | highlevel_byblocktype block[4]; /* padding, impulse, transition, long */ 57 | 58 | } highlevel_encode_setup; 59 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/lookup.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: lookup based functions 14 | last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_LOOKUP_H_ 19 | 20 | #ifdef FLOAT_LOOKUP 21 | extern float vorbis_coslook(float a); 22 | extern float vorbis_invsqlook(float a); 23 | extern float vorbis_invsq2explook(int a); 24 | extern float vorbis_fromdBlook(float a); 25 | #endif 26 | #ifdef INT_LOOKUP 27 | extern long vorbis_invsqlook_i(long a,long e); 28 | extern long vorbis_coslook_i(long a); 29 | extern float vorbis_fromdBlook_i(long a); 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/lpc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: LPC low level routines 14 | last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_LPC_H_ 19 | #define _V_LPC_H_ 20 | 21 | #include "vorbis/codec.h" 22 | 23 | /* simple linear scale LPC code */ 24 | extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m); 25 | 26 | extern void vorbis_lpc_predict(float *coeff,float *prime,int m, 27 | float *data,long n); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/lsp.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: LSP (also called LSF) conversion routines 14 | last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | 19 | #ifndef _V_LSP_H_ 20 | #define _V_LSP_H_ 21 | 22 | extern int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m); 23 | 24 | extern void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln, 25 | float *lsp,int m, 26 | float amp,float ampoffset); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/mdct.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: modified discrete cosine transform prototypes 14 | last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _OGG_mdct_H_ 19 | #define _OGG_mdct_H_ 20 | 21 | #include "vorbis/codec.h" 22 | 23 | 24 | 25 | 26 | 27 | /*#define MDCT_INTEGERIZED <- be warned there could be some hurt left here*/ 28 | #ifdef MDCT_INTEGERIZED 29 | 30 | #define DATA_TYPE int 31 | #define REG_TYPE register int 32 | #define TRIGBITS 14 33 | #define cPI3_8 6270 34 | #define cPI2_8 11585 35 | #define cPI1_8 15137 36 | 37 | #define FLOAT_CONV(x) ((int)((x)*(1<>TRIGBITS) 39 | #define HALVE(x) ((x)>>1) 40 | 41 | #else 42 | 43 | #define DATA_TYPE float 44 | #define REG_TYPE float 45 | #define cPI3_8 .38268343236508977175F 46 | #define cPI2_8 .70710678118654752441F 47 | #define cPI1_8 .92387953251128675613F 48 | 49 | #define FLOAT_CONV(x) (x) 50 | #define MULT_NORM(x) (x) 51 | #define HALVE(x) ((x)*.5f) 52 | 53 | #endif 54 | 55 | 56 | typedef struct { 57 | int n; 58 | int log2n; 59 | 60 | DATA_TYPE *trig; 61 | int *bitrev; 62 | 63 | DATA_TYPE scale; 64 | } vbs_mdct_lookup; 65 | 66 | extern void mdct_init(vbs_mdct_lookup *lookup,int n); 67 | extern void mdct_clear(vbs_mdct_lookup *l); 68 | extern void mdct_forward(vbs_mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out); 69 | extern void mdct_backward(vbs_mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out); 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/misc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: miscellaneous prototypes 14 | last mod: $Id: misc.h 19457 2015-03-03 00:15:29Z giles $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_RANDOM_H_ 19 | #define _V_RANDOM_H_ 20 | #include "vorbis/codec.h" 21 | 22 | extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); 23 | extern void _vorbis_block_ripcord(vorbis_block *vb); 24 | extern int ov_ilog(ogg_uint32_t v); 25 | 26 | #ifdef ANALYSIS 27 | extern int analysis_noisy; 28 | extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB, 29 | ogg_int64_t off); 30 | extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB, 31 | ogg_int64_t off); 32 | #endif 33 | 34 | #ifdef DEBUG_MALLOC 35 | 36 | #define _VDBG_GRAPHFILE "malloc.m" 37 | #undef _VDBG_GRAPHFILE 38 | extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line); 39 | extern void _VDBG_free(void *ptr,char *file,long line); 40 | 41 | #ifndef MISC_C 42 | #undef _ogg_malloc 43 | #undef _ogg_calloc 44 | #undef _ogg_realloc 45 | #undef _ogg_free 46 | 47 | #define _ogg_malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__) 48 | #define _ogg_calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__) 49 | #define _ogg_realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__) 50 | #define _ogg_free(x) _VDBG_free((x),__FILE__,__LINE__) 51 | #endif 52 | #endif 53 | 54 | #endif 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/modes/psych_11.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: 11kHz settings 14 | last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | static const double _psy_lowpass_11[3]={4.5,5.5,30.,}; 19 | 20 | static const att3 _psy_tone_masteratt_11[3]={ 21 | {{ 30, 25, 12}, 0, 0}, /* 0 */ 22 | {{ 30, 25, 12}, 0, 0}, /* 0 */ 23 | {{ 20, 0, -14}, 0, 0}, /* 0 */ 24 | }; 25 | 26 | static const vp_adjblock _vp_tonemask_adj_11[3]={ 27 | /* adjust for mode zero */ 28 | /* 63 125 250 500 1 2 4 8 16 */ 29 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* 0 */ 30 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 5, 0, 0,99,99,99}}, /* 1 */ 31 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 2 */ 32 | }; 33 | 34 | 35 | static const noise3 _psy_noisebias_11[3]={ 36 | /* 63 125 250 500 1k 2k 4k 8k 16k*/ 37 | {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 10, 10, 12, 12, 12, 99, 99, 99}, 38 | {-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 4, 5, 5, 10, 99, 99, 99}, 39 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}}, 40 | 41 | {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 10, 10, 12, 12, 12, 99, 99, 99}, 42 | {-15,-15,-15,-15,-10,-10, -5, -5, -5, 0, 0, 0, 0, 0, 99, 99, 99}, 43 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}}, 44 | 45 | {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 99, 99, 99}, 46 | {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10, 99, 99, 99}, 47 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}}, 48 | }; 49 | 50 | static const double _noise_thresh_11[3]={ .3,.5,.5 }; 51 | 52 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/modes/setup_44p51.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: toplevel settings for 44.1/48kHz 5.1 surround modes 14 | last mod: $Id: setup_44p51.h 19013 2013-11-12 04:04:50Z giles $ 15 | 16 | ********************************************************************/ 17 | 18 | #include "modes/residue_44p51.h" 19 | 20 | static const double rate_mapping_44p51[12]={ 21 | 14000.,20000.,28000.,38000.,46000.,54000., 22 | 75000.,96000.,120000.,140000.,180000.,240001. 23 | }; 24 | 25 | static const ve_setup_data_template ve_setup_44_51={ 26 | 11, 27 | rate_mapping_44p51, 28 | quality_mapping_44, 29 | 6, 30 | 40000, 31 | 70000, 32 | 33 | blocksize_short_44, 34 | blocksize_long_44, 35 | 36 | _psy_tone_masteratt_44, 37 | _psy_tone_0dB, 38 | _psy_tone_suppress, 39 | 40 | _vp_tonemask_adj_otherblock, 41 | _vp_tonemask_adj_longblock, 42 | _vp_tonemask_adj_otherblock, 43 | 44 | _psy_noiseguards_44, 45 | _psy_noisebias_impulse, 46 | _psy_noisebias_padding, 47 | _psy_noisebias_trans, 48 | _psy_noisebias_long, 49 | _psy_noise_suppress, 50 | 51 | _psy_compand_44, 52 | _psy_compand_short_mapping, 53 | _psy_compand_long_mapping, 54 | 55 | {_noise_start_short_44,_noise_start_long_44}, 56 | {_noise_part_short_44,_noise_part_long_44}, 57 | _noise_thresh_44, 58 | 59 | _psy_ath_floater, 60 | _psy_ath_abs, 61 | 62 | _psy_lowpass_44, 63 | 64 | _psy_global_44, 65 | _global_mapping_44, 66 | _psy_stereo_modes_44, 67 | 68 | _floor_books, 69 | _floor, 70 | 3, 71 | _floor_mapping_44, 72 | 73 | _mapres_template_44_51 74 | }; 75 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/modes/setup_44u.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: toplevel settings for 44.1/48kHz uncoupled modes 14 | last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #include "modes/residue_44u.h" 19 | 20 | static const double rate_mapping_44_un[12]={ 21 | 32000.,48000.,60000.,70000.,80000.,86000., 22 | 96000.,110000.,120000.,140000.,160000.,240001. 23 | }; 24 | 25 | static const ve_setup_data_template ve_setup_44_uncoupled={ 26 | 11, 27 | rate_mapping_44_un, 28 | quality_mapping_44, 29 | -1, 30 | 40000, 31 | 50000, 32 | 33 | blocksize_short_44, 34 | blocksize_long_44, 35 | 36 | _psy_tone_masteratt_44, 37 | _psy_tone_0dB, 38 | _psy_tone_suppress, 39 | 40 | _vp_tonemask_adj_otherblock, 41 | _vp_tonemask_adj_longblock, 42 | _vp_tonemask_adj_otherblock, 43 | 44 | _psy_noiseguards_44, 45 | _psy_noisebias_impulse, 46 | _psy_noisebias_padding, 47 | _psy_noisebias_trans, 48 | _psy_noisebias_long, 49 | _psy_noise_suppress, 50 | 51 | _psy_compand_44, 52 | _psy_compand_short_mapping, 53 | _psy_compand_long_mapping, 54 | 55 | {_noise_start_short_44,_noise_start_long_44}, 56 | {_noise_part_short_44,_noise_part_long_44}, 57 | _noise_thresh_44, 58 | 59 | _psy_ath_floater, 60 | _psy_ath_abs, 61 | 62 | _psy_lowpass_44, 63 | 64 | _psy_global_44, 65 | _global_mapping_44, 66 | _psy_stereo_modes_44, 67 | 68 | _floor_books, 69 | _floor, 70 | 2, 71 | _floor_mapping_44, 72 | 73 | _mapres_template_44_uncoupled 74 | }; 75 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/registry.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: registry for time, floor, res backends and channel mappings 14 | last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #include "vorbis/codec.h" 19 | #include "codec_internal.h" 20 | #include "registry.h" 21 | #include "misc.h" 22 | /* seems like major overkill now; the backend numbers will grow into 23 | the infrastructure soon enough */ 24 | 25 | extern const vorbis_func_floor floor0_exportbundle; 26 | extern const vorbis_func_floor floor1_exportbundle; 27 | extern const vorbis_func_residue residue0_exportbundle; 28 | extern const vorbis_func_residue residue1_exportbundle; 29 | extern const vorbis_func_residue residue2_exportbundle; 30 | extern const vorbis_func_mapping mapping0_exportbundle; 31 | 32 | const vorbis_func_floor *const _floor_P[]={ 33 | &floor0_exportbundle, 34 | &floor1_exportbundle, 35 | }; 36 | 37 | const vorbis_func_residue *const _residue_P[]={ 38 | &residue0_exportbundle, 39 | &residue1_exportbundle, 40 | &residue2_exportbundle, 41 | }; 42 | 43 | const vorbis_func_mapping *const _mapping_P[]={ 44 | &mapping0_exportbundle, 45 | }; 46 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/registry.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: registry for time, floor, res backends and channel mappings 14 | last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_REG_H_ 19 | #define _V_REG_H_ 20 | 21 | #define VI_TRANSFORMB 1 22 | #define VI_WINDOWB 1 23 | #define VI_TIMEB 1 24 | #define VI_FLOORB 2 25 | #define VI_RESB 3 26 | #define VI_MAPB 1 27 | 28 | extern const vorbis_func_floor *const _floor_P[]; 29 | extern const vorbis_func_residue *const _residue_P[]; 30 | extern const vorbis_func_mapping *const _mapping_P[]; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/smallft.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: fft transform 14 | last mod: $Id: smallft.h 13293 2007-07-24 00:09:47Z xiphmont $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_SMFT_H_ 19 | #define _V_SMFT_H_ 20 | 21 | #include "vorbis/codec.h" 22 | 23 | typedef struct { 24 | int n; 25 | float *trigcache; 26 | int *splitcache; 27 | } drft_lookup; 28 | 29 | extern void drft_forward(drft_lookup *l,float *data); 30 | extern void drft_backward(drft_lookup *l,float *data); 31 | extern void drft_init(drft_lookup *l,int n); 32 | extern void drft_clear(drft_lookup *l); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/tone.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void usage(){ 7 | fprintf(stderr,"tone ,[] [,[]...]\n"); 8 | exit(1); 9 | } 10 | 11 | int main (int argc,char *argv[]){ 12 | int i,j; 13 | double *f; 14 | double *amp; 15 | 16 | if(argc<2)usage(); 17 | 18 | f=alloca(sizeof(*f)*(argc-1)); 19 | amp=alloca(sizeof(*amp)*(argc-1)); 20 | 21 | i=0; 22 | while(argv[i+1]){ 23 | char *pos=strchr(argv[i+1],','); 24 | 25 | f[i]=atof(argv[i+1]); 26 | if(pos) 27 | amp[i]=atof(pos+1)*32767.f; 28 | else 29 | amp[i]=32767.f; 30 | 31 | fprintf(stderr,"%g Hz, %g amp\n",f[i],amp[i]); 32 | 33 | i++; 34 | } 35 | 36 | for(i=0;i<44100*10;i++){ 37 | float val=0; 38 | int ival; 39 | for(j=0;j32767.f)ival=32767.f; 44 | if(ival<-32768.f)ival=-32768.f; 45 | 46 | fprintf(stdout,"%c%c%c%c", 47 | (char)(ival&0xff), 48 | (char)((ival>>8)&0xff), 49 | (char)(ival&0xff), 50 | (char)((ival>>8)&0xff)); 51 | } 52 | return(0); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /third_party/libvorbis/src/window.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: window functions 14 | last mod: $Id: window.h 19028 2013-12-02 23:23:39Z tterribe $ 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_WINDOW_ 19 | #define _V_WINDOW_ 20 | 21 | extern const float *_vorbis_window_get(int n); 22 | extern void _vorbis_apply_window(float *d,int *winno,long *blocksizes, 23 | int lW,int W,int nW); 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /third_party/musepack/include/mpc/datatypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Musepack audio compression 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | // mpcenc.h 22 | #define CENTER 448 // offset for centering current data in Main-array 23 | #define BLOCK 1152 // blocksize 24 | #define ANABUFFER (BLOCK + CENTER) // size of PCM-data array for analysis 25 | 26 | 27 | typedef struct { 28 | float L [36]; 29 | float R [36]; 30 | } SubbandFloatTyp; 31 | 32 | typedef struct { 33 | float L [ANABUFFER]; 34 | float R [ANABUFFER]; 35 | float M [ANABUFFER]; 36 | float S [ANABUFFER]; 37 | } PCMDataTyp; 38 | 39 | -------------------------------------------------------------------------------- /third_party/musepack/include/mpc/minimax.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Musepack audio compression 3 | * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #pragma once 21 | 22 | # define clip(x,min,max) ( (x) < (min) ? (min) : (x) > (max) ? (max) : (x) ) 23 | 24 | #ifdef __cplusplus 25 | 26 | # define maxi(A,B) ( (A) >? (B) ) 27 | # define mini(A,B) ( (A) ? (B) ) 29 | # define mind(A,B) ( (A) ? (B) ) 31 | # define minf(A,B) ( (A) (B) ? (A) : (B) ) 36 | # define mini(A,B) ( (A) < (B) ? (A) : (B) ) 37 | # define maxd(A,B) ( (A) > (B) ? (A) : (B) ) 38 | # define mind(A,B) ( (A) < (B) ? (A) : (B) ) 39 | # define maxf(A,B) ( (A) > (B) ? (A) : (B) ) 40 | # define minf(A,B) ( (A) < (B) ? (A) : (B) ) 41 | 42 | #endif 43 | 44 | #ifdef __GNUC__ 45 | 46 | # define absi(A) abs (A) 47 | # define absf(A) fabsf (A) 48 | # define absd(A) fabs (A) 49 | 50 | #else 51 | 52 | # define absi(A) ( (A) >= 0 ? (A) : -(A) ) 53 | # define absf(A) ( (A) >= 0.f ? (A) : -(A) ) 54 | # define absd(A) ( (A) >= 0. ? (A) : -(A) ) 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /third_party/musepack/libmpcdec/crc32.c: -------------------------------------------------------------------------------- 1 | /* 2 | * C Implementation: crc32 3 | * 4 | * code from http://www.w3.org/TR/PNG/#D-CRCAppendix 5 | * 6 | */ 7 | 8 | /* Table of CRCs of all 8-bit messages. */ 9 | static unsigned long crc_table[256]; 10 | 11 | /* Flag: has the table been computed? Initially false. */ 12 | static int crc_table_computed = 0; 13 | 14 | /* Make the table for a fast CRC. */ 15 | static void make_crc_table(void) 16 | { 17 | unsigned long c; 18 | int n, k; 19 | 20 | for (n = 0; n < 256; n++) { 21 | c = (unsigned long) n; 22 | for (k = 0; k < 8; k++) { 23 | if (c & 1) 24 | c = 0xedb88320L ^ (c >> 1); 25 | else 26 | c = c >> 1; 27 | } 28 | crc_table[n] = c; 29 | } 30 | crc_table_computed = 1; 31 | } 32 | 33 | 34 | /* Update a running CRC with the bytes buf[0..len-1]--the CRC 35 | should be initialized to all 1's, and the transmitted value 36 | is the 1's complement of the final running CRC (see the 37 | crc() routine below). */ 38 | 39 | static unsigned long update_crc(unsigned long crc, unsigned char *buf, int len) 40 | { 41 | unsigned long c = crc; 42 | int n; 43 | 44 | if (!crc_table_computed) 45 | make_crc_table(); 46 | for (n = 0; n < len; n++) { 47 | c = crc_table[(c ^ buf[n]) & 0xff] ^ (c >> 8); 48 | } 49 | return c; 50 | } 51 | 52 | /* Return the CRC of the bytes buf[0..len-1]. */ 53 | unsigned long mpc_crc32(unsigned char *buf, int len) 54 | { 55 | return update_crc(0xffffffffL, buf, len) ^ 0xffffffffL; 56 | } 57 | -------------------------------------------------------------------------------- /third_party/musepack/libmpcdec/huffman.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2009, The Musepack Development Team 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | * Neither the name of the The Musepack Development Team nor the 18 | names of its contributors may be used to endorse or promote 19 | products derived from this software without specific prior 20 | written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | /// \file huffman.h 35 | /// Data structures and functions for huffman coding. 36 | 37 | #ifndef _MPCDEC_HUFFMAN_H_ 38 | #define _MPCDEC_HUFFMAN_H_ 39 | #ifdef WIN32 40 | #pragma once 41 | #endif 42 | 43 | #include 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | // LUT size parameter, LUT size is 1 << LUT_DEPTH 50 | #define LUT_DEPTH 6 51 | 52 | /// Huffman table entry. 53 | typedef struct mpc_huffman_t { 54 | mpc_uint16_t Code; 55 | mpc_uint8_t Length; 56 | mpc_int8_t Value; 57 | } mpc_huffman; 58 | 59 | /// Huffman LUT entry. 60 | typedef struct mpc_huff_lut_t { 61 | mpc_uint8_t Length; 62 | mpc_int8_t Value; 63 | } mpc_huff_lut; 64 | 65 | /// Type used for huffman LUT decoding 66 | typedef struct mpc_lut_data_t { 67 | mpc_huffman const * const table; 68 | mpc_huff_lut lut[1 << LUT_DEPTH]; 69 | } mpc_lut_data; 70 | 71 | /// Type used for canonical huffman decoding 72 | typedef struct mpc_can_data_t { 73 | mpc_huffman const * const table; 74 | mpc_int8_t const * const sym; 75 | mpc_huff_lut lut[1 << LUT_DEPTH]; 76 | } mpc_can_data; 77 | 78 | void huff_init_lut(const int bits); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif 84 | -------------------------------------------------------------------------------- /third_party/musepack/libmpcdec/requant.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2009, The Musepack Development Team 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | * Neither the name of the The Musepack Development Team nor the 18 | names of its contributors may be used to endorse or promote 19 | products derived from this software without specific prior 20 | written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | /// \file requant.h 35 | /// Requantization function definitions. 36 | #ifndef _MPCDEC_REQUANT_H_ 37 | #define _MPCDEC_REQUANT_H_ 38 | #ifdef WIN32 39 | #pragma once 40 | #endif 41 | 42 | #include 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | 49 | /* C O N S T A N T S */ 50 | const mpc_uint8_t Res_bit [18]; ///< Bits per sample for chosen quantizer 51 | const MPC_SAMPLE_FORMAT __Cc [1 + 18]; ///< Requantization coefficients 52 | const mpc_int16_t __Dc [1 + 18]; ///< Requantization offset 53 | 54 | #define Cc (__Cc + 1) 55 | #define Dc (__Dc + 1) 56 | 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | #endif 62 | -------------------------------------------------------------------------------- /third_party/opus/celt/arm/arm_celt_map.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 Xiph.Org Foundation 2 | * Copyright (c) 2013 Parrot */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "pitch.h" 33 | 34 | #if defined(OPUS_HAVE_RTCD) 35 | 36 | # if defined(FIXED_POINT) 37 | opus_val32 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *, 38 | const opus_val16 *, opus_val32 *, int , int) = { 39 | celt_pitch_xcorr_c, /* ARMv4 */ 40 | MAY_HAVE_EDSP(celt_pitch_xcorr), /* EDSP */ 41 | MAY_HAVE_MEDIA(celt_pitch_xcorr), /* Media */ 42 | MAY_HAVE_NEON(celt_pitch_xcorr) /* NEON */ 43 | }; 44 | # else 45 | # error "Floating-point implementation is not supported by ARM asm yet." \ 46 | "Reconfigure with --disable-rtcd or send patches." 47 | # endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /third_party/opus/celt/arm/armcpu.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 Xiph.Org Foundation 2 | * Copyright (c) 2013 Parrot */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !defined(ARMCPU_H) 29 | # define ARMCPU_H 30 | 31 | # if defined(OPUS_ARM_MAY_HAVE_EDSP) 32 | # define MAY_HAVE_EDSP(name) name ## _edsp 33 | # else 34 | # define MAY_HAVE_EDSP(name) name ## _c 35 | # endif 36 | 37 | # if defined(OPUS_ARM_MAY_HAVE_MEDIA) 38 | # define MAY_HAVE_MEDIA(name) name ## _media 39 | # else 40 | # define MAY_HAVE_MEDIA(name) MAY_HAVE_EDSP(name) 41 | # endif 42 | 43 | # if defined(OPUS_ARM_MAY_HAVE_NEON) 44 | # define MAY_HAVE_NEON(name) name ## _neon 45 | # else 46 | # define MAY_HAVE_NEON(name) MAY_HAVE_MEDIA(name) 47 | # endif 48 | 49 | # if defined(OPUS_ARM_PRESUME_EDSP) 50 | # define PRESUME_EDSP(name) name ## _edsp 51 | # else 52 | # define PRESUME_EDSP(name) name ## _c 53 | # endif 54 | 55 | # if defined(OPUS_ARM_PRESUME_MEDIA) 56 | # define PRESUME_MEDIA(name) name ## _media 57 | # else 58 | # define PRESUME_MEDIA(name) PRESUME_EDSP(name) 59 | # endif 60 | 61 | # if defined(OPUS_ARM_PRESUME_NEON) 62 | # define PRESUME_NEON(name) name ## _neon 63 | # else 64 | # define PRESUME_NEON(name) PRESUME_MEDIA(name) 65 | # endif 66 | 67 | # if defined(OPUS_HAVE_RTCD) 68 | int opus_select_arch(void); 69 | # endif 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /third_party/opus/celt/arm/armopts.s.in: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Mozilla Corporation */ 2 | /* 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | - Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 18 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 22 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | ; Set the following to 1 if we have EDSP instructions 28 | ; (LDRD/STRD, etc., ARMv5E and later). 29 | OPUS_ARM_MAY_HAVE_EDSP * @OPUS_ARM_MAY_HAVE_EDSP@ 30 | 31 | ; Set the following to 1 if we have ARMv6 media instructions. 32 | OPUS_ARM_MAY_HAVE_MEDIA * @OPUS_ARM_MAY_HAVE_MEDIA@ 33 | 34 | ; Set the following to 1 if we have NEON (some ARMv7) 35 | OPUS_ARM_MAY_HAVE_NEON * @OPUS_ARM_MAY_HAVE_NEON@ 36 | 37 | END 38 | -------------------------------------------------------------------------------- /third_party/opus/celt/arm/pitch_arm.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 Xiph.Org Foundation 2 | * Copyright (c) 2013 Parrot */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !defined(PITCH_ARM_H) 29 | # define PITCH_ARM_H 30 | 31 | # include "armcpu.h" 32 | 33 | # if defined(FIXED_POINT) 34 | 35 | # if defined(OPUS_ARM_MAY_HAVE_NEON) 36 | opus_val32 celt_pitch_xcorr_neon(const opus_val16 *_x, const opus_val16 *_y, 37 | opus_val32 *xcorr, int len, int max_pitch); 38 | # endif 39 | 40 | # if defined(OPUS_ARM_MAY_HAVE_MEDIA) 41 | # define celt_pitch_xcorr_media MAY_HAVE_EDSP(celt_pitch_xcorr) 42 | # endif 43 | 44 | # if defined(OPUS_ARM_MAY_HAVE_EDSP) 45 | opus_val32 celt_pitch_xcorr_edsp(const opus_val16 *_x, const opus_val16 *_y, 46 | opus_val32 *xcorr, int len, int max_pitch); 47 | # endif 48 | 49 | # if !defined(OPUS_HAVE_RTCD) 50 | # define OVERRIDE_PITCH_XCORR (1) 51 | # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \ 52 | ((void)(arch),PRESUME_NEON(celt_pitch_xcorr)(_x, _y, xcorr, len, max_pitch)) 53 | # endif 54 | 55 | # endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /third_party/opus/celt/celt_lpc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009-2010 Xiph.Org Foundation 2 | Written by Jean-Marc Valin */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef PLC_H 29 | #define PLC_H 30 | 31 | #include "arch.h" 32 | 33 | #define LPC_ORDER 24 34 | 35 | void _celt_lpc(opus_val16 *_lpc, const opus_val32 *ac, int p); 36 | 37 | void celt_fir(const opus_val16 *x, 38 | const opus_val16 *num, 39 | opus_val16 *y, 40 | int N, 41 | int ord, 42 | opus_val16 *mem); 43 | 44 | void celt_iir(const opus_val32 *x, 45 | const opus_val16 *den, 46 | opus_val32 *y, 47 | int N, 48 | int ord, 49 | opus_val16 *mem); 50 | 51 | int _celt_autocorr(const opus_val16 *x, opus_val32 *ac, 52 | const opus_val16 *window, int overlap, int lag, int n, int arch); 53 | 54 | #endif /* PLC_H */ 55 | -------------------------------------------------------------------------------- /third_party/opus/celt/cpu_support.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 Xiph.Org Foundation 2 | * Copyright (c) 2013 Parrot */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef CPU_SUPPORT_H 29 | #define CPU_SUPPORT_H 30 | 31 | #include "opus_types.h" 32 | #include "opus_defines.h" 33 | 34 | #if defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_ASM) 35 | #include "arm/armcpu.h" 36 | 37 | /* We currently support 4 ARM variants: 38 | * arch[0] -> ARMv4 39 | * arch[1] -> ARMv5E 40 | * arch[2] -> ARMv6 41 | * arch[3] -> NEON 42 | */ 43 | #define OPUS_ARCHMASK 3 44 | 45 | #else 46 | #define OPUS_ARCHMASK 0 47 | 48 | static OPUS_INLINE int opus_select_arch(void) 49 | { 50 | return 0; 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /third_party/opus/celt/cwrs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007-2008 CSIRO 2 | Copyright (c) 2007-2009 Xiph.Org Foundation 3 | Copyright (c) 2007-2009 Timothy B. Terriberry 4 | Written by Timothy B. Terriberry and Jean-Marc Valin */ 5 | /* 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | - Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | - Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 21 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef CWRS_H 31 | #define CWRS_H 32 | 33 | #include "arch.h" 34 | #include "stack_alloc.h" 35 | #include "entenc.h" 36 | #include "entdec.h" 37 | 38 | #ifdef CUSTOM_MODES 39 | int log2_frac(opus_uint32 val, int frac); 40 | #endif 41 | 42 | void get_required_bits(opus_int16 *bits, int N, int K, int frac); 43 | 44 | void encode_pulses(const int *_y, int N, int K, ec_enc *enc); 45 | 46 | void decode_pulses(int *_y, int N, int K, ec_dec *dec); 47 | 48 | #endif /* CWRS_H */ 49 | -------------------------------------------------------------------------------- /third_party/opus/celt/laplace.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 CSIRO 2 | Copyright (c) 2007-2009 Xiph.Org Foundation 3 | Written by Jean-Marc Valin */ 4 | /* 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | - Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 20 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include "entenc.h" 30 | #include "entdec.h" 31 | 32 | /** Encode a value that is assumed to be the realisation of a 33 | Laplace-distributed random process 34 | @param enc Entropy encoder state 35 | @param value Value to encode 36 | @param fs Probability of 0, multiplied by 32768 37 | @param decay Probability of the value +/- 1, multiplied by 16384 38 | */ 39 | void ec_laplace_encode(ec_enc *enc, int *value, unsigned fs, int decay); 40 | 41 | /** Decode a value that is assumed to be the realisation of a 42 | Laplace-distributed random process 43 | @param dec Entropy decoder state 44 | @param fs Probability of 0, multiplied by 32768 45 | @param decay Probability of the value +/- 1, multiplied by 16384 46 | @return Value decoded 47 | */ 48 | int ec_laplace_decode(ec_dec *dec, unsigned fs, int decay); 49 | -------------------------------------------------------------------------------- /third_party/opus/celt/mfrngcod.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001-2008 Timothy B. Terriberry 2 | Copyright (c) 2008-2009 Xiph.Org Foundation */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !defined(_mfrngcode_H) 29 | # define _mfrngcode_H (1) 30 | # include "entcode.h" 31 | 32 | /*Constants used by the entropy encoder/decoder.*/ 33 | 34 | /*The number of bits to output at a time.*/ 35 | # define EC_SYM_BITS (8) 36 | /*The total number of bits in each of the state registers.*/ 37 | # define EC_CODE_BITS (32) 38 | /*The maximum symbol value.*/ 39 | # define EC_SYM_MAX ((1U<>EC_SYM_BITS) 46 | /*The number of bits available for the last, partial symbol in the code field.*/ 47 | # define EC_CODE_EXTRA ((EC_CODE_BITS-2)%EC_SYM_BITS+1) 48 | #endif 49 | -------------------------------------------------------------------------------- /third_party/opus/celt/modes.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007-2008 CSIRO 2 | Copyright (c) 2007-2009 Xiph.Org Foundation 3 | Copyright (c) 2008 Gregory Maxwell 4 | Written by Jean-Marc Valin and Gregory Maxwell */ 5 | /* 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | - Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | - Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 21 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef MODES_H 31 | #define MODES_H 32 | 33 | #include "opus_types.h" 34 | #include "celt.h" 35 | #include "arch.h" 36 | #include "mdct.h" 37 | #include "entenc.h" 38 | #include "entdec.h" 39 | 40 | #define MAX_PERIOD 1024 41 | 42 | #ifndef OVERLAP 43 | #define OVERLAP(mode) ((mode)->overlap) 44 | #endif 45 | 46 | #ifndef FRAMESIZE 47 | #define FRAMESIZE(mode) ((mode)->mdctSize) 48 | #endif 49 | 50 | typedef struct { 51 | int size; 52 | const opus_int16 *index; 53 | const unsigned char *bits; 54 | const unsigned char *caps; 55 | } PulseCache; 56 | 57 | /** Mode definition (opaque) 58 | @brief Mode definition 59 | */ 60 | struct OpusCustomMode { 61 | opus_int32 Fs; 62 | int overlap; 63 | 64 | int nbEBands; 65 | int effEBands; 66 | opus_val16 preemph[4]; 67 | const opus_int16 *eBands; /**< Definition for each "pseudo-critical band" */ 68 | 69 | int maxLM; 70 | int nbShortMdcts; 71 | int shortMdctSize; 72 | 73 | int nbAllocVectors; /**< Number of lines in the matrix below */ 74 | const unsigned char *allocVectors; /**< Number of bits in each band for several rates */ 75 | const opus_int16 *logN; 76 | 77 | const opus_val16 *window; 78 | mdct_lookup mdct; 79 | PulseCache cache; 80 | }; 81 | 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /third_party/opus/celt/vq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007-2008 CSIRO 2 | Copyright (c) 2007-2009 Xiph.Org Foundation 3 | Written by Jean-Marc Valin */ 4 | /** 5 | @file vq.h 6 | @brief Vector quantisation of the residual 7 | */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions 11 | are met: 12 | 13 | - Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 16 | - Redistributions in binary form must reproduce the above copyright 17 | notice, this list of conditions and the following disclaimer in the 18 | documentation and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 24 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef VQ_H 34 | #define VQ_H 35 | 36 | #include "entenc.h" 37 | #include "entdec.h" 38 | #include "modes.h" 39 | 40 | /** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of 41 | * the pitch and a combination of pulses such that its norm is still equal 42 | * to 1. This is the function that will typically require the most CPU. 43 | * @param X Residual signal to quantise/encode (returns quantised version) 44 | * @param N Number of samples to encode 45 | * @param K Number of pulses to use 46 | * @param enc Entropy encoder state 47 | * @ret A mask indicating which blocks in the band received pulses 48 | */ 49 | unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, 50 | ec_enc *enc 51 | #ifdef RESYNTH 52 | , opus_val16 gain 53 | #endif 54 | ); 55 | 56 | /** Algebraic pulse decoder 57 | * @param X Decoded normalised spectrum (returned) 58 | * @param N Number of samples to decode 59 | * @param K Number of pulses to use 60 | * @param dec Entropy decoder state 61 | * @ret A mask indicating which blocks in the band received pulses 62 | */ 63 | unsigned alg_unquant(celt_norm *X, int N, int K, int spread, int B, 64 | ec_dec *dec, opus_val16 gain); 65 | 66 | void renormalise_vector(celt_norm *X, int N, opus_val16 gain); 67 | 68 | int stereo_itheta(celt_norm *X, celt_norm *Y, int stereo, int N); 69 | 70 | #endif /* VQ_H */ 71 | -------------------------------------------------------------------------------- /third_party/opus/libopus/src/mlp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2011 Octasic Inc. 2 | Written by Jean-Marc Valin */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 19 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _MLP_H_ 29 | #define _MLP_H_ 30 | 31 | #include "arch.h" 32 | 33 | typedef struct { 34 | int layers; 35 | const int *topo; 36 | const float *weights; 37 | } MLP; 38 | 39 | void mlp_process(const MLP *m, const float *in, float *out); 40 | 41 | #endif /* _MLP_H_ */ 42 | -------------------------------------------------------------------------------- /third_party/opus/libopus/src/tansig_table.h: -------------------------------------------------------------------------------- 1 | /* This file is auto-generated by gen_tables */ 2 | 3 | static const float tansig_table[201] = { 4 | 0.000000f, 0.039979f, 0.079830f, 0.119427f, 0.158649f, 5 | 0.197375f, 0.235496f, 0.272905f, 0.309507f, 0.345214f, 6 | 0.379949f, 0.413644f, 0.446244f, 0.477700f, 0.507977f, 7 | 0.537050f, 0.564900f, 0.591519f, 0.616909f, 0.641077f, 8 | 0.664037f, 0.685809f, 0.706419f, 0.725897f, 0.744277f, 9 | 0.761594f, 0.777888f, 0.793199f, 0.807569f, 0.821040f, 10 | 0.833655f, 0.845456f, 0.856485f, 0.866784f, 0.876393f, 11 | 0.885352f, 0.893698f, 0.901468f, 0.908698f, 0.915420f, 12 | 0.921669f, 0.927473f, 0.932862f, 0.937863f, 0.942503f, 13 | 0.946806f, 0.950795f, 0.954492f, 0.957917f, 0.961090f, 14 | 0.964028f, 0.966747f, 0.969265f, 0.971594f, 0.973749f, 15 | 0.975743f, 0.977587f, 0.979293f, 0.980869f, 0.982327f, 16 | 0.983675f, 0.984921f, 0.986072f, 0.987136f, 0.988119f, 17 | 0.989027f, 0.989867f, 0.990642f, 0.991359f, 0.992020f, 18 | 0.992631f, 0.993196f, 0.993718f, 0.994199f, 0.994644f, 19 | 0.995055f, 0.995434f, 0.995784f, 0.996108f, 0.996407f, 20 | 0.996682f, 0.996937f, 0.997172f, 0.997389f, 0.997590f, 21 | 0.997775f, 0.997946f, 0.998104f, 0.998249f, 0.998384f, 22 | 0.998508f, 0.998623f, 0.998728f, 0.998826f, 0.998916f, 23 | 0.999000f, 0.999076f, 0.999147f, 0.999213f, 0.999273f, 24 | 0.999329f, 0.999381f, 0.999428f, 0.999472f, 0.999513f, 25 | 0.999550f, 0.999585f, 0.999617f, 0.999646f, 0.999673f, 26 | 0.999699f, 0.999722f, 0.999743f, 0.999763f, 0.999781f, 27 | 0.999798f, 0.999813f, 0.999828f, 0.999841f, 0.999853f, 28 | 0.999865f, 0.999875f, 0.999885f, 0.999893f, 0.999902f, 29 | 0.999909f, 0.999916f, 0.999923f, 0.999929f, 0.999934f, 30 | 0.999939f, 0.999944f, 0.999948f, 0.999952f, 0.999956f, 31 | 0.999959f, 0.999962f, 0.999965f, 0.999968f, 0.999970f, 32 | 0.999973f, 0.999975f, 0.999977f, 0.999978f, 0.999980f, 33 | 0.999982f, 0.999983f, 0.999984f, 0.999986f, 0.999987f, 34 | 0.999988f, 0.999989f, 0.999990f, 0.999990f, 0.999991f, 35 | 0.999992f, 0.999992f, 0.999993f, 0.999994f, 0.999994f, 36 | 0.999994f, 0.999995f, 0.999995f, 0.999996f, 0.999996f, 37 | 0.999996f, 0.999997f, 0.999997f, 0.999997f, 0.999997f, 38 | 0.999997f, 0.999998f, 0.999998f, 0.999998f, 0.999998f, 39 | 0.999998f, 0.999998f, 0.999999f, 0.999999f, 0.999999f, 40 | 0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, 41 | 0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, 42 | 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 43 | 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 44 | 1.000000f, 45 | }; 46 | -------------------------------------------------------------------------------- /third_party/opus/opusfile/src/internal.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE libopusfile SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE libopusfile SOURCE CODE IS (C) COPYRIGHT 2012 * 9 | * by the Xiph.Org Foundation and contributors http://www.xiph.org/ * 10 | * * 11 | ********************************************************************/ 12 | #ifdef HAVE_CONFIG_H 13 | #include "config.h" 14 | #endif 15 | 16 | #include "internal.h" 17 | 18 | #if defined(OP_ENABLE_ASSERTIONS) 19 | void op_fatal_impl(const char *_str,const char *_file,int _line){ 20 | fprintf(stderr,"Fatal (internal) error in %s, line %i: %s\n", 21 | _file,_line,_str); 22 | abort(); 23 | } 24 | #endif 25 | 26 | /*A version of strncasecmp() that is guaranteed to only ignore the case of 27 | ASCII characters.*/ 28 | int op_strncasecmp(const char *_a,const char *_b,int _n){ 29 | int i; 30 | for(i=0;i<_n;i++){ 31 | int a; 32 | int b; 33 | int d; 34 | a=_a[i]; 35 | b=_b[i]; 36 | if(a>='a'&&a<='z')a-='a'-'A'; 37 | if(b>='a'&&b<='z')b-='a'-'A'; 38 | d=a-b; 39 | if(d)return d; 40 | } 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /third_party/opus/silk/arm/SigProc_FIX_armv4.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (C) 2013 Xiph.Org Foundation and contributors 3 | Copyright (c) 2013 Parrot 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | - Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 13 | names of specific contributors, may be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | POSSIBILITY OF SUCH DAMAGE. 27 | ***********************************************************************/ 28 | 29 | #ifndef SILK_SIGPROC_FIX_ARMv4_H 30 | #define SILK_SIGPROC_FIX_ARMv4_H 31 | 32 | #undef silk_MLA 33 | static OPUS_INLINE opus_int32 silk_MLA_armv4(opus_int32 a, opus_int32 b, 34 | opus_int32 c) 35 | { 36 | opus_int32 res; 37 | __asm__( 38 | "#silk_MLA\n\t" 39 | "mla %0, %1, %2, %3\n\t" 40 | : "=&r"(res) 41 | : "r"(b), "r"(c), "r"(a) 42 | ); 43 | return res; 44 | } 45 | #define silk_MLA(a, b, c) (silk_MLA_armv4(a, b, c)) 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /third_party/opus/silk/arm/SigProc_FIX_armv5e.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Copyright (c) 2013 Parrot 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | - Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 13 | names of specific contributors, may be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | POSSIBILITY OF SUCH DAMAGE. 27 | ***********************************************************************/ 28 | 29 | #ifndef SILK_SIGPROC_FIX_ARMv5E_H 30 | #define SILK_SIGPROC_FIX_ARMv5E_H 31 | 32 | #undef silk_SMULTT 33 | static OPUS_INLINE opus_int32 silk_SMULTT_armv5e(opus_int32 a, opus_int32 b) 34 | { 35 | opus_int32 res; 36 | __asm__( 37 | "#silk_SMULTT\n\t" 38 | "smultt %0, %1, %2\n\t" 39 | : "=r"(res) 40 | : "%r"(a), "r"(b) 41 | ); 42 | return res; 43 | } 44 | #define silk_SMULTT(a, b) (silk_SMULTT_armv5e(a, b)) 45 | 46 | #undef silk_SMLATT 47 | static OPUS_INLINE opus_int32 silk_SMLATT_armv5e(opus_int32 a, opus_int32 b, 48 | opus_int32 c) 49 | { 50 | opus_int32 res; 51 | __asm__( 52 | "#silk_SMLATT\n\t" 53 | "smlatt %0, %1, %2, %3\n\t" 54 | : "=r"(res) 55 | : "%r"(b), "r"(c), "r"(a) 56 | ); 57 | return res; 58 | } 59 | #define silk_SMLATT(a, b, c) (silk_SMLATT_armv5e(a, b, c)) 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /third_party/opus/silk/bwexpander.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | 34 | /* Chirp (bandwidth expand) LP AR filter */ 35 | void silk_bwexpander( 36 | opus_int16 *ar, /* I/O AR filter to be expanded (without leading 1) */ 37 | const opus_int d, /* I Length of ar */ 38 | opus_int32 chirp_Q16 /* I Chirp factor (typically in the range 0 to 1) */ 39 | ) 40 | { 41 | opus_int i; 42 | opus_int32 chirp_minus_one_Q16 = chirp_Q16 - 65536; 43 | 44 | /* NB: Dont use silk_SMULWB, instead of silk_RSHIFT_ROUND( silk_MUL(), 16 ), below. */ 45 | /* Bias in silk_SMULWB can lead to unstable filters */ 46 | for( i = 0; i < d - 1; i++ ) { 47 | ar[ i ] = (opus_int16)silk_RSHIFT_ROUND( silk_MUL( chirp_Q16, ar[ i ] ), 16 ); 48 | chirp_Q16 += silk_RSHIFT_ROUND( silk_MUL( chirp_Q16, chirp_minus_one_Q16 ), 16 ); 49 | } 50 | ar[ d - 1 ] = (opus_int16)silk_RSHIFT_ROUND( silk_MUL( chirp_Q16, ar[ d - 1 ] ), 16 ); 51 | } 52 | -------------------------------------------------------------------------------- /third_party/opus/silk/bwexpander_32.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | 34 | /* Chirp (bandwidth expand) LP AR filter */ 35 | void silk_bwexpander_32( 36 | opus_int32 *ar, /* I/O AR filter to be expanded (without leading 1) */ 37 | const opus_int d, /* I Length of ar */ 38 | opus_int32 chirp_Q16 /* I Chirp factor in Q16 */ 39 | ) 40 | { 41 | opus_int i; 42 | opus_int32 chirp_minus_one_Q16 = chirp_Q16 - 65536; 43 | 44 | for( i = 0; i < d - 1; i++ ) { 45 | ar[ i ] = silk_SMULWW( chirp_Q16, ar[ i ] ); 46 | chirp_Q16 += silk_RSHIFT_ROUND( silk_MUL( chirp_Q16, chirp_minus_one_Q16 ), 16 ); 47 | } 48 | ar[ d - 1 ] = silk_SMULWW( chirp_Q16, ar[ d - 1 ] ); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /third_party/opus/silk/fixed/autocorr_FIX.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | #include "celt_lpc.h" 34 | 35 | /* Compute autocorrelation */ 36 | void silk_autocorr( 37 | opus_int32 *results, /* O Result (length correlationCount) */ 38 | opus_int *scale, /* O Scaling of the correlation vector */ 39 | const opus_int16 *inputData, /* I Input data to correlate */ 40 | const opus_int inputDataSize, /* I Length of input */ 41 | const opus_int correlationCount, /* I Number of correlation taps to compute */ 42 | int arch /* I Run-time architecture */ 43 | ) 44 | { 45 | opus_int corrCount; 46 | corrCount = silk_min_int( inputDataSize, correlationCount ); 47 | *scale = _celt_autocorr(inputData, results, NULL, 0, corrCount-1, inputDataSize, arch); 48 | } 49 | -------------------------------------------------------------------------------- /third_party/opus/silk/fixed/k2a_FIX.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | 34 | /* Step up function, converts reflection coefficients to prediction coefficients */ 35 | void silk_k2a( 36 | opus_int32 *A_Q24, /* O Prediction coefficients [order] Q24 */ 37 | const opus_int16 *rc_Q15, /* I Reflection coefficients [order] Q15 */ 38 | const opus_int32 order /* I Prediction order */ 39 | ) 40 | { 41 | opus_int k, n; 42 | opus_int32 Atmp[ SILK_MAX_ORDER_LPC ]; 43 | 44 | for( k = 0; k < order; k++ ) { 45 | for( n = 0; n < k; n++ ) { 46 | Atmp[ n ] = A_Q24[ n ]; 47 | } 48 | for( n = 0; n < k; n++ ) { 49 | A_Q24[ n ] = silk_SMLAWB( A_Q24[ n ], silk_LSHIFT( Atmp[ k - n - 1 ], 1 ), rc_Q15[ k ] ); 50 | } 51 | A_Q24[ k ] = -silk_LSHIFT( (opus_int32)rc_Q15[ k ], 9 ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /third_party/opus/silk/fixed/k2a_Q16_FIX.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | 34 | /* Step up function, converts reflection coefficients to prediction coefficients */ 35 | void silk_k2a_Q16( 36 | opus_int32 *A_Q24, /* O Prediction coefficients [order] Q24 */ 37 | const opus_int32 *rc_Q16, /* I Reflection coefficients [order] Q16 */ 38 | const opus_int32 order /* I Prediction order */ 39 | ) 40 | { 41 | opus_int k, n; 42 | opus_int32 Atmp[ SILK_MAX_ORDER_LPC ]; 43 | 44 | for( k = 0; k < order; k++ ) { 45 | for( n = 0; n < k; n++ ) { 46 | Atmp[ n ] = A_Q24[ n ]; 47 | } 48 | for( n = 0; n < k; n++ ) { 49 | A_Q24[ n ] = silk_SMLAWW( A_Q24[ n ], Atmp[ k - n - 1 ], rc_Q16[ k ] ); 50 | } 51 | A_Q24[ k ] = -silk_LSHIFT( rc_Q16[ k ], 8 ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /third_party/opus/silk/fixed/regularize_correlations_FIX.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "main_FIX.h" 33 | 34 | /* Add noise to matrix diagonal */ 35 | void silk_regularize_correlations_FIX( 36 | opus_int32 *XX, /* I/O Correlation matrices */ 37 | opus_int32 *xx, /* I/O Correlation values */ 38 | opus_int32 noise, /* I Noise to add */ 39 | opus_int D /* I Dimension of XX */ 40 | ) 41 | { 42 | opus_int i; 43 | for( i = 0; i < D; i++ ) { 44 | matrix_ptr( &XX[ 0 ], i, i, D ) = silk_ADD32( matrix_ptr( &XX[ 0 ], i, i, D ), noise ); 45 | } 46 | xx[ 0 ] += noise; 47 | } 48 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/LTP_scale_ctrl_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "main_FLP.h" 33 | 34 | void silk_LTP_scale_ctrl_FLP( 35 | silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ 36 | silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ 37 | opus_int condCoding /* I The type of conditional coding to use */ 38 | ) 39 | { 40 | opus_int round_loss; 41 | 42 | if( condCoding == CODE_INDEPENDENTLY ) { 43 | /* Only scale if first frame in packet */ 44 | round_loss = psEnc->sCmn.PacketLoss_perc + psEnc->sCmn.nFramesPerPacket; 45 | psEnc->sCmn.indices.LTP_scaleIndex = (opus_int8)silk_LIMIT( round_loss * psEncCtrl->LTPredCodGain * 0.1f, 0.0f, 2.0f ); 46 | } else { 47 | /* Default is minimum scaling */ 48 | psEnc->sCmn.indices.LTP_scaleIndex = 0; 49 | } 50 | 51 | psEncCtrl->LTP_scale = (silk_float)silk_LTPScales_table_Q14[ psEnc->sCmn.indices.LTP_scaleIndex ] / 16384.0f; 52 | } 53 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/autocorrelation_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "typedef.h" 33 | #include "SigProc_FLP.h" 34 | 35 | /* compute autocorrelation */ 36 | void silk_autocorrelation_FLP( 37 | silk_float *results, /* O result (length correlationCount) */ 38 | const silk_float *inputData, /* I input data to correlate */ 39 | opus_int inputDataSize, /* I length of input */ 40 | opus_int correlationCount /* I number of correlation taps to compute */ 41 | ) 42 | { 43 | opus_int i; 44 | 45 | if( correlationCount > inputDataSize ) { 46 | correlationCount = inputDataSize; 47 | } 48 | 49 | for( i = 0; i < correlationCount; i++ ) { 50 | results[ i ] = (silk_float)silk_inner_product_FLP( inputData, inputData + i, inputDataSize - i ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/bwexpander_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FLP.h" 33 | 34 | /* Chirp (bw expand) LP AR filter */ 35 | void silk_bwexpander_FLP( 36 | silk_float *ar, /* I/O AR filter to be expanded (without leading 1) */ 37 | const opus_int d, /* I length of ar */ 38 | const silk_float chirp /* I chirp factor (typically in range (0..1) ) */ 39 | ) 40 | { 41 | opus_int i; 42 | silk_float cfac = chirp; 43 | 44 | for( i = 0; i < d - 1; i++ ) { 45 | ar[ i ] *= cfac; 46 | cfac *= chirp; 47 | } 48 | ar[ d - 1 ] *= cfac; 49 | } 50 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/energy_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FLP.h" 33 | 34 | /* sum of squares of a silk_float array, with result as double */ 35 | double silk_energy_FLP( 36 | const silk_float *data, 37 | opus_int dataSize 38 | ) 39 | { 40 | opus_int i, dataSize4; 41 | double result; 42 | 43 | /* 4x unrolled loop */ 44 | result = 0.0; 45 | dataSize4 = dataSize & 0xFFFC; 46 | for( i = 0; i < dataSize4; i += 4 ) { 47 | result += data[ i + 0 ] * (double)data[ i + 0 ] + 48 | data[ i + 1 ] * (double)data[ i + 1 ] + 49 | data[ i + 2 ] * (double)data[ i + 2 ] + 50 | data[ i + 3 ] * (double)data[ i + 3 ]; 51 | } 52 | 53 | /* add any remaining products */ 54 | for( ; i < dataSize; i++ ) { 55 | result += data[ i ] * (double)data[ i ]; 56 | } 57 | 58 | silk_assert( result >= 0.0 ); 59 | return result; 60 | } 61 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/inner_product_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FLP.h" 33 | 34 | /* inner product of two silk_float arrays, with result as double */ 35 | double silk_inner_product_FLP( 36 | const silk_float *data1, 37 | const silk_float *data2, 38 | opus_int dataSize 39 | ) 40 | { 41 | opus_int i, dataSize4; 42 | double result; 43 | 44 | /* 4x unrolled loop */ 45 | result = 0.0; 46 | dataSize4 = dataSize & 0xFFFC; 47 | for( i = 0; i < dataSize4; i += 4 ) { 48 | result += data1[ i + 0 ] * (double)data2[ i + 0 ] + 49 | data1[ i + 1 ] * (double)data2[ i + 1 ] + 50 | data1[ i + 2 ] * (double)data2[ i + 2 ] + 51 | data1[ i + 3 ] * (double)data2[ i + 3 ]; 52 | } 53 | 54 | /* add any remaining products */ 55 | for( ; i < dataSize; i++ ) { 56 | result += data1[ i ] * (double)data2[ i ]; 57 | } 58 | 59 | return result; 60 | } 61 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/k2a_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FLP.h" 33 | 34 | /* step up function, converts reflection coefficients to prediction coefficients */ 35 | void silk_k2a_FLP( 36 | silk_float *A, /* O prediction coefficients [order] */ 37 | const silk_float *rc, /* I reflection coefficients [order] */ 38 | opus_int32 order /* I prediction order */ 39 | ) 40 | { 41 | opus_int k, n; 42 | silk_float Atmp[ SILK_MAX_ORDER_LPC ]; 43 | 44 | for( k = 0; k < order; k++ ) { 45 | for( n = 0; n < k; n++ ) { 46 | Atmp[ n ] = A[ n ]; 47 | } 48 | for( n = 0; n < k; n++ ) { 49 | A[ n ] += Atmp[ k - n - 1 ] * rc[ k ]; 50 | } 51 | A[ k ] = -rc[ k ]; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/regularize_correlations_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "main_FLP.h" 33 | 34 | /* Add noise to matrix diagonal */ 35 | void silk_regularize_correlations_FLP( 36 | silk_float *XX, /* I/O Correlation matrices */ 37 | silk_float *xx, /* I/O Correlation values */ 38 | const silk_float noise, /* I Noise energy to add */ 39 | const opus_int D /* I Dimension of XX */ 40 | ) 41 | { 42 | opus_int i; 43 | 44 | for( i = 0; i < D; i++ ) { 45 | matrix_ptr( &XX[ 0 ], i, i, D ) += noise; 46 | } 47 | xx[ 0 ] += noise; 48 | } 49 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/scale_copy_vector_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FLP.h" 33 | 34 | /* copy and multiply a vector by a constant */ 35 | void silk_scale_copy_vector_FLP( 36 | silk_float *data_out, 37 | const silk_float *data_in, 38 | silk_float gain, 39 | opus_int dataSize 40 | ) 41 | { 42 | opus_int i, dataSize4; 43 | 44 | /* 4x unrolled loop */ 45 | dataSize4 = dataSize & 0xFFFC; 46 | for( i = 0; i < dataSize4; i += 4 ) { 47 | data_out[ i + 0 ] = gain * data_in[ i + 0 ]; 48 | data_out[ i + 1 ] = gain * data_in[ i + 1 ]; 49 | data_out[ i + 2 ] = gain * data_in[ i + 2 ]; 50 | data_out[ i + 3 ] = gain * data_in[ i + 3 ]; 51 | } 52 | 53 | /* any remaining elements */ 54 | for( ; i < dataSize; i++ ) { 55 | data_out[ i ] = gain * data_in[ i ]; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /third_party/opus/silk/float/scale_vector_FLP.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FLP.h" 33 | 34 | /* multiply a vector by a constant */ 35 | void silk_scale_vector_FLP( 36 | silk_float *data1, 37 | silk_float gain, 38 | opus_int dataSize 39 | ) 40 | { 41 | opus_int i, dataSize4; 42 | 43 | /* 4x unrolled loop */ 44 | dataSize4 = dataSize & 0xFFFC; 45 | for( i = 0; i < dataSize4; i += 4 ) { 46 | data1[ i + 0 ] *= gain; 47 | data1[ i + 1 ] *= gain; 48 | data1[ i + 2 ] *= gain; 49 | data1[ i + 3 ] *= gain; 50 | } 51 | 52 | /* any remaining elements */ 53 | for( ; i < dataSize; i++ ) { 54 | data1[ i ] *= gain; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /third_party/opus/silk/init_decoder.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "main.h" 33 | 34 | /************************/ 35 | /* Init Decoder State */ 36 | /************************/ 37 | opus_int silk_init_decoder( 38 | silk_decoder_state *psDec /* I/O Decoder state pointer */ 39 | ) 40 | { 41 | /* Clear the entire encoder state, except anything copied */ 42 | silk_memset( psDec, 0, sizeof( silk_decoder_state ) ); 43 | 44 | /* Used to deactivate LSF interpolation */ 45 | psDec->first_frame_after_reset = 1; 46 | psDec->prev_gain_Q16 = 65536; 47 | 48 | /* Reset CNG state */ 49 | silk_CNG_Reset( psDec ); 50 | 51 | /* Reset PLC state */ 52 | silk_PLC_Reset( psDec ); 53 | 54 | return(0); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /third_party/opus/silk/inner_prod_aligned.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | 34 | opus_int32 silk_inner_prod_aligned_scale( 35 | const opus_int16 *const inVec1, /* I input vector 1 */ 36 | const opus_int16 *const inVec2, /* I input vector 2 */ 37 | const opus_int scale, /* I number of bits to shift */ 38 | const opus_int len /* I vector lengths */ 39 | ) 40 | { 41 | opus_int i; 42 | opus_int32 sum = 0; 43 | for( i = 0; i < len; i++ ) { 44 | sum = silk_ADD_RSHIFT32( sum, silk_SMULBB( inVec1[ i ], inVec2[ i ] ), scale ); 45 | } 46 | return sum; 47 | } 48 | -------------------------------------------------------------------------------- /third_party/opus/silk/interpolate.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "main.h" 33 | 34 | /* Interpolate two vectors */ 35 | void silk_interpolate( 36 | opus_int16 xi[ MAX_LPC_ORDER ], /* O interpolated vector */ 37 | const opus_int16 x0[ MAX_LPC_ORDER ], /* I first vector */ 38 | const opus_int16 x1[ MAX_LPC_ORDER ], /* I second vector */ 39 | const opus_int ifact_Q2, /* I interp. factor, weight on 2nd vector */ 40 | const opus_int d /* I number of parameters */ 41 | ) 42 | { 43 | opus_int i; 44 | 45 | silk_assert( ifact_Q2 >= 0 ); 46 | silk_assert( ifact_Q2 <= 4 ); 47 | 48 | for( i = 0; i < d; i++ ) { 49 | xi[ i ] = (opus_int16)silk_ADD_RSHIFT( x0[ i ], silk_SMULBB( x1[ i ] - x0[ i ], ifact_Q2 ), 2 ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /third_party/opus/silk/lin2log.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | /* Approximation of 128 * log2() (very close inverse of silk_log2lin()) */ 34 | /* Convert input to a log scale */ 35 | opus_int32 silk_lin2log( 36 | const opus_int32 inLin /* I input in linear scale */ 37 | ) 38 | { 39 | opus_int32 lz, frac_Q7; 40 | 41 | silk_CLZ_FRAC( inLin, &lz, &frac_Q7 ); 42 | 43 | /* Piece-wise parabolic approximation */ 44 | return silk_LSHIFT( 31 - lz, 7 ) + silk_SMLAWB( frac_Q7, silk_MUL( frac_Q7, 128 - frac_Q7 ), 179 ); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /third_party/opus/silk/log2lin.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | 34 | /* Approximation of 2^() (very close inverse of silk_lin2log()) */ 35 | /* Convert input to a linear scale */ 36 | opus_int32 silk_log2lin( 37 | const opus_int32 inLog_Q7 /* I input on log scale */ 38 | ) 39 | { 40 | opus_int32 out, frac_Q7; 41 | 42 | if( inLog_Q7 < 0 ) { 43 | return 0; 44 | } else if ( inLog_Q7 >= 3967 ) { 45 | return silk_int32_MAX; 46 | } 47 | 48 | out = silk_LSHIFT( 1, silk_RSHIFT( inLog_Q7, 7 ) ); 49 | frac_Q7 = inLog_Q7 & 0x7F; 50 | if( inLog_Q7 < 2048 ) { 51 | /* Piece-wise parabolic approximation */ 52 | out = silk_ADD_RSHIFT32( out, silk_MUL( out, silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) ), 7 ); 53 | } else { 54 | /* Piece-wise parabolic approximation */ 55 | out = silk_MLA( out, silk_RSHIFT( out, 7 ), silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) ); 56 | } 57 | return out; 58 | } 59 | -------------------------------------------------------------------------------- /third_party/opus/silk/resampler_private_AR2.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "SigProc_FIX.h" 33 | #include "resampler_private.h" 34 | 35 | /* Second order AR filter with single delay elements */ 36 | void silk_resampler_private_AR2( 37 | opus_int32 S[], /* I/O State vector [ 2 ] */ 38 | opus_int32 out_Q8[], /* O Output signal */ 39 | const opus_int16 in[], /* I Input signal */ 40 | const opus_int16 A_Q14[], /* I AR coefficients, Q14 */ 41 | opus_int32 len /* I Signal length */ 42 | ) 43 | { 44 | opus_int32 k; 45 | opus_int32 out32; 46 | 47 | for( k = 0; k < len; k++ ) { 48 | out32 = silk_ADD_LSHIFT32( S[ 0 ], (opus_int32)in[ k ], 8 ); 49 | out_Q8[ k ] = out32; 50 | out32 = silk_LSHIFT( out32, 2 ); 51 | S[ 0 ] = silk_SMLAWB( S[ 1 ], out32, A_Q14[ 0 ] ); 52 | S[ 1 ] = silk_SMULWB( out32, A_Q14[ 1 ] ); 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /third_party/opus/silk/resampler_structs.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifndef SILK_RESAMPLER_STRUCTS_H 29 | #define SILK_RESAMPLER_STRUCTS_H 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #define SILK_RESAMPLER_MAX_FIR_ORDER 36 36 | #define SILK_RESAMPLER_MAX_IIR_ORDER 6 37 | 38 | typedef struct _silk_resampler_state_struct{ 39 | opus_int32 sIIR[ SILK_RESAMPLER_MAX_IIR_ORDER ]; /* this must be the first element of this struct */ 40 | union{ 41 | opus_int32 i32[ SILK_RESAMPLER_MAX_FIR_ORDER ]; 42 | opus_int16 i16[ SILK_RESAMPLER_MAX_FIR_ORDER ]; 43 | } sFIR; 44 | opus_int16 delayBuf[ 48 ]; 45 | opus_int resampler_function; 46 | opus_int batchSize; 47 | opus_int32 invRatio_Q16; 48 | opus_int FIR_Order; 49 | opus_int FIR_Fracs; 50 | opus_int Fs_in_kHz; 51 | opus_int Fs_out_kHz; 52 | opus_int inputDelay; 53 | const opus_int16 *Coefs; 54 | } silk_resampler_state_struct; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #endif /* SILK_RESAMPLER_STRUCTS_H */ 60 | 61 | -------------------------------------------------------------------------------- /third_party/opus/silk/tables_gain.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | - Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 12 | names of specific contributors, may be used to endorse or promote 13 | products derived from this software without specific prior written 14 | permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | ***********************************************************************/ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #include "tables.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | 39 | const opus_uint8 silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ] = 40 | { 41 | { 42 | 224, 112, 44, 15, 3, 2, 1, 0 43 | }, 44 | { 45 | 254, 237, 192, 132, 70, 23, 4, 0 46 | }, 47 | { 48 | 255, 252, 226, 155, 61, 11, 2, 0 49 | } 50 | }; 51 | 52 | const opus_uint8 silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ] = { 53 | 250, 245, 234, 203, 71, 50, 42, 38, 54 | 35, 33, 31, 29, 28, 27, 26, 25, 55 | 24, 23, 22, 21, 20, 19, 18, 17, 56 | 16, 15, 14, 13, 12, 11, 10, 9, 57 | 8, 7, 6, 5, 4, 3, 2, 1, 58 | 0 59 | }; 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /third_party/wavpack/src/wavpack_version.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // **** WAVPACK **** // 3 | // Hybrid Lossless Wavefile Compressor // 4 | // Copyright (c) 1998 - 2006 Conifer Software. // 5 | // All Rights Reserved. // 6 | // Distributed under the BSD Software License (see license.txt) // 7 | //////////////////////////////////////////////////////////////////////////// 8 | 9 | // wavpack_version.h 10 | 11 | #ifndef WAVPACK_VERSION_H 12 | #define WAVPACK_VERSION_H 13 | 14 | #define LIBWAVPACK_MAJOR 5 15 | #define LIBWAVPACK_MINOR 1 16 | #define LIBWAVPACK_MICRO 0 17 | #define LIBWAVPACK_VERSION_STRING "5.1.0" 18 | 19 | #endif 20 | --------------------------------------------------------------------------------