aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct86
-rw-r--r--bin/tests/test_math.cpp2
-rw-r--r--core/globals.cpp2
-rw-r--r--core/hashfuncs.h5
-rw-r--r--core/variant_parser.cpp8
-rw-r--r--doc/base/classes.xml32
-rw-r--r--drivers/SCsub100
-rw-r--r--drivers/alsa/SCsub2
-rw-r--r--drivers/builtin_openssl2/SCsub663
-rw-r--r--drivers/builtin_zlib/SCsub22
-rw-r--r--drivers/chibi/SCsub5
-rw-r--r--drivers/convex_decomp/SCsub5
-rw-r--r--drivers/dds/SCsub10
-rw-r--r--drivers/etc1/SCsub15
-rw-r--r--drivers/freetype/SCsub73
-rw-r--r--drivers/freetype/src/Jamfile19
-rw-r--r--drivers/freetype/src/autofit/Jamfile53
-rw-r--r--drivers/freetype/src/base/Jamfile88
-rw-r--r--drivers/freetype/src/bdf/Jamfile31
-rw-r--r--drivers/freetype/src/cache/Jamfile37
-rw-r--r--drivers/freetype/src/cff/Jamfile45
-rw-r--r--drivers/freetype/src/cid/Jamfile34
-rw-r--r--drivers/freetype/src/gxvalid/Jamfile52
-rw-r--r--drivers/freetype/src/otvalid/Jamfile37
-rw-r--r--drivers/freetype/src/pcf/Jamfile32
-rw-r--r--drivers/freetype/src/pfr/Jamfile35
-rw-r--r--drivers/freetype/src/psaux/Jamfile35
-rw-r--r--drivers/freetype/src/pshinter/Jamfile34
-rw-r--r--drivers/freetype/src/psnames/Jamfile31
-rw-r--r--drivers/freetype/src/raster/Jamfile32
-rw-r--r--drivers/freetype/src/sfnt/Jamfile40
-rw-r--r--drivers/freetype/src/smooth/Jamfile32
-rw-r--r--drivers/freetype/src/truetype/Jamfile37
-rw-r--r--drivers/freetype/src/type1/Jamfile35
-rw-r--r--drivers/freetype/src/type42/Jamfile32
-rw-r--r--drivers/freetype/src/winfonts/Jamfile16
-rw-r--r--drivers/gl_context/SCsub20
-rw-r--r--drivers/gles2/SCsub4
-rw-r--r--drivers/gles2/shaders/SCsub2
-rw-r--r--drivers/jpegd/SCsub11
-rw-r--r--drivers/mpc/SCsub21
-rw-r--r--drivers/nedmalloc/License.txt23
-rw-r--r--drivers/nedmalloc/Readme.txt136
-rw-r--r--drivers/nedmalloc/SCsub4
-rw-r--r--drivers/nedmalloc/malloc.c.h5814
-rw-r--r--drivers/nedmalloc/memory_pool_static_nedmalloc.cpp163
-rw-r--r--drivers/nedmalloc/nedmalloc.cpp1467
-rw-r--r--drivers/nedmalloc/nedmalloc.h302
-rw-r--r--drivers/nrex/SCsub8
-rw-r--r--drivers/ogg/SCsub9
-rw-r--r--drivers/openssl/SCsub6
-rw-r--r--drivers/opus/SCsub196
-rw-r--r--drivers/png/SCsub74
-rw-r--r--drivers/png/image_loader_png.cpp1
-rw-r--r--drivers/png/image_loader_png.h3
-rw-r--r--drivers/png/resource_saver_png.cpp10
-rw-r--r--drivers/pnm/SCsub10
-rw-r--r--drivers/pulseaudio/SCsub2
-rw-r--r--drivers/pvr/SCsub15
-rw-r--r--drivers/register_driver_types.cpp252
-rw-r--r--drivers/rtaudio/SCsub18
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp2
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.h3
-rw-r--r--drivers/speex/SCsub55
-rw-r--r--drivers/speex/_kiss_fft_guts.h160
-rw-r--r--drivers/speex/arch.h249
-rw-r--r--drivers/speex/audio_stream_speex.cpp581
-rw-r--r--drivers/speex/audio_stream_speex.h153
-rw-r--r--drivers/speex/bits.c372
-rw-r--r--drivers/speex/buffer.c176
-rw-r--r--drivers/speex/cb_search.c612
-rw-r--r--drivers/speex/cb_search.h103
-rw-r--r--drivers/speex/cb_search_arm4.h137
-rw-r--r--drivers/speex/cb_search_bfin.h112
-rw-r--r--drivers/speex/cb_search_sse.h84
-rw-r--r--drivers/speex/echo_diagnostic.m72
-rw-r--r--drivers/speex/exc_10_16_table.c50
-rw-r--r--drivers/speex/exc_10_32_table.c66
-rw-r--r--drivers/speex/exc_20_32_table.c66
-rw-r--r--drivers/speex/exc_5_256_table.c290
-rw-r--r--drivers/speex/exc_5_64_table.c98
-rw-r--r--drivers/speex/exc_8_128_table.c162
-rw-r--r--drivers/speex/fftwrap.c397
-rw-r--r--drivers/speex/fftwrap.h58
-rw-r--r--drivers/speex/filterbank.c227
-rw-r--r--drivers/speex/filterbank.h66
-rw-r--r--drivers/speex/filters.c821
-rw-r--r--drivers/speex/filters.h90
-rw-r--r--drivers/speex/filters_arm4.h96
-rw-r--r--drivers/speex/filters_bfin.h515
-rw-r--r--drivers/speex/filters_sse.h336
-rw-r--r--drivers/speex/fixed_arm4.h148
-rw-r--r--drivers/speex/fixed_arm5e.h178
-rw-r--r--drivers/speex/fixed_bfin.h173
-rw-r--r--drivers/speex/fixed_debug.h487
-rw-r--r--drivers/speex/fixed_generic.h106
-rw-r--r--drivers/speex/gain_table.c160
-rw-r--r--drivers/speex/gain_table_lbr.c64
-rw-r--r--drivers/speex/hexc_10_32_table.c66
-rw-r--r--drivers/speex/hexc_table.c162
-rw-r--r--drivers/speex/high_lsp_tables.c163
-rw-r--r--drivers/speex/jitter.c843
-rw-r--r--drivers/speex/kiss_fft.c523
-rw-r--r--drivers/speex/kiss_fft.h108
-rw-r--r--drivers/speex/kiss_fftr.c297
-rw-r--r--drivers/speex/kiss_fftr.h51
-rw-r--r--drivers/speex/lpc.c201
-rw-r--r--drivers/speex/lpc_bfin.h131
-rw-r--r--drivers/speex/lsp.c656
-rw-r--r--drivers/speex/lsp.h64
-rw-r--r--drivers/speex/lsp_bfin.h89
-rw-r--r--drivers/speex/lsp_tables_nb.c360
-rw-r--r--drivers/speex/ltp.c839
-rw-r--r--drivers/speex/ltp.h141
-rw-r--r--drivers/speex/ltp_arm4.h187
-rw-r--r--drivers/speex/ltp_bfin.h419
-rw-r--r--drivers/speex/ltp_sse.h92
-rw-r--r--drivers/speex/math_approx.h333
-rw-r--r--drivers/speex/mdf.c1285
-rw-r--r--drivers/speex/misc_bfin.h54
-rw-r--r--drivers/speex/modes.c366
-rw-r--r--drivers/speex/modes.h161
-rw-r--r--drivers/speex/modes_wb.c300
-rw-r--r--drivers/speex/nb_celp.c1903
-rw-r--r--drivers/speex/nb_celp.h203
-rw-r--r--drivers/speex/os_support.h172
-rw-r--r--drivers/speex/preprocess.c1219
-rw-r--r--drivers/speex/pseudofloat.h379
-rw-r--r--drivers/speex/quant_lsp.c385
-rw-r--r--drivers/speex/quant_lsp.h74
-rw-r--r--drivers/speex/quant_lsp_bfin.h165
-rw-r--r--drivers/speex/resample.c1131
-rw-r--r--drivers/speex/resample_sse.h128
-rw-r--r--drivers/speex/sb_celp.c1488
-rw-r--r--drivers/speex/sb_celp.h155
-rw-r--r--drivers/speex/scal.c289
-rw-r--r--drivers/speex/smallft.c1261
-rw-r--r--drivers/speex/smallft.h46
-rw-r--r--drivers/speex/speex.c250
-rw-r--r--drivers/speex/speex.h424
-rw-r--r--drivers/speex/speex_bind.cpp64
-rw-r--r--drivers/speex/speex_bind.h48
-rw-r--r--drivers/speex/speex_bits.h174
-rw-r--r--drivers/speex/speex_buffer.h68
-rw-r--r--drivers/speex/speex_callbacks.c144
-rw-r--r--drivers/speex/speex_callbacks.h134
-rw-r--r--drivers/speex/speex_config_types.h11
-rw-r--r--drivers/speex/speex_echo.h170
-rw-r--r--drivers/speex/speex_header.c200
-rw-r--r--drivers/speex/speex_header.h94
-rw-r--r--drivers/speex/speex_jitter.h197
-rw-r--r--drivers/speex/speex_preprocess.h219
-rw-r--r--drivers/speex/speex_resampler.h340
-rw-r--r--drivers/speex/speex_stereo.h91
-rw-r--r--drivers/speex/speex_types.h126
-rw-r--r--drivers/speex/stack_alloc.h115
-rw-r--r--drivers/speex/stereo.c296
-rw-r--r--drivers/speex/vbr.c275
-rw-r--r--drivers/speex/vbr.h70
-rw-r--r--drivers/speex/vorbis_psy.h97
-rw-r--r--drivers/speex/vq.c147
-rw-r--r--drivers/speex/vq.h54
-rw-r--r--drivers/speex/vq_arm4.h115
-rw-r--r--drivers/speex/vq_bfin.h107
-rw-r--r--drivers/speex/vq_sse.h120
-rw-r--r--drivers/speex/window.c102
-rw-r--r--drivers/squish/SCsub23
-rw-r--r--drivers/squish/alpha.cpp348
-rw-r--r--drivers/squish/alpha.h41
-rw-r--r--drivers/squish/clusterfit.cpp393
-rw-r--r--drivers/squish/clusterfit.h61
-rw-r--r--drivers/squish/colourblock.cpp214
-rw-r--r--drivers/squish/colourblock.h41
-rw-r--r--drivers/squish/colourfit.cpp50
-rw-r--r--drivers/squish/colourfit.h53
-rw-r--r--drivers/squish/colourset.cpp121
-rw-r--r--drivers/squish/colourset.h58
-rw-r--r--drivers/squish/config.h49
-rw-r--r--drivers/squish/maths.cpp227
-rw-r--r--drivers/squish/maths.h233
-rw-r--r--drivers/squish/rangefit.cpp202
-rw-r--r--drivers/squish/rangefit.h54
-rw-r--r--drivers/squish/simd.h40
-rw-r--r--drivers/squish/simd_float.h183
-rw-r--r--drivers/squish/simd_sse.h180
-rw-r--r--drivers/squish/simd_ve.h166
-rw-r--r--drivers/squish/singlecolourfit.cpp172
-rw-r--r--drivers/squish/singlecolourfit.h58
-rw-r--r--drivers/squish/singlecolourlookup.inl1040
-rw-r--r--drivers/squish/squish.cpp239
-rw-r--r--drivers/squish/squish.h247
-rw-r--r--drivers/theora/SCsub65
-rw-r--r--drivers/theora/theora.exp55
-rw-r--r--drivers/unix/SCsub2
-rw-r--r--drivers/vorbis/SCsub36
-rw-r--r--drivers/webp/SCsub115
-rw-r--r--drivers/webp/extras.h51
-rw-r--r--drivers/windows/SCsub2
-rw-r--r--drivers/zlib/SCsub24
-rw-r--r--modules/chibi/SCsub7
-rw-r--r--modules/chibi/config.py6
-rw-r--r--modules/chibi/cp_config.h (renamed from drivers/chibi/cp_config.h)0
-rw-r--r--modules/chibi/cp_envelope.cpp (renamed from drivers/chibi/cp_envelope.cpp)0
-rw-r--r--modules/chibi/cp_envelope.h (renamed from drivers/chibi/cp_envelope.h)0
-rw-r--r--modules/chibi/cp_file_access_wrapper.h (renamed from drivers/chibi/cp_file_access_wrapper.h)0
-rw-r--r--modules/chibi/cp_instrument.cpp (renamed from drivers/chibi/cp_instrument.cpp)0
-rw-r--r--modules/chibi/cp_instrument.h (renamed from drivers/chibi/cp_instrument.h)0
-rw-r--r--modules/chibi/cp_loader.h (renamed from drivers/chibi/cp_loader.h)0
-rw-r--r--modules/chibi/cp_loader_it.cpp (renamed from drivers/chibi/cp_loader_it.cpp)0
-rw-r--r--modules/chibi/cp_loader_it.h (renamed from drivers/chibi/cp_loader_it.h)0
-rw-r--r--modules/chibi/cp_loader_it_info.cpp (renamed from drivers/chibi/cp_loader_it_info.cpp)0
-rw-r--r--modules/chibi/cp_loader_it_instruments.cpp (renamed from drivers/chibi/cp_loader_it_instruments.cpp)0
-rw-r--r--modules/chibi/cp_loader_it_patterns.cpp (renamed from drivers/chibi/cp_loader_it_patterns.cpp)0
-rw-r--r--modules/chibi/cp_loader_it_samples.cpp (renamed from drivers/chibi/cp_loader_it_samples.cpp)0
-rw-r--r--modules/chibi/cp_loader_mod.cpp (renamed from drivers/chibi/cp_loader_mod.cpp)0
-rw-r--r--modules/chibi/cp_loader_mod.h (renamed from drivers/chibi/cp_loader_mod.h)0
-rw-r--r--modules/chibi/cp_loader_s3m.cpp (renamed from drivers/chibi/cp_loader_s3m.cpp)0
-rw-r--r--modules/chibi/cp_loader_s3m.h (renamed from drivers/chibi/cp_loader_s3m.h)0
-rw-r--r--modules/chibi/cp_loader_xm.cpp (renamed from drivers/chibi/cp_loader_xm.cpp)0
-rw-r--r--modules/chibi/cp_loader_xm.h (renamed from drivers/chibi/cp_loader_xm.h)0
-rw-r--r--modules/chibi/cp_mixer.h (renamed from drivers/chibi/cp_mixer.h)0
-rw-r--r--modules/chibi/cp_note.h (renamed from drivers/chibi/cp_note.h)0
-rw-r--r--modules/chibi/cp_order.h (renamed from drivers/chibi/cp_order.h)0
-rw-r--r--modules/chibi/cp_pattern.cpp (renamed from drivers/chibi/cp_pattern.cpp)0
-rw-r--r--modules/chibi/cp_pattern.h (renamed from drivers/chibi/cp_pattern.h)0
-rw-r--r--modules/chibi/cp_player_data.cpp (renamed from drivers/chibi/cp_player_data.cpp)0
-rw-r--r--modules/chibi/cp_player_data.h (renamed from drivers/chibi/cp_player_data.h)0
-rw-r--r--modules/chibi/cp_player_data_control.cpp (renamed from drivers/chibi/cp_player_data_control.cpp)0
-rw-r--r--modules/chibi/cp_player_data_effects.cpp (renamed from drivers/chibi/cp_player_data_effects.cpp)0
-rw-r--r--modules/chibi/cp_player_data_envelopes.cpp (renamed from drivers/chibi/cp_player_data_envelopes.cpp)0
-rw-r--r--modules/chibi/cp_player_data_events.cpp (renamed from drivers/chibi/cp_player_data_events.cpp)0
-rw-r--r--modules/chibi/cp_player_data_filter.cpp (renamed from drivers/chibi/cp_player_data_filter.cpp)0
-rw-r--r--modules/chibi/cp_player_data_nna.cpp (renamed from drivers/chibi/cp_player_data_nna.cpp)0
-rw-r--r--modules/chibi/cp_player_data_notes.cpp (renamed from drivers/chibi/cp_player_data_notes.cpp)0
-rw-r--r--modules/chibi/cp_player_data_utils.cpp (renamed from drivers/chibi/cp_player_data_utils.cpp)0
-rw-r--r--modules/chibi/cp_sample.cpp (renamed from drivers/chibi/cp_sample.cpp)0
-rw-r--r--modules/chibi/cp_sample.h (renamed from drivers/chibi/cp_sample.h)0
-rw-r--r--modules/chibi/cp_sample_defs.h (renamed from drivers/chibi/cp_sample_defs.h)0
-rw-r--r--modules/chibi/cp_sample_manager.cpp (renamed from drivers/chibi/cp_sample_manager.cpp)0
-rw-r--r--modules/chibi/cp_sample_manager.h (renamed from drivers/chibi/cp_sample_manager.h)0
-rw-r--r--modules/chibi/cp_song.cpp (renamed from drivers/chibi/cp_song.cpp)0
-rw-r--r--modules/chibi/cp_song.h (renamed from drivers/chibi/cp_song.h)0
-rw-r--r--modules/chibi/cp_tables.cpp (renamed from drivers/chibi/cp_tables.cpp)0
-rw-r--r--modules/chibi/cp_tables.h (renamed from drivers/chibi/cp_tables.h)0
-rw-r--r--modules/chibi/event_stream_chibi.cpp (renamed from drivers/chibi/event_stream_chibi.cpp)0
-rw-r--r--modules/chibi/event_stream_chibi.h (renamed from drivers/chibi/event_stream_chibi.h)0
-rw-r--r--modules/chibi/register_types.cpp41
-rw-r--r--modules/chibi/register_types.h30
-rw-r--r--modules/cscript/SCsub2
-rw-r--r--modules/dds/SCsub6
-rw-r--r--modules/dds/config.py6
-rw-r--r--modules/dds/register_types.cpp44
-rw-r--r--modules/dds/register_types.h30
-rw-r--r--modules/dds/texture_loader_dds.cpp (renamed from drivers/dds/texture_loader_dds.cpp)0
-rw-r--r--modules/dds/texture_loader_dds.h (renamed from drivers/dds/texture_loader_dds.h)0
-rw-r--r--modules/enet/SCsub28
-rw-r--r--modules/enet/config.py7
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp28
-rw-r--r--modules/enet/networked_multiplayer_enet.h28
-rw-r--r--modules/etc1/SCsub18
-rw-r--r--modules/etc1/config.py6
-rw-r--r--modules/etc1/image_etc.cpp (renamed from drivers/etc1/image_etc.cpp)0
-rw-r--r--modules/etc1/image_etc.h (renamed from drivers/etc1/image_etc.h)0
-rw-r--r--modules/etc1/register_types.cpp47
-rw-r--r--modules/etc1/register_types.h30
-rw-r--r--modules/etc1/texture_loader_pkm.cpp (renamed from drivers/etc1/texture_loader_pkm.cpp)0
-rw-r--r--modules/etc1/texture_loader_pkm.h (renamed from drivers/etc1/texture_loader_pkm.h)0
-rw-r--r--modules/freetype/SCsub88
-rw-r--r--modules/freetype/config.py6
-rw-r--r--modules/freetype/register_types.cpp33
-rw-r--r--modules/freetype/register_types.h30
-rw-r--r--modules/freetype/winrtdef.h (renamed from drivers/freetype/winrtdef.h)0
-rw-r--r--modules/gdscript/SCsub2
-rw-r--r--modules/gdscript/gd_functions.cpp19
-rw-r--r--modules/gdscript/gd_functions.h1
-rw-r--r--modules/gdscript/gd_parser.cpp8
-rw-r--r--modules/gridmap/SCsub4
-rw-r--r--modules/ik/SCsub4
-rw-r--r--modules/jpg/SCsub18
-rw-r--r--modules/jpg/config.py6
-rw-r--r--modules/jpg/image_loader_jpegd.cpp (renamed from drivers/jpegd/image_loader_jpegd.cpp)3
-rw-r--r--modules/jpg/image_loader_jpegd.h (renamed from drivers/jpegd/image_loader_jpegd.h)0
-rw-r--r--modules/jpg/register_types.cpp44
-rw-r--r--modules/jpg/register_types.h30
-rw-r--r--modules/mpc/SCsub26
-rw-r--r--modules/mpc/audio_stream_mpc.cpp (renamed from drivers/mpc/audio_stream_mpc.cpp)0
-rw-r--r--modules/mpc/audio_stream_mpc.h (renamed from drivers/mpc/audio_stream_mpc.h)9
-rw-r--r--modules/mpc/config.py6
-rw-r--r--modules/mpc/register_types.cpp45
-rw-r--r--modules/mpc/register_types.h30
-rw-r--r--modules/ogg/SCsub19
-rw-r--r--modules/ogg/config.py6
-rw-r--r--modules/ogg/register_types.cpp35
-rw-r--r--modules/ogg/register_types.h30
-rw-r--r--modules/openssl/SCsub685
-rw-r--r--modules/openssl/config.py6
-rw-r--r--modules/openssl/curl_hostcheck.c (renamed from drivers/openssl/curl_hostcheck.c)4
-rw-r--r--modules/openssl/curl_hostcheck.h (renamed from drivers/openssl/curl_hostcheck.h)4
-rw-r--r--modules/openssl/register_types.cpp (renamed from drivers/openssl/register_openssl.cpp)13
-rw-r--r--modules/openssl/register_types.h30
-rw-r--r--modules/openssl/stream_peer_openssl.cpp (renamed from drivers/openssl/stream_peer_openssl.cpp)3
-rw-r--r--modules/openssl/stream_peer_openssl.h (renamed from drivers/openssl/stream_peer_openssl.h)4
-rw-r--r--modules/opus/SCsub213
-rw-r--r--modules/opus/audio_stream_opus.cpp (renamed from drivers/opus/audio_stream_opus.cpp)0
-rw-r--r--modules/opus/audio_stream_opus.h (renamed from drivers/opus/audio_stream_opus.h)8
-rw-r--r--modules/opus/config.py6
-rw-r--r--modules/opus/register_types.cpp45
-rw-r--r--modules/opus/register_types.h30
-rw-r--r--modules/pbm/SCsub6
-rw-r--r--modules/pbm/bitmap_loader_pbm.cpp (renamed from drivers/pnm/bitmap_loader_pnm.cpp)4
-rw-r--r--modules/pbm/bitmap_loader_pbm.h (renamed from drivers/pnm/bitmap_loader_pnm.h)6
-rw-r--r--modules/pbm/config.py6
-rw-r--r--modules/pbm/register_types.cpp44
-rw-r--r--modules/pbm/register_types.h30
-rw-r--r--modules/pvr/SCsub22
-rw-r--r--modules/pvr/config.py6
-rw-r--r--modules/pvr/register_types.cpp44
-rw-r--r--modules/pvr/register_types.h30
-rw-r--r--modules/pvr/texture_loader_pvr.cpp (renamed from drivers/pvr/texture_loader_pvr.cpp)0
-rw-r--r--modules/pvr/texture_loader_pvr.h (renamed from drivers/pvr/texture_loader_pvr.h)0
-rw-r--r--modules/squish/SCsub27
-rw-r--r--modules/squish/config.py10
-rw-r--r--modules/squish/image_compress_squish.cpp (renamed from drivers/squish/image_compress_squish.cpp)5
-rw-r--r--modules/squish/image_compress_squish.h (renamed from drivers/squish/image_compress_squish.h)3
-rw-r--r--modules/squish/register_types.cpp (renamed from drivers/nedmalloc/memory_pool_static_nedmalloc.h)51
-rw-r--r--modules/squish/register_types.h (renamed from drivers/openssl/register_openssl.h)15
-rw-r--r--modules/theora/SCsub81
-rw-r--r--modules/theora/config.py6
-rw-r--r--modules/theora/register_types.cpp45
-rw-r--r--modules/theora/register_types.h30
-rw-r--r--modules/theora/video_stream_theora.cpp (renamed from drivers/theora/video_stream_theora.cpp)9
-rw-r--r--modules/theora/video_stream_theora.h (renamed from drivers/theora/video_stream_theora.h)17
-rw-r--r--modules/theora/yuv2rgb.h (renamed from drivers/theora/yuv2rgb.h)0
-rw-r--r--modules/visual_script/SCsub2
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp17
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h1
-rw-r--r--modules/vorbis/SCsub47
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp (renamed from drivers/vorbis/audio_stream_ogg_vorbis.cpp)0
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h (renamed from drivers/vorbis/audio_stream_ogg_vorbis.h)6
-rw-r--r--modules/vorbis/config.py6
-rw-r--r--modules/vorbis/register_types.cpp45
-rw-r--r--modules/vorbis/register_types.h30
-rw-r--r--modules/webp/SCsub119
-rw-r--r--modules/webp/config.py6
-rw-r--r--modules/webp/image_loader_webp.cpp (renamed from drivers/webp/image_loader_webp.cpp)7
-rw-r--r--modules/webp/image_loader_webp.h (renamed from drivers/webp/image_loader_webp.h)0
-rw-r--r--modules/webp/register_types.cpp44
-rw-r--r--modules/webp/register_types.h30
-rw-r--r--platform/android/detect.py28
-rw-r--r--platform/bb10/detect.py6
-rw-r--r--platform/haiku/detect.py2
-rw-r--r--platform/iphone/detect.py4
-rw-r--r--platform/javascript/detect.py23
-rw-r--r--platform/osx/detect.py9
-rw-r--r--platform/osx/platform_config.h2
-rw-r--r--platform/server/detect.py1
-rw-r--r--platform/windows/detect.py8
-rw-r--r--platform/windows/os_windows.cpp1
-rw-r--r--platform/windows/platform_config.h4
-rw-r--r--platform/winrt/detect.py1
-rw-r--r--platform/winrt/os_winrt.cpp1
-rw-r--r--platform/x11/detect.py49
-rw-r--r--platform/x11/platform_config.h4
-rw-r--r--scene/gui/base_button.cpp10
-rw-r--r--scene/gui/button_array.cpp60
-rw-r--r--scene/gui/button_array.h8
-rw-r--r--scene/gui/button_group.cpp4
-rw-r--r--scene/gui/dialogs.cpp35
-rw-r--r--scene/gui/graph_edit.cpp1
-rw-r--r--scene/gui/text_edit.cpp11
-rw-r--r--scene/gui/text_edit.h3
-rw-r--r--thirdparty/README.md218
-rw-r--r--thirdparty/enet/LICENSE7
-rw-r--r--thirdparty/enet/callbacks.c (renamed from modules/enet/callbacks.c)0
-rw-r--r--thirdparty/enet/compress.c (renamed from modules/enet/compress.c)0
-rw-r--r--thirdparty/enet/enet/callbacks.h (renamed from modules/enet/enet/callbacks.h)0
-rw-r--r--thirdparty/enet/enet/enet.h (renamed from modules/enet/enet/enet.h)0
-rw-r--r--thirdparty/enet/enet/list.h (renamed from modules/enet/enet/list.h)0
-rw-r--r--thirdparty/enet/enet/protocol.h (renamed from modules/enet/enet/protocol.h)0
-rw-r--r--thirdparty/enet/enet/time.h (renamed from modules/enet/enet/time.h)0
-rw-r--r--thirdparty/enet/enet/types.h (renamed from modules/enet/enet/types.h)0
-rw-r--r--thirdparty/enet/enet/unix.h (renamed from modules/enet/enet/unix.h)0
-rw-r--r--thirdparty/enet/enet/utility.h (renamed from modules/enet/enet/utility.h)0
-rw-r--r--thirdparty/enet/enet/win32.h (renamed from modules/enet/enet/win32.h)0
-rw-r--r--thirdparty/enet/host.c (renamed from modules/enet/host.c)0
-rw-r--r--thirdparty/enet/list.c (renamed from modules/enet/list.c)0
-rw-r--r--thirdparty/enet/packet.c (renamed from modules/enet/packet.c)0
-rw-r--r--thirdparty/enet/peer.c (renamed from modules/enet/peer.c)0
-rw-r--r--thirdparty/enet/protocol.c (renamed from modules/enet/protocol.c)0
-rw-r--r--thirdparty/enet/unix.c (renamed from modules/enet/unix.c)0
-rw-r--r--thirdparty/enet/win32.c (renamed from modules/enet/win32.c)0
-rw-r--r--thirdparty/freetype/FTL.TXT (renamed from drivers/freetype/FTL.TXT)0
-rw-r--r--thirdparty/freetype/LICENSE.TXT (renamed from drivers/freetype/LICENSE.TXT)0
-rw-r--r--thirdparty/freetype/include/freetype/config/ftconfig.h (renamed from drivers/freetype/include/freetype/config/ftconfig.h)0
-rw-r--r--thirdparty/freetype/include/freetype/config/ftheader.h (renamed from drivers/freetype/include/freetype/config/ftheader.h)0
-rw-r--r--thirdparty/freetype/include/freetype/config/ftmodule.h (renamed from drivers/freetype/include/freetype/config/ftmodule.h)0
-rw-r--r--thirdparty/freetype/include/freetype/config/ftoption.h (renamed from drivers/freetype/include/freetype/config/ftoption.h)0
-rw-r--r--thirdparty/freetype/include/freetype/config/ftstdlib.h (renamed from drivers/freetype/include/freetype/config/ftstdlib.h)0
-rw-r--r--thirdparty/freetype/include/freetype/freetype.h (renamed from drivers/freetype/include/freetype/freetype.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftadvanc.h (renamed from drivers/freetype/include/freetype/ftadvanc.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftautoh.h (renamed from drivers/freetype/include/freetype/ftautoh.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftbbox.h (renamed from drivers/freetype/include/freetype/ftbbox.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftbdf.h (renamed from drivers/freetype/include/freetype/ftbdf.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftbitmap.h (renamed from drivers/freetype/include/freetype/ftbitmap.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftbzip2.h (renamed from drivers/freetype/include/freetype/ftbzip2.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftcache.h (renamed from drivers/freetype/include/freetype/ftcache.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftcffdrv.h (renamed from drivers/freetype/include/freetype/ftcffdrv.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftchapters.h (renamed from drivers/freetype/include/freetype/ftchapters.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftcid.h (renamed from drivers/freetype/include/freetype/ftcid.h)0
-rw-r--r--thirdparty/freetype/include/freetype/fterrdef.h (renamed from drivers/freetype/include/freetype/fterrdef.h)0
-rw-r--r--thirdparty/freetype/include/freetype/fterrors.h (renamed from drivers/freetype/include/freetype/fterrors.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftfntfmt.h (renamed from drivers/freetype/include/freetype/ftfntfmt.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftgasp.h (renamed from drivers/freetype/include/freetype/ftgasp.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftglyph.h (renamed from drivers/freetype/include/freetype/ftglyph.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftgxval.h (renamed from drivers/freetype/include/freetype/ftgxval.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftgzip.h (renamed from drivers/freetype/include/freetype/ftgzip.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftimage.h (renamed from drivers/freetype/include/freetype/ftimage.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftincrem.h (renamed from drivers/freetype/include/freetype/ftincrem.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftlcdfil.h (renamed from drivers/freetype/include/freetype/ftlcdfil.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftlist.h (renamed from drivers/freetype/include/freetype/ftlist.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftlzw.h (renamed from drivers/freetype/include/freetype/ftlzw.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftmac.h (renamed from drivers/freetype/include/freetype/ftmac.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftmm.h (renamed from drivers/freetype/include/freetype/ftmm.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftmodapi.h (renamed from drivers/freetype/include/freetype/ftmodapi.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftmoderr.h (renamed from drivers/freetype/include/freetype/ftmoderr.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftotval.h (renamed from drivers/freetype/include/freetype/ftotval.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftoutln.h (renamed from drivers/freetype/include/freetype/ftoutln.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftpfr.h (renamed from drivers/freetype/include/freetype/ftpfr.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftrender.h (renamed from drivers/freetype/include/freetype/ftrender.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftsizes.h (renamed from drivers/freetype/include/freetype/ftsizes.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftsnames.h (renamed from drivers/freetype/include/freetype/ftsnames.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftstroke.h (renamed from drivers/freetype/include/freetype/ftstroke.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftsynth.h (renamed from drivers/freetype/include/freetype/ftsynth.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftsystem.h (renamed from drivers/freetype/include/freetype/ftsystem.h)0
-rw-r--r--thirdparty/freetype/include/freetype/fttrigon.h (renamed from drivers/freetype/include/freetype/fttrigon.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftttdrv.h (renamed from drivers/freetype/include/freetype/ftttdrv.h)0
-rw-r--r--thirdparty/freetype/include/freetype/fttypes.h (renamed from drivers/freetype/include/freetype/fttypes.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ftwinfnt.h (renamed from drivers/freetype/include/freetype/ftwinfnt.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/autohint.h (renamed from drivers/freetype/include/freetype/internal/autohint.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftcalc.h (renamed from drivers/freetype/include/freetype/internal/ftcalc.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftdebug.h (renamed from drivers/freetype/include/freetype/internal/ftdebug.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftdriver.h (renamed from drivers/freetype/include/freetype/internal/ftdriver.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftgloadr.h (renamed from drivers/freetype/include/freetype/internal/ftgloadr.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/fthash.h (renamed from drivers/freetype/include/freetype/internal/fthash.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftmemory.h (renamed from drivers/freetype/include/freetype/internal/ftmemory.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftobjs.h (renamed from drivers/freetype/include/freetype/internal/ftobjs.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftpic.h (renamed from drivers/freetype/include/freetype/internal/ftpic.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftrfork.h (renamed from drivers/freetype/include/freetype/internal/ftrfork.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftserv.h (renamed from drivers/freetype/include/freetype/internal/ftserv.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftstream.h (renamed from drivers/freetype/include/freetype/internal/ftstream.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/fttrace.h (renamed from drivers/freetype/include/freetype/internal/fttrace.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftvalid.h (renamed from drivers/freetype/include/freetype/internal/ftvalid.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/internal.h (renamed from drivers/freetype/include/freetype/internal/internal.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/psaux.h (renamed from drivers/freetype/include/freetype/internal/psaux.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/pshints.h (renamed from drivers/freetype/include/freetype/internal/pshints.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svbdf.h (renamed from drivers/freetype/include/freetype/internal/services/svbdf.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svcid.h (renamed from drivers/freetype/include/freetype/internal/services/svcid.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svfntfmt.h (renamed from drivers/freetype/include/freetype/internal/services/svfntfmt.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svgldict.h (renamed from drivers/freetype/include/freetype/internal/services/svgldict.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svgxval.h (renamed from drivers/freetype/include/freetype/internal/services/svgxval.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svkern.h (renamed from drivers/freetype/include/freetype/internal/services/svkern.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svmm.h (renamed from drivers/freetype/include/freetype/internal/services/svmm.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svotval.h (renamed from drivers/freetype/include/freetype/internal/services/svotval.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpfr.h (renamed from drivers/freetype/include/freetype/internal/services/svpfr.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpostnm.h (renamed from drivers/freetype/include/freetype/internal/services/svpostnm.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svprop.h (renamed from drivers/freetype/include/freetype/internal/services/svprop.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpscmap.h (renamed from drivers/freetype/include/freetype/internal/services/svpscmap.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpsinfo.h (renamed from drivers/freetype/include/freetype/internal/services/svpsinfo.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svsfnt.h (renamed from drivers/freetype/include/freetype/internal/services/svsfnt.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svttcmap.h (renamed from drivers/freetype/include/freetype/internal/services/svttcmap.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svtteng.h (renamed from drivers/freetype/include/freetype/internal/services/svtteng.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svttglyf.h (renamed from drivers/freetype/include/freetype/internal/services/svttglyf.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svwinfnt.h (renamed from drivers/freetype/include/freetype/internal/services/svwinfnt.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/sfnt.h (renamed from drivers/freetype/include/freetype/internal/sfnt.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/t1types.h (renamed from drivers/freetype/include/freetype/internal/t1types.h)0
-rw-r--r--thirdparty/freetype/include/freetype/internal/tttypes.h (renamed from drivers/freetype/include/freetype/internal/tttypes.h)0
-rw-r--r--thirdparty/freetype/include/freetype/t1tables.h (renamed from drivers/freetype/include/freetype/t1tables.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ttnameid.h (renamed from drivers/freetype/include/freetype/ttnameid.h)0
-rw-r--r--thirdparty/freetype/include/freetype/tttables.h (renamed from drivers/freetype/include/freetype/tttables.h)0
-rw-r--r--thirdparty/freetype/include/freetype/tttags.h (renamed from drivers/freetype/include/freetype/tttags.h)0
-rw-r--r--thirdparty/freetype/include/freetype/ttunpat.h (renamed from drivers/freetype/include/freetype/ttunpat.h)0
-rw-r--r--thirdparty/freetype/include/ft2build.h (renamed from drivers/freetype/include/ft2build.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afangles.c (renamed from drivers/freetype/src/autofit/afangles.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afangles.h (renamed from drivers/freetype/src/autofit/afangles.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afblue.c (renamed from drivers/freetype/src/autofit/afblue.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afblue.cin (renamed from drivers/freetype/src/autofit/afblue.cin)0
-rw-r--r--thirdparty/freetype/src/autofit/afblue.dat (renamed from drivers/freetype/src/autofit/afblue.dat)0
-rw-r--r--thirdparty/freetype/src/autofit/afblue.h (renamed from drivers/freetype/src/autofit/afblue.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afblue.hin (renamed from drivers/freetype/src/autofit/afblue.hin)0
-rw-r--r--thirdparty/freetype/src/autofit/afcjk.c (renamed from drivers/freetype/src/autofit/afcjk.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afcjk.h (renamed from drivers/freetype/src/autofit/afcjk.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afcover.h (renamed from drivers/freetype/src/autofit/afcover.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afdummy.c (renamed from drivers/freetype/src/autofit/afdummy.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afdummy.h (renamed from drivers/freetype/src/autofit/afdummy.h)0
-rw-r--r--thirdparty/freetype/src/autofit/aferrors.h (renamed from drivers/freetype/src/autofit/aferrors.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afglobal.c (renamed from drivers/freetype/src/autofit/afglobal.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afglobal.h (renamed from drivers/freetype/src/autofit/afglobal.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afhints.c (renamed from drivers/freetype/src/autofit/afhints.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afhints.h (renamed from drivers/freetype/src/autofit/afhints.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afindic.c (renamed from drivers/freetype/src/autofit/afindic.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afindic.h (renamed from drivers/freetype/src/autofit/afindic.h)0
-rw-r--r--thirdparty/freetype/src/autofit/aflatin.c (renamed from drivers/freetype/src/autofit/aflatin.c)0
-rw-r--r--thirdparty/freetype/src/autofit/aflatin.h (renamed from drivers/freetype/src/autofit/aflatin.h)0
-rw-r--r--thirdparty/freetype/src/autofit/aflatin2.c (renamed from drivers/freetype/src/autofit/aflatin2.c)0
-rw-r--r--thirdparty/freetype/src/autofit/aflatin2.h (renamed from drivers/freetype/src/autofit/aflatin2.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afloader.c (renamed from drivers/freetype/src/autofit/afloader.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afloader.h (renamed from drivers/freetype/src/autofit/afloader.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afmodule.c (renamed from drivers/freetype/src/autofit/afmodule.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afmodule.h (renamed from drivers/freetype/src/autofit/afmodule.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afpic.c (renamed from drivers/freetype/src/autofit/afpic.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afpic.h (renamed from drivers/freetype/src/autofit/afpic.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afranges.c (renamed from drivers/freetype/src/autofit/afranges.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afranges.h (renamed from drivers/freetype/src/autofit/afranges.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afscript.h (renamed from drivers/freetype/src/autofit/afscript.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afshaper.c (renamed from drivers/freetype/src/autofit/afshaper.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afshaper.h (renamed from drivers/freetype/src/autofit/afshaper.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afstyles.h (renamed from drivers/freetype/src/autofit/afstyles.h)0
-rw-r--r--thirdparty/freetype/src/autofit/aftypes.h (renamed from drivers/freetype/src/autofit/aftypes.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afwarp.c (renamed from drivers/freetype/src/autofit/afwarp.c)0
-rw-r--r--thirdparty/freetype/src/autofit/afwarp.h (renamed from drivers/freetype/src/autofit/afwarp.h)0
-rw-r--r--thirdparty/freetype/src/autofit/afwrtsys.h (renamed from drivers/freetype/src/autofit/afwrtsys.h)0
-rw-r--r--thirdparty/freetype/src/autofit/autofit.c (renamed from drivers/freetype/src/autofit/autofit.c)0
-rw-r--r--thirdparty/freetype/src/autofit/module.mk (renamed from drivers/freetype/src/autofit/module.mk)0
-rw-r--r--thirdparty/freetype/src/autofit/rules.mk (renamed from drivers/freetype/src/autofit/rules.mk)0
-rw-r--r--thirdparty/freetype/src/base/basepic.c (renamed from drivers/freetype/src/base/basepic.c)0
-rw-r--r--thirdparty/freetype/src/base/basepic.h (renamed from drivers/freetype/src/base/basepic.h)0
-rw-r--r--thirdparty/freetype/src/base/ftadvanc.c (renamed from drivers/freetype/src/base/ftadvanc.c)0
-rw-r--r--thirdparty/freetype/src/base/ftapi.c (renamed from drivers/freetype/src/base/ftapi.c)0
-rw-r--r--thirdparty/freetype/src/base/ftbase.c (renamed from drivers/freetype/src/base/ftbase.c)0
-rw-r--r--thirdparty/freetype/src/base/ftbase.h (renamed from drivers/freetype/src/base/ftbase.h)0
-rw-r--r--thirdparty/freetype/src/base/ftbbox.c (renamed from drivers/freetype/src/base/ftbbox.c)0
-rw-r--r--thirdparty/freetype/src/base/ftbdf.c (renamed from drivers/freetype/src/base/ftbdf.c)0
-rw-r--r--thirdparty/freetype/src/base/ftbitmap.c (renamed from drivers/freetype/src/base/ftbitmap.c)0
-rw-r--r--thirdparty/freetype/src/base/ftcalc.c (renamed from drivers/freetype/src/base/ftcalc.c)0
-rw-r--r--thirdparty/freetype/src/base/ftcid.c (renamed from drivers/freetype/src/base/ftcid.c)0
-rw-r--r--thirdparty/freetype/src/base/ftdbgmem.c (renamed from drivers/freetype/src/base/ftdbgmem.c)0
-rw-r--r--thirdparty/freetype/src/base/ftdebug.c (renamed from drivers/freetype/src/base/ftdebug.c)0
-rw-r--r--thirdparty/freetype/src/base/ftfntfmt.c (renamed from drivers/freetype/src/base/ftfntfmt.c)0
-rw-r--r--thirdparty/freetype/src/base/ftfstype.c (renamed from drivers/freetype/src/base/ftfstype.c)0
-rw-r--r--thirdparty/freetype/src/base/ftgasp.c (renamed from drivers/freetype/src/base/ftgasp.c)0
-rw-r--r--thirdparty/freetype/src/base/ftgloadr.c (renamed from drivers/freetype/src/base/ftgloadr.c)0
-rw-r--r--thirdparty/freetype/src/base/ftglyph.c (renamed from drivers/freetype/src/base/ftglyph.c)0
-rw-r--r--thirdparty/freetype/src/base/ftgxval.c (renamed from drivers/freetype/src/base/ftgxval.c)0
-rw-r--r--thirdparty/freetype/src/base/fthash.c (renamed from drivers/freetype/src/base/fthash.c)0
-rw-r--r--thirdparty/freetype/src/base/ftinit.c (renamed from drivers/freetype/src/base/ftinit.c)0
-rw-r--r--thirdparty/freetype/src/base/ftlcdfil.c (renamed from drivers/freetype/src/base/ftlcdfil.c)0
-rw-r--r--thirdparty/freetype/src/base/ftmac.c (renamed from drivers/freetype/src/base/ftmac.c)0
-rw-r--r--thirdparty/freetype/src/base/ftmm.c (renamed from drivers/freetype/src/base/ftmm.c)0
-rw-r--r--thirdparty/freetype/src/base/ftobjs.c (renamed from drivers/freetype/src/base/ftobjs.c)0
-rw-r--r--thirdparty/freetype/src/base/ftotval.c (renamed from drivers/freetype/src/base/ftotval.c)0
-rw-r--r--thirdparty/freetype/src/base/ftoutln.c (renamed from drivers/freetype/src/base/ftoutln.c)0
-rw-r--r--thirdparty/freetype/src/base/ftpatent.c (renamed from drivers/freetype/src/base/ftpatent.c)0
-rw-r--r--thirdparty/freetype/src/base/ftpfr.c (renamed from drivers/freetype/src/base/ftpfr.c)0
-rw-r--r--thirdparty/freetype/src/base/ftpic.c (renamed from drivers/freetype/src/base/ftpic.c)0
-rw-r--r--thirdparty/freetype/src/base/ftrfork.c (renamed from drivers/freetype/src/base/ftrfork.c)0
-rw-r--r--thirdparty/freetype/src/base/ftsnames.c (renamed from drivers/freetype/src/base/ftsnames.c)0
-rw-r--r--thirdparty/freetype/src/base/ftstream.c (renamed from drivers/freetype/src/base/ftstream.c)0
-rw-r--r--thirdparty/freetype/src/base/ftstroke.c (renamed from drivers/freetype/src/base/ftstroke.c)0
-rw-r--r--thirdparty/freetype/src/base/ftsynth.c (renamed from drivers/freetype/src/base/ftsynth.c)0
-rw-r--r--thirdparty/freetype/src/base/ftsystem.c (renamed from drivers/freetype/src/base/ftsystem.c)0
-rw-r--r--thirdparty/freetype/src/base/fttrigon.c (renamed from drivers/freetype/src/base/fttrigon.c)0
-rw-r--r--thirdparty/freetype/src/base/fttype1.c (renamed from drivers/freetype/src/base/fttype1.c)0
-rw-r--r--thirdparty/freetype/src/base/ftutil.c (renamed from drivers/freetype/src/base/ftutil.c)0
-rw-r--r--thirdparty/freetype/src/base/ftwinfnt.c (renamed from drivers/freetype/src/base/ftwinfnt.c)0
-rw-r--r--thirdparty/freetype/src/base/md5.c (renamed from drivers/freetype/src/base/md5.c)0
-rw-r--r--thirdparty/freetype/src/base/md5.h (renamed from drivers/freetype/src/base/md5.h)0
-rw-r--r--thirdparty/freetype/src/base/rules.mk (renamed from drivers/freetype/src/base/rules.mk)0
-rw-r--r--thirdparty/freetype/src/bdf/README (renamed from drivers/freetype/src/bdf/README)0
-rw-r--r--thirdparty/freetype/src/bdf/bdf.c (renamed from drivers/freetype/src/bdf/bdf.c)0
-rw-r--r--thirdparty/freetype/src/bdf/bdf.h (renamed from drivers/freetype/src/bdf/bdf.h)0
-rw-r--r--thirdparty/freetype/src/bdf/bdfdrivr.c (renamed from drivers/freetype/src/bdf/bdfdrivr.c)0
-rw-r--r--thirdparty/freetype/src/bdf/bdfdrivr.h (renamed from drivers/freetype/src/bdf/bdfdrivr.h)0
-rw-r--r--thirdparty/freetype/src/bdf/bdferror.h (renamed from drivers/freetype/src/bdf/bdferror.h)0
-rw-r--r--thirdparty/freetype/src/bdf/bdflib.c (renamed from drivers/freetype/src/bdf/bdflib.c)0
-rw-r--r--thirdparty/freetype/src/bdf/module.mk (renamed from drivers/freetype/src/bdf/module.mk)0
-rw-r--r--thirdparty/freetype/src/bdf/rules.mk (renamed from drivers/freetype/src/bdf/rules.mk)0
-rw-r--r--thirdparty/freetype/src/cache/ftcache.c (renamed from drivers/freetype/src/cache/ftcache.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftcbasic.c (renamed from drivers/freetype/src/cache/ftcbasic.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftccache.c (renamed from drivers/freetype/src/cache/ftccache.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftccache.h (renamed from drivers/freetype/src/cache/ftccache.h)0
-rw-r--r--thirdparty/freetype/src/cache/ftccback.h (renamed from drivers/freetype/src/cache/ftccback.h)0
-rw-r--r--thirdparty/freetype/src/cache/ftccmap.c (renamed from drivers/freetype/src/cache/ftccmap.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftcerror.h (renamed from drivers/freetype/src/cache/ftcerror.h)0
-rw-r--r--thirdparty/freetype/src/cache/ftcglyph.c (renamed from drivers/freetype/src/cache/ftcglyph.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftcglyph.h (renamed from drivers/freetype/src/cache/ftcglyph.h)0
-rw-r--r--thirdparty/freetype/src/cache/ftcimage.c (renamed from drivers/freetype/src/cache/ftcimage.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftcimage.h (renamed from drivers/freetype/src/cache/ftcimage.h)0
-rw-r--r--thirdparty/freetype/src/cache/ftcmanag.c (renamed from drivers/freetype/src/cache/ftcmanag.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftcmanag.h (renamed from drivers/freetype/src/cache/ftcmanag.h)0
-rw-r--r--thirdparty/freetype/src/cache/ftcmru.c (renamed from drivers/freetype/src/cache/ftcmru.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftcmru.h (renamed from drivers/freetype/src/cache/ftcmru.h)0
-rw-r--r--thirdparty/freetype/src/cache/ftcsbits.c (renamed from drivers/freetype/src/cache/ftcsbits.c)0
-rw-r--r--thirdparty/freetype/src/cache/ftcsbits.h (renamed from drivers/freetype/src/cache/ftcsbits.h)0
-rw-r--r--thirdparty/freetype/src/cache/rules.mk (renamed from drivers/freetype/src/cache/rules.mk)0
-rw-r--r--thirdparty/freetype/src/cff/cf2arrst.c (renamed from drivers/freetype/src/cff/cf2arrst.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2arrst.h (renamed from drivers/freetype/src/cff/cf2arrst.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2blues.c (renamed from drivers/freetype/src/cff/cf2blues.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2blues.h (renamed from drivers/freetype/src/cff/cf2blues.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2error.c (renamed from drivers/freetype/src/cff/cf2error.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2error.h (renamed from drivers/freetype/src/cff/cf2error.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2fixed.h (renamed from drivers/freetype/src/cff/cf2fixed.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2font.c (renamed from drivers/freetype/src/cff/cf2font.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2font.h (renamed from drivers/freetype/src/cff/cf2font.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2ft.c (renamed from drivers/freetype/src/cff/cf2ft.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2ft.h (renamed from drivers/freetype/src/cff/cf2ft.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2glue.h (renamed from drivers/freetype/src/cff/cf2glue.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2hints.c (renamed from drivers/freetype/src/cff/cf2hints.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2hints.h (renamed from drivers/freetype/src/cff/cf2hints.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2intrp.c (renamed from drivers/freetype/src/cff/cf2intrp.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2intrp.h (renamed from drivers/freetype/src/cff/cf2intrp.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2read.c (renamed from drivers/freetype/src/cff/cf2read.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2read.h (renamed from drivers/freetype/src/cff/cf2read.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2stack.c (renamed from drivers/freetype/src/cff/cf2stack.c)0
-rw-r--r--thirdparty/freetype/src/cff/cf2stack.h (renamed from drivers/freetype/src/cff/cf2stack.h)0
-rw-r--r--thirdparty/freetype/src/cff/cf2types.h (renamed from drivers/freetype/src/cff/cf2types.h)0
-rw-r--r--thirdparty/freetype/src/cff/cff.c (renamed from drivers/freetype/src/cff/cff.c)0
-rw-r--r--thirdparty/freetype/src/cff/cffcmap.c (renamed from drivers/freetype/src/cff/cffcmap.c)0
-rw-r--r--thirdparty/freetype/src/cff/cffcmap.h (renamed from drivers/freetype/src/cff/cffcmap.h)0
-rw-r--r--thirdparty/freetype/src/cff/cffdrivr.c (renamed from drivers/freetype/src/cff/cffdrivr.c)0
-rw-r--r--thirdparty/freetype/src/cff/cffdrivr.h (renamed from drivers/freetype/src/cff/cffdrivr.h)0
-rw-r--r--thirdparty/freetype/src/cff/cfferrs.h (renamed from drivers/freetype/src/cff/cfferrs.h)0
-rw-r--r--thirdparty/freetype/src/cff/cffgload.c (renamed from drivers/freetype/src/cff/cffgload.c)0
-rw-r--r--thirdparty/freetype/src/cff/cffgload.h (renamed from drivers/freetype/src/cff/cffgload.h)0
-rw-r--r--thirdparty/freetype/src/cff/cffload.c (renamed from drivers/freetype/src/cff/cffload.c)0
-rw-r--r--thirdparty/freetype/src/cff/cffload.h (renamed from drivers/freetype/src/cff/cffload.h)0
-rw-r--r--thirdparty/freetype/src/cff/cffobjs.c (renamed from drivers/freetype/src/cff/cffobjs.c)0
-rw-r--r--thirdparty/freetype/src/cff/cffobjs.h (renamed from drivers/freetype/src/cff/cffobjs.h)0
-rw-r--r--thirdparty/freetype/src/cff/cffparse.c (renamed from drivers/freetype/src/cff/cffparse.c)0
-rw-r--r--thirdparty/freetype/src/cff/cffparse.h (renamed from drivers/freetype/src/cff/cffparse.h)0
-rw-r--r--thirdparty/freetype/src/cff/cffpic.c (renamed from drivers/freetype/src/cff/cffpic.c)0
-rw-r--r--thirdparty/freetype/src/cff/cffpic.h (renamed from drivers/freetype/src/cff/cffpic.h)0
-rw-r--r--thirdparty/freetype/src/cff/cfftoken.h (renamed from drivers/freetype/src/cff/cfftoken.h)0
-rw-r--r--thirdparty/freetype/src/cff/cfftypes.h (renamed from drivers/freetype/src/cff/cfftypes.h)0
-rw-r--r--thirdparty/freetype/src/cff/module.mk (renamed from drivers/freetype/src/cff/module.mk)0
-rw-r--r--thirdparty/freetype/src/cff/rules.mk (renamed from drivers/freetype/src/cff/rules.mk)0
-rw-r--r--thirdparty/freetype/src/cid/ciderrs.h (renamed from drivers/freetype/src/cid/ciderrs.h)0
-rw-r--r--thirdparty/freetype/src/cid/cidgload.c (renamed from drivers/freetype/src/cid/cidgload.c)0
-rw-r--r--thirdparty/freetype/src/cid/cidgload.h (renamed from drivers/freetype/src/cid/cidgload.h)0
-rw-r--r--thirdparty/freetype/src/cid/cidload.c (renamed from drivers/freetype/src/cid/cidload.c)0
-rw-r--r--thirdparty/freetype/src/cid/cidload.h (renamed from drivers/freetype/src/cid/cidload.h)0
-rw-r--r--thirdparty/freetype/src/cid/cidobjs.c (renamed from drivers/freetype/src/cid/cidobjs.c)0
-rw-r--r--thirdparty/freetype/src/cid/cidobjs.h (renamed from drivers/freetype/src/cid/cidobjs.h)0
-rw-r--r--thirdparty/freetype/src/cid/cidparse.c (renamed from drivers/freetype/src/cid/cidparse.c)0
-rw-r--r--thirdparty/freetype/src/cid/cidparse.h (renamed from drivers/freetype/src/cid/cidparse.h)0
-rw-r--r--thirdparty/freetype/src/cid/cidriver.c (renamed from drivers/freetype/src/cid/cidriver.c)0
-rw-r--r--thirdparty/freetype/src/cid/cidriver.h (renamed from drivers/freetype/src/cid/cidriver.h)0
-rw-r--r--thirdparty/freetype/src/cid/cidtoken.h (renamed from drivers/freetype/src/cid/cidtoken.h)0
-rw-r--r--thirdparty/freetype/src/cid/module.mk (renamed from drivers/freetype/src/cid/module.mk)0
-rw-r--r--thirdparty/freetype/src/cid/rules.mk (renamed from drivers/freetype/src/cid/rules.mk)0
-rw-r--r--thirdparty/freetype/src/cid/type1cid.c (renamed from drivers/freetype/src/cid/type1cid.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/README (renamed from drivers/freetype/src/gxvalid/README)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvalid.c (renamed from drivers/freetype/src/gxvalid/gxvalid.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvalid.h (renamed from drivers/freetype/src/gxvalid/gxvalid.h)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvbsln.c (renamed from drivers/freetype/src/gxvalid/gxvbsln.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvcommn.c (renamed from drivers/freetype/src/gxvalid/gxvcommn.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvcommn.h (renamed from drivers/freetype/src/gxvalid/gxvcommn.h)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxverror.h (renamed from drivers/freetype/src/gxvalid/gxverror.h)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvfeat.c (renamed from drivers/freetype/src/gxvalid/gxvfeat.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvfeat.h (renamed from drivers/freetype/src/gxvalid/gxvfeat.h)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvfgen.c (renamed from drivers/freetype/src/gxvalid/gxvfgen.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvjust.c (renamed from drivers/freetype/src/gxvalid/gxvjust.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvkern.c (renamed from drivers/freetype/src/gxvalid/gxvkern.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvlcar.c (renamed from drivers/freetype/src/gxvalid/gxvlcar.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmod.c (renamed from drivers/freetype/src/gxvalid/gxvmod.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmod.h (renamed from drivers/freetype/src/gxvalid/gxvmod.h)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort.c (renamed from drivers/freetype/src/gxvalid/gxvmort.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort.h (renamed from drivers/freetype/src/gxvalid/gxvmort.h)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort0.c (renamed from drivers/freetype/src/gxvalid/gxvmort0.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort1.c (renamed from drivers/freetype/src/gxvalid/gxvmort1.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort2.c (renamed from drivers/freetype/src/gxvalid/gxvmort2.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort4.c (renamed from drivers/freetype/src/gxvalid/gxvmort4.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort5.c (renamed from drivers/freetype/src/gxvalid/gxvmort5.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx.c (renamed from drivers/freetype/src/gxvalid/gxvmorx.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx.h (renamed from drivers/freetype/src/gxvalid/gxvmorx.h)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx0.c (renamed from drivers/freetype/src/gxvalid/gxvmorx0.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx1.c (renamed from drivers/freetype/src/gxvalid/gxvmorx1.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx2.c (renamed from drivers/freetype/src/gxvalid/gxvmorx2.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx4.c (renamed from drivers/freetype/src/gxvalid/gxvmorx4.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx5.c (renamed from drivers/freetype/src/gxvalid/gxvmorx5.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvopbd.c (renamed from drivers/freetype/src/gxvalid/gxvopbd.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvprop.c (renamed from drivers/freetype/src/gxvalid/gxvprop.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvtrak.c (renamed from drivers/freetype/src/gxvalid/gxvtrak.c)0
-rw-r--r--thirdparty/freetype/src/gxvalid/module.mk (renamed from drivers/freetype/src/gxvalid/module.mk)0
-rw-r--r--thirdparty/freetype/src/gxvalid/rules.mk (renamed from drivers/freetype/src/gxvalid/rules.mk)0
-rw-r--r--thirdparty/freetype/src/otvalid/module.mk (renamed from drivers/freetype/src/otvalid/module.mk)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvalid.c (renamed from drivers/freetype/src/otvalid/otvalid.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvalid.h (renamed from drivers/freetype/src/otvalid/otvalid.h)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvbase.c (renamed from drivers/freetype/src/otvalid/otvbase.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvcommn.c (renamed from drivers/freetype/src/otvalid/otvcommn.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvcommn.h (renamed from drivers/freetype/src/otvalid/otvcommn.h)0
-rw-r--r--thirdparty/freetype/src/otvalid/otverror.h (renamed from drivers/freetype/src/otvalid/otverror.h)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvgdef.c (renamed from drivers/freetype/src/otvalid/otvgdef.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvgpos.c (renamed from drivers/freetype/src/otvalid/otvgpos.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvgpos.h (renamed from drivers/freetype/src/otvalid/otvgpos.h)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvgsub.c (renamed from drivers/freetype/src/otvalid/otvgsub.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvjstf.c (renamed from drivers/freetype/src/otvalid/otvjstf.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvmath.c (renamed from drivers/freetype/src/otvalid/otvmath.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvmod.c (renamed from drivers/freetype/src/otvalid/otvmod.c)0
-rw-r--r--thirdparty/freetype/src/otvalid/otvmod.h (renamed from drivers/freetype/src/otvalid/otvmod.h)0
-rw-r--r--thirdparty/freetype/src/otvalid/rules.mk (renamed from drivers/freetype/src/otvalid/rules.mk)0
-rw-r--r--thirdparty/freetype/src/pcf/README (renamed from drivers/freetype/src/pcf/README)0
-rw-r--r--thirdparty/freetype/src/pcf/module.mk (renamed from drivers/freetype/src/pcf/module.mk)0
-rw-r--r--thirdparty/freetype/src/pcf/pcf.c (renamed from drivers/freetype/src/pcf/pcf.c)0
-rw-r--r--thirdparty/freetype/src/pcf/pcf.h (renamed from drivers/freetype/src/pcf/pcf.h)0
-rw-r--r--thirdparty/freetype/src/pcf/pcfdrivr.c (renamed from drivers/freetype/src/pcf/pcfdrivr.c)0
-rw-r--r--thirdparty/freetype/src/pcf/pcfdrivr.h (renamed from drivers/freetype/src/pcf/pcfdrivr.h)0
-rw-r--r--thirdparty/freetype/src/pcf/pcferror.h (renamed from drivers/freetype/src/pcf/pcferror.h)0
-rw-r--r--thirdparty/freetype/src/pcf/pcfread.c (renamed from drivers/freetype/src/pcf/pcfread.c)0
-rw-r--r--thirdparty/freetype/src/pcf/pcfread.h (renamed from drivers/freetype/src/pcf/pcfread.h)0
-rw-r--r--thirdparty/freetype/src/pcf/pcfutil.c (renamed from drivers/freetype/src/pcf/pcfutil.c)0
-rw-r--r--thirdparty/freetype/src/pcf/pcfutil.h (renamed from drivers/freetype/src/pcf/pcfutil.h)0
-rw-r--r--thirdparty/freetype/src/pcf/rules.mk (renamed from drivers/freetype/src/pcf/rules.mk)0
-rw-r--r--thirdparty/freetype/src/pfr/module.mk (renamed from drivers/freetype/src/pfr/module.mk)0
-rw-r--r--thirdparty/freetype/src/pfr/pfr.c (renamed from drivers/freetype/src/pfr/pfr.c)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrcmap.c (renamed from drivers/freetype/src/pfr/pfrcmap.c)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrcmap.h (renamed from drivers/freetype/src/pfr/pfrcmap.h)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrdrivr.c (renamed from drivers/freetype/src/pfr/pfrdrivr.c)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrdrivr.h (renamed from drivers/freetype/src/pfr/pfrdrivr.h)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrerror.h (renamed from drivers/freetype/src/pfr/pfrerror.h)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrgload.c (renamed from drivers/freetype/src/pfr/pfrgload.c)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrgload.h (renamed from drivers/freetype/src/pfr/pfrgload.h)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrload.c (renamed from drivers/freetype/src/pfr/pfrload.c)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrload.h (renamed from drivers/freetype/src/pfr/pfrload.h)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrobjs.c (renamed from drivers/freetype/src/pfr/pfrobjs.c)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrobjs.h (renamed from drivers/freetype/src/pfr/pfrobjs.h)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrsbit.c (renamed from drivers/freetype/src/pfr/pfrsbit.c)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrsbit.h (renamed from drivers/freetype/src/pfr/pfrsbit.h)0
-rw-r--r--thirdparty/freetype/src/pfr/pfrtypes.h (renamed from drivers/freetype/src/pfr/pfrtypes.h)0
-rw-r--r--thirdparty/freetype/src/pfr/rules.mk (renamed from drivers/freetype/src/pfr/rules.mk)0
-rw-r--r--thirdparty/freetype/src/psaux/afmparse.c (renamed from drivers/freetype/src/psaux/afmparse.c)0
-rw-r--r--thirdparty/freetype/src/psaux/afmparse.h (renamed from drivers/freetype/src/psaux/afmparse.h)0
-rw-r--r--thirdparty/freetype/src/psaux/module.mk (renamed from drivers/freetype/src/psaux/module.mk)0
-rw-r--r--thirdparty/freetype/src/psaux/psaux.c (renamed from drivers/freetype/src/psaux/psaux.c)0
-rw-r--r--thirdparty/freetype/src/psaux/psauxerr.h (renamed from drivers/freetype/src/psaux/psauxerr.h)0
-rw-r--r--thirdparty/freetype/src/psaux/psauxmod.c (renamed from drivers/freetype/src/psaux/psauxmod.c)0
-rw-r--r--thirdparty/freetype/src/psaux/psauxmod.h (renamed from drivers/freetype/src/psaux/psauxmod.h)0
-rw-r--r--thirdparty/freetype/src/psaux/psconv.c (renamed from drivers/freetype/src/psaux/psconv.c)0
-rw-r--r--thirdparty/freetype/src/psaux/psconv.h (renamed from drivers/freetype/src/psaux/psconv.h)0
-rw-r--r--thirdparty/freetype/src/psaux/psobjs.c (renamed from drivers/freetype/src/psaux/psobjs.c)0
-rw-r--r--thirdparty/freetype/src/psaux/psobjs.h (renamed from drivers/freetype/src/psaux/psobjs.h)0
-rw-r--r--thirdparty/freetype/src/psaux/rules.mk (renamed from drivers/freetype/src/psaux/rules.mk)0
-rw-r--r--thirdparty/freetype/src/psaux/t1cmap.c (renamed from drivers/freetype/src/psaux/t1cmap.c)0
-rw-r--r--thirdparty/freetype/src/psaux/t1cmap.h (renamed from drivers/freetype/src/psaux/t1cmap.h)0
-rw-r--r--thirdparty/freetype/src/psaux/t1decode.c (renamed from drivers/freetype/src/psaux/t1decode.c)0
-rw-r--r--thirdparty/freetype/src/psaux/t1decode.h (renamed from drivers/freetype/src/psaux/t1decode.h)0
-rw-r--r--thirdparty/freetype/src/pshinter/module.mk (renamed from drivers/freetype/src/pshinter/module.mk)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshalgo.c (renamed from drivers/freetype/src/pshinter/pshalgo.c)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshalgo.h (renamed from drivers/freetype/src/pshinter/pshalgo.h)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshglob.c (renamed from drivers/freetype/src/pshinter/pshglob.c)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshglob.h (renamed from drivers/freetype/src/pshinter/pshglob.h)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshinter.c (renamed from drivers/freetype/src/pshinter/pshinter.c)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshmod.c (renamed from drivers/freetype/src/pshinter/pshmod.c)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshmod.h (renamed from drivers/freetype/src/pshinter/pshmod.h)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshnterr.h (renamed from drivers/freetype/src/pshinter/pshnterr.h)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshpic.c (renamed from drivers/freetype/src/pshinter/pshpic.c)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshpic.h (renamed from drivers/freetype/src/pshinter/pshpic.h)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshrec.c (renamed from drivers/freetype/src/pshinter/pshrec.c)0
-rw-r--r--thirdparty/freetype/src/pshinter/pshrec.h (renamed from drivers/freetype/src/pshinter/pshrec.h)0
-rw-r--r--thirdparty/freetype/src/pshinter/rules.mk (renamed from drivers/freetype/src/pshinter/rules.mk)0
-rw-r--r--thirdparty/freetype/src/psnames/module.mk (renamed from drivers/freetype/src/psnames/module.mk)0
-rw-r--r--thirdparty/freetype/src/psnames/psmodule.c (renamed from drivers/freetype/src/psnames/psmodule.c)0
-rw-r--r--thirdparty/freetype/src/psnames/psmodule.h (renamed from drivers/freetype/src/psnames/psmodule.h)0
-rw-r--r--thirdparty/freetype/src/psnames/psnamerr.h (renamed from drivers/freetype/src/psnames/psnamerr.h)0
-rw-r--r--thirdparty/freetype/src/psnames/psnames.c (renamed from drivers/freetype/src/psnames/psnames.c)0
-rw-r--r--thirdparty/freetype/src/psnames/pspic.c (renamed from drivers/freetype/src/psnames/pspic.c)0
-rw-r--r--thirdparty/freetype/src/psnames/pspic.h (renamed from drivers/freetype/src/psnames/pspic.h)0
-rw-r--r--thirdparty/freetype/src/psnames/pstables.h (renamed from drivers/freetype/src/psnames/pstables.h)0
-rw-r--r--thirdparty/freetype/src/psnames/rules.mk (renamed from drivers/freetype/src/psnames/rules.mk)0
-rw-r--r--thirdparty/freetype/src/raster/ftmisc.h (renamed from drivers/freetype/src/raster/ftmisc.h)0
-rw-r--r--thirdparty/freetype/src/raster/ftraster.c (renamed from drivers/freetype/src/raster/ftraster.c)0
-rw-r--r--thirdparty/freetype/src/raster/ftraster.h (renamed from drivers/freetype/src/raster/ftraster.h)0
-rw-r--r--thirdparty/freetype/src/raster/ftrend1.c (renamed from drivers/freetype/src/raster/ftrend1.c)0
-rw-r--r--thirdparty/freetype/src/raster/ftrend1.h (renamed from drivers/freetype/src/raster/ftrend1.h)0
-rw-r--r--thirdparty/freetype/src/raster/module.mk (renamed from drivers/freetype/src/raster/module.mk)0
-rw-r--r--thirdparty/freetype/src/raster/raster.c (renamed from drivers/freetype/src/raster/raster.c)0
-rw-r--r--thirdparty/freetype/src/raster/rasterrs.h (renamed from drivers/freetype/src/raster/rasterrs.h)0
-rw-r--r--thirdparty/freetype/src/raster/rastpic.c (renamed from drivers/freetype/src/raster/rastpic.c)0
-rw-r--r--thirdparty/freetype/src/raster/rastpic.h (renamed from drivers/freetype/src/raster/rastpic.h)0
-rw-r--r--thirdparty/freetype/src/raster/rules.mk (renamed from drivers/freetype/src/raster/rules.mk)0
-rw-r--r--thirdparty/freetype/src/sfnt/module.mk (renamed from drivers/freetype/src/sfnt/module.mk)0
-rw-r--r--thirdparty/freetype/src/sfnt/pngshim.c (renamed from drivers/freetype/src/sfnt/pngshim.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/pngshim.h (renamed from drivers/freetype/src/sfnt/pngshim.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/rules.mk (renamed from drivers/freetype/src/sfnt/rules.mk)0
-rw-r--r--thirdparty/freetype/src/sfnt/sfdriver.c (renamed from drivers/freetype/src/sfnt/sfdriver.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/sfdriver.h (renamed from drivers/freetype/src/sfnt/sfdriver.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/sferrors.h (renamed from drivers/freetype/src/sfnt/sferrors.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/sfnt.c (renamed from drivers/freetype/src/sfnt/sfnt.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/sfntpic.c (renamed from drivers/freetype/src/sfnt/sfntpic.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/sfntpic.h (renamed from drivers/freetype/src/sfnt/sfntpic.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/sfobjs.c (renamed from drivers/freetype/src/sfnt/sfobjs.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/sfobjs.h (renamed from drivers/freetype/src/sfnt/sfobjs.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttbdf.c (renamed from drivers/freetype/src/sfnt/ttbdf.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttbdf.h (renamed from drivers/freetype/src/sfnt/ttbdf.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmap.c (renamed from drivers/freetype/src/sfnt/ttcmap.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmap.h (renamed from drivers/freetype/src/sfnt/ttcmap.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmapc.h (renamed from drivers/freetype/src/sfnt/ttcmapc.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttkern.c (renamed from drivers/freetype/src/sfnt/ttkern.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttkern.h (renamed from drivers/freetype/src/sfnt/ttkern.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttload.c (renamed from drivers/freetype/src/sfnt/ttload.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttload.h (renamed from drivers/freetype/src/sfnt/ttload.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttmtx.c (renamed from drivers/freetype/src/sfnt/ttmtx.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttmtx.h (renamed from drivers/freetype/src/sfnt/ttmtx.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttpost.c (renamed from drivers/freetype/src/sfnt/ttpost.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttpost.h (renamed from drivers/freetype/src/sfnt/ttpost.h)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttsbit.c (renamed from drivers/freetype/src/sfnt/ttsbit.c)0
-rw-r--r--thirdparty/freetype/src/sfnt/ttsbit.h (renamed from drivers/freetype/src/sfnt/ttsbit.h)0
-rw-r--r--thirdparty/freetype/src/smooth/ftgrays.c (renamed from drivers/freetype/src/smooth/ftgrays.c)0
-rw-r--r--thirdparty/freetype/src/smooth/ftgrays.h (renamed from drivers/freetype/src/smooth/ftgrays.h)0
-rw-r--r--thirdparty/freetype/src/smooth/ftsmerrs.h (renamed from drivers/freetype/src/smooth/ftsmerrs.h)0
-rw-r--r--thirdparty/freetype/src/smooth/ftsmooth.c (renamed from drivers/freetype/src/smooth/ftsmooth.c)0
-rw-r--r--thirdparty/freetype/src/smooth/ftsmooth.h (renamed from drivers/freetype/src/smooth/ftsmooth.h)0
-rw-r--r--thirdparty/freetype/src/smooth/ftspic.c (renamed from drivers/freetype/src/smooth/ftspic.c)0
-rw-r--r--thirdparty/freetype/src/smooth/ftspic.h (renamed from drivers/freetype/src/smooth/ftspic.h)0
-rw-r--r--thirdparty/freetype/src/smooth/module.mk (renamed from drivers/freetype/src/smooth/module.mk)0
-rw-r--r--thirdparty/freetype/src/smooth/rules.mk (renamed from drivers/freetype/src/smooth/rules.mk)0
-rw-r--r--thirdparty/freetype/src/smooth/smooth.c (renamed from drivers/freetype/src/smooth/smooth.c)0
-rw-r--r--thirdparty/freetype/src/truetype/module.mk (renamed from drivers/freetype/src/truetype/module.mk)0
-rw-r--r--thirdparty/freetype/src/truetype/rules.mk (renamed from drivers/freetype/src/truetype/rules.mk)0
-rw-r--r--thirdparty/freetype/src/truetype/truetype.c (renamed from drivers/freetype/src/truetype/truetype.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttdriver.c (renamed from drivers/freetype/src/truetype/ttdriver.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttdriver.h (renamed from drivers/freetype/src/truetype/ttdriver.h)0
-rw-r--r--thirdparty/freetype/src/truetype/tterrors.h (renamed from drivers/freetype/src/truetype/tterrors.h)0
-rw-r--r--thirdparty/freetype/src/truetype/ttgload.c (renamed from drivers/freetype/src/truetype/ttgload.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttgload.h (renamed from drivers/freetype/src/truetype/ttgload.h)0
-rw-r--r--thirdparty/freetype/src/truetype/ttgxvar.c (renamed from drivers/freetype/src/truetype/ttgxvar.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttgxvar.h (renamed from drivers/freetype/src/truetype/ttgxvar.h)0
-rw-r--r--thirdparty/freetype/src/truetype/ttinterp.c (renamed from drivers/freetype/src/truetype/ttinterp.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttinterp.h (renamed from drivers/freetype/src/truetype/ttinterp.h)0
-rw-r--r--thirdparty/freetype/src/truetype/ttobjs.c (renamed from drivers/freetype/src/truetype/ttobjs.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttobjs.h (renamed from drivers/freetype/src/truetype/ttobjs.h)0
-rw-r--r--thirdparty/freetype/src/truetype/ttpic.c (renamed from drivers/freetype/src/truetype/ttpic.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttpic.h (renamed from drivers/freetype/src/truetype/ttpic.h)0
-rw-r--r--thirdparty/freetype/src/truetype/ttpload.c (renamed from drivers/freetype/src/truetype/ttpload.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttpload.h (renamed from drivers/freetype/src/truetype/ttpload.h)0
-rw-r--r--thirdparty/freetype/src/truetype/ttsubpix.c (renamed from drivers/freetype/src/truetype/ttsubpix.c)0
-rw-r--r--thirdparty/freetype/src/truetype/ttsubpix.h (renamed from drivers/freetype/src/truetype/ttsubpix.h)0
-rw-r--r--thirdparty/freetype/src/type1/module.mk (renamed from drivers/freetype/src/type1/module.mk)0
-rw-r--r--thirdparty/freetype/src/type1/rules.mk (renamed from drivers/freetype/src/type1/rules.mk)0
-rw-r--r--thirdparty/freetype/src/type1/t1afm.c (renamed from drivers/freetype/src/type1/t1afm.c)0
-rw-r--r--thirdparty/freetype/src/type1/t1afm.h (renamed from drivers/freetype/src/type1/t1afm.h)0
-rw-r--r--thirdparty/freetype/src/type1/t1driver.c (renamed from drivers/freetype/src/type1/t1driver.c)0
-rw-r--r--thirdparty/freetype/src/type1/t1driver.h (renamed from drivers/freetype/src/type1/t1driver.h)0
-rw-r--r--thirdparty/freetype/src/type1/t1errors.h (renamed from drivers/freetype/src/type1/t1errors.h)0
-rw-r--r--thirdparty/freetype/src/type1/t1gload.c (renamed from drivers/freetype/src/type1/t1gload.c)0
-rw-r--r--thirdparty/freetype/src/type1/t1gload.h (renamed from drivers/freetype/src/type1/t1gload.h)0
-rw-r--r--thirdparty/freetype/src/type1/t1load.c (renamed from drivers/freetype/src/type1/t1load.c)0
-rw-r--r--thirdparty/freetype/src/type1/t1load.h (renamed from drivers/freetype/src/type1/t1load.h)0
-rw-r--r--thirdparty/freetype/src/type1/t1objs.c (renamed from drivers/freetype/src/type1/t1objs.c)0
-rw-r--r--thirdparty/freetype/src/type1/t1objs.h (renamed from drivers/freetype/src/type1/t1objs.h)0
-rw-r--r--thirdparty/freetype/src/type1/t1parse.c (renamed from drivers/freetype/src/type1/t1parse.c)0
-rw-r--r--thirdparty/freetype/src/type1/t1parse.h (renamed from drivers/freetype/src/type1/t1parse.h)0
-rw-r--r--thirdparty/freetype/src/type1/t1tokens.h (renamed from drivers/freetype/src/type1/t1tokens.h)0
-rw-r--r--thirdparty/freetype/src/type1/type1.c (renamed from drivers/freetype/src/type1/type1.c)0
-rw-r--r--thirdparty/freetype/src/type42/module.mk (renamed from drivers/freetype/src/type42/module.mk)0
-rw-r--r--thirdparty/freetype/src/type42/rules.mk (renamed from drivers/freetype/src/type42/rules.mk)0
-rw-r--r--thirdparty/freetype/src/type42/t42drivr.c (renamed from drivers/freetype/src/type42/t42drivr.c)0
-rw-r--r--thirdparty/freetype/src/type42/t42drivr.h (renamed from drivers/freetype/src/type42/t42drivr.h)0
-rw-r--r--thirdparty/freetype/src/type42/t42error.h (renamed from drivers/freetype/src/type42/t42error.h)0
-rw-r--r--thirdparty/freetype/src/type42/t42objs.c (renamed from drivers/freetype/src/type42/t42objs.c)0
-rw-r--r--thirdparty/freetype/src/type42/t42objs.h (renamed from drivers/freetype/src/type42/t42objs.h)0
-rw-r--r--thirdparty/freetype/src/type42/t42parse.c (renamed from drivers/freetype/src/type42/t42parse.c)0
-rw-r--r--thirdparty/freetype/src/type42/t42parse.h (renamed from drivers/freetype/src/type42/t42parse.h)0
-rw-r--r--thirdparty/freetype/src/type42/t42types.h (renamed from drivers/freetype/src/type42/t42types.h)0
-rw-r--r--thirdparty/freetype/src/type42/type42.c (renamed from drivers/freetype/src/type42/type42.c)0
-rw-r--r--thirdparty/freetype/src/winfonts/fnterrs.h (renamed from drivers/freetype/src/winfonts/fnterrs.h)0
-rw-r--r--thirdparty/freetype/src/winfonts/module.mk (renamed from drivers/freetype/src/winfonts/module.mk)0
-rw-r--r--thirdparty/freetype/src/winfonts/rules.mk (renamed from drivers/freetype/src/winfonts/rules.mk)0
-rw-r--r--thirdparty/freetype/src/winfonts/winfnt.c (renamed from drivers/freetype/src/winfonts/winfnt.c)0
-rw-r--r--thirdparty/freetype/src/winfonts/winfnt.h (renamed from drivers/freetype/src/winfonts/winfnt.h)0
-rw-r--r--thirdparty/glew/GL/glew.h (renamed from drivers/gl_context/GL/glew.h)0
-rw-r--r--thirdparty/glew/GL/glxew.h (renamed from drivers/gl_context/GL/glxew.h)0
-rw-r--r--thirdparty/glew/GL/wglew.h (renamed from drivers/gl_context/GL/wglew.h)0
-rw-r--r--thirdparty/glew/LICENSE.txt73
-rw-r--r--thirdparty/glew/glew.c (renamed from drivers/gl_context/glew.c)0
-rw-r--r--thirdparty/jpeg-compressor/jpgd.cpp (renamed from drivers/jpegd/jpgd.cpp)0
-rw-r--r--thirdparty/jpeg-compressor/jpgd.h (renamed from drivers/jpegd/jpgd.h)0
-rw-r--r--thirdparty/libmpcdec/COPYING31
-rw-r--r--thirdparty/libmpcdec/decoder.h (renamed from drivers/mpc/decoder.h)0
-rw-r--r--thirdparty/libmpcdec/huffman.c (renamed from drivers/mpc/huffman.c)0
-rw-r--r--thirdparty/libmpcdec/huffman.h (renamed from drivers/mpc/huffman.h)0
-rw-r--r--thirdparty/libmpcdec/internal.h (renamed from drivers/mpc/internal.h)0
-rw-r--r--thirdparty/libmpcdec/mpc/datatypes.h (renamed from drivers/mpc/datatypes.h)0
-rw-r--r--thirdparty/libmpcdec/mpc/minimax.h (renamed from drivers/mpc/minimax.h)0
-rw-r--r--thirdparty/libmpcdec/mpc/mpc_types.h (renamed from drivers/mpc/mpc_types.h)0
-rw-r--r--thirdparty/libmpcdec/mpc/mpcdec.h (renamed from drivers/mpc/mpcdec.h)0
-rw-r--r--thirdparty/libmpcdec/mpc/mpcmath.h (renamed from drivers/mpc/mpcmath.h)0
-rw-r--r--thirdparty/libmpcdec/mpc/reader.h (renamed from drivers/mpc/reader.h)0
-rw-r--r--thirdparty/libmpcdec/mpc/streaminfo.h (renamed from drivers/mpc/streaminfo.h)0
-rw-r--r--thirdparty/libmpcdec/mpc_bits_reader.c (renamed from drivers/mpc/mpc_bits_reader.c)0
-rw-r--r--thirdparty/libmpcdec/mpc_bits_reader.h (renamed from drivers/mpc/mpc_bits_reader.h)0
-rw-r--r--thirdparty/libmpcdec/mpc_decoder.c (renamed from drivers/mpc/mpc_decoder.c)0
-rw-r--r--thirdparty/libmpcdec/mpc_demux.c (renamed from drivers/mpc/mpc_demux.c)0
-rw-r--r--thirdparty/libmpcdec/mpc_reader.c (renamed from drivers/mpc/mpc_reader.c)0
-rw-r--r--thirdparty/libmpcdec/mpcdec_math.h (renamed from drivers/mpc/mpcdec_math.h)0
-rw-r--r--thirdparty/libmpcdec/requant.c (renamed from drivers/mpc/requant.c)0
-rw-r--r--thirdparty/libmpcdec/requant.h (renamed from drivers/mpc/requant.h)0
-rw-r--r--thirdparty/libmpcdec/streaminfo.c (renamed from drivers/mpc/streaminfo.c)0
-rw-r--r--thirdparty/libmpcdec/synth_filter.c (renamed from drivers/mpc/synth_filter.c)0
-rw-r--r--thirdparty/libogg/COPYING (renamed from drivers/ogg/COPYING)0
-rw-r--r--thirdparty/libogg/bitwise.c (renamed from drivers/ogg/bitwise.c)0
-rw-r--r--thirdparty/libogg/framing.c (renamed from drivers/ogg/framing.c)0
-rw-r--r--thirdparty/libogg/ogg/config_types.h (renamed from drivers/ogg/config_types.h)0
-rw-r--r--thirdparty/libogg/ogg/ogg.h (renamed from drivers/ogg/ogg.h)0
-rw-r--r--thirdparty/libogg/ogg/os_types.h (renamed from drivers/ogg/os_types.h)0
-rw-r--r--thirdparty/libpng/LICENSE130
-rw-r--r--thirdparty/libpng/arm/arm_init.c (renamed from drivers/png/arm/arm_init.c)0
-rw-r--r--thirdparty/libpng/arm/filter_neon.S (renamed from drivers/png/arm/filter_neon.S)0
-rw-r--r--thirdparty/libpng/arm/filter_neon_intrinsics.c (renamed from drivers/png/arm/filter_neon_intrinsics.c)0
-rw-r--r--thirdparty/libpng/png.c (renamed from drivers/png/png.c)0
-rw-r--r--thirdparty/libpng/png.h (renamed from drivers/png/png.h)0
-rw-r--r--thirdparty/libpng/pngconf.h (renamed from drivers/png/pngconf.h)0
-rw-r--r--thirdparty/libpng/pngdebug.h (renamed from drivers/png/pngdebug.h)0
-rw-r--r--thirdparty/libpng/pngerror.c (renamed from drivers/png/pngerror.c)0
-rw-r--r--thirdparty/libpng/pngget.c (renamed from drivers/png/pngget.c)0
-rw-r--r--thirdparty/libpng/pnginfo.h (renamed from drivers/png/pnginfo.h)0
-rw-r--r--thirdparty/libpng/pnglibconf.h (renamed from drivers/png/pnglibconf.h)0
-rw-r--r--thirdparty/libpng/pngmem.c (renamed from drivers/png/pngmem.c)0
-rw-r--r--thirdparty/libpng/pngpread.c (renamed from drivers/png/pngpread.c)0
-rw-r--r--thirdparty/libpng/pngpriv.h (renamed from drivers/png/pngpriv.h)0
-rw-r--r--thirdparty/libpng/pngread.c (renamed from drivers/png/pngread.c)0
-rw-r--r--thirdparty/libpng/pngrio.c (renamed from drivers/png/pngrio.c)0
-rw-r--r--thirdparty/libpng/pngrtran.c (renamed from drivers/png/pngrtran.c)0
-rw-r--r--thirdparty/libpng/pngrutil.c (renamed from drivers/png/pngrutil.c)0
-rw-r--r--thirdparty/libpng/pngset.c (renamed from drivers/png/pngset.c)0
-rw-r--r--thirdparty/libpng/pngstruct.h (renamed from drivers/png/pngstruct.h)0
-rw-r--r--thirdparty/libpng/pngtrans.c (renamed from drivers/png/pngtrans.c)0
-rw-r--r--thirdparty/libpng/pngwio.c (renamed from drivers/png/pngwio.c)0
-rw-r--r--thirdparty/libpng/pngwrite.c (renamed from drivers/png/pngwrite.c)0
-rw-r--r--thirdparty/libpng/pngwtran.c (renamed from drivers/png/pngwtran.c)0
-rw-r--r--thirdparty/libpng/pngwutil.c (renamed from drivers/png/pngwutil.c)0
-rw-r--r--thirdparty/libtheora/COPYING (renamed from drivers/theora/COPYING)0
-rw-r--r--thirdparty/libtheora/LICENSE (renamed from drivers/theora/LICENSE)0
-rw-r--r--thirdparty/libtheora/analyze.c (renamed from drivers/theora/analyze.c)0
-rw-r--r--thirdparty/libtheora/apiwrapper.c (renamed from drivers/theora/apiwrapper.c)0
-rw-r--r--thirdparty/libtheora/apiwrapper.h (renamed from drivers/theora/apiwrapper.h)0
-rw-r--r--thirdparty/libtheora/bitpack.c (renamed from drivers/theora/bitpack.c)0
-rw-r--r--thirdparty/libtheora/bitpack.h (renamed from drivers/theora/bitpack.h)0
-rw-r--r--thirdparty/libtheora/cpu.c (renamed from drivers/theora/cpu.c)0
-rw-r--r--thirdparty/libtheora/cpu.h (renamed from drivers/theora/cpu.h)0
-rw-r--r--thirdparty/libtheora/dct.h (renamed from drivers/theora/dct.h)0
-rw-r--r--thirdparty/libtheora/decapiwrapper.c (renamed from drivers/theora/decapiwrapper.c)0
-rw-r--r--thirdparty/libtheora/decinfo.c (renamed from drivers/theora/decinfo.c)0
-rw-r--r--thirdparty/libtheora/decint.h (renamed from drivers/theora/decint.h)0
-rw-r--r--thirdparty/libtheora/decode.c (renamed from drivers/theora/decode.c)0
-rw-r--r--thirdparty/libtheora/dequant.c (renamed from drivers/theora/dequant.c)0
-rw-r--r--thirdparty/libtheora/dequant.h (renamed from drivers/theora/dequant.h)0
-rw-r--r--thirdparty/libtheora/encapiwrapper.c (renamed from drivers/theora/encapiwrapper.c)0
-rw-r--r--thirdparty/libtheora/encfrag.c (renamed from drivers/theora/encfrag.c)0
-rw-r--r--thirdparty/libtheora/encinfo.c (renamed from drivers/theora/encinfo.c)0
-rw-r--r--thirdparty/libtheora/encint.h (renamed from drivers/theora/encint.h)0
-rw-r--r--thirdparty/libtheora/encode.c (renamed from drivers/theora/encode.c)0
-rw-r--r--thirdparty/libtheora/encoder_disabled.c (renamed from drivers/theora/encoder_disabled.c)0
-rw-r--r--thirdparty/libtheora/enquant.c (renamed from drivers/theora/enquant.c)0
-rw-r--r--thirdparty/libtheora/enquant.h (renamed from drivers/theora/enquant.h)0
-rw-r--r--thirdparty/libtheora/fdct.c (renamed from drivers/theora/fdct.c)0
-rw-r--r--thirdparty/libtheora/fragment.c (renamed from drivers/theora/fragment.c)0
-rw-r--r--thirdparty/libtheora/huffdec.c (renamed from drivers/theora/huffdec.c)0
-rw-r--r--thirdparty/libtheora/huffdec.h (renamed from drivers/theora/huffdec.h)0
-rw-r--r--thirdparty/libtheora/huffenc.c (renamed from drivers/theora/huffenc.c)0
-rw-r--r--thirdparty/libtheora/huffenc.h (renamed from drivers/theora/huffenc.h)0
-rw-r--r--thirdparty/libtheora/huffman.h (renamed from drivers/theora/huffman.h)0
-rw-r--r--thirdparty/libtheora/idct.c (renamed from drivers/theora/idct.c)0
-rw-r--r--thirdparty/libtheora/info.c (renamed from drivers/theora/info.c)0
-rw-r--r--thirdparty/libtheora/internal.c (renamed from drivers/theora/internal.c)0
-rw-r--r--thirdparty/libtheora/internal.h (renamed from drivers/theora/internal.h)0
-rw-r--r--thirdparty/libtheora/mathops.c (renamed from drivers/theora/mathops.c)0
-rw-r--r--thirdparty/libtheora/mathops.h (renamed from drivers/theora/mathops.h)0
-rw-r--r--thirdparty/libtheora/mcenc.c (renamed from drivers/theora/mcenc.c)0
-rw-r--r--thirdparty/libtheora/modedec.h (renamed from drivers/theora/modedec.h)0
-rw-r--r--thirdparty/libtheora/ocintrin.h (renamed from drivers/theora/ocintrin.h)0
-rw-r--r--thirdparty/libtheora/quant.c (renamed from drivers/theora/quant.c)0
-rw-r--r--thirdparty/libtheora/quant.h (renamed from drivers/theora/quant.h)0
-rw-r--r--thirdparty/libtheora/rate.c (renamed from drivers/theora/rate.c)0
-rw-r--r--thirdparty/libtheora/state.c (renamed from drivers/theora/state.c)0
-rw-r--r--thirdparty/libtheora/theora/codec.h (renamed from drivers/theora/codec.h)0
-rw-r--r--thirdparty/libtheora/theora/theora.h (renamed from drivers/theora/theora.h)0
-rw-r--r--thirdparty/libtheora/theora/theoradec.h (renamed from drivers/theora/theoradec.h)0
-rw-r--r--thirdparty/libtheora/theora/theoraenc.h (renamed from drivers/theora/theoraenc.h)0
-rw-r--r--thirdparty/libtheora/tokenize.c (renamed from drivers/theora/tokenize.c)0
-rw-r--r--thirdparty/libtheora/x86/mmxencfrag.c (renamed from drivers/theora/x86/mmxencfrag.c)0
-rw-r--r--thirdparty/libtheora/x86/mmxfdct.c (renamed from drivers/theora/x86/mmxfdct.c)0
-rw-r--r--thirdparty/libtheora/x86/mmxfrag.c (renamed from drivers/theora/x86/mmxfrag.c)0
-rw-r--r--thirdparty/libtheora/x86/mmxfrag.h (renamed from drivers/theora/x86/mmxfrag.h)0
-rw-r--r--thirdparty/libtheora/x86/mmxidct.c (renamed from drivers/theora/x86/mmxidct.c)0
-rw-r--r--thirdparty/libtheora/x86/mmxloop.h (renamed from drivers/theora/x86/mmxloop.h)0
-rw-r--r--thirdparty/libtheora/x86/mmxstate.c (renamed from drivers/theora/x86/mmxstate.c)0
-rw-r--r--thirdparty/libtheora/x86/sse2fdct.c (renamed from drivers/theora/x86/sse2fdct.c)0
-rw-r--r--thirdparty/libtheora/x86/x86enc.c (renamed from drivers/theora/x86/x86enc.c)0
-rw-r--r--thirdparty/libtheora/x86/x86enc.h (renamed from drivers/theora/x86/x86enc.h)0
-rw-r--r--thirdparty/libtheora/x86/x86int.h (renamed from drivers/theora/x86/x86int.h)0
-rw-r--r--thirdparty/libtheora/x86/x86state.c (renamed from drivers/theora/x86/x86state.c)0
-rw-r--r--thirdparty/libtheora/x86_vc/mmxencfrag.c (renamed from drivers/theora/x86_vc/mmxencfrag.c)0
-rw-r--r--thirdparty/libtheora/x86_vc/mmxfdct.c (renamed from drivers/theora/x86_vc/mmxfdct.c)0
-rw-r--r--thirdparty/libtheora/x86_vc/mmxfrag.c (renamed from drivers/theora/x86_vc/mmxfrag.c)0
-rw-r--r--thirdparty/libtheora/x86_vc/mmxfrag.h (renamed from drivers/theora/x86_vc/mmxfrag.h)0
-rw-r--r--thirdparty/libtheora/x86_vc/mmxidct.c (renamed from drivers/theora/x86_vc/mmxidct.c)0
-rw-r--r--thirdparty/libtheora/x86_vc/mmxloop.h (renamed from drivers/theora/x86_vc/mmxloop.h)0
-rw-r--r--thirdparty/libtheora/x86_vc/mmxstate.c (renamed from drivers/theora/x86_vc/mmxstate.c)0
-rw-r--r--thirdparty/libtheora/x86_vc/x86enc.c (renamed from drivers/theora/x86_vc/x86enc.c)0
-rw-r--r--thirdparty/libtheora/x86_vc/x86enc.h (renamed from drivers/theora/x86_vc/x86enc.h)0
-rw-r--r--thirdparty/libtheora/x86_vc/x86int.h (renamed from drivers/theora/x86_vc/x86int.h)0
-rw-r--r--thirdparty/libtheora/x86_vc/x86state.c (renamed from drivers/theora/x86_vc/x86state.c)0
-rw-r--r--thirdparty/libvorbis/COPYING (renamed from drivers/vorbis/COPYING)0
-rw-r--r--thirdparty/libvorbis/analysis.c (renamed from drivers/vorbis/analysis.c)0
-rw-r--r--thirdparty/libvorbis/backends.h (renamed from drivers/vorbis/backends.h)0
-rw-r--r--thirdparty/libvorbis/barkmel.c (renamed from drivers/vorbis/barkmel.c)0
-rw-r--r--thirdparty/libvorbis/bitrate.c (renamed from drivers/vorbis/bitrate.c)0
-rw-r--r--thirdparty/libvorbis/bitrate.h (renamed from drivers/vorbis/bitrate.h)0
-rw-r--r--thirdparty/libvorbis/block.c (renamed from drivers/vorbis/block.c)0
-rw-r--r--thirdparty/libvorbis/books/coupled/res_books_51.h (renamed from drivers/vorbis/books/coupled/res_books_51.h)0
-rw-r--r--thirdparty/libvorbis/books/coupled/res_books_stereo.h (renamed from drivers/vorbis/books/coupled/res_books_stereo.h)0
-rw-r--r--thirdparty/libvorbis/books/floor/floor_books.h (renamed from drivers/vorbis/books/floor/floor_books.h)0
-rw-r--r--thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h (renamed from drivers/vorbis/books/uncoupled/res_books_uncoupled.h)0
-rw-r--r--thirdparty/libvorbis/codebook.c (renamed from drivers/vorbis/codebook.c)0
-rw-r--r--thirdparty/libvorbis/codebook.h (renamed from drivers/vorbis/codebook.h)0
-rw-r--r--thirdparty/libvorbis/codec_internal.h (renamed from drivers/vorbis/codec_internal.h)0
-rw-r--r--thirdparty/libvorbis/envelope.c (renamed from drivers/vorbis/envelope.c)0
-rw-r--r--thirdparty/libvorbis/envelope.h (renamed from drivers/vorbis/envelope.h)0
-rw-r--r--thirdparty/libvorbis/floor0.c (renamed from drivers/vorbis/floor0.c)0
-rw-r--r--thirdparty/libvorbis/floor1.c (renamed from drivers/vorbis/floor1.c)0
-rw-r--r--thirdparty/libvorbis/highlevel.h (renamed from drivers/vorbis/highlevel.h)0
-rw-r--r--thirdparty/libvorbis/info.c (renamed from drivers/vorbis/info.c)0
-rw-r--r--thirdparty/libvorbis/lookup.c (renamed from drivers/vorbis/lookup.c)0
-rw-r--r--thirdparty/libvorbis/lookup.h (renamed from drivers/vorbis/lookup.h)0
-rw-r--r--thirdparty/libvorbis/lookup_data.h (renamed from drivers/vorbis/lookup_data.h)0
-rw-r--r--thirdparty/libvorbis/lpc.c (renamed from drivers/vorbis/lpc.c)0
-rw-r--r--thirdparty/libvorbis/lpc.h (renamed from drivers/vorbis/lpc.h)0
-rw-r--r--thirdparty/libvorbis/lsp.c (renamed from drivers/vorbis/lsp.c)0
-rw-r--r--thirdparty/libvorbis/lsp.h (renamed from drivers/vorbis/lsp.h)0
-rw-r--r--thirdparty/libvorbis/mapping0.c (renamed from drivers/vorbis/mapping0.c)0
-rw-r--r--thirdparty/libvorbis/masking.h (renamed from drivers/vorbis/masking.h)0
-rw-r--r--thirdparty/libvorbis/mdct.c (renamed from drivers/vorbis/mdct.c)0
-rw-r--r--thirdparty/libvorbis/mdct.h (renamed from drivers/vorbis/mdct.h)0
-rw-r--r--thirdparty/libvorbis/misc.h (renamed from drivers/vorbis/misc.h)0
-rw-r--r--thirdparty/libvorbis/modes/floor_all.h (renamed from drivers/vorbis/modes/floor_all.h)0
-rw-r--r--thirdparty/libvorbis/modes/psych_11.h (renamed from drivers/vorbis/modes/psych_11.h)0
-rw-r--r--thirdparty/libvorbis/modes/psych_16.h (renamed from drivers/vorbis/modes/psych_16.h)0
-rw-r--r--thirdparty/libvorbis/modes/psych_44.h (renamed from drivers/vorbis/modes/psych_44.h)0
-rw-r--r--thirdparty/libvorbis/modes/psych_8.h (renamed from drivers/vorbis/modes/psych_8.h)0
-rw-r--r--thirdparty/libvorbis/modes/residue_16.h (renamed from drivers/vorbis/modes/residue_16.h)0
-rw-r--r--thirdparty/libvorbis/modes/residue_44.h (renamed from drivers/vorbis/modes/residue_44.h)0
-rw-r--r--thirdparty/libvorbis/modes/residue_44p51.h (renamed from drivers/vorbis/modes/residue_44p51.h)0
-rw-r--r--thirdparty/libvorbis/modes/residue_44u.h (renamed from drivers/vorbis/modes/residue_44u.h)0
-rw-r--r--thirdparty/libvorbis/modes/residue_8.h (renamed from drivers/vorbis/modes/residue_8.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_11.h (renamed from drivers/vorbis/modes/setup_11.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_16.h (renamed from drivers/vorbis/modes/setup_16.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_22.h (renamed from drivers/vorbis/modes/setup_22.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_32.h (renamed from drivers/vorbis/modes/setup_32.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_44.h (renamed from drivers/vorbis/modes/setup_44.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_44p51.h (renamed from drivers/vorbis/modes/setup_44p51.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_44u.h (renamed from drivers/vorbis/modes/setup_44u.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_8.h (renamed from drivers/vorbis/modes/setup_8.h)0
-rw-r--r--thirdparty/libvorbis/modes/setup_X.h (renamed from drivers/vorbis/modes/setup_X.h)0
-rw-r--r--thirdparty/libvorbis/os.h (renamed from drivers/vorbis/os.h)0
-rw-r--r--thirdparty/libvorbis/psy.c (renamed from drivers/vorbis/psy.c)0
-rw-r--r--thirdparty/libvorbis/psy.h (renamed from drivers/vorbis/psy.h)0
-rw-r--r--thirdparty/libvorbis/psytune.c (renamed from drivers/vorbis/psytune.c)0
-rw-r--r--thirdparty/libvorbis/registry.c (renamed from drivers/vorbis/registry.c)0
-rw-r--r--thirdparty/libvorbis/registry.h (renamed from drivers/vorbis/registry.h)0
-rw-r--r--thirdparty/libvorbis/res0.c (renamed from drivers/vorbis/res0.c)0
-rw-r--r--thirdparty/libvorbis/scales.h (renamed from drivers/vorbis/scales.h)0
-rw-r--r--thirdparty/libvorbis/sharedbook.c (renamed from drivers/vorbis/sharedbook.c)0
-rw-r--r--thirdparty/libvorbis/smallft.c (renamed from drivers/vorbis/smallft.c)0
-rw-r--r--thirdparty/libvorbis/smallft.h (renamed from drivers/vorbis/smallft.h)0
-rw-r--r--thirdparty/libvorbis/synthesis.c (renamed from drivers/vorbis/synthesis.c)0
-rw-r--r--thirdparty/libvorbis/tone.c (renamed from drivers/vorbis/tone.c)0
-rw-r--r--thirdparty/libvorbis/vorbis/codec.h (renamed from drivers/vorbis/codec.h)0
-rw-r--r--thirdparty/libvorbis/vorbis/vorbisenc.h (renamed from drivers/vorbis/vorbisenc.h)0
-rw-r--r--thirdparty/libvorbis/vorbis/vorbisfile.h (renamed from drivers/vorbis/vorbisfile.h)0
-rw-r--r--thirdparty/libvorbis/vorbisenc.c (renamed from drivers/vorbis/vorbisenc.c)0
-rw-r--r--thirdparty/libvorbis/vorbisfile.c (renamed from drivers/vorbis/vorbisfile.c)0
-rw-r--r--thirdparty/libvorbis/window.c (renamed from drivers/vorbis/window.c)0
-rw-r--r--thirdparty/libvorbis/window.h (renamed from drivers/vorbis/window.h)0
-rw-r--r--thirdparty/libwebp/AUTHORS (renamed from drivers/webp/AUTHORS)0
-rw-r--r--thirdparty/libwebp/COPYING (renamed from drivers/webp/COPYING)0
-rw-r--r--thirdparty/libwebp/PATENTS (renamed from drivers/webp/PATENTS)0
-rw-r--r--thirdparty/libwebp/dec/alpha.c (renamed from drivers/webp/dec/alpha.c)2
-rw-r--r--thirdparty/libwebp/dec/alphai.h (renamed from drivers/webp/dec/alphai.h)0
-rw-r--r--thirdparty/libwebp/dec/buffer.c (renamed from drivers/webp/dec/buffer.c)0
-rw-r--r--thirdparty/libwebp/dec/common.h (renamed from drivers/webp/dec/common.h)0
-rw-r--r--thirdparty/libwebp/dec/decode_vp8.h (renamed from drivers/webp/dec/decode_vp8.h)2
-rw-r--r--thirdparty/libwebp/dec/frame.c (renamed from drivers/webp/dec/frame.c)0
-rw-r--r--thirdparty/libwebp/dec/idec.c (renamed from drivers/webp/dec/idec.c)0
-rw-r--r--thirdparty/libwebp/dec/io.c (renamed from drivers/webp/dec/io.c)0
-rw-r--r--thirdparty/libwebp/dec/quant.c (renamed from drivers/webp/dec/quant.c)0
-rw-r--r--thirdparty/libwebp/dec/tree.c (renamed from drivers/webp/dec/tree.c)0
-rw-r--r--thirdparty/libwebp/dec/vp8.c (renamed from drivers/webp/dec/vp8.c)0
-rw-r--r--thirdparty/libwebp/dec/vp8i.h (renamed from drivers/webp/dec/vp8i.h)0
-rw-r--r--thirdparty/libwebp/dec/vp8l.c (renamed from drivers/webp/dec/vp8l.c)0
-rw-r--r--thirdparty/libwebp/dec/vp8li.h (renamed from drivers/webp/dec/vp8li.h)0
-rw-r--r--thirdparty/libwebp/dec/webp.c (renamed from drivers/webp/dec/webp.c)2
-rw-r--r--thirdparty/libwebp/dec/webpi.h (renamed from drivers/webp/dec/webpi.h)0
-rw-r--r--thirdparty/libwebp/demux/anim_decode.c (renamed from drivers/webp/demux/anim_decode.c)6
-rw-r--r--thirdparty/libwebp/demux/demux.c (renamed from drivers/webp/demux/demux.c)8
-rw-r--r--thirdparty/libwebp/dsp/alpha_processing.c (renamed from drivers/webp/dsp/alpha_processing.c)0
-rw-r--r--thirdparty/libwebp/dsp/alpha_processing_mips_dsp_r2.c (renamed from drivers/webp/dsp/alpha_processing_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/alpha_processing_sse2.c (renamed from drivers/webp/dsp/alpha_processing_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/alpha_processing_sse41.c (renamed from drivers/webp/dsp/alpha_processing_sse41.c)0
-rw-r--r--thirdparty/libwebp/dsp/argb.c (renamed from drivers/webp/dsp/argb.c)0
-rw-r--r--thirdparty/libwebp/dsp/argb_mips_dsp_r2.c (renamed from drivers/webp/dsp/argb_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/argb_sse2.c (renamed from drivers/webp/dsp/argb_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/common_sse2.h (renamed from drivers/webp/dsp/common_sse2.h)0
-rw-r--r--thirdparty/libwebp/dsp/cost.c (renamed from drivers/webp/dsp/cost.c)0
-rw-r--r--thirdparty/libwebp/dsp/cost_mips32.c (renamed from drivers/webp/dsp/cost_mips32.c)0
-rw-r--r--thirdparty/libwebp/dsp/cost_mips_dsp_r2.c (renamed from drivers/webp/dsp/cost_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/cost_sse2.c (renamed from drivers/webp/dsp/cost_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/cpu.c (renamed from drivers/webp/dsp/cpu.c)0
-rw-r--r--thirdparty/libwebp/dsp/dec.c (renamed from drivers/webp/dsp/dec.c)0
-rw-r--r--thirdparty/libwebp/dsp/dec_clip_tables.c (renamed from drivers/webp/dsp/dec_clip_tables.c)0
-rw-r--r--thirdparty/libwebp/dsp/dec_mips32.c (renamed from drivers/webp/dsp/dec_mips32.c)0
-rw-r--r--thirdparty/libwebp/dsp/dec_mips_dsp_r2.c (renamed from drivers/webp/dsp/dec_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/dec_msa.c (renamed from drivers/webp/dsp/dec_msa.c)0
-rw-r--r--thirdparty/libwebp/dsp/dec_neon.c (renamed from drivers/webp/dsp/dec_neon.c)0
-rw-r--r--thirdparty/libwebp/dsp/dec_sse2.c (renamed from drivers/webp/dsp/dec_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/dec_sse41.c (renamed from drivers/webp/dsp/dec_sse41.c)0
-rw-r--r--thirdparty/libwebp/dsp/dsp.h (renamed from drivers/webp/dsp/dsp.h)4
-rw-r--r--thirdparty/libwebp/dsp/enc.c (renamed from drivers/webp/dsp/enc.c)0
-rw-r--r--thirdparty/libwebp/dsp/enc_avx2.c (renamed from drivers/webp/dsp/enc_avx2.c)0
-rw-r--r--thirdparty/libwebp/dsp/enc_mips32.c (renamed from drivers/webp/dsp/enc_mips32.c)0
-rw-r--r--thirdparty/libwebp/dsp/enc_mips_dsp_r2.c (renamed from drivers/webp/dsp/enc_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/enc_neon.c (renamed from drivers/webp/dsp/enc_neon.c)0
-rw-r--r--thirdparty/libwebp/dsp/enc_sse2.c (renamed from drivers/webp/dsp/enc_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/enc_sse41.c (renamed from drivers/webp/dsp/enc_sse41.c)0
-rw-r--r--thirdparty/libwebp/dsp/filters.c (renamed from drivers/webp/dsp/filters.c)0
-rw-r--r--thirdparty/libwebp/dsp/filters_mips_dsp_r2.c (renamed from drivers/webp/dsp/filters_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/filters_sse2.c (renamed from drivers/webp/dsp/filters_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless.c (renamed from drivers/webp/dsp/lossless.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless.h (renamed from drivers/webp/dsp/lossless.h)4
-rw-r--r--thirdparty/libwebp/dsp/lossless_enc.c (renamed from drivers/webp/dsp/lossless_enc.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless_enc_mips32.c (renamed from drivers/webp/dsp/lossless_enc_mips32.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless_enc_mips_dsp_r2.c (renamed from drivers/webp/dsp/lossless_enc_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless_enc_neon.c (renamed from drivers/webp/dsp/lossless_enc_neon.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless_enc_sse2.c (renamed from drivers/webp/dsp/lossless_enc_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless_enc_sse41.c (renamed from drivers/webp/dsp/lossless_enc_sse41.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless_mips_dsp_r2.c (renamed from drivers/webp/dsp/lossless_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless_neon.c (renamed from drivers/webp/dsp/lossless_neon.c)0
-rw-r--r--thirdparty/libwebp/dsp/lossless_sse2.c (renamed from drivers/webp/dsp/lossless_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/mips_macro.h (renamed from drivers/webp/dsp/mips_macro.h)0
-rw-r--r--thirdparty/libwebp/dsp/msa_macro.h (renamed from drivers/webp/dsp/msa_macro.h)0
-rw-r--r--thirdparty/libwebp/dsp/neon.h (renamed from drivers/webp/dsp/neon.h)0
-rw-r--r--thirdparty/libwebp/dsp/rescaler.c (renamed from drivers/webp/dsp/rescaler.c)0
-rw-r--r--thirdparty/libwebp/dsp/rescaler_mips32.c (renamed from drivers/webp/dsp/rescaler_mips32.c)0
-rw-r--r--thirdparty/libwebp/dsp/rescaler_mips_dsp_r2.c (renamed from drivers/webp/dsp/rescaler_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/rescaler_neon.c (renamed from drivers/webp/dsp/rescaler_neon.c)0
-rw-r--r--thirdparty/libwebp/dsp/rescaler_sse2.c (renamed from drivers/webp/dsp/rescaler_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/upsampling.c (renamed from drivers/webp/dsp/upsampling.c)0
-rw-r--r--thirdparty/libwebp/dsp/upsampling_mips_dsp_r2.c (renamed from drivers/webp/dsp/upsampling_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/upsampling_neon.c (renamed from drivers/webp/dsp/upsampling_neon.c)0
-rw-r--r--thirdparty/libwebp/dsp/upsampling_sse2.c (renamed from drivers/webp/dsp/upsampling_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/yuv.c (renamed from drivers/webp/dsp/yuv.c)0
-rw-r--r--thirdparty/libwebp/dsp/yuv.h (renamed from drivers/webp/dsp/yuv.h)0
-rw-r--r--thirdparty/libwebp/dsp/yuv_mips32.c (renamed from drivers/webp/dsp/yuv_mips32.c)0
-rw-r--r--thirdparty/libwebp/dsp/yuv_mips_dsp_r2.c (renamed from drivers/webp/dsp/yuv_mips_dsp_r2.c)0
-rw-r--r--thirdparty/libwebp/dsp/yuv_sse2.c (renamed from drivers/webp/dsp/yuv_sse2.c)0
-rw-r--r--thirdparty/libwebp/dsp/yuv_tables_sse2.h (renamed from drivers/webp/dsp/yuv_tables_sse2.h)0
-rw-r--r--thirdparty/libwebp/enc/alpha.c (renamed from drivers/webp/enc/alpha.c)2
-rw-r--r--thirdparty/libwebp/enc/analysis.c (renamed from drivers/webp/enc/analysis.c)0
-rw-r--r--thirdparty/libwebp/enc/backward_references.c (renamed from drivers/webp/enc/backward_references.c)0
-rw-r--r--thirdparty/libwebp/enc/backward_references.h (renamed from drivers/webp/enc/backward_references.h)4
-rw-r--r--thirdparty/libwebp/enc/config.c (renamed from drivers/webp/enc/config.c)2
-rw-r--r--thirdparty/libwebp/enc/cost.c (renamed from drivers/webp/enc/cost.c)0
-rw-r--r--thirdparty/libwebp/enc/cost.h (renamed from drivers/webp/enc/cost.h)0
-rw-r--r--thirdparty/libwebp/enc/delta_palettization.c (renamed from drivers/webp/enc/delta_palettization.c)2
-rw-r--r--thirdparty/libwebp/enc/delta_palettization.h (renamed from drivers/webp/enc/delta_palettization.h)2
-rw-r--r--thirdparty/libwebp/enc/filter.c (renamed from drivers/webp/enc/filter.c)0
-rw-r--r--thirdparty/libwebp/enc/frame.c (renamed from drivers/webp/enc/frame.c)2
-rw-r--r--thirdparty/libwebp/enc/histogram.c (renamed from drivers/webp/enc/histogram.c)2
-rw-r--r--thirdparty/libwebp/enc/histogram.h (renamed from drivers/webp/enc/histogram.h)4
-rw-r--r--thirdparty/libwebp/enc/iterator.c (renamed from drivers/webp/enc/iterator.c)0
-rw-r--r--thirdparty/libwebp/enc/near_lossless.c (renamed from drivers/webp/enc/near_lossless.c)0
-rw-r--r--thirdparty/libwebp/enc/picture.c (renamed from drivers/webp/enc/picture.c)0
-rw-r--r--thirdparty/libwebp/enc/picture_csp.c (renamed from drivers/webp/enc/picture_csp.c)0
-rw-r--r--thirdparty/libwebp/enc/picture_psnr.c (renamed from drivers/webp/enc/picture_psnr.c)0
-rw-r--r--thirdparty/libwebp/enc/picture_rescale.c (renamed from drivers/webp/enc/picture_rescale.c)0
-rw-r--r--thirdparty/libwebp/enc/picture_tools.c (renamed from drivers/webp/enc/picture_tools.c)0
-rw-r--r--thirdparty/libwebp/enc/quant.c (renamed from drivers/webp/enc/quant.c)0
-rw-r--r--thirdparty/libwebp/enc/syntax.c (renamed from drivers/webp/enc/syntax.c)4
-rw-r--r--thirdparty/libwebp/enc/token.c (renamed from drivers/webp/enc/token.c)0
-rw-r--r--thirdparty/libwebp/enc/tree.c (renamed from drivers/webp/enc/tree.c)0
-rw-r--r--thirdparty/libwebp/enc/vp8enci.h (renamed from drivers/webp/enc/vp8enci.h)2
-rw-r--r--thirdparty/libwebp/enc/vp8l.c (renamed from drivers/webp/enc/vp8l.c)2
-rw-r--r--thirdparty/libwebp/enc/vp8li.h (renamed from drivers/webp/enc/vp8li.h)4
-rw-r--r--thirdparty/libwebp/enc/webpenc.c (renamed from drivers/webp/enc/webpenc.c)0
-rw-r--r--thirdparty/libwebp/mux/anim_encode.c (renamed from drivers/webp/mux/anim_encode.c)8
-rw-r--r--thirdparty/libwebp/mux/muxedit.c (renamed from drivers/webp/mux/muxedit.c)0
-rw-r--r--thirdparty/libwebp/mux/muxi.h (renamed from drivers/webp/mux/muxi.h)2
-rw-r--r--thirdparty/libwebp/mux/muxinternal.c (renamed from drivers/webp/mux/muxinternal.c)0
-rw-r--r--thirdparty/libwebp/mux/muxread.c (renamed from drivers/webp/mux/muxread.c)0
-rw-r--r--thirdparty/libwebp/utils/bit_reader.c (renamed from drivers/webp/utils/bit_reader.c)4
-rw-r--r--thirdparty/libwebp/utils/bit_reader.h (renamed from drivers/webp/utils/bit_reader.h)8
-rw-r--r--thirdparty/libwebp/utils/bit_reader_inl.h (renamed from drivers/webp/utils/bit_reader_inl.h)2
-rw-r--r--thirdparty/libwebp/utils/bit_writer.c (renamed from drivers/webp/utils/bit_writer.c)0
-rw-r--r--thirdparty/libwebp/utils/bit_writer.h (renamed from drivers/webp/utils/bit_writer.h)2
-rw-r--r--thirdparty/libwebp/utils/color_cache.c (renamed from drivers/webp/utils/color_cache.c)0
-rw-r--r--thirdparty/libwebp/utils/color_cache.h (renamed from drivers/webp/utils/color_cache.h)2
-rw-r--r--thirdparty/libwebp/utils/endian_inl.h (renamed from drivers/webp/utils/endian_inl.h)0
-rw-r--r--thirdparty/libwebp/utils/filters.c (renamed from drivers/webp/utils/filters.c)0
-rw-r--r--thirdparty/libwebp/utils/filters.h (renamed from drivers/webp/utils/filters.h)2
-rw-r--r--thirdparty/libwebp/utils/huffman.c (renamed from drivers/webp/utils/huffman.c)2
-rw-r--r--thirdparty/libwebp/utils/huffman.h (renamed from drivers/webp/utils/huffman.h)4
-rw-r--r--thirdparty/libwebp/utils/huffman_encode.c (renamed from drivers/webp/utils/huffman_encode.c)2
-rw-r--r--thirdparty/libwebp/utils/huffman_encode.h (renamed from drivers/webp/utils/huffman_encode.h)2
-rw-r--r--thirdparty/libwebp/utils/quant_levels.c (renamed from drivers/webp/utils/quant_levels.c)0
-rw-r--r--thirdparty/libwebp/utils/quant_levels.h (renamed from drivers/webp/utils/quant_levels.h)2
-rw-r--r--thirdparty/libwebp/utils/quant_levels_dec.c (renamed from drivers/webp/utils/quant_levels_dec.c)0
-rw-r--r--thirdparty/libwebp/utils/quant_levels_dec.h (renamed from drivers/webp/utils/quant_levels_dec.h)2
-rw-r--r--thirdparty/libwebp/utils/random.c (renamed from drivers/webp/utils/random.c)0
-rw-r--r--thirdparty/libwebp/utils/random.h (renamed from drivers/webp/utils/random.h)2
-rw-r--r--thirdparty/libwebp/utils/rescaler.c (renamed from drivers/webp/utils/rescaler.c)0
-rw-r--r--thirdparty/libwebp/utils/rescaler.h (renamed from drivers/webp/utils/rescaler.h)2
-rw-r--r--thirdparty/libwebp/utils/thread.c (renamed from drivers/webp/utils/thread.c)0
-rw-r--r--thirdparty/libwebp/utils/thread.h (renamed from drivers/webp/utils/thread.h)4
-rw-r--r--thirdparty/libwebp/utils/utils.c (renamed from drivers/webp/utils/utils.c)6
-rw-r--r--thirdparty/libwebp/utils/utils.h (renamed from drivers/webp/utils/utils.h)4
-rw-r--r--thirdparty/libwebp/webp/config.h (renamed from drivers/webp/config.h)0
-rw-r--r--thirdparty/libwebp/webp/decode.h (renamed from drivers/webp/decode.h)0
-rw-r--r--thirdparty/libwebp/webp/demux.h (renamed from drivers/webp/demux.h)0
-rw-r--r--thirdparty/libwebp/webp/encode.h (renamed from drivers/webp/encode.h)0
-rw-r--r--thirdparty/libwebp/webp/format_constants.h (renamed from drivers/webp/format_constants.h)0
-rw-r--r--thirdparty/libwebp/webp/mux.h (renamed from drivers/webp/mux.h)0
-rw-r--r--thirdparty/libwebp/webp/mux_types.h (renamed from drivers/webp/mux_types.h)0
-rw-r--r--thirdparty/libwebp/webp/types.h (renamed from drivers/webp/types.h)0
-rw-r--r--thirdparty/openssl/LICENSE127
-rw-r--r--thirdparty/openssl/buildinf.h (renamed from drivers/builtin_openssl2/buildinf.h)0
-rw-r--r--thirdparty/openssl/crypto/LPdir_nyi.c (renamed from drivers/builtin_openssl2/crypto/LPdir_nyi.c)0
-rw-r--r--thirdparty/openssl/crypto/LPdir_unix.c (renamed from drivers/builtin_openssl2/crypto/LPdir_unix.c)0
-rw-r--r--thirdparty/openssl/crypto/LPdir_vms.c (renamed from drivers/builtin_openssl2/crypto/LPdir_vms.c)0
-rw-r--r--thirdparty/openssl/crypto/LPdir_win.c (renamed from drivers/builtin_openssl2/crypto/LPdir_win.c)0
-rw-r--r--thirdparty/openssl/crypto/LPdir_win32.c (renamed from drivers/builtin_openssl2/crypto/LPdir_win32.c)0
-rw-r--r--thirdparty/openssl/crypto/LPdir_wince.c (renamed from drivers/builtin_openssl2/crypto/LPdir_wince.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/README (renamed from drivers/builtin_openssl2/crypto/aes/README)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_cbc.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_cbc.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_cfb.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_cfb.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_core.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_core.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_ctr.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_ctr.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_ecb.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_ecb.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_ige.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_ige.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_locl.h (renamed from drivers/builtin_openssl2/crypto/aes/aes_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_misc.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_misc.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_ofb.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_ofb.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_wrap.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_wrap.c)0
-rw-r--r--thirdparty/openssl/crypto/aes/aes_x86core.c (renamed from drivers/builtin_openssl2/crypto/aes/aes_x86core.c)0
-rw-r--r--thirdparty/openssl/crypto/arm_arch.h (renamed from drivers/builtin_openssl2/crypto/arm_arch.h)0
-rw-r--r--thirdparty/openssl/crypto/armcap.c (renamed from drivers/builtin_openssl2/crypto/armcap.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_bitstr.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_bitstr.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_bool.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_bool.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_bytes.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_bytes.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_d2i_fp.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_d2i_fp.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_digest.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_digest.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_dup.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_dup.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_enum.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_enum.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_gentm.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_gentm.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_i2d_fp.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_i2d_fp.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_int.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_int.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_mbstr.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_mbstr.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_object.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_object.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_octet.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_octet.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_print.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_print.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_set.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_set.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_sign.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_sign.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_strex.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_strex.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_strnid.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_strnid.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_time.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_time.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_type.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_type.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_utctm.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_utctm.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_utf8.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_utf8.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/a_verify.c (renamed from drivers/builtin_openssl2/crypto/asn1/a_verify.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/ameth_lib.c (renamed from drivers/builtin_openssl2/crypto/asn1/ameth_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/asn1_err.c (renamed from drivers/builtin_openssl2/crypto/asn1/asn1_err.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/asn1_gen.c (renamed from drivers/builtin_openssl2/crypto/asn1/asn1_gen.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/asn1_lib.c (renamed from drivers/builtin_openssl2/crypto/asn1/asn1_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/asn1_locl.h (renamed from drivers/builtin_openssl2/crypto/asn1/asn1_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/asn1/asn1_par.c (renamed from drivers/builtin_openssl2/crypto/asn1/asn1_par.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/asn_mime.c (renamed from drivers/builtin_openssl2/crypto/asn1/asn_mime.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/asn_moid.c (renamed from drivers/builtin_openssl2/crypto/asn1/asn_moid.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/asn_pack.c (renamed from drivers/builtin_openssl2/crypto/asn1/asn_pack.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/bio_asn1.c (renamed from drivers/builtin_openssl2/crypto/asn1/bio_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/bio_ndef.c (renamed from drivers/builtin_openssl2/crypto/asn1/bio_ndef.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/charmap.h (renamed from drivers/builtin_openssl2/crypto/asn1/charmap.h)0
-rw-r--r--thirdparty/openssl/crypto/asn1/d2i_pr.c (renamed from drivers/builtin_openssl2/crypto/asn1/d2i_pr.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/d2i_pu.c (renamed from drivers/builtin_openssl2/crypto/asn1/d2i_pu.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/evp_asn1.c (renamed from drivers/builtin_openssl2/crypto/asn1/evp_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/f_enum.c (renamed from drivers/builtin_openssl2/crypto/asn1/f_enum.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/f_int.c (renamed from drivers/builtin_openssl2/crypto/asn1/f_int.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/f_string.c (renamed from drivers/builtin_openssl2/crypto/asn1/f_string.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/i2d_pr.c (renamed from drivers/builtin_openssl2/crypto/asn1/i2d_pr.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/i2d_pu.c (renamed from drivers/builtin_openssl2/crypto/asn1/i2d_pu.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/n_pkey.c (renamed from drivers/builtin_openssl2/crypto/asn1/n_pkey.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/nsseq.c (renamed from drivers/builtin_openssl2/crypto/asn1/nsseq.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/p5_pbe.c (renamed from drivers/builtin_openssl2/crypto/asn1/p5_pbe.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/p5_pbev2.c (renamed from drivers/builtin_openssl2/crypto/asn1/p5_pbev2.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/p8_pkey.c (renamed from drivers/builtin_openssl2/crypto/asn1/p8_pkey.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/t_bitst.c (renamed from drivers/builtin_openssl2/crypto/asn1/t_bitst.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/t_crl.c (renamed from drivers/builtin_openssl2/crypto/asn1/t_crl.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/t_pkey.c (renamed from drivers/builtin_openssl2/crypto/asn1/t_pkey.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/t_req.c (renamed from drivers/builtin_openssl2/crypto/asn1/t_req.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/t_spki.c (renamed from drivers/builtin_openssl2/crypto/asn1/t_spki.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/t_x509.c (renamed from drivers/builtin_openssl2/crypto/asn1/t_x509.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/t_x509a.c (renamed from drivers/builtin_openssl2/crypto/asn1/t_x509a.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/tasn_dec.c (renamed from drivers/builtin_openssl2/crypto/asn1/tasn_dec.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/tasn_enc.c (renamed from drivers/builtin_openssl2/crypto/asn1/tasn_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/tasn_fre.c (renamed from drivers/builtin_openssl2/crypto/asn1/tasn_fre.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/tasn_new.c (renamed from drivers/builtin_openssl2/crypto/asn1/tasn_new.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/tasn_prn.c (renamed from drivers/builtin_openssl2/crypto/asn1/tasn_prn.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/tasn_typ.c (renamed from drivers/builtin_openssl2/crypto/asn1/tasn_typ.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/tasn_utl.c (renamed from drivers/builtin_openssl2/crypto/asn1/tasn_utl.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_algor.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_algor.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_attrib.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_attrib.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_bignum.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_bignum.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_crl.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_crl.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_exten.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_exten.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_info.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_info.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_long.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_long.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_name.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_name.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_nx509.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_nx509.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_pkey.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_pkey.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_pubkey.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_pubkey.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_req.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_req.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_sig.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_sig.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_spki.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_spki.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_val.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_val.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_x509.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_x509.c)0
-rw-r--r--thirdparty/openssl/crypto/asn1/x_x509a.c (renamed from drivers/builtin_openssl2/crypto/asn1/x_x509a.c)0
-rw-r--r--thirdparty/openssl/crypto/bf/COPYRIGHT (renamed from drivers/builtin_openssl2/crypto/bf/COPYRIGHT)0
-rw-r--r--thirdparty/openssl/crypto/bf/INSTALL (renamed from drivers/builtin_openssl2/crypto/bf/INSTALL)0
-rw-r--r--thirdparty/openssl/crypto/bf/README (renamed from drivers/builtin_openssl2/crypto/bf/README)0
-rw-r--r--thirdparty/openssl/crypto/bf/VERSION (renamed from drivers/builtin_openssl2/crypto/bf/VERSION)0
-rw-r--r--thirdparty/openssl/crypto/bf/asm/readme (renamed from drivers/builtin_openssl2/crypto/bf/asm/readme)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_cbc.c (renamed from drivers/builtin_openssl2/crypto/bf/bf_cbc.c)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_cfb64.c (renamed from drivers/builtin_openssl2/crypto/bf/bf_cfb64.c)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_ecb.c (renamed from drivers/builtin_openssl2/crypto/bf/bf_ecb.c)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_enc.c (renamed from drivers/builtin_openssl2/crypto/bf/bf_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_locl.h (renamed from drivers/builtin_openssl2/crypto/bf/bf_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_ofb64.c (renamed from drivers/builtin_openssl2/crypto/bf/bf_ofb64.c)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_opts.c (renamed from drivers/builtin_openssl2/crypto/bf/bf_opts.c)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_pi.h (renamed from drivers/builtin_openssl2/crypto/bf/bf_pi.h)0
-rw-r--r--thirdparty/openssl/crypto/bf/bf_skey.c (renamed from drivers/builtin_openssl2/crypto/bf/bf_skey.c)0
-rw-r--r--thirdparty/openssl/crypto/bf/bfs.cpp (renamed from drivers/builtin_openssl2/crypto/bf/bfs.cpp)0
-rw-r--r--thirdparty/openssl/crypto/bf/bfspeed.c (renamed from drivers/builtin_openssl2/crypto/bf/bfspeed.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/b_dump.c (renamed from drivers/builtin_openssl2/crypto/bio/b_dump.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/b_print.c (renamed from drivers/builtin_openssl2/crypto/bio/b_print.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/b_sock.c (renamed from drivers/builtin_openssl2/crypto/bio/b_sock.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bf_buff.c (renamed from drivers/builtin_openssl2/crypto/bio/bf_buff.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bf_lbuf.c (renamed from drivers/builtin_openssl2/crypto/bio/bf_lbuf.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bf_nbio.c (renamed from drivers/builtin_openssl2/crypto/bio/bf_nbio.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bf_null.c (renamed from drivers/builtin_openssl2/crypto/bio/bf_null.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bio_cb.c (renamed from drivers/builtin_openssl2/crypto/bio/bio_cb.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bio_err.c (renamed from drivers/builtin_openssl2/crypto/bio/bio_err.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bio_lcl.h (renamed from drivers/builtin_openssl2/crypto/bio/bio_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/bio/bio_lib.c (renamed from drivers/builtin_openssl2/crypto/bio/bio_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_acpt.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_acpt.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_bio.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_bio.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_conn.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_conn.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_dgram.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_dgram.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_fd.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_fd.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_file.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_file.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_log.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_log.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_mem.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_mem.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_null.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_null.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_rtcp.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_rtcp.c)0
-rw-r--r--thirdparty/openssl/crypto/bio/bss_sock.c (renamed from drivers/builtin_openssl2/crypto/bio/bss_sock.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/asm/README (renamed from drivers/builtin_openssl2/crypto/bn/asm/README)0
-rw-r--r--thirdparty/openssl/crypto/bn/asm/vms.mar (renamed from drivers/builtin_openssl2/crypto/bn/asm/vms.mar)0
-rw-r--r--thirdparty/openssl/crypto/bn/asm/x86/f (renamed from drivers/builtin_openssl2/crypto/bn/asm/x86/f)0
-rw-r--r--thirdparty/openssl/crypto/bn/asm/x86_64-gcc.c (renamed from drivers/builtin_openssl2/crypto/bn/asm/x86_64-gcc.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn.mul (renamed from drivers/builtin_openssl2/crypto/bn/bn.mul)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_add.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_add.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_asm.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_asm.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_blind.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_blind.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_const.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_const.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_ctx.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_ctx.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_depr.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_depr.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_div.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_div.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_err.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_err.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_exp.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_exp.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_exp2.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_exp2.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_gcd.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_gcd.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_gf2m.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_gf2m.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_kron.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_kron.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_lcl.h (renamed from drivers/builtin_openssl2/crypto/bn/bn_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_lib.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_mod.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_mod.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_mont.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_mont.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_mpi.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_mpi.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_mul.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_mul.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_nist.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_nist.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_prime.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_prime.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_prime.h (renamed from drivers/builtin_openssl2/crypto/bn/bn_prime.h)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_print.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_print.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_rand.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_rand.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_recp.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_recp.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_shift.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_shift.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_sqr.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_sqr.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_sqrt.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_sqrt.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_word.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_word.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bn_x931p.c (renamed from drivers/builtin_openssl2/crypto/bn/bn_x931p.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/bnspeed.c (renamed from drivers/builtin_openssl2/crypto/bn/bnspeed.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/exp.c (renamed from drivers/builtin_openssl2/crypto/bn/exp.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/expspeed.c (renamed from drivers/builtin_openssl2/crypto/bn/expspeed.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/rsaz_exp.c (renamed from drivers/builtin_openssl2/crypto/bn/rsaz_exp.c)0
-rw-r--r--thirdparty/openssl/crypto/bn/rsaz_exp.h (renamed from drivers/builtin_openssl2/crypto/bn/rsaz_exp.h)0
-rw-r--r--thirdparty/openssl/crypto/bn/todo (renamed from drivers/builtin_openssl2/crypto/bn/todo)0
-rw-r--r--thirdparty/openssl/crypto/bn/vms-helper.c (renamed from drivers/builtin_openssl2/crypto/bn/vms-helper.c)0
-rw-r--r--thirdparty/openssl/crypto/buffer/buf_err.c (renamed from drivers/builtin_openssl2/crypto/buffer/buf_err.c)0
-rw-r--r--thirdparty/openssl/crypto/buffer/buf_str.c (renamed from drivers/builtin_openssl2/crypto/buffer/buf_str.c)0
-rw-r--r--thirdparty/openssl/crypto/buffer/buffer.c (renamed from drivers/builtin_openssl2/crypto/buffer/buffer.c)0
-rw-r--r--thirdparty/openssl/crypto/camellia/camellia.c (renamed from drivers/builtin_openssl2/crypto/camellia/camellia.c)0
-rw-r--r--thirdparty/openssl/crypto/camellia/cmll_cbc.c (renamed from drivers/builtin_openssl2/crypto/camellia/cmll_cbc.c)0
-rw-r--r--thirdparty/openssl/crypto/camellia/cmll_cfb.c (renamed from drivers/builtin_openssl2/crypto/camellia/cmll_cfb.c)0
-rw-r--r--thirdparty/openssl/crypto/camellia/cmll_ctr.c (renamed from drivers/builtin_openssl2/crypto/camellia/cmll_ctr.c)0
-rw-r--r--thirdparty/openssl/crypto/camellia/cmll_ecb.c (renamed from drivers/builtin_openssl2/crypto/camellia/cmll_ecb.c)0
-rw-r--r--thirdparty/openssl/crypto/camellia/cmll_locl.h (renamed from drivers/builtin_openssl2/crypto/camellia/cmll_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/camellia/cmll_misc.c (renamed from drivers/builtin_openssl2/crypto/camellia/cmll_misc.c)0
-rw-r--r--thirdparty/openssl/crypto/camellia/cmll_ofb.c (renamed from drivers/builtin_openssl2/crypto/camellia/cmll_ofb.c)0
-rw-r--r--thirdparty/openssl/crypto/camellia/cmll_utl.c (renamed from drivers/builtin_openssl2/crypto/camellia/cmll_utl.c)0
-rw-r--r--thirdparty/openssl/crypto/cast/asm/readme (renamed from drivers/builtin_openssl2/crypto/cast/asm/readme)0
-rw-r--r--thirdparty/openssl/crypto/cast/c_cfb64.c (renamed from drivers/builtin_openssl2/crypto/cast/c_cfb64.c)0
-rw-r--r--thirdparty/openssl/crypto/cast/c_ecb.c (renamed from drivers/builtin_openssl2/crypto/cast/c_ecb.c)0
-rw-r--r--thirdparty/openssl/crypto/cast/c_enc.c (renamed from drivers/builtin_openssl2/crypto/cast/c_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/cast/c_ofb64.c (renamed from drivers/builtin_openssl2/crypto/cast/c_ofb64.c)0
-rw-r--r--thirdparty/openssl/crypto/cast/c_skey.c (renamed from drivers/builtin_openssl2/crypto/cast/c_skey.c)0
-rw-r--r--thirdparty/openssl/crypto/cast/cast_lcl.h (renamed from drivers/builtin_openssl2/crypto/cast/cast_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/cast/cast_s.h (renamed from drivers/builtin_openssl2/crypto/cast/cast_s.h)0
-rw-r--r--thirdparty/openssl/crypto/cast/cast_spd.c (renamed from drivers/builtin_openssl2/crypto/cast/cast_spd.c)0
-rw-r--r--thirdparty/openssl/crypto/cast/castopts.c (renamed from drivers/builtin_openssl2/crypto/cast/castopts.c)0
-rw-r--r--thirdparty/openssl/crypto/cast/casts.cpp (renamed from drivers/builtin_openssl2/crypto/cast/casts.cpp)0
-rw-r--r--thirdparty/openssl/crypto/cmac/cm_ameth.c (renamed from drivers/builtin_openssl2/crypto/cmac/cm_ameth.c)0
-rw-r--r--thirdparty/openssl/crypto/cmac/cm_pmeth.c (renamed from drivers/builtin_openssl2/crypto/cmac/cm_pmeth.c)0
-rw-r--r--thirdparty/openssl/crypto/cmac/cmac.c (renamed from drivers/builtin_openssl2/crypto/cmac/cmac.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_asn1.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_att.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_att.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_cd.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_cd.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_dd.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_dd.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_enc.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_env.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_env.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_err.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_err.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_ess.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_ess.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_io.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_io.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_kari.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_kari.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_lcl.h (renamed from drivers/builtin_openssl2/crypto/cms/cms_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_lib.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_pwri.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_pwri.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_sd.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_sd.c)0
-rw-r--r--thirdparty/openssl/crypto/cms/cms_smime.c (renamed from drivers/builtin_openssl2/crypto/cms/cms_smime.c)0
-rw-r--r--thirdparty/openssl/crypto/comp/c_rle.c (renamed from drivers/builtin_openssl2/crypto/comp/c_rle.c)0
-rw-r--r--thirdparty/openssl/crypto/comp/c_zlib.c (renamed from drivers/builtin_openssl2/crypto/comp/c_zlib.c)0
-rw-r--r--thirdparty/openssl/crypto/comp/comp_err.c (renamed from drivers/builtin_openssl2/crypto/comp/comp_err.c)0
-rw-r--r--thirdparty/openssl/crypto/comp/comp_lib.c (renamed from drivers/builtin_openssl2/crypto/comp/comp_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/README (renamed from drivers/builtin_openssl2/crypto/conf/README)0
-rw-r--r--thirdparty/openssl/crypto/conf/cnf_save.c (renamed from drivers/builtin_openssl2/crypto/conf/cnf_save.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/conf_api.c (renamed from drivers/builtin_openssl2/crypto/conf/conf_api.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/conf_def.c (renamed from drivers/builtin_openssl2/crypto/conf/conf_def.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/conf_def.h (renamed from drivers/builtin_openssl2/crypto/conf/conf_def.h)0
-rw-r--r--thirdparty/openssl/crypto/conf/conf_err.c (renamed from drivers/builtin_openssl2/crypto/conf/conf_err.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/conf_lib.c (renamed from drivers/builtin_openssl2/crypto/conf/conf_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/conf_mall.c (renamed from drivers/builtin_openssl2/crypto/conf/conf_mall.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/conf_mod.c (renamed from drivers/builtin_openssl2/crypto/conf/conf_mod.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/conf_sap.c (renamed from drivers/builtin_openssl2/crypto/conf/conf_sap.c)0
-rw-r--r--thirdparty/openssl/crypto/conf/ssleay.cnf (renamed from drivers/builtin_openssl2/crypto/conf/ssleay.cnf)0
-rw-r--r--thirdparty/openssl/crypto/constant_time_locl.h (renamed from drivers/builtin_openssl2/crypto/constant_time_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/cpt_err.c (renamed from drivers/builtin_openssl2/crypto/cpt_err.c)0
-rw-r--r--thirdparty/openssl/crypto/cryptlib.c (renamed from drivers/builtin_openssl2/crypto/cryptlib.c)0
-rw-r--r--thirdparty/openssl/crypto/cryptlib.h (renamed from drivers/builtin_openssl2/crypto/cryptlib.h)0
-rw-r--r--thirdparty/openssl/crypto/crypto-lib.com (renamed from drivers/builtin_openssl2/crypto/crypto-lib.com)0
-rw-r--r--thirdparty/openssl/crypto/cversion.c (renamed from drivers/builtin_openssl2/crypto/cversion.c)0
-rw-r--r--thirdparty/openssl/crypto/des/COPYRIGHT (renamed from drivers/builtin_openssl2/crypto/des/COPYRIGHT)0
-rw-r--r--thirdparty/openssl/crypto/des/DES.pm (renamed from drivers/builtin_openssl2/crypto/des/DES.pm)0
-rw-r--r--thirdparty/openssl/crypto/des/DES.xs (renamed from drivers/builtin_openssl2/crypto/des/DES.xs)0
-rw-r--r--thirdparty/openssl/crypto/des/FILES0 (renamed from drivers/builtin_openssl2/crypto/des/FILES0)0
-rw-r--r--thirdparty/openssl/crypto/des/INSTALL (renamed from drivers/builtin_openssl2/crypto/des/INSTALL)0
-rw-r--r--thirdparty/openssl/crypto/des/Imakefile (renamed from drivers/builtin_openssl2/crypto/des/Imakefile)0
-rw-r--r--thirdparty/openssl/crypto/des/KERBEROS (renamed from drivers/builtin_openssl2/crypto/des/KERBEROS)0
-rw-r--r--thirdparty/openssl/crypto/des/README (renamed from drivers/builtin_openssl2/crypto/des/README)0
-rw-r--r--thirdparty/openssl/crypto/des/VERSION (renamed from drivers/builtin_openssl2/crypto/des/VERSION)0
-rw-r--r--thirdparty/openssl/crypto/des/asm/des_enc.m4 (renamed from drivers/builtin_openssl2/crypto/des/asm/des_enc.m4)0
-rw-r--r--thirdparty/openssl/crypto/des/asm/readme (renamed from drivers/builtin_openssl2/crypto/des/asm/readme)0
-rw-r--r--thirdparty/openssl/crypto/des/cbc3_enc.c (renamed from drivers/builtin_openssl2/crypto/des/cbc3_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/cbc_cksm.c (renamed from drivers/builtin_openssl2/crypto/des/cbc_cksm.c)0
-rw-r--r--thirdparty/openssl/crypto/des/cbc_enc.c (renamed from drivers/builtin_openssl2/crypto/des/cbc_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/cfb64ede.c (renamed from drivers/builtin_openssl2/crypto/des/cfb64ede.c)0
-rw-r--r--thirdparty/openssl/crypto/des/cfb64enc.c (renamed from drivers/builtin_openssl2/crypto/des/cfb64enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/cfb_enc.c (renamed from drivers/builtin_openssl2/crypto/des/cfb_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/des-lib.com (renamed from drivers/builtin_openssl2/crypto/des/des-lib.com)0
-rw-r--r--thirdparty/openssl/crypto/des/des.c (renamed from drivers/builtin_openssl2/crypto/des/des.c)0
-rw-r--r--thirdparty/openssl/crypto/des/des3s.cpp (renamed from drivers/builtin_openssl2/crypto/des/des3s.cpp)0
-rw-r--r--thirdparty/openssl/crypto/des/des_enc.c (renamed from drivers/builtin_openssl2/crypto/des/des_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/des_locl.h (renamed from drivers/builtin_openssl2/crypto/des/des_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/des/des_old.c (renamed from drivers/builtin_openssl2/crypto/des/des_old.c)0
-rw-r--r--thirdparty/openssl/crypto/des/des_old2.c (renamed from drivers/builtin_openssl2/crypto/des/des_old2.c)0
-rw-r--r--thirdparty/openssl/crypto/des/des_opts.c (renamed from drivers/builtin_openssl2/crypto/des/des_opts.c)0
-rw-r--r--thirdparty/openssl/crypto/des/des_ver.h (renamed from drivers/builtin_openssl2/crypto/des/des_ver.h)0
-rw-r--r--thirdparty/openssl/crypto/des/dess.cpp (renamed from drivers/builtin_openssl2/crypto/des/dess.cpp)0
-rw-r--r--thirdparty/openssl/crypto/des/ecb3_enc.c (renamed from drivers/builtin_openssl2/crypto/des/ecb3_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/ecb_enc.c (renamed from drivers/builtin_openssl2/crypto/des/ecb_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/ede_cbcm_enc.c (renamed from drivers/builtin_openssl2/crypto/des/ede_cbcm_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/enc_read.c (renamed from drivers/builtin_openssl2/crypto/des/enc_read.c)0
-rw-r--r--thirdparty/openssl/crypto/des/enc_writ.c (renamed from drivers/builtin_openssl2/crypto/des/enc_writ.c)0
-rw-r--r--thirdparty/openssl/crypto/des/fcrypt.c (renamed from drivers/builtin_openssl2/crypto/des/fcrypt.c)0
-rw-r--r--thirdparty/openssl/crypto/des/fcrypt_b.c (renamed from drivers/builtin_openssl2/crypto/des/fcrypt_b.c)0
-rw-r--r--thirdparty/openssl/crypto/des/makefile.bc (renamed from drivers/builtin_openssl2/crypto/des/makefile.bc)0
-rw-r--r--thirdparty/openssl/crypto/des/ncbc_enc.c (renamed from drivers/builtin_openssl2/crypto/des/ncbc_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/ofb64ede.c (renamed from drivers/builtin_openssl2/crypto/des/ofb64ede.c)0
-rw-r--r--thirdparty/openssl/crypto/des/ofb64enc.c (renamed from drivers/builtin_openssl2/crypto/des/ofb64enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/ofb_enc.c (renamed from drivers/builtin_openssl2/crypto/des/ofb_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/options.txt (renamed from drivers/builtin_openssl2/crypto/des/options.txt)0
-rw-r--r--thirdparty/openssl/crypto/des/pcbc_enc.c (renamed from drivers/builtin_openssl2/crypto/des/pcbc_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/qud_cksm.c (renamed from drivers/builtin_openssl2/crypto/des/qud_cksm.c)0
-rw-r--r--thirdparty/openssl/crypto/des/rand_key.c (renamed from drivers/builtin_openssl2/crypto/des/rand_key.c)0
-rw-r--r--thirdparty/openssl/crypto/des/read2pwd.c (renamed from drivers/builtin_openssl2/crypto/des/read2pwd.c)0
-rw-r--r--thirdparty/openssl/crypto/des/read_pwd.c (renamed from drivers/builtin_openssl2/crypto/des/read_pwd.c)0
-rw-r--r--thirdparty/openssl/crypto/des/rpc_des.h (renamed from drivers/builtin_openssl2/crypto/des/rpc_des.h)0
-rw-r--r--thirdparty/openssl/crypto/des/rpc_enc.c (renamed from drivers/builtin_openssl2/crypto/des/rpc_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/des/rpw.c (renamed from drivers/builtin_openssl2/crypto/des/rpw.c)0
-rw-r--r--thirdparty/openssl/crypto/des/set_key.c (renamed from drivers/builtin_openssl2/crypto/des/set_key.c)0
-rw-r--r--thirdparty/openssl/crypto/des/speed.c (renamed from drivers/builtin_openssl2/crypto/des/speed.c)0
-rw-r--r--thirdparty/openssl/crypto/des/spr.h (renamed from drivers/builtin_openssl2/crypto/des/spr.h)0
-rw-r--r--thirdparty/openssl/crypto/des/str2key.c (renamed from drivers/builtin_openssl2/crypto/des/str2key.c)0
-rw-r--r--thirdparty/openssl/crypto/des/t/test (renamed from drivers/builtin_openssl2/crypto/des/t/test)0
-rw-r--r--thirdparty/openssl/crypto/des/times/486-50.sol (renamed from drivers/builtin_openssl2/crypto/des/times/486-50.sol)0
-rw-r--r--thirdparty/openssl/crypto/des/times/586-100.lnx (renamed from drivers/builtin_openssl2/crypto/des/times/586-100.lnx)0
-rw-r--r--thirdparty/openssl/crypto/des/times/686-200.fre (renamed from drivers/builtin_openssl2/crypto/des/times/686-200.fre)0
-rw-r--r--thirdparty/openssl/crypto/des/times/aix.cc (renamed from drivers/builtin_openssl2/crypto/des/times/aix.cc)0
-rw-r--r--thirdparty/openssl/crypto/des/times/alpha.cc (renamed from drivers/builtin_openssl2/crypto/des/times/alpha.cc)0
-rw-r--r--thirdparty/openssl/crypto/des/times/hpux.cc (renamed from drivers/builtin_openssl2/crypto/des/times/hpux.cc)0
-rw-r--r--thirdparty/openssl/crypto/des/times/sparc.gcc (renamed from drivers/builtin_openssl2/crypto/des/times/sparc.gcc)0
-rw-r--r--thirdparty/openssl/crypto/des/times/usparc.cc (renamed from drivers/builtin_openssl2/crypto/des/times/usparc.cc)0
-rw-r--r--thirdparty/openssl/crypto/des/typemap (renamed from drivers/builtin_openssl2/crypto/des/typemap)0
-rw-r--r--thirdparty/openssl/crypto/des/xcbc_enc.c (renamed from drivers/builtin_openssl2/crypto/des/xcbc_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh1024.pem (renamed from drivers/builtin_openssl2/crypto/dh/dh1024.pem)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh192.pem (renamed from drivers/builtin_openssl2/crypto/dh/dh192.pem)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh2048.pem (renamed from drivers/builtin_openssl2/crypto/dh/dh2048.pem)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh4096.pem (renamed from drivers/builtin_openssl2/crypto/dh/dh4096.pem)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh512.pem (renamed from drivers/builtin_openssl2/crypto/dh/dh512.pem)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_ameth.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_ameth.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_asn1.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_check.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_check.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_depr.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_depr.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_err.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_err.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_gen.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_gen.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_kdf.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_kdf.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_key.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_key.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_lib.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_pmeth.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_pmeth.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_prn.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_prn.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/dh_rfc5114.c (renamed from drivers/builtin_openssl2/crypto/dh/dh_rfc5114.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/example (renamed from drivers/builtin_openssl2/crypto/dh/example)0
-rw-r--r--thirdparty/openssl/crypto/dh/generate (renamed from drivers/builtin_openssl2/crypto/dh/generate)0
-rw-r--r--thirdparty/openssl/crypto/dh/p1024.c (renamed from drivers/builtin_openssl2/crypto/dh/p1024.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/p192.c (renamed from drivers/builtin_openssl2/crypto/dh/p192.c)0
-rw-r--r--thirdparty/openssl/crypto/dh/p512.c (renamed from drivers/builtin_openssl2/crypto/dh/p512.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/README (renamed from drivers/builtin_openssl2/crypto/dsa/README)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_ameth.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_ameth.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_asn1.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_depr.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_depr.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_err.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_err.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_gen.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_gen.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_key.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_key.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_lib.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_locl.h (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_ossl.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_ossl.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_pmeth.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_pmeth.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_prn.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_prn.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_sign.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_sign.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsa_vrf.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsa_vrf.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/dsagen.c (renamed from drivers/builtin_openssl2/crypto/dsa/dsagen.c)0
-rw-r--r--thirdparty/openssl/crypto/dsa/fips186a.txt (renamed from drivers/builtin_openssl2/crypto/dsa/fips186a.txt)0
-rw-r--r--thirdparty/openssl/crypto/dso/README (renamed from drivers/builtin_openssl2/crypto/dso/README)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_beos.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_beos.c)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_dl.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_dl.c)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_dlfcn.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_dlfcn.c)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_err.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_err.c)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_lib.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_null.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_null.c)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_openssl.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_openssl.c)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_vms.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_vms.c)0
-rw-r--r--thirdparty/openssl/crypto/dso/dso_win32.c (renamed from drivers/builtin_openssl2/crypto/dso/dso_win32.c)0
-rw-r--r--thirdparty/openssl/crypto/ebcdic.c (renamed from drivers/builtin_openssl2/crypto/ebcdic.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec2_mult.c (renamed from drivers/builtin_openssl2/crypto/ec/ec2_mult.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec2_oct.c (renamed from drivers/builtin_openssl2/crypto/ec/ec2_oct.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec2_smpl.c (renamed from drivers/builtin_openssl2/crypto/ec/ec2_smpl.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_ameth.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_ameth.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_asn1.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_check.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_check.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_curve.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_curve.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_cvt.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_cvt.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_err.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_err.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_key.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_key.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_lcl.h (renamed from drivers/builtin_openssl2/crypto/ec/ec_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_lib.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_mult.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_mult.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_oct.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_oct.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_pmeth.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_pmeth.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ec_print.c (renamed from drivers/builtin_openssl2/crypto/ec/ec_print.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/eck_prn.c (renamed from drivers/builtin_openssl2/crypto/ec/eck_prn.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_mont.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_mont.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_nist.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_nist.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_nistp224.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_nistp224.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_nistp256.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_nistp256.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_nistp521.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_nistp521.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_nistputil.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_nistputil.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_nistz256.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_nistz256.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_nistz256_table.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_nistz256_table.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_oct.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_oct.c)0
-rw-r--r--thirdparty/openssl/crypto/ec/ecp_smpl.c (renamed from drivers/builtin_openssl2/crypto/ec/ecp_smpl.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdh/ech_err.c (renamed from drivers/builtin_openssl2/crypto/ecdh/ech_err.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdh/ech_kdf.c (renamed from drivers/builtin_openssl2/crypto/ecdh/ech_kdf.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdh/ech_key.c (renamed from drivers/builtin_openssl2/crypto/ecdh/ech_key.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdh/ech_lib.c (renamed from drivers/builtin_openssl2/crypto/ecdh/ech_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdh/ech_locl.h (renamed from drivers/builtin_openssl2/crypto/ecdh/ech_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/ecdh/ech_ossl.c (renamed from drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdsa/ecs_asn1.c (renamed from drivers/builtin_openssl2/crypto/ecdsa/ecs_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdsa/ecs_err.c (renamed from drivers/builtin_openssl2/crypto/ecdsa/ecs_err.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdsa/ecs_lib.c (renamed from drivers/builtin_openssl2/crypto/ecdsa/ecs_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdsa/ecs_locl.h (renamed from drivers/builtin_openssl2/crypto/ecdsa/ecs_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/ecdsa/ecs_ossl.c (renamed from drivers/builtin_openssl2/crypto/ecdsa/ecs_ossl.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdsa/ecs_sign.c (renamed from drivers/builtin_openssl2/crypto/ecdsa/ecs_sign.c)0
-rw-r--r--thirdparty/openssl/crypto/ecdsa/ecs_vrf.c (renamed from drivers/builtin_openssl2/crypto/ecdsa/ecs_vrf.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/README (renamed from drivers/builtin_openssl2/crypto/engine/README)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_all.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_all.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_cnf.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_cnf.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_cryptodev.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_cryptodev.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_ctrl.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_ctrl.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_dyn.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_dyn.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_err.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_err.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_fat.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_fat.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_init.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_init.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_int.h (renamed from drivers/builtin_openssl2/crypto/engine/eng_int.h)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_lib.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_list.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_list.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_openssl.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_openssl.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_pkey.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_pkey.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_rdrand.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_rdrand.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/eng_table.c (renamed from drivers/builtin_openssl2/crypto/engine/eng_table.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_asnmth.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_asnmth.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_cipher.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_cipher.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_dh.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_dh.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_digest.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_digest.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_dsa.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_dsa.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_ecdh.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_ecdh.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_ecdsa.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_ecdsa.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_pkmeth.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_pkmeth.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_rand.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_rand.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_rsa.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_rsa.c)0
-rw-r--r--thirdparty/openssl/crypto/engine/tb_store.c (renamed from drivers/builtin_openssl2/crypto/engine/tb_store.c)0
-rw-r--r--thirdparty/openssl/crypto/err/err.c (renamed from drivers/builtin_openssl2/crypto/err/err.c)0
-rw-r--r--thirdparty/openssl/crypto/err/err_all.c (renamed from drivers/builtin_openssl2/crypto/err/err_all.c)0
-rw-r--r--thirdparty/openssl/crypto/err/err_prn.c (renamed from drivers/builtin_openssl2/crypto/err/err_prn.c)0
-rw-r--r--thirdparty/openssl/crypto/err/openssl.ec (renamed from drivers/builtin_openssl2/crypto/err/openssl.ec)0
-rw-r--r--thirdparty/openssl/crypto/evp/bio_b64.c (renamed from drivers/builtin_openssl2/crypto/evp/bio_b64.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/bio_enc.c (renamed from drivers/builtin_openssl2/crypto/evp/bio_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/bio_md.c (renamed from drivers/builtin_openssl2/crypto/evp/bio_md.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/bio_ok.c (renamed from drivers/builtin_openssl2/crypto/evp/bio_ok.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/c_all.c (renamed from drivers/builtin_openssl2/crypto/evp/c_all.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/c_allc.c (renamed from drivers/builtin_openssl2/crypto/evp/c_allc.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/c_alld.c (renamed from drivers/builtin_openssl2/crypto/evp/c_alld.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/digest.c (renamed from drivers/builtin_openssl2/crypto/evp/digest.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_aes.c (renamed from drivers/builtin_openssl2/crypto/evp/e_aes.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c (renamed from drivers/builtin_openssl2/crypto/evp/e_aes_cbc_hmac_sha1.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c (renamed from drivers/builtin_openssl2/crypto/evp/e_aes_cbc_hmac_sha256.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_bf.c (renamed from drivers/builtin_openssl2/crypto/evp/e_bf.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_camellia.c (renamed from drivers/builtin_openssl2/crypto/evp/e_camellia.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_cast.c (renamed from drivers/builtin_openssl2/crypto/evp/e_cast.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_des.c (renamed from drivers/builtin_openssl2/crypto/evp/e_des.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_des3.c (renamed from drivers/builtin_openssl2/crypto/evp/e_des3.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_dsa.c (renamed from drivers/builtin_openssl2/crypto/evp/e_dsa.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_idea.c (renamed from drivers/builtin_openssl2/crypto/evp/e_idea.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_null.c (renamed from drivers/builtin_openssl2/crypto/evp/e_null.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_old.c (renamed from drivers/builtin_openssl2/crypto/evp/e_old.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_rc2.c (renamed from drivers/builtin_openssl2/crypto/evp/e_rc2.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_rc4.c (renamed from drivers/builtin_openssl2/crypto/evp/e_rc4.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_rc4_hmac_md5.c (renamed from drivers/builtin_openssl2/crypto/evp/e_rc4_hmac_md5.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_rc5.c (renamed from drivers/builtin_openssl2/crypto/evp/e_rc5.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_seed.c (renamed from drivers/builtin_openssl2/crypto/evp/e_seed.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/e_xcbc_d.c (renamed from drivers/builtin_openssl2/crypto/evp/e_xcbc_d.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/encode.c (renamed from drivers/builtin_openssl2/crypto/evp/encode.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_acnf.c (renamed from drivers/builtin_openssl2/crypto/evp/evp_acnf.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_cnf.c (renamed from drivers/builtin_openssl2/crypto/evp/evp_cnf.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_enc.c (renamed from drivers/builtin_openssl2/crypto/evp/evp_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_err.c (renamed from drivers/builtin_openssl2/crypto/evp/evp_err.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_key.c (renamed from drivers/builtin_openssl2/crypto/evp/evp_key.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_lib.c (renamed from drivers/builtin_openssl2/crypto/evp/evp_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_locl.h (renamed from drivers/builtin_openssl2/crypto/evp/evp_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_pbe.c (renamed from drivers/builtin_openssl2/crypto/evp/evp_pbe.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evp_pkey.c (renamed from drivers/builtin_openssl2/crypto/evp/evp_pkey.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/evptests.txt (renamed from drivers/builtin_openssl2/crypto/evp/evptests.txt)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_dss.c (renamed from drivers/builtin_openssl2/crypto/evp/m_dss.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_dss1.c (renamed from drivers/builtin_openssl2/crypto/evp/m_dss1.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_ecdsa.c (renamed from drivers/builtin_openssl2/crypto/evp/m_ecdsa.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_md2.c (renamed from drivers/builtin_openssl2/crypto/evp/m_md2.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_md4.c (renamed from drivers/builtin_openssl2/crypto/evp/m_md4.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_md5.c (renamed from drivers/builtin_openssl2/crypto/evp/m_md5.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_mdc2.c (renamed from drivers/builtin_openssl2/crypto/evp/m_mdc2.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_null.c (renamed from drivers/builtin_openssl2/crypto/evp/m_null.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_ripemd.c (renamed from drivers/builtin_openssl2/crypto/evp/m_ripemd.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_sha.c (renamed from drivers/builtin_openssl2/crypto/evp/m_sha.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_sha1.c (renamed from drivers/builtin_openssl2/crypto/evp/m_sha1.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_sigver.c (renamed from drivers/builtin_openssl2/crypto/evp/m_sigver.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/m_wp.c (renamed from drivers/builtin_openssl2/crypto/evp/m_wp.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/names.c (renamed from drivers/builtin_openssl2/crypto/evp/names.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/openbsd_hw.c (renamed from drivers/builtin_openssl2/crypto/evp/openbsd_hw.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p5_crpt.c (renamed from drivers/builtin_openssl2/crypto/evp/p5_crpt.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p5_crpt2.c (renamed from drivers/builtin_openssl2/crypto/evp/p5_crpt2.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p_dec.c (renamed from drivers/builtin_openssl2/crypto/evp/p_dec.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p_enc.c (renamed from drivers/builtin_openssl2/crypto/evp/p_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p_lib.c (renamed from drivers/builtin_openssl2/crypto/evp/p_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p_open.c (renamed from drivers/builtin_openssl2/crypto/evp/p_open.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p_seal.c (renamed from drivers/builtin_openssl2/crypto/evp/p_seal.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p_sign.c (renamed from drivers/builtin_openssl2/crypto/evp/p_sign.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/p_verify.c (renamed from drivers/builtin_openssl2/crypto/evp/p_verify.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/pmeth_fn.c (renamed from drivers/builtin_openssl2/crypto/evp/pmeth_fn.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/pmeth_gn.c (renamed from drivers/builtin_openssl2/crypto/evp/pmeth_gn.c)0
-rw-r--r--thirdparty/openssl/crypto/evp/pmeth_lib.c (renamed from drivers/builtin_openssl2/crypto/evp/pmeth_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/ex_data.c (renamed from drivers/builtin_openssl2/crypto/ex_data.c)0
-rw-r--r--thirdparty/openssl/crypto/fips_err.h (renamed from drivers/builtin_openssl2/crypto/fips_err.h)0
-rw-r--r--thirdparty/openssl/crypto/fips_ers.c (renamed from drivers/builtin_openssl2/crypto/fips_ers.c)0
-rw-r--r--thirdparty/openssl/crypto/hmac/hm_ameth.c (renamed from drivers/builtin_openssl2/crypto/hmac/hm_ameth.c)0
-rw-r--r--thirdparty/openssl/crypto/hmac/hm_pmeth.c (renamed from drivers/builtin_openssl2/crypto/hmac/hm_pmeth.c)0
-rw-r--r--thirdparty/openssl/crypto/hmac/hmac.c (renamed from drivers/builtin_openssl2/crypto/hmac/hmac.c)0
-rw-r--r--thirdparty/openssl/crypto/idea/i_cbc.c (renamed from drivers/builtin_openssl2/crypto/idea/i_cbc.c)0
-rw-r--r--thirdparty/openssl/crypto/idea/i_cfb64.c (renamed from drivers/builtin_openssl2/crypto/idea/i_cfb64.c)0
-rw-r--r--thirdparty/openssl/crypto/idea/i_ecb.c (renamed from drivers/builtin_openssl2/crypto/idea/i_ecb.c)0
-rw-r--r--thirdparty/openssl/crypto/idea/i_ofb64.c (renamed from drivers/builtin_openssl2/crypto/idea/i_ofb64.c)0
-rw-r--r--thirdparty/openssl/crypto/idea/i_skey.c (renamed from drivers/builtin_openssl2/crypto/idea/i_skey.c)0
-rw-r--r--thirdparty/openssl/crypto/idea/idea_lcl.h (renamed from drivers/builtin_openssl2/crypto/idea/idea_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/idea/idea_spd.c (renamed from drivers/builtin_openssl2/crypto/idea/idea_spd.c)0
-rw-r--r--thirdparty/openssl/crypto/idea/version (renamed from drivers/builtin_openssl2/crypto/idea/version)0
-rwxr-xr-xthirdparty/openssl/crypto/install-crypto.com (renamed from drivers/builtin_openssl2/crypto/install-crypto.com)0
-rw-r--r--thirdparty/openssl/crypto/jpake/jpake.c (renamed from drivers/builtin_openssl2/crypto/jpake/jpake.c)0
-rw-r--r--thirdparty/openssl/crypto/jpake/jpake.h (renamed from drivers/builtin_openssl2/crypto/jpake/jpake.h)0
-rw-r--r--thirdparty/openssl/crypto/jpake/jpake_err.c (renamed from drivers/builtin_openssl2/crypto/jpake/jpake_err.c)0
-rw-r--r--thirdparty/openssl/crypto/krb5/krb5_asn.c (renamed from drivers/builtin_openssl2/crypto/krb5/krb5_asn.c)0
-rw-r--r--thirdparty/openssl/crypto/lhash/lh_stats.c (renamed from drivers/builtin_openssl2/crypto/lhash/lh_stats.c)0
-rw-r--r--thirdparty/openssl/crypto/lhash/lhash.c (renamed from drivers/builtin_openssl2/crypto/lhash/lhash.c)0
-rw-r--r--thirdparty/openssl/crypto/md2/md2.c (renamed from drivers/builtin_openssl2/crypto/md2/md2.c)0
-rw-r--r--thirdparty/openssl/crypto/md2/md2.h (renamed from drivers/builtin_openssl2/crypto/md2/md2.h)0
-rw-r--r--thirdparty/openssl/crypto/md2/md2_dgst.c (renamed from drivers/builtin_openssl2/crypto/md2/md2_dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/md2/md2_one.c (renamed from drivers/builtin_openssl2/crypto/md2/md2_one.c)0
-rw-r--r--thirdparty/openssl/crypto/md32_common.h (renamed from drivers/builtin_openssl2/crypto/md32_common.h)0
-rw-r--r--thirdparty/openssl/crypto/md4/md4.c (renamed from drivers/builtin_openssl2/crypto/md4/md4.c)0
-rw-r--r--thirdparty/openssl/crypto/md4/md4_dgst.c (renamed from drivers/builtin_openssl2/crypto/md4/md4_dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/md4/md4_locl.h (renamed from drivers/builtin_openssl2/crypto/md4/md4_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/md4/md4_one.c (renamed from drivers/builtin_openssl2/crypto/md4/md4_one.c)0
-rw-r--r--thirdparty/openssl/crypto/md4/md4s.cpp (renamed from drivers/builtin_openssl2/crypto/md4/md4s.cpp)0
-rw-r--r--thirdparty/openssl/crypto/md5/md5.c (renamed from drivers/builtin_openssl2/crypto/md5/md5.c)0
-rw-r--r--thirdparty/openssl/crypto/md5/md5_dgst.c (renamed from drivers/builtin_openssl2/crypto/md5/md5_dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/md5/md5_locl.h (renamed from drivers/builtin_openssl2/crypto/md5/md5_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/md5/md5_one.c (renamed from drivers/builtin_openssl2/crypto/md5/md5_one.c)0
-rw-r--r--thirdparty/openssl/crypto/md5/md5s.cpp (renamed from drivers/builtin_openssl2/crypto/md5/md5s.cpp)0
-rw-r--r--thirdparty/openssl/crypto/mdc2/mdc2_one.c (renamed from drivers/builtin_openssl2/crypto/mdc2/mdc2_one.c)0
-rw-r--r--thirdparty/openssl/crypto/mdc2/mdc2dgst.c (renamed from drivers/builtin_openssl2/crypto/mdc2/mdc2dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/mem.c (renamed from drivers/builtin_openssl2/crypto/mem.c)0
-rw-r--r--thirdparty/openssl/crypto/mem_clr.c (renamed from drivers/builtin_openssl2/crypto/mem_clr.c)0
-rw-r--r--thirdparty/openssl/crypto/mem_dbg.c (renamed from drivers/builtin_openssl2/crypto/mem_dbg.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/cbc128.c (renamed from drivers/builtin_openssl2/crypto/modes/cbc128.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/ccm128.c (renamed from drivers/builtin_openssl2/crypto/modes/ccm128.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/cfb128.c (renamed from drivers/builtin_openssl2/crypto/modes/cfb128.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/ctr128.c (renamed from drivers/builtin_openssl2/crypto/modes/ctr128.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/cts128.c (renamed from drivers/builtin_openssl2/crypto/modes/cts128.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/gcm128.c (renamed from drivers/builtin_openssl2/crypto/modes/gcm128.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/modes_lcl.h (renamed from drivers/builtin_openssl2/crypto/modes/modes_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/modes/ofb128.c (renamed from drivers/builtin_openssl2/crypto/modes/ofb128.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/wrap128.c (renamed from drivers/builtin_openssl2/crypto/modes/wrap128.c)0
-rw-r--r--thirdparty/openssl/crypto/modes/xts128.c (renamed from drivers/builtin_openssl2/crypto/modes/xts128.c)0
-rw-r--r--thirdparty/openssl/crypto/o_dir.c (renamed from drivers/builtin_openssl2/crypto/o_dir.c)0
-rw-r--r--thirdparty/openssl/crypto/o_dir.h (renamed from drivers/builtin_openssl2/crypto/o_dir.h)0
-rw-r--r--thirdparty/openssl/crypto/o_fips.c (renamed from drivers/builtin_openssl2/crypto/o_fips.c)0
-rw-r--r--thirdparty/openssl/crypto/o_init.c (renamed from drivers/builtin_openssl2/crypto/o_init.c)0
-rw-r--r--thirdparty/openssl/crypto/o_str.c (renamed from drivers/builtin_openssl2/crypto/o_str.c)0
-rw-r--r--thirdparty/openssl/crypto/o_str.h (renamed from drivers/builtin_openssl2/crypto/o_str.h)0
-rw-r--r--thirdparty/openssl/crypto/o_time.c (renamed from drivers/builtin_openssl2/crypto/o_time.c)0
-rw-r--r--thirdparty/openssl/crypto/o_time.h (renamed from drivers/builtin_openssl2/crypto/o_time.h)0
-rw-r--r--thirdparty/openssl/crypto/objects/o_names.c (renamed from drivers/builtin_openssl2/crypto/objects/o_names.c)0
-rw-r--r--thirdparty/openssl/crypto/objects/obj_dat.c (renamed from drivers/builtin_openssl2/crypto/objects/obj_dat.c)0
-rw-r--r--thirdparty/openssl/crypto/objects/obj_dat.h (renamed from drivers/builtin_openssl2/crypto/objects/obj_dat.h)0
-rw-r--r--thirdparty/openssl/crypto/objects/obj_err.c (renamed from drivers/builtin_openssl2/crypto/objects/obj_err.c)0
-rw-r--r--thirdparty/openssl/crypto/objects/obj_lib.c (renamed from drivers/builtin_openssl2/crypto/objects/obj_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/objects/obj_mac.num (renamed from drivers/builtin_openssl2/crypto/objects/obj_mac.num)0
-rw-r--r--thirdparty/openssl/crypto/objects/obj_xref.c (renamed from drivers/builtin_openssl2/crypto/objects/obj_xref.c)0
-rw-r--r--thirdparty/openssl/crypto/objects/obj_xref.h (renamed from drivers/builtin_openssl2/crypto/objects/obj_xref.h)0
-rw-r--r--thirdparty/openssl/crypto/objects/obj_xref.txt (renamed from drivers/builtin_openssl2/crypto/objects/obj_xref.txt)0
-rw-r--r--thirdparty/openssl/crypto/objects/objects.README (renamed from drivers/builtin_openssl2/crypto/objects/objects.README)0
-rw-r--r--thirdparty/openssl/crypto/objects/objects.txt (renamed from drivers/builtin_openssl2/crypto/objects/objects.txt)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_asn.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_asn.c)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_cl.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_cl.c)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_err.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_err.c)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_ext.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_ext.c)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_ht.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_ht.c)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_lib.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_prn.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_prn.c)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_srv.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_srv.c)0
-rw-r--r--thirdparty/openssl/crypto/ocsp/ocsp_vfy.c (renamed from drivers/builtin_openssl2/crypto/ocsp/ocsp_vfy.c)0
-rw-r--r--thirdparty/openssl/crypto/opensslconf.h.in (renamed from drivers/builtin_openssl2/crypto/opensslconf.h.in)0
-rw-r--r--thirdparty/openssl/crypto/pem/message (renamed from drivers/builtin_openssl2/crypto/pem/message)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_all.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_all.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_err.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_err.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_info.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_info.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_lib.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_oth.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_oth.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_pk8.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_pk8.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_pkey.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_pkey.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_seal.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_seal.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_sign.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_sign.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_x509.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_x509.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pem_xaux.c (renamed from drivers/builtin_openssl2/crypto/pem/pem_xaux.c)0
-rw-r--r--thirdparty/openssl/crypto/pem/pkcs7.lis (renamed from drivers/builtin_openssl2/crypto/pem/pkcs7.lis)0
-rw-r--r--thirdparty/openssl/crypto/pem/pvkfmt.c (renamed from drivers/builtin_openssl2/crypto/pem/pvkfmt.c)0
-rw-r--r--thirdparty/openssl/crypto/perlasm/readme (renamed from drivers/builtin_openssl2/crypto/perlasm/readme)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_add.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_add.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_asn.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_asn.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_attr.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_attr.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_crpt.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_crpt.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_crt.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_crt.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_decr.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_decr.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_init.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_init.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_key.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_key.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_kiss.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_kiss.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_mutl.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_mutl.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_npas.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_npas.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_p8d.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_p8d.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_p8e.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/p12_utl.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/p12_utl.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs12/pk12err.c (renamed from drivers/builtin_openssl2/crypto/pkcs12/pk12err.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/bio_pk7.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/bio_pk7.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pk7_asn1.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pk7_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pk7_attr.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pk7_attr.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pk7_dgst.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pk7_dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pk7_doit.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pk7_doit.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pk7_enc.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pk7_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pk7_lib.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pk7_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pk7_mime.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pk7_mime.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pk7_smime.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pk7_smime.c)0
-rw-r--r--thirdparty/openssl/crypto/pkcs7/pkcs7err.c (renamed from drivers/builtin_openssl2/crypto/pkcs7/pkcs7err.c)0
-rw-r--r--thirdparty/openssl/crypto/ppc_arch.h (renamed from drivers/builtin_openssl2/crypto/ppc_arch.h)0
-rw-r--r--thirdparty/openssl/crypto/ppccap.c (renamed from drivers/builtin_openssl2/crypto/ppccap.c)0
-rw-r--r--thirdparty/openssl/crypto/pqueue/pqueue.c (renamed from drivers/builtin_openssl2/crypto/pqueue/pqueue.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/md_rand.c (renamed from drivers/builtin_openssl2/crypto/rand/md_rand.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_egd.c (renamed from drivers/builtin_openssl2/crypto/rand/rand_egd.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_err.c (renamed from drivers/builtin_openssl2/crypto/rand/rand_err.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_lcl.h (renamed from drivers/builtin_openssl2/crypto/rand/rand_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_lib.c (renamed from drivers/builtin_openssl2/crypto/rand/rand_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_nw.c (renamed from drivers/builtin_openssl2/crypto/rand/rand_nw.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_os2.c (renamed from drivers/builtin_openssl2/crypto/rand/rand_os2.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_unix.c (renamed from drivers/builtin_openssl2/crypto/rand/rand_unix.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_vms.c (renamed from drivers/builtin_openssl2/crypto/rand/rand_vms.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/rand_win.c (renamed from drivers/builtin_openssl2/crypto/rand/rand_win.c)0
-rw-r--r--thirdparty/openssl/crypto/rand/randfile.c (renamed from drivers/builtin_openssl2/crypto/rand/randfile.c)0
-rw-r--r--thirdparty/openssl/crypto/rc2/rc2_cbc.c (renamed from drivers/builtin_openssl2/crypto/rc2/rc2_cbc.c)0
-rw-r--r--thirdparty/openssl/crypto/rc2/rc2_ecb.c (renamed from drivers/builtin_openssl2/crypto/rc2/rc2_ecb.c)0
-rw-r--r--thirdparty/openssl/crypto/rc2/rc2_locl.h (renamed from drivers/builtin_openssl2/crypto/rc2/rc2_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/rc2/rc2_skey.c (renamed from drivers/builtin_openssl2/crypto/rc2/rc2_skey.c)0
-rw-r--r--thirdparty/openssl/crypto/rc2/rc2cfb64.c (renamed from drivers/builtin_openssl2/crypto/rc2/rc2cfb64.c)0
-rw-r--r--thirdparty/openssl/crypto/rc2/rc2ofb64.c (renamed from drivers/builtin_openssl2/crypto/rc2/rc2ofb64.c)0
-rw-r--r--thirdparty/openssl/crypto/rc2/rc2speed.c (renamed from drivers/builtin_openssl2/crypto/rc2/rc2speed.c)0
-rw-r--r--thirdparty/openssl/crypto/rc2/rrc2.doc (renamed from drivers/builtin_openssl2/crypto/rc2/rrc2.doc)0
-rw-r--r--thirdparty/openssl/crypto/rc2/tab.c (renamed from drivers/builtin_openssl2/crypto/rc2/tab.c)0
-rw-r--r--thirdparty/openssl/crypto/rc2/version (renamed from drivers/builtin_openssl2/crypto/rc2/version)0
-rw-r--r--thirdparty/openssl/crypto/rc4/rc4.c (renamed from drivers/builtin_openssl2/crypto/rc4/rc4.c)0
-rw-r--r--thirdparty/openssl/crypto/rc4/rc4_enc.c (renamed from drivers/builtin_openssl2/crypto/rc4/rc4_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/rc4/rc4_locl.h (renamed from drivers/builtin_openssl2/crypto/rc4/rc4_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/rc4/rc4_skey.c (renamed from drivers/builtin_openssl2/crypto/rc4/rc4_skey.c)0
-rw-r--r--thirdparty/openssl/crypto/rc4/rc4_utl.c (renamed from drivers/builtin_openssl2/crypto/rc4/rc4_utl.c)0
-rw-r--r--thirdparty/openssl/crypto/rc4/rc4s.cpp (renamed from drivers/builtin_openssl2/crypto/rc4/rc4s.cpp)0
-rw-r--r--thirdparty/openssl/crypto/rc4/rc4speed.c (renamed from drivers/builtin_openssl2/crypto/rc4/rc4speed.c)0
-rw-r--r--thirdparty/openssl/crypto/rc4/rrc4.doc (renamed from drivers/builtin_openssl2/crypto/rc4/rrc4.doc)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5.h (renamed from drivers/builtin_openssl2/crypto/rc5/rc5.h)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5_ecb.c (renamed from drivers/builtin_openssl2/crypto/rc5/rc5_ecb.c)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5_enc.c (renamed from drivers/builtin_openssl2/crypto/rc5/rc5_enc.c)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5_locl.h (renamed from drivers/builtin_openssl2/crypto/rc5/rc5_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5_skey.c (renamed from drivers/builtin_openssl2/crypto/rc5/rc5_skey.c)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5cfb64.c (renamed from drivers/builtin_openssl2/crypto/rc5/rc5cfb64.c)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5ofb64.c (renamed from drivers/builtin_openssl2/crypto/rc5/rc5ofb64.c)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5s.cpp (renamed from drivers/builtin_openssl2/crypto/rc5/rc5s.cpp)0
-rw-r--r--thirdparty/openssl/crypto/rc5/rc5speed.c (renamed from drivers/builtin_openssl2/crypto/rc5/rc5speed.c)0
-rw-r--r--thirdparty/openssl/crypto/ripemd/README (renamed from drivers/builtin_openssl2/crypto/ripemd/README)0
-rw-r--r--thirdparty/openssl/crypto/ripemd/asm/rips.cpp (renamed from drivers/builtin_openssl2/crypto/ripemd/asm/rips.cpp)0
-rw-r--r--thirdparty/openssl/crypto/ripemd/rmd160.c (renamed from drivers/builtin_openssl2/crypto/ripemd/rmd160.c)0
-rw-r--r--thirdparty/openssl/crypto/ripemd/rmd_dgst.c (renamed from drivers/builtin_openssl2/crypto/ripemd/rmd_dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/ripemd/rmd_locl.h (renamed from drivers/builtin_openssl2/crypto/ripemd/rmd_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/ripemd/rmd_one.c (renamed from drivers/builtin_openssl2/crypto/ripemd/rmd_one.c)0
-rw-r--r--thirdparty/openssl/crypto/ripemd/rmdconst.h (renamed from drivers/builtin_openssl2/crypto/ripemd/rmdconst.h)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_ameth.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_ameth.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_asn1.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_chk.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_chk.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_crpt.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_crpt.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_depr.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_depr.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_eay.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_eay.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_err.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_err.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_gen.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_gen.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_lib.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_locl.h (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_none.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_none.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_null.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_null.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_oaep.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_oaep.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_pk1.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_pk1.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_pmeth.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_pmeth.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_prn.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_prn.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_pss.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_pss.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_saos.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_saos.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_sign.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_sign.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_ssl.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_ssl.c)0
-rw-r--r--thirdparty/openssl/crypto/rsa/rsa_x931.c (renamed from drivers/builtin_openssl2/crypto/rsa/rsa_x931.c)0
-rw-r--r--thirdparty/openssl/crypto/s390xcap.c (renamed from drivers/builtin_openssl2/crypto/s390xcap.c)0
-rw-r--r--thirdparty/openssl/crypto/seed/seed.c (renamed from drivers/builtin_openssl2/crypto/seed/seed.c)0
-rw-r--r--thirdparty/openssl/crypto/seed/seed_cbc.c (renamed from drivers/builtin_openssl2/crypto/seed/seed_cbc.c)0
-rw-r--r--thirdparty/openssl/crypto/seed/seed_cfb.c (renamed from drivers/builtin_openssl2/crypto/seed/seed_cfb.c)0
-rw-r--r--thirdparty/openssl/crypto/seed/seed_ecb.c (renamed from drivers/builtin_openssl2/crypto/seed/seed_ecb.c)0
-rw-r--r--thirdparty/openssl/crypto/seed/seed_locl.h (renamed from drivers/builtin_openssl2/crypto/seed/seed_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/seed/seed_ofb.c (renamed from drivers/builtin_openssl2/crypto/seed/seed_ofb.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/asm/README (renamed from drivers/builtin_openssl2/crypto/sha/asm/README)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha.c (renamed from drivers/builtin_openssl2/crypto/sha/sha.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha1.c (renamed from drivers/builtin_openssl2/crypto/sha/sha1.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha1_one.c (renamed from drivers/builtin_openssl2/crypto/sha/sha1_one.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha1dgst.c (renamed from drivers/builtin_openssl2/crypto/sha/sha1dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha256.c (renamed from drivers/builtin_openssl2/crypto/sha/sha256.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha256t.c (renamed from drivers/builtin_openssl2/crypto/sha/sha256t.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha512.c (renamed from drivers/builtin_openssl2/crypto/sha/sha512.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha512t.c (renamed from drivers/builtin_openssl2/crypto/sha/sha512t.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha_dgst.c (renamed from drivers/builtin_openssl2/crypto/sha/sha_dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha_locl.h (renamed from drivers/builtin_openssl2/crypto/sha/sha_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/sha/sha_one.c (renamed from drivers/builtin_openssl2/crypto/sha/sha_one.c)0
-rw-r--r--thirdparty/openssl/crypto/sparc_arch.h (renamed from drivers/builtin_openssl2/crypto/sparc_arch.h)0
-rw-r--r--thirdparty/openssl/crypto/sparcv9cap.c (renamed from drivers/builtin_openssl2/crypto/sparcv9cap.c)0
-rw-r--r--thirdparty/openssl/crypto/srp/srp_grps.h (renamed from drivers/builtin_openssl2/crypto/srp/srp_grps.h)0
-rw-r--r--thirdparty/openssl/crypto/srp/srp_lcl.h (renamed from drivers/builtin_openssl2/crypto/srp/srp_lcl.h)0
-rw-r--r--thirdparty/openssl/crypto/srp/srp_lib.c (renamed from drivers/builtin_openssl2/crypto/srp/srp_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/srp/srp_vfy.c (renamed from drivers/builtin_openssl2/crypto/srp/srp_vfy.c)0
-rw-r--r--thirdparty/openssl/crypto/stack/stack.c (renamed from drivers/builtin_openssl2/crypto/stack/stack.c)0
-rw-r--r--thirdparty/openssl/crypto/store/README (renamed from drivers/builtin_openssl2/crypto/store/README)0
-rw-r--r--thirdparty/openssl/crypto/store/store.h (renamed from drivers/builtin_openssl2/crypto/store/store.h)0
-rw-r--r--thirdparty/openssl/crypto/store/str_err.c (renamed from drivers/builtin_openssl2/crypto/store/str_err.c)0
-rw-r--r--thirdparty/openssl/crypto/store/str_lib.c (renamed from drivers/builtin_openssl2/crypto/store/str_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/store/str_locl.h (renamed from drivers/builtin_openssl2/crypto/store/str_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/store/str_mem.c (renamed from drivers/builtin_openssl2/crypto/store/str_mem.c)0
-rw-r--r--thirdparty/openssl/crypto/store/str_meth.c (renamed from drivers/builtin_openssl2/crypto/store/str_meth.c)0
-rw-r--r--thirdparty/openssl/crypto/threads/README (renamed from drivers/builtin_openssl2/crypto/threads/README)0
-rw-r--r--thirdparty/openssl/crypto/threads/netware.bat (renamed from drivers/builtin_openssl2/crypto/threads/netware.bat)0
-rw-r--r--thirdparty/openssl/crypto/threads/profile.sh (renamed from drivers/builtin_openssl2/crypto/threads/profile.sh)0
-rwxr-xr-xthirdparty/openssl/crypto/threads/ptest.bat (renamed from drivers/builtin_openssl2/crypto/threads/ptest.bat)0
-rw-r--r--thirdparty/openssl/crypto/threads/pthread.sh (renamed from drivers/builtin_openssl2/crypto/threads/pthread.sh)0
-rwxr-xr-xthirdparty/openssl/crypto/threads/pthread2.sh (renamed from drivers/builtin_openssl2/crypto/threads/pthread2.sh)0
-rw-r--r--thirdparty/openssl/crypto/threads/pthreads-vms.com (renamed from drivers/builtin_openssl2/crypto/threads/pthreads-vms.com)0
-rw-r--r--thirdparty/openssl/crypto/threads/purify.sh (renamed from drivers/builtin_openssl2/crypto/threads/purify.sh)0
-rw-r--r--thirdparty/openssl/crypto/threads/solaris.sh (renamed from drivers/builtin_openssl2/crypto/threads/solaris.sh)0
-rw-r--r--thirdparty/openssl/crypto/threads/th-lock.c (renamed from drivers/builtin_openssl2/crypto/threads/th-lock.c)0
-rwxr-xr-xthirdparty/openssl/crypto/threads/win32.bat (renamed from drivers/builtin_openssl2/crypto/threads/win32.bat)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_asn1.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_asn1.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_conf.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_conf.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_err.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_err.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_lib.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_req_print.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_req_print.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_req_utils.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_req_utils.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_rsp_print.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_rsp_print.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_rsp_sign.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_rsp_sign.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_rsp_utils.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_rsp_utils.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_rsp_verify.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_rsp_verify.c)0
-rw-r--r--thirdparty/openssl/crypto/ts/ts_verify_ctx.c (renamed from drivers/builtin_openssl2/crypto/ts/ts_verify_ctx.c)0
-rw-r--r--thirdparty/openssl/crypto/txt_db/txt_db.c (renamed from drivers/builtin_openssl2/crypto/txt_db/txt_db.c)0
-rw-r--r--thirdparty/openssl/crypto/ui/ui_compat.c (renamed from drivers/builtin_openssl2/crypto/ui/ui_compat.c)0
-rw-r--r--thirdparty/openssl/crypto/ui/ui_err.c (renamed from drivers/builtin_openssl2/crypto/ui/ui_err.c)0
-rw-r--r--thirdparty/openssl/crypto/ui/ui_lib.c (renamed from drivers/builtin_openssl2/crypto/ui/ui_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/ui/ui_locl.h (renamed from drivers/builtin_openssl2/crypto/ui/ui_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/ui/ui_openssl.c (renamed from drivers/builtin_openssl2/crypto/ui/ui_openssl.c)0
-rw-r--r--thirdparty/openssl/crypto/ui/ui_util.c (renamed from drivers/builtin_openssl2/crypto/ui/ui_util.c)0
-rw-r--r--thirdparty/openssl/crypto/uid.c (renamed from drivers/builtin_openssl2/crypto/uid.c)0
-rw-r--r--thirdparty/openssl/crypto/vms_rms.h (renamed from drivers/builtin_openssl2/crypto/vms_rms.h)0
-rw-r--r--thirdparty/openssl/crypto/whrlpool/wp_block.c (renamed from drivers/builtin_openssl2/crypto/whrlpool/wp_block.c)0
-rw-r--r--thirdparty/openssl/crypto/whrlpool/wp_dgst.c (renamed from drivers/builtin_openssl2/crypto/whrlpool/wp_dgst.c)0
-rw-r--r--thirdparty/openssl/crypto/whrlpool/wp_locl.h (renamed from drivers/builtin_openssl2/crypto/whrlpool/wp_locl.h)0
-rw-r--r--thirdparty/openssl/crypto/x509/by_dir.c (renamed from drivers/builtin_openssl2/crypto/x509/by_dir.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/by_file.c (renamed from drivers/builtin_openssl2/crypto/x509/by_file.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/vpm_int.h (renamed from drivers/builtin_openssl2/crypto/x509/vpm_int.h)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_att.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_att.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_cmp.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_cmp.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_d2.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_d2.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_def.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_def.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_err.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_err.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_ext.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_ext.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_lu.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_lu.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_obj.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_obj.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_r2x.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_r2x.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_req.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_req.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_set.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_set.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_trs.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_trs.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_txt.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_txt.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_v3.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_v3.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_vfy.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_vfy.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509_vpm.c (renamed from drivers/builtin_openssl2/crypto/x509/x509_vpm.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509cset.c (renamed from drivers/builtin_openssl2/crypto/x509/x509cset.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509name.c (renamed from drivers/builtin_openssl2/crypto/x509/x509name.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509rset.c (renamed from drivers/builtin_openssl2/crypto/x509/x509rset.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509spki.c (renamed from drivers/builtin_openssl2/crypto/x509/x509spki.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x509type.c (renamed from drivers/builtin_openssl2/crypto/x509/x509type.c)0
-rw-r--r--thirdparty/openssl/crypto/x509/x_all.c (renamed from drivers/builtin_openssl2/crypto/x509/x_all.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/ext_dat.h (renamed from drivers/builtin_openssl2/crypto/x509v3/ext_dat.h)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/pcy_cache.c (renamed from drivers/builtin_openssl2/crypto/x509v3/pcy_cache.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/pcy_data.c (renamed from drivers/builtin_openssl2/crypto/x509v3/pcy_data.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/pcy_int.h (renamed from drivers/builtin_openssl2/crypto/x509v3/pcy_int.h)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/pcy_lib.c (renamed from drivers/builtin_openssl2/crypto/x509v3/pcy_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/pcy_map.c (renamed from drivers/builtin_openssl2/crypto/x509v3/pcy_map.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/pcy_node.c (renamed from drivers/builtin_openssl2/crypto/x509v3/pcy_node.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/pcy_tree.c (renamed from drivers/builtin_openssl2/crypto/x509v3/pcy_tree.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_addr.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_addr.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_akey.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_akey.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_akeya.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_akeya.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_alt.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_alt.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_asid.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_asid.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_bcons.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_bcons.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_bitst.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_bitst.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_conf.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_conf.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_cpols.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_cpols.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_crld.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_crld.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_enum.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_enum.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_extku.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_extku.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_genn.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_genn.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_ia5.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_ia5.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_info.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_info.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_int.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_int.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_lib.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_lib.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_ncons.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_ncons.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_ocsp.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_ocsp.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_pci.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_pci.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_pcia.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_pcia.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_pcons.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_pcons.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_pku.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_pku.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_pmaps.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_pmaps.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_prn.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_prn.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_purp.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_purp.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_scts.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_scts.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_skey.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_skey.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_sxnet.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_sxnet.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_utl.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3_utl.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3conf.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3conf.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3err.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3err.c)0
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3prin.c (renamed from drivers/builtin_openssl2/crypto/x509v3/v3prin.c)0
-rw-r--r--thirdparty/openssl/e_os.h (renamed from drivers/builtin_openssl2/e_os.h)0
-rw-r--r--thirdparty/openssl/openssl/aes.h (renamed from drivers/builtin_openssl2/openssl/aes.h)0
-rw-r--r--thirdparty/openssl/openssl/asn1.h (renamed from drivers/builtin_openssl2/openssl/asn1.h)0
-rw-r--r--thirdparty/openssl/openssl/asn1_mac.h (renamed from drivers/builtin_openssl2/openssl/asn1_mac.h)0
-rw-r--r--thirdparty/openssl/openssl/asn1t.h (renamed from drivers/builtin_openssl2/openssl/asn1t.h)0
-rw-r--r--thirdparty/openssl/openssl/bio.h (renamed from drivers/builtin_openssl2/openssl/bio.h)0
-rw-r--r--thirdparty/openssl/openssl/blowfish.h (renamed from drivers/builtin_openssl2/openssl/blowfish.h)0
-rw-r--r--thirdparty/openssl/openssl/bn.h (renamed from drivers/builtin_openssl2/openssl/bn.h)0
-rw-r--r--thirdparty/openssl/openssl/buffer.h (renamed from drivers/builtin_openssl2/openssl/buffer.h)0
-rw-r--r--thirdparty/openssl/openssl/camellia.h (renamed from drivers/builtin_openssl2/openssl/camellia.h)0
-rw-r--r--thirdparty/openssl/openssl/cast.h (renamed from drivers/builtin_openssl2/openssl/cast.h)0
-rw-r--r--thirdparty/openssl/openssl/cmac.h (renamed from drivers/builtin_openssl2/openssl/cmac.h)0
-rw-r--r--thirdparty/openssl/openssl/cms.h (renamed from drivers/builtin_openssl2/openssl/cms.h)0
-rw-r--r--thirdparty/openssl/openssl/comp.h (renamed from drivers/builtin_openssl2/openssl/comp.h)0
-rw-r--r--thirdparty/openssl/openssl/conf.h (renamed from drivers/builtin_openssl2/openssl/conf.h)0
-rw-r--r--thirdparty/openssl/openssl/conf_api.h (renamed from drivers/builtin_openssl2/openssl/conf_api.h)0
-rw-r--r--thirdparty/openssl/openssl/crypto.h (renamed from drivers/builtin_openssl2/openssl/crypto.h)0
-rw-r--r--thirdparty/openssl/openssl/des.h (renamed from drivers/builtin_openssl2/openssl/des.h)0
-rw-r--r--thirdparty/openssl/openssl/des_old.h (renamed from drivers/builtin_openssl2/openssl/des_old.h)0
-rw-r--r--thirdparty/openssl/openssl/dh.h (renamed from drivers/builtin_openssl2/openssl/dh.h)0
-rw-r--r--thirdparty/openssl/openssl/dsa.h (renamed from drivers/builtin_openssl2/openssl/dsa.h)0
-rw-r--r--thirdparty/openssl/openssl/dso.h (renamed from drivers/builtin_openssl2/openssl/dso.h)0
-rw-r--r--thirdparty/openssl/openssl/dtls1.h (renamed from drivers/builtin_openssl2/openssl/dtls1.h)0
-rw-r--r--thirdparty/openssl/openssl/e_os2.h (renamed from drivers/builtin_openssl2/openssl/e_os2.h)0
-rw-r--r--thirdparty/openssl/openssl/ebcdic.h (renamed from drivers/builtin_openssl2/openssl/ebcdic.h)0
-rw-r--r--thirdparty/openssl/openssl/ec.h (renamed from drivers/builtin_openssl2/openssl/ec.h)0
-rw-r--r--thirdparty/openssl/openssl/ecdh.h (renamed from drivers/builtin_openssl2/openssl/ecdh.h)0
-rw-r--r--thirdparty/openssl/openssl/ecdsa.h (renamed from drivers/builtin_openssl2/openssl/ecdsa.h)0
-rw-r--r--thirdparty/openssl/openssl/engine.h (renamed from drivers/builtin_openssl2/openssl/engine.h)0
-rw-r--r--thirdparty/openssl/openssl/err.h (renamed from drivers/builtin_openssl2/openssl/err.h)0
-rw-r--r--thirdparty/openssl/openssl/evp.h (renamed from drivers/builtin_openssl2/openssl/evp.h)0
-rw-r--r--thirdparty/openssl/openssl/hmac.h (renamed from drivers/builtin_openssl2/openssl/hmac.h)0
-rw-r--r--thirdparty/openssl/openssl/idea.h (renamed from drivers/builtin_openssl2/openssl/idea.h)0
-rw-r--r--thirdparty/openssl/openssl/krb5_asn.h (renamed from drivers/builtin_openssl2/openssl/krb5_asn.h)0
-rw-r--r--thirdparty/openssl/openssl/kssl.h (renamed from drivers/builtin_openssl2/openssl/kssl.h)0
-rw-r--r--thirdparty/openssl/openssl/lhash.h (renamed from drivers/builtin_openssl2/openssl/lhash.h)0
-rw-r--r--thirdparty/openssl/openssl/md4.h (renamed from drivers/builtin_openssl2/openssl/md4.h)0
-rw-r--r--thirdparty/openssl/openssl/md5.h (renamed from drivers/builtin_openssl2/openssl/md5.h)0
-rw-r--r--thirdparty/openssl/openssl/mdc2.h (renamed from drivers/builtin_openssl2/openssl/mdc2.h)0
-rw-r--r--thirdparty/openssl/openssl/modes.h (renamed from drivers/builtin_openssl2/openssl/modes.h)0
-rw-r--r--thirdparty/openssl/openssl/obj_mac.h (renamed from drivers/builtin_openssl2/openssl/obj_mac.h)0
-rw-r--r--thirdparty/openssl/openssl/objects.h (renamed from drivers/builtin_openssl2/openssl/objects.h)0
-rw-r--r--thirdparty/openssl/openssl/ocsp.h (renamed from drivers/builtin_openssl2/openssl/ocsp.h)0
-rw-r--r--thirdparty/openssl/openssl/opensslconf.h (renamed from drivers/builtin_openssl2/openssl/opensslconf.h)0
-rw-r--r--thirdparty/openssl/openssl/opensslv.h (renamed from drivers/builtin_openssl2/openssl/opensslv.h)0
-rw-r--r--thirdparty/openssl/openssl/ossl_typ.h (renamed from drivers/builtin_openssl2/openssl/ossl_typ.h)0
-rw-r--r--thirdparty/openssl/openssl/pem.h (renamed from drivers/builtin_openssl2/openssl/pem.h)0
-rw-r--r--thirdparty/openssl/openssl/pem2.h (renamed from drivers/builtin_openssl2/openssl/pem2.h)0
-rw-r--r--thirdparty/openssl/openssl/pkcs12.h (renamed from drivers/builtin_openssl2/openssl/pkcs12.h)0
-rw-r--r--thirdparty/openssl/openssl/pkcs7.h (renamed from drivers/builtin_openssl2/openssl/pkcs7.h)0
-rw-r--r--thirdparty/openssl/openssl/pqueue.h (renamed from drivers/builtin_openssl2/openssl/pqueue.h)0
-rw-r--r--thirdparty/openssl/openssl/rand.h (renamed from drivers/builtin_openssl2/openssl/rand.h)0
-rw-r--r--thirdparty/openssl/openssl/rc2.h (renamed from drivers/builtin_openssl2/openssl/rc2.h)0
-rw-r--r--thirdparty/openssl/openssl/rc4.h (renamed from drivers/builtin_openssl2/openssl/rc4.h)0
-rw-r--r--thirdparty/openssl/openssl/ripemd.h (renamed from drivers/builtin_openssl2/openssl/ripemd.h)0
-rw-r--r--thirdparty/openssl/openssl/rsa.h (renamed from drivers/builtin_openssl2/openssl/rsa.h)0
-rw-r--r--thirdparty/openssl/openssl/safestack.h (renamed from drivers/builtin_openssl2/openssl/safestack.h)0
-rw-r--r--thirdparty/openssl/openssl/seed.h (renamed from drivers/builtin_openssl2/openssl/seed.h)0
-rw-r--r--thirdparty/openssl/openssl/sha.h (renamed from drivers/builtin_openssl2/openssl/sha.h)0
-rw-r--r--thirdparty/openssl/openssl/srp.h (renamed from drivers/builtin_openssl2/openssl/srp.h)0
-rw-r--r--thirdparty/openssl/openssl/srtp.h (renamed from drivers/builtin_openssl2/openssl/srtp.h)0
-rw-r--r--thirdparty/openssl/openssl/ssl.h (renamed from drivers/builtin_openssl2/openssl/ssl.h)0
-rw-r--r--thirdparty/openssl/openssl/ssl2.h (renamed from drivers/builtin_openssl2/openssl/ssl2.h)0
-rw-r--r--thirdparty/openssl/openssl/ssl23.h (renamed from drivers/builtin_openssl2/openssl/ssl23.h)0
-rw-r--r--thirdparty/openssl/openssl/ssl3.h (renamed from drivers/builtin_openssl2/openssl/ssl3.h)0
-rw-r--r--thirdparty/openssl/openssl/stack.h (renamed from drivers/builtin_openssl2/openssl/stack.h)0
-rw-r--r--thirdparty/openssl/openssl/symhacks.h (renamed from drivers/builtin_openssl2/openssl/symhacks.h)0
-rw-r--r--thirdparty/openssl/openssl/tls1.h (renamed from drivers/builtin_openssl2/openssl/tls1.h)0
-rw-r--r--thirdparty/openssl/openssl/ts.h (renamed from drivers/builtin_openssl2/openssl/ts.h)0
-rw-r--r--thirdparty/openssl/openssl/txt_db.h (renamed from drivers/builtin_openssl2/openssl/txt_db.h)0
-rw-r--r--thirdparty/openssl/openssl/ui.h (renamed from drivers/builtin_openssl2/openssl/ui.h)0
-rw-r--r--thirdparty/openssl/openssl/ui_compat.h (renamed from drivers/builtin_openssl2/openssl/ui_compat.h)0
-rw-r--r--thirdparty/openssl/openssl/whrlpool.h (renamed from drivers/builtin_openssl2/openssl/whrlpool.h)0
-rw-r--r--thirdparty/openssl/openssl/x509.h (renamed from drivers/builtin_openssl2/openssl/x509.h)0
-rw-r--r--thirdparty/openssl/openssl/x509_vfy.h (renamed from drivers/builtin_openssl2/openssl/x509_vfy.h)0
-rw-r--r--thirdparty/openssl/openssl/x509v3.h (renamed from drivers/builtin_openssl2/openssl/x509v3.h)0
-rw-r--r--thirdparty/openssl/ssl/bio_ssl.c (renamed from drivers/builtin_openssl2/ssl/bio_ssl.c)0
-rw-r--r--thirdparty/openssl/ssl/d1_both.c (renamed from drivers/builtin_openssl2/ssl/d1_both.c)0
-rw-r--r--thirdparty/openssl/ssl/d1_clnt.c (renamed from drivers/builtin_openssl2/ssl/d1_clnt.c)0
-rw-r--r--thirdparty/openssl/ssl/d1_lib.c (renamed from drivers/builtin_openssl2/ssl/d1_lib.c)0
-rw-r--r--thirdparty/openssl/ssl/d1_meth.c (renamed from drivers/builtin_openssl2/ssl/d1_meth.c)0
-rw-r--r--thirdparty/openssl/ssl/d1_pkt.c (renamed from drivers/builtin_openssl2/ssl/d1_pkt.c)0
-rw-r--r--thirdparty/openssl/ssl/d1_srtp.c (renamed from drivers/builtin_openssl2/ssl/d1_srtp.c)0
-rw-r--r--thirdparty/openssl/ssl/d1_srvr.c (renamed from drivers/builtin_openssl2/ssl/d1_srvr.c)0
-rwxr-xr-xthirdparty/openssl/ssl/install-ssl.com (renamed from drivers/builtin_openssl2/ssl/install-ssl.com)0
-rw-r--r--thirdparty/openssl/ssl/kssl.c (renamed from drivers/builtin_openssl2/ssl/kssl.c)0
-rw-r--r--thirdparty/openssl/ssl/kssl_lcl.h (renamed from drivers/builtin_openssl2/ssl/kssl_lcl.h)0
-rw-r--r--thirdparty/openssl/ssl/s23_clnt.c (renamed from drivers/builtin_openssl2/ssl/s23_clnt.c)0
-rw-r--r--thirdparty/openssl/ssl/s23_lib.c (renamed from drivers/builtin_openssl2/ssl/s23_lib.c)0
-rw-r--r--thirdparty/openssl/ssl/s23_meth.c (renamed from drivers/builtin_openssl2/ssl/s23_meth.c)0
-rw-r--r--thirdparty/openssl/ssl/s23_pkt.c (renamed from drivers/builtin_openssl2/ssl/s23_pkt.c)0
-rw-r--r--thirdparty/openssl/ssl/s23_srvr.c (renamed from drivers/builtin_openssl2/ssl/s23_srvr.c)0
-rw-r--r--thirdparty/openssl/ssl/s2_clnt.c (renamed from drivers/builtin_openssl2/ssl/s2_clnt.c)0
-rw-r--r--thirdparty/openssl/ssl/s2_enc.c (renamed from drivers/builtin_openssl2/ssl/s2_enc.c)0
-rw-r--r--thirdparty/openssl/ssl/s2_lib.c (renamed from drivers/builtin_openssl2/ssl/s2_lib.c)0
-rw-r--r--thirdparty/openssl/ssl/s2_meth.c (renamed from drivers/builtin_openssl2/ssl/s2_meth.c)0
-rw-r--r--thirdparty/openssl/ssl/s2_pkt.c (renamed from drivers/builtin_openssl2/ssl/s2_pkt.c)0
-rw-r--r--thirdparty/openssl/ssl/s2_srvr.c (renamed from drivers/builtin_openssl2/ssl/s2_srvr.c)0
-rw-r--r--thirdparty/openssl/ssl/s3_both.c (renamed from drivers/builtin_openssl2/ssl/s3_both.c)0
-rw-r--r--thirdparty/openssl/ssl/s3_cbc.c (renamed from drivers/builtin_openssl2/ssl/s3_cbc.c)0
-rw-r--r--thirdparty/openssl/ssl/s3_clnt.c (renamed from drivers/builtin_openssl2/ssl/s3_clnt.c)0
-rw-r--r--thirdparty/openssl/ssl/s3_enc.c (renamed from drivers/builtin_openssl2/ssl/s3_enc.c)0
-rw-r--r--thirdparty/openssl/ssl/s3_lib.c (renamed from drivers/builtin_openssl2/ssl/s3_lib.c)0
-rw-r--r--thirdparty/openssl/ssl/s3_meth.c (renamed from drivers/builtin_openssl2/ssl/s3_meth.c)0
-rw-r--r--thirdparty/openssl/ssl/s3_pkt.c (renamed from drivers/builtin_openssl2/ssl/s3_pkt.c)0
-rw-r--r--thirdparty/openssl/ssl/s3_srvr.c (renamed from drivers/builtin_openssl2/ssl/s3_srvr.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl-lib.com (renamed from drivers/builtin_openssl2/ssl/ssl-lib.com)0
-rw-r--r--thirdparty/openssl/ssl/ssl_algs.c (renamed from drivers/builtin_openssl2/ssl/ssl_algs.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_asn1.c (renamed from drivers/builtin_openssl2/ssl/ssl_asn1.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_cert.c (renamed from drivers/builtin_openssl2/ssl/ssl_cert.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_ciph.c (renamed from drivers/builtin_openssl2/ssl/ssl_ciph.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_conf.c (renamed from drivers/builtin_openssl2/ssl/ssl_conf.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_err.c (renamed from drivers/builtin_openssl2/ssl/ssl_err.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_err2.c (renamed from drivers/builtin_openssl2/ssl/ssl_err2.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_lib.c (renamed from drivers/builtin_openssl2/ssl/ssl_lib.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_locl.h (renamed from drivers/builtin_openssl2/ssl/ssl_locl.h)0
-rw-r--r--thirdparty/openssl/ssl/ssl_rsa.c (renamed from drivers/builtin_openssl2/ssl/ssl_rsa.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_sess.c (renamed from drivers/builtin_openssl2/ssl/ssl_sess.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_stat.c (renamed from drivers/builtin_openssl2/ssl/ssl_stat.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_task.c (renamed from drivers/builtin_openssl2/ssl/ssl_task.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_txt.c (renamed from drivers/builtin_openssl2/ssl/ssl_txt.c)0
-rw-r--r--thirdparty/openssl/ssl/ssl_utst.c (renamed from drivers/builtin_openssl2/ssl/ssl_utst.c)0
-rw-r--r--thirdparty/openssl/ssl/t1_clnt.c (renamed from drivers/builtin_openssl2/ssl/t1_clnt.c)0
-rw-r--r--thirdparty/openssl/ssl/t1_enc.c (renamed from drivers/builtin_openssl2/ssl/t1_enc.c)0
-rw-r--r--thirdparty/openssl/ssl/t1_ext.c (renamed from drivers/builtin_openssl2/ssl/t1_ext.c)0
-rw-r--r--thirdparty/openssl/ssl/t1_lib.c (renamed from drivers/builtin_openssl2/ssl/t1_lib.c)0
-rw-r--r--thirdparty/openssl/ssl/t1_meth.c (renamed from drivers/builtin_openssl2/ssl/t1_meth.c)0
-rw-r--r--thirdparty/openssl/ssl/t1_reneg.c (renamed from drivers/builtin_openssl2/ssl/t1_reneg.c)0
-rw-r--r--thirdparty/openssl/ssl/t1_srvr.c (renamed from drivers/builtin_openssl2/ssl/t1_srvr.c)0
-rw-r--r--thirdparty/openssl/ssl/t1_trce.c (renamed from drivers/builtin_openssl2/ssl/t1_trce.c)0
-rw-r--r--thirdparty/openssl/ssl/tls_srp.c (renamed from drivers/builtin_openssl2/ssl/tls_srp.c)0
-rw-r--r--thirdparty/openssl/winrt.cpp (renamed from drivers/builtin_openssl2/winrt.cpp)0
-rw-r--r--thirdparty/openssl/winrt_fix.patch (renamed from drivers/builtin_openssl2/winrt_fix.patch)0
-rw-r--r--thirdparty/opus/COPYING (renamed from drivers/opus/COPYING)0
-rw-r--r--thirdparty/opus/analysis.c (renamed from drivers/opus/analysis.c)29
-rw-r--r--thirdparty/opus/analysis.h (renamed from drivers/opus/analysis.h)4
-rw-r--r--thirdparty/opus/celt/_kiss_fft_guts.h (renamed from drivers/opus/celt/_kiss_fft_guts.h)14
-rw-r--r--thirdparty/opus/celt/arch.h (renamed from drivers/opus/celt/arch.h)16
-rwxr-xr-xthirdparty/opus/celt/arm/arm2gnu.pl (renamed from drivers/opus/celt/arm/arm2gnu.pl)0
-rw-r--r--thirdparty/opus/celt/arm/arm_celt_map.c (renamed from drivers/opus/celt/arm/arm_celt_map.c)11
-rw-r--r--thirdparty/opus/celt/arm/armcpu.c (renamed from drivers/opus/celt/arm/armcpu.c)13
-rw-r--r--thirdparty/opus/celt/arm/armcpu.h (renamed from drivers/opus/celt/arm/armcpu.h)0
-rw-r--r--thirdparty/opus/celt/arm/armopts.s.in (renamed from drivers/opus/celt/arm/armopts.s.in)0
-rw-r--r--thirdparty/opus/celt/arm/celt_ne10_fft.c (renamed from drivers/opus/celt/arm/celt_ne10_fft.c)10
-rw-r--r--thirdparty/opus/celt/arm/celt_ne10_mdct.c (renamed from drivers/opus/celt/arm/celt_ne10_mdct.c)12
-rw-r--r--thirdparty/opus/celt/arm/celt_neon_intr.c (renamed from drivers/opus/celt/arm/celt_neon_intr.c)7
-rw-r--r--thirdparty/opus/celt/arm/celt_pitch_xcorr_arm-gnu.S (renamed from drivers/opus/celt/arm/celt_pitch_xcorr_arm-gnu.S)0
-rw-r--r--thirdparty/opus/celt/arm/celt_pitch_xcorr_arm.s (renamed from drivers/opus/celt/arm/celt_pitch_xcorr_arm.s)0
-rw-r--r--thirdparty/opus/celt/arm/fft_arm.h (renamed from drivers/opus/celt/arm/fft_arm.h)4
-rw-r--r--thirdparty/opus/celt/arm/fixed_arm64.h (renamed from drivers/speex/config.h)35
-rw-r--r--thirdparty/opus/celt/arm/fixed_armv4.h (renamed from drivers/opus/celt/arm/fixed_armv4.h)0
-rw-r--r--thirdparty/opus/celt/arm/fixed_armv5e.h (renamed from drivers/opus/celt/arm/fixed_armv5e.h)2
-rw-r--r--thirdparty/opus/celt/arm/kiss_fft_armv4.h (renamed from drivers/opus/celt/arm/kiss_fft_armv4.h)2
-rw-r--r--thirdparty/opus/celt/arm/kiss_fft_armv5e.h (renamed from drivers/opus/celt/arm/kiss_fft_armv5e.h)2
-rw-r--r--thirdparty/opus/celt/arm/mdct_arm.h (renamed from drivers/opus/celt/arm/mdct_arm.h)4
-rw-r--r--thirdparty/opus/celt/arm/pitch_arm.h (renamed from drivers/opus/celt/arm/pitch_arm.h)2
-rw-r--r--thirdparty/opus/celt/bands.c (renamed from drivers/opus/celt/bands.c)49
-rw-r--r--thirdparty/opus/celt/bands.h (renamed from drivers/opus/celt/bands.h)10
-rw-r--r--thirdparty/opus/celt/celt.c (renamed from drivers/opus/celt/celt.c)37
-rw-r--r--thirdparty/opus/celt/celt.h (renamed from drivers/opus/celt/celt.h)12
-rw-r--r--thirdparty/opus/celt/celt_decoder.c (renamed from drivers/opus/celt/celt_decoder.c)51
-rw-r--r--thirdparty/opus/celt/celt_encoder.c (renamed from drivers/opus/celt/celt_encoder.c)63
-rw-r--r--thirdparty/opus/celt/celt_lpc.c (renamed from drivers/opus/celt/celt_lpc.c)23
-rw-r--r--thirdparty/opus/celt/celt_lpc.h (renamed from drivers/opus/celt/celt_lpc.h)6
-rw-r--r--thirdparty/opus/celt/cpu_support.h (renamed from drivers/opus/celt/cpu_support.h)8
-rw-r--r--thirdparty/opus/celt/cwrs.c (renamed from drivers/opus/celt/cwrs.c)13
-rw-r--r--thirdparty/opus/celt/cwrs.h (renamed from drivers/opus/celt/cwrs.h)8
-rw-r--r--thirdparty/opus/celt/ecintrin.h (renamed from drivers/opus/celt/ecintrin.h)4
-rw-r--r--thirdparty/opus/celt/entcode.c (renamed from drivers/opus/celt/entcode.c)9
-rw-r--r--thirdparty/opus/celt/entcode.h (renamed from drivers/opus/celt/entcode.h)6
-rw-r--r--thirdparty/opus/celt/entdec.c (renamed from drivers/opus/celt/entdec.c)13
-rw-r--r--thirdparty/opus/celt/entdec.h (renamed from drivers/opus/celt/entdec.h)2
-rw-r--r--thirdparty/opus/celt/entenc.c (renamed from drivers/opus/celt/entenc.c)13
-rw-r--r--thirdparty/opus/celt/entenc.h (renamed from drivers/opus/celt/entenc.h)2
-rw-r--r--thirdparty/opus/celt/fixed_debug.h (renamed from drivers/opus/celt/fixed_debug.h)2
-rw-r--r--thirdparty/opus/celt/fixed_generic.h (renamed from drivers/opus/celt/fixed_generic.h)2
-rw-r--r--thirdparty/opus/celt/float_cast.h (renamed from drivers/opus/celt/float_cast.h)2
-rw-r--r--thirdparty/opus/celt/kiss_fft.c (renamed from drivers/opus/celt/kiss_fft.c)24
-rw-r--r--thirdparty/opus/celt/kiss_fft.h (renamed from drivers/opus/celt/kiss_fft.h)12
-rw-r--r--thirdparty/opus/celt/laplace.c (renamed from drivers/opus/celt/laplace.c)9
-rw-r--r--thirdparty/opus/celt/laplace.h (renamed from drivers/opus/celt/laplace.h)4
-rw-r--r--thirdparty/opus/celt/mathops.c (renamed from drivers/opus/celt/mathops.c)9
-rw-r--r--thirdparty/opus/celt/mathops.h (renamed from drivers/opus/celt/mathops.h)14
-rw-r--r--thirdparty/opus/celt/mdct.c (renamed from drivers/opus/celt/mdct.c)20
-rw-r--r--thirdparty/opus/celt/mdct.h (renamed from drivers/opus/celt/mdct.h)8
-rw-r--r--thirdparty/opus/celt/mfrngcod.h (renamed from drivers/opus/celt/mfrngcod.h)2
-rw-r--r--thirdparty/opus/celt/mips/celt_mipsr1.h (renamed from drivers/opus/celt/mips/celt_mipsr1.h)33
-rw-r--r--thirdparty/opus/celt/mips/fixed_generic_mipsr1.h (renamed from drivers/opus/celt/mips/fixed_generic_mipsr1.h)0
-rw-r--r--thirdparty/opus/celt/mips/kiss_fft_mipsr1.h (renamed from drivers/opus/celt/mips/kiss_fft_mipsr1.h)4
-rw-r--r--thirdparty/opus/celt/mips/mdct_mipsr1.h (renamed from drivers/opus/celt/mips/mdct_mipsr1.h)18
-rw-r--r--thirdparty/opus/celt/mips/pitch_mipsr1.h (renamed from drivers/opus/celt/mips/pitch_mipsr1.h)0
-rw-r--r--thirdparty/opus/celt/mips/vq_mipsr1.h (renamed from drivers/opus/celt/mips/vq_mipsr1.h)13
-rw-r--r--thirdparty/opus/celt/modes.c (renamed from drivers/opus/celt/modes.c)27
-rw-r--r--thirdparty/opus/celt/modes.h (renamed from drivers/opus/celt/modes.h)12
-rw-r--r--thirdparty/opus/celt/opus_custom_demo.c (renamed from drivers/opus/celt/opus_custom_demo.c)9
-rw-r--r--thirdparty/opus/celt/os_support.h (renamed from drivers/opus/celt/os_support.h)4
-rw-r--r--thirdparty/opus/celt/pitch.c (renamed from drivers/opus/celt/pitch.c)65
-rw-r--r--thirdparty/opus/celt/pitch.h (renamed from drivers/opus/celt/pitch.h)14
-rw-r--r--thirdparty/opus/celt/quant_bands.c (renamed from drivers/opus/celt/quant_bands.c)41
-rw-r--r--thirdparty/opus/celt/quant_bands.h (renamed from drivers/opus/celt/quant_bands.h)12
-rw-r--r--thirdparty/opus/celt/rate.c (renamed from drivers/opus/celt/rate.c)17
-rw-r--r--thirdparty/opus/celt/rate.h (renamed from drivers/opus/celt/rate.h)4
-rw-r--r--thirdparty/opus/celt/stack_alloc.h (renamed from drivers/opus/celt/stack_alloc.h)6
-rw-r--r--thirdparty/opus/celt/static_modes_fixed.h (renamed from drivers/opus/celt/static_modes_fixed.h)6
-rw-r--r--thirdparty/opus/celt/static_modes_fixed_arm_ne10.h (renamed from drivers/opus/celt/static_modes_fixed_arm_ne10.h)0
-rw-r--r--thirdparty/opus/celt/static_modes_float.h (renamed from drivers/opus/celt/static_modes_float.h)6
-rw-r--r--thirdparty/opus/celt/static_modes_float_arm_ne10.h (renamed from drivers/opus/celt/static_modes_float_arm_ne10.h)0
-rw-r--r--thirdparty/opus/celt/tests/test_unit_cwrs32.c161
-rw-r--r--thirdparty/opus/celt/tests/test_unit_dft.c189
-rw-r--r--thirdparty/opus/celt/tests/test_unit_entropy.c382
-rw-r--r--thirdparty/opus/celt/tests/test_unit_laplace.c93
-rw-r--r--thirdparty/opus/celt/tests/test_unit_mathops.c304
-rw-r--r--thirdparty/opus/celt/tests/test_unit_mdct.c230
-rw-r--r--thirdparty/opus/celt/tests/test_unit_rotation.c120
-rw-r--r--thirdparty/opus/celt/tests/test_unit_types.c (renamed from drivers/speex/lpc.h)59
-rw-r--r--thirdparty/opus/celt/vq.c (renamed from drivers/opus/celt/vq.c)41
-rw-r--r--thirdparty/opus/celt/vq.h (renamed from drivers/opus/celt/vq.h)8
-rw-r--r--thirdparty/opus/celt/x86/celt_lpc_sse.c (renamed from drivers/opus/celt/x86/celt_lpc_sse.c)15
-rw-r--r--thirdparty/opus/celt/x86/celt_lpc_sse.h (renamed from drivers/opus/celt/x86/celt_lpc_sse.h)5
-rw-r--r--thirdparty/opus/celt/x86/pitch_sse.c (renamed from drivers/opus/celt/x86/pitch_sse.c)17
-rw-r--r--thirdparty/opus/celt/x86/pitch_sse.h (renamed from drivers/opus/celt/x86/pitch_sse.h)5
-rw-r--r--thirdparty/opus/celt/x86/pitch_sse2.c (renamed from drivers/opus/celt/x86/pitch_sse2.c)15
-rw-r--r--thirdparty/opus/celt/x86/pitch_sse4_1.c (renamed from drivers/opus/celt/x86/pitch_sse4_1.c)17
-rw-r--r--thirdparty/opus/celt/x86/x86_celt_map.c (renamed from drivers/opus/celt/x86/x86_celt_map.c)13
-rw-r--r--thirdparty/opus/celt/x86/x86cpu.c (renamed from drivers/opus/celt/x86/x86cpu.c)15
-rw-r--r--thirdparty/opus/celt/x86/x86cpu.h (renamed from drivers/opus/celt/x86/x86cpu.h)0
-rw-r--r--thirdparty/opus/config.h (renamed from drivers/opus/opus_config.h)0
-rw-r--r--thirdparty/opus/http.c (renamed from drivers/opus/http.c)8
-rw-r--r--thirdparty/opus/info.c (renamed from drivers/opus/info.c)6
-rw-r--r--thirdparty/opus/internal.c (renamed from drivers/opus/internal.c)6
-rw-r--r--thirdparty/opus/internal.h (renamed from drivers/opus/internal.h)2
-rw-r--r--thirdparty/opus/mlp.c (renamed from drivers/opus/mlp.c)17
-rw-r--r--thirdparty/opus/mlp.h (renamed from drivers/opus/mlp.h)2
-rw-r--r--thirdparty/opus/mlp_data.c (renamed from drivers/opus/mlp_data.c)7
-rw-r--r--thirdparty/opus/opus.c (renamed from drivers/opus/opus.c)9
-rw-r--r--thirdparty/opus/opus.h (renamed from drivers/opus/opus.h)4
-rw-r--r--thirdparty/opus/opus_compare.c (renamed from drivers/opus/opus_compare.c)0
-rw-r--r--thirdparty/opus/opus_custom.h (renamed from drivers/opus/opus_custom.h)2
-rw-r--r--thirdparty/opus/opus_decoder.c (renamed from drivers/opus/opus_decoder.c)43
-rw-r--r--thirdparty/opus/opus_defines.h (renamed from drivers/opus/opus_defines.h)2
-rw-r--r--thirdparty/opus/opus_encoder.c (renamed from drivers/opus/opus_encoder.c)67
-rw-r--r--thirdparty/opus/opus_multistream.c (renamed from drivers/opus/opus_multistream.c)17
-rw-r--r--thirdparty/opus/opus_multistream.h (renamed from drivers/opus/opus_multistream.h)2
-rw-r--r--thirdparty/opus/opus_multistream_decoder.c (renamed from drivers/opus/opus_multistream_decoder.c)19
-rw-r--r--thirdparty/opus/opus_multistream_encoder.c (renamed from drivers/opus/opus_multistream_encoder.c)37
-rw-r--r--thirdparty/opus/opus_private.h (renamed from drivers/opus/opus_private.h)6
-rw-r--r--thirdparty/opus/opus_types.h (renamed from drivers/opus/opus_types.h)0
-rw-r--r--thirdparty/opus/opusfile.c (renamed from drivers/opus/opusfile.c)8
-rw-r--r--thirdparty/opus/opusfile.h (renamed from drivers/opus/opusfile.h)2
-rw-r--r--thirdparty/opus/repacketizer.c (renamed from drivers/opus/repacketizer.c)11
-rw-r--r--thirdparty/opus/repacketizer_demo.c (renamed from drivers/opus/repacketizer_demo.c)7
-rw-r--r--thirdparty/opus/silk/A2NLSF.c (renamed from drivers/opus/silk/A2NLSF.c)9
-rw-r--r--thirdparty/opus/silk/API.h (renamed from drivers/opus/silk/API.h)10
-rw-r--r--thirdparty/opus/silk/CNG.c (renamed from drivers/opus/silk/CNG.c)9
-rw-r--r--thirdparty/opus/silk/HP_variable_cutoff.c (renamed from drivers/opus/silk/HP_variable_cutoff.c)13
-rw-r--r--thirdparty/opus/silk/Inlines.h (renamed from drivers/opus/silk/Inlines.h)0
-rw-r--r--thirdparty/opus/silk/LPC_analysis_filter.c (renamed from drivers/opus/silk/LPC_analysis_filter.c)13
-rw-r--r--thirdparty/opus/silk/LPC_inv_pred_gain.c (renamed from drivers/opus/silk/LPC_inv_pred_gain.c)9
-rw-r--r--thirdparty/opus/silk/LP_variable_cutoff.c (renamed from drivers/opus/silk/LP_variable_cutoff.c)7
-rw-r--r--thirdparty/opus/silk/MacroCount.h (renamed from drivers/opus/silk/MacroCount.h)0
-rw-r--r--thirdparty/opus/silk/MacroDebug.h (renamed from drivers/opus/silk/MacroDebug.h)0
-rw-r--r--thirdparty/opus/silk/NLSF2A.c (renamed from drivers/opus/silk/NLSF2A.c)9
-rw-r--r--thirdparty/opus/silk/NLSF_VQ.c (renamed from drivers/opus/silk/NLSF_VQ.c)7
-rw-r--r--thirdparty/opus/silk/NLSF_VQ_weights_laroia.c (renamed from drivers/opus/silk/NLSF_VQ_weights_laroia.c)9
-rw-r--r--thirdparty/opus/silk/NLSF_decode.c (renamed from drivers/opus/silk/NLSF_decode.c)7
-rw-r--r--thirdparty/opus/silk/NLSF_del_dec_quant.c (renamed from drivers/opus/silk/NLSF_del_dec_quant.c)7
-rw-r--r--thirdparty/opus/silk/NLSF_encode.c (renamed from drivers/opus/silk/NLSF_encode.c)9
-rw-r--r--thirdparty/opus/silk/NLSF_stabilize.c (renamed from drivers/opus/silk/NLSF_stabilize.c)7
-rw-r--r--thirdparty/opus/silk/NLSF_unpack.c (renamed from drivers/opus/silk/NLSF_unpack.c)7
-rw-r--r--thirdparty/opus/silk/NSQ.c (renamed from drivers/opus/silk/NSQ.c)9
-rw-r--r--thirdparty/opus/silk/NSQ.h101
-rw-r--r--thirdparty/opus/silk/NSQ_del_dec.c (renamed from drivers/opus/silk/NSQ_del_dec.c)11
-rw-r--r--thirdparty/opus/silk/PLC.c (renamed from drivers/opus/silk/PLC.c)11
-rw-r--r--thirdparty/opus/silk/PLC.h (renamed from drivers/opus/silk/PLC.h)2
-rw-r--r--thirdparty/opus/silk/SigProc_FIX.h (renamed from drivers/opus/silk/SigProc_FIX.h)22
-rw-r--r--thirdparty/opus/silk/VAD.c (renamed from drivers/opus/silk/VAD.c)9
-rw-r--r--thirdparty/opus/silk/VQ_WMat_EC.c (renamed from drivers/opus/silk/VQ_WMat_EC.c)7
-rw-r--r--thirdparty/opus/silk/ana_filt_bank_1.c (renamed from drivers/opus/silk/ana_filt_bank_1.c)7
-rw-r--r--thirdparty/opus/silk/arm/NSQ_neon.c112
-rw-r--r--thirdparty/opus/silk/arm/NSQ_neon.h113
-rw-r--r--thirdparty/opus/silk/arm/SigProc_FIX_armv4.h (renamed from drivers/opus/silk/arm/SigProc_FIX_armv4.h)0
-rw-r--r--thirdparty/opus/silk/arm/SigProc_FIX_armv5e.h (renamed from drivers/opus/silk/arm/SigProc_FIX_armv5e.h)0
-rw-r--r--thirdparty/opus/silk/arm/arm_silk_map.c55
-rw-r--r--thirdparty/opus/silk/arm/macros_arm64.h39
-rw-r--r--thirdparty/opus/silk/arm/macros_armv4.h (renamed from drivers/opus/silk/arm/macros_armv4.h)0
-rw-r--r--thirdparty/opus/silk/arm/macros_armv5e.h (renamed from drivers/opus/silk/arm/macros_armv5e.h)0
-rw-r--r--thirdparty/opus/silk/biquad_alt.c (renamed from drivers/opus/silk/biquad_alt.c)7
-rw-r--r--thirdparty/opus/silk/bwexpander.c (renamed from drivers/opus/silk/bwexpander.c)7
-rw-r--r--thirdparty/opus/silk/bwexpander_32.c (renamed from drivers/opus/silk/bwexpander_32.c)7
-rw-r--r--thirdparty/opus/silk/check_control_input.c (renamed from drivers/opus/silk/check_control_input.c)11
-rw-r--r--thirdparty/opus/silk/code_signs.c (renamed from drivers/opus/silk/code_signs.c)7
-rw-r--r--thirdparty/opus/silk/control.h (renamed from drivers/opus/silk/control.h)2
-rw-r--r--thirdparty/opus/silk/control_SNR.c (renamed from drivers/opus/silk/control_SNR.c)9
-rw-r--r--thirdparty/opus/silk/control_audio_bandwidth.c (renamed from drivers/opus/silk/control_audio_bandwidth.c)9
-rw-r--r--thirdparty/opus/silk/control_codec.c (renamed from drivers/opus/silk/control_codec.c)23
-rw-r--r--thirdparty/opus/silk/debug.c (renamed from drivers/opus/silk/debug.c)9
-rw-r--r--thirdparty/opus/silk/debug.h (renamed from drivers/opus/silk/debug.h)2
-rw-r--r--thirdparty/opus/silk/dec_API.c (renamed from drivers/opus/silk/dec_API.c)13
-rw-r--r--thirdparty/opus/silk/decode_core.c (renamed from drivers/opus/silk/decode_core.c)9
-rw-r--r--thirdparty/opus/silk/decode_frame.c (renamed from drivers/opus/silk/decode_frame.c)11
-rw-r--r--thirdparty/opus/silk/decode_indices.c (renamed from drivers/opus/silk/decode_indices.c)7
-rw-r--r--thirdparty/opus/silk/decode_parameters.c (renamed from drivers/opus/silk/decode_parameters.c)7
-rw-r--r--thirdparty/opus/silk/decode_pitch.c (renamed from drivers/opus/silk/decode_pitch.c)9
-rw-r--r--thirdparty/opus/silk/decode_pulses.c (renamed from drivers/opus/silk/decode_pulses.c)7
-rw-r--r--thirdparty/opus/silk/decoder_set_fs.c (renamed from drivers/opus/silk/decoder_set_fs.c)7
-rw-r--r--thirdparty/opus/silk/define.h (renamed from drivers/opus/silk/define.h)4
-rw-r--r--thirdparty/opus/silk/enc_API.c (renamed from drivers/opus/silk/enc_API.c)25
-rw-r--r--thirdparty/opus/silk/encode_indices.c (renamed from drivers/opus/silk/encode_indices.c)7
-rw-r--r--thirdparty/opus/silk/encode_pulses.c (renamed from drivers/opus/silk/encode_pulses.c)9
-rw-r--r--thirdparty/opus/silk/errors.h (renamed from drivers/opus/silk/errors.h)0
-rw-r--r--thirdparty/opus/silk/fixed/LTP_analysis_filter_FIX.c (renamed from drivers/opus/silk/fixed/LTP_analysis_filter_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/LTP_scale_ctrl_FIX.c (renamed from drivers/opus/silk/fixed/LTP_scale_ctrl_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/apply_sine_window_FIX.c (renamed from drivers/opus/silk/fixed/apply_sine_window_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/autocorr_FIX.c (renamed from drivers/opus/silk/fixed/autocorr_FIX.c)9
-rw-r--r--thirdparty/opus/silk/fixed/burg_modified_FIX.c (renamed from drivers/opus/silk/fixed/burg_modified_FIX.c)13
-rw-r--r--thirdparty/opus/silk/fixed/corrMatrix_FIX.c (renamed from drivers/opus/silk/fixed/corrMatrix_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/encode_frame_FIX.c (renamed from drivers/opus/silk/fixed/encode_frame_FIX.c)11
-rw-r--r--thirdparty/opus/silk/fixed/find_LPC_FIX.c (renamed from drivers/opus/silk/fixed/find_LPC_FIX.c)11
-rw-r--r--thirdparty/opus/silk/fixed/find_LTP_FIX.c (renamed from drivers/opus/silk/fixed/find_LTP_FIX.c)9
-rw-r--r--thirdparty/opus/silk/fixed/find_pitch_lags_FIX.c (renamed from drivers/opus/silk/fixed/find_pitch_lags_FIX.c)11
-rw-r--r--thirdparty/opus/silk/fixed/find_pred_coefs_FIX.c (renamed from drivers/opus/silk/fixed/find_pred_coefs_FIX.c)9
-rw-r--r--thirdparty/opus/silk/fixed/k2a_FIX.c (renamed from drivers/opus/silk/fixed/k2a_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/k2a_Q16_FIX.c (renamed from drivers/opus/silk/fixed/k2a_Q16_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/main_FIX.h (renamed from drivers/opus/silk/fixed/main_FIX.h)14
-rw-r--r--thirdparty/opus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h (renamed from drivers/opus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h)0
-rw-r--r--thirdparty/opus/silk/fixed/mips/prefilter_FIX_mipsr1.h (renamed from drivers/opus/silk/fixed/mips/prefilter_FIX_mipsr1.h)11
-rw-r--r--thirdparty/opus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h (renamed from drivers/opus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h)7
-rw-r--r--thirdparty/opus/silk/fixed/noise_shape_analysis_FIX.c (renamed from drivers/opus/silk/fixed/noise_shape_analysis_FIX.c)13
-rw-r--r--thirdparty/opus/silk/fixed/pitch_analysis_core_FIX.c (renamed from drivers/opus/silk/fixed/pitch_analysis_core_FIX.c)15
-rw-r--r--thirdparty/opus/silk/fixed/prefilter_FIX.c (renamed from drivers/opus/silk/fixed/prefilter_FIX.c)13
-rw-r--r--thirdparty/opus/silk/fixed/process_gains_FIX.c (renamed from drivers/opus/silk/fixed/process_gains_FIX.c)9
-rw-r--r--thirdparty/opus/silk/fixed/regularize_correlations_FIX.c (renamed from drivers/opus/silk/fixed/regularize_correlations_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/residual_energy16_FIX.c (renamed from drivers/opus/silk/fixed/residual_energy16_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/residual_energy_FIX.c (renamed from drivers/opus/silk/fixed/residual_energy_FIX.c)9
-rw-r--r--thirdparty/opus/silk/fixed/schur64_FIX.c (renamed from drivers/opus/silk/fixed/schur64_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/schur_FIX.c (renamed from drivers/opus/silk/fixed/schur_FIX.c)7
-rw-r--r--thirdparty/opus/silk/fixed/solve_LS_FIX.c (renamed from drivers/opus/silk/fixed/solve_LS_FIX.c)11
-rw-r--r--thirdparty/opus/silk/fixed/structs_FIX.h (renamed from drivers/opus/silk/fixed/structs_FIX.h)6
-rw-r--r--thirdparty/opus/silk/fixed/vector_ops_FIX.c (renamed from drivers/opus/silk/fixed/vector_ops_FIX.c)11
-rw-r--r--thirdparty/opus/silk/fixed/warped_autocorrelation_FIX.c (renamed from drivers/opus/silk/fixed/warped_autocorrelation_FIX.c)9
-rw-r--r--thirdparty/opus/silk/fixed/x86/burg_modified_FIX_sse.c (renamed from drivers/opus/silk/fixed/x86/burg_modified_FIX_sse.c)15
-rw-r--r--thirdparty/opus/silk/fixed/x86/prefilter_FIX_sse.c (renamed from drivers/opus/silk/fixed/x86/prefilter_FIX_sse.c)9
-rw-r--r--thirdparty/opus/silk/fixed/x86/vector_ops_FIX_sse.c (renamed from drivers/opus/silk/fixed/x86/vector_ops_FIX_sse.c)11
-rw-r--r--thirdparty/opus/silk/float/LPC_analysis_filter_FLP.c (renamed from drivers/opus/silk/float/LPC_analysis_filter_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/LPC_inv_pred_gain_FLP.c (renamed from drivers/opus/silk/float/LPC_inv_pred_gain_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/LTP_analysis_filter_FLP.c (renamed from drivers/opus/silk/float/LTP_analysis_filter_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/LTP_scale_ctrl_FLP.c (renamed from drivers/opus/silk/float/LTP_scale_ctrl_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/SigProc_FLP.h (renamed from drivers/opus/silk/float/SigProc_FLP.h)4
-rw-r--r--thirdparty/opus/silk/float/apply_sine_window_FLP.c (renamed from drivers/opus/silk/float/apply_sine_window_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/autocorrelation_FLP.c (renamed from drivers/opus/silk/float/autocorrelation_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/burg_modified_FLP.c (renamed from drivers/opus/silk/float/burg_modified_FLP.c)11
-rw-r--r--thirdparty/opus/silk/float/bwexpander_FLP.c (renamed from drivers/opus/silk/float/bwexpander_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/corrMatrix_FLP.c (renamed from drivers/opus/silk/float/corrMatrix_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/encode_frame_FLP.c (renamed from drivers/opus/silk/float/encode_frame_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/energy_FLP.c (renamed from drivers/opus/silk/float/energy_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/find_LPC_FLP.c (renamed from drivers/opus/silk/float/find_LPC_FLP.c)11
-rw-r--r--thirdparty/opus/silk/float/find_LTP_FLP.c (renamed from drivers/opus/silk/float/find_LTP_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/find_pitch_lags_FLP.c (renamed from drivers/opus/silk/float/find_pitch_lags_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/find_pred_coefs_FLP.c (renamed from drivers/opus/silk/float/find_pred_coefs_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/inner_product_FLP.c (renamed from drivers/opus/silk/float/inner_product_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/k2a_FLP.c (renamed from drivers/opus/silk/float/k2a_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/levinsondurbin_FLP.c (renamed from drivers/opus/silk/float/levinsondurbin_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/main_FLP.h (renamed from drivers/opus/silk/float/main_FLP.h)14
-rw-r--r--thirdparty/opus/silk/float/noise_shape_analysis_FLP.c (renamed from drivers/opus/silk/float/noise_shape_analysis_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/pitch_analysis_core_FLP.c (renamed from drivers/opus/silk/float/pitch_analysis_core_FLP.c)13
-rw-r--r--thirdparty/opus/silk/float/prefilter_FLP.c (renamed from drivers/opus/silk/float/prefilter_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/process_gains_FLP.c (renamed from drivers/opus/silk/float/process_gains_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/regularize_correlations_FLP.c (renamed from drivers/opus/silk/float/regularize_correlations_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/residual_energy_FLP.c (renamed from drivers/opus/silk/float/residual_energy_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/scale_copy_vector_FLP.c (renamed from drivers/opus/silk/float/scale_copy_vector_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/scale_vector_FLP.c (renamed from drivers/opus/silk/float/scale_vector_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/schur_FLP.c (renamed from drivers/opus/silk/float/schur_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/solve_LS_FLP.c (renamed from drivers/opus/silk/float/solve_LS_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/sort_FLP.c (renamed from drivers/opus/silk/float/sort_FLP.c)9
-rw-r--r--thirdparty/opus/silk/float/structs_FLP.h (renamed from drivers/opus/silk/float/structs_FLP.h)6
-rw-r--r--thirdparty/opus/silk/float/warped_autocorrelation_FLP.c (renamed from drivers/opus/silk/float/warped_autocorrelation_FLP.c)7
-rw-r--r--thirdparty/opus/silk/float/wrappers_FLP.c (renamed from drivers/opus/silk/float/wrappers_FLP.c)7
-rw-r--r--thirdparty/opus/silk/gain_quant.c (renamed from drivers/opus/silk/gain_quant.c)7
-rw-r--r--thirdparty/opus/silk/init_decoder.c (renamed from drivers/opus/silk/init_decoder.c)7
-rw-r--r--thirdparty/opus/silk/init_encoder.c (renamed from drivers/opus/silk/init_encoder.c)15
-rw-r--r--thirdparty/opus/silk/inner_prod_aligned.c (renamed from drivers/opus/silk/inner_prod_aligned.c)7
-rw-r--r--thirdparty/opus/silk/interpolate.c (renamed from drivers/opus/silk/interpolate.c)7
-rw-r--r--thirdparty/opus/silk/lin2log.c (renamed from drivers/opus/silk/lin2log.c)7
-rw-r--r--thirdparty/opus/silk/log2lin.c (renamed from drivers/opus/silk/log2lin.c)7
-rw-r--r--thirdparty/opus/silk/macros.h (renamed from drivers/opus/silk/macros.h)17
-rw-r--r--thirdparty/opus/silk/main.h (renamed from drivers/opus/silk/main.h)20
-rw-r--r--thirdparty/opus/silk/mips/NSQ_del_dec_mipsr1.h (renamed from drivers/opus/silk/mips/NSQ_del_dec_mipsr1.h)9
-rw-r--r--thirdparty/opus/silk/mips/macros_mipsr1.h (renamed from drivers/opus/silk/mips/macros_mipsr1.h)0
-rw-r--r--thirdparty/opus/silk/mips/sigproc_fix_mipsr1.h (renamed from drivers/opus/silk/mips/sigproc_fix_mipsr1.h)0
-rw-r--r--thirdparty/opus/silk/pitch_est_defines.h (renamed from drivers/opus/silk/pitch_est_defines.h)2
-rw-r--r--thirdparty/opus/silk/pitch_est_tables.c (renamed from drivers/opus/silk/pitch_est_tables.c)9
-rw-r--r--thirdparty/opus/silk/process_NLSFs.c (renamed from drivers/opus/silk/process_NLSFs.c)7
-rw-r--r--thirdparty/opus/silk/quant_LTP_gains.c (renamed from drivers/opus/silk/quant_LTP_gains.c)9
-rw-r--r--thirdparty/opus/silk/resampler.c (renamed from drivers/opus/silk/resampler.c)7
-rw-r--r--thirdparty/opus/silk/resampler_down2.c (renamed from drivers/opus/silk/resampler_down2.c)9
-rw-r--r--thirdparty/opus/silk/resampler_down2_3.c (renamed from drivers/opus/silk/resampler_down2_3.c)11
-rw-r--r--thirdparty/opus/silk/resampler_private.h (renamed from drivers/opus/silk/resampler_private.h)6
-rw-r--r--thirdparty/opus/silk/resampler_private_AR2.c (renamed from drivers/opus/silk/resampler_private_AR2.c)9
-rw-r--r--thirdparty/opus/silk/resampler_private_IIR_FIR.c (renamed from drivers/opus/silk/resampler_private_IIR_FIR.c)11
-rw-r--r--thirdparty/opus/silk/resampler_private_down_FIR.c (renamed from drivers/opus/silk/resampler_private_down_FIR.c)11
-rw-r--r--thirdparty/opus/silk/resampler_private_up2_HQ.c (renamed from drivers/opus/silk/resampler_private_up2_HQ.c)9
-rw-r--r--thirdparty/opus/silk/resampler_rom.c (renamed from drivers/opus/silk/resampler_rom.c)7
-rw-r--r--thirdparty/opus/silk/resampler_rom.h (renamed from drivers/opus/silk/resampler_rom.h)4
-rw-r--r--thirdparty/opus/silk/resampler_structs.h (renamed from drivers/opus/silk/resampler_structs.h)0
-rw-r--r--thirdparty/opus/silk/shell_coder.c (renamed from drivers/opus/silk/shell_coder.c)7
-rw-r--r--thirdparty/opus/silk/sigm_Q15.c (renamed from drivers/opus/silk/sigm_Q15.c)7
-rw-r--r--thirdparty/opus/silk/sort.c (renamed from drivers/opus/silk/sort.c)9
-rw-r--r--thirdparty/opus/silk/stereo_LR_to_MS.c (renamed from drivers/opus/silk/stereo_LR_to_MS.c)9
-rw-r--r--thirdparty/opus/silk/stereo_MS_to_LR.c (renamed from drivers/opus/silk/stereo_MS_to_LR.c)7
-rw-r--r--thirdparty/opus/silk/stereo_decode_pred.c (renamed from drivers/opus/silk/stereo_decode_pred.c)7
-rw-r--r--thirdparty/opus/silk/stereo_encode_pred.c (renamed from drivers/opus/silk/stereo_encode_pred.c)7
-rw-r--r--thirdparty/opus/silk/stereo_find_predictor.c (renamed from drivers/opus/silk/stereo_find_predictor.c)7
-rw-r--r--thirdparty/opus/silk/stereo_quant_pred.c (renamed from drivers/opus/silk/stereo_quant_pred.c)7
-rw-r--r--thirdparty/opus/silk/structs.h (renamed from drivers/opus/silk/structs.h)10
-rw-r--r--thirdparty/opus/silk/sum_sqr_shift.c (renamed from drivers/opus/silk/sum_sqr_shift.c)7
-rw-r--r--thirdparty/opus/silk/table_LSF_cos.c (renamed from drivers/opus/silk/table_LSF_cos.c)7
-rw-r--r--thirdparty/opus/silk/tables.h (renamed from drivers/opus/silk/tables.h)4
-rw-r--r--thirdparty/opus/silk/tables_LTP.c (renamed from drivers/opus/silk/tables_LTP.c)7
-rw-r--r--thirdparty/opus/silk/tables_NLSF_CB_NB_MB.c (renamed from drivers/opus/silk/tables_NLSF_CB_NB_MB.c)7
-rw-r--r--thirdparty/opus/silk/tables_NLSF_CB_WB.c (renamed from drivers/opus/silk/tables_NLSF_CB_WB.c)7
-rw-r--r--thirdparty/opus/silk/tables_gain.c (renamed from drivers/opus/silk/tables_gain.c)7
-rw-r--r--thirdparty/opus/silk/tables_other.c (renamed from drivers/opus/silk/tables_other.c)11
-rw-r--r--thirdparty/opus/silk/tables_pitch_lag.c (renamed from drivers/opus/silk/tables_pitch_lag.c)7
-rw-r--r--thirdparty/opus/silk/tables_pulses_per_block.c (renamed from drivers/opus/silk/tables_pulses_per_block.c)7
-rw-r--r--thirdparty/opus/silk/tuning_parameters.h (renamed from drivers/opus/silk/tuning_parameters.h)0
-rw-r--r--thirdparty/opus/silk/typedef.h (renamed from drivers/opus/silk/typedef.h)6
-rw-r--r--thirdparty/opus/silk/x86/NSQ_del_dec_sse.c (renamed from drivers/opus/silk/x86/NSQ_del_dec_sse.c)11
-rw-r--r--thirdparty/opus/silk/x86/NSQ_sse.c (renamed from drivers/opus/silk/x86/NSQ_sse.c)11
-rw-r--r--thirdparty/opus/silk/x86/SigProc_FIX_sse.h (renamed from drivers/opus/silk/x86/SigProc_FIX_sse.h)5
-rw-r--r--thirdparty/opus/silk/x86/VAD_sse.c (renamed from drivers/opus/silk/x86/VAD_sse.c)9
-rw-r--r--thirdparty/opus/silk/x86/VQ_WMat_EC_sse.c (renamed from drivers/opus/silk/x86/VQ_WMat_EC_sse.c)9
-rw-r--r--thirdparty/opus/silk/x86/main_sse.h (renamed from drivers/opus/silk/x86/main_sse.h)5
-rw-r--r--thirdparty/opus/silk/x86/x86_silk_map.c (renamed from drivers/opus/silk/x86/x86_silk_map.c)17
-rw-r--r--thirdparty/opus/stream.c (renamed from drivers/opus/stream.c)6
-rw-r--r--thirdparty/opus/tansig_table.h (renamed from drivers/opus/tansig_table.h)0
-rw-r--r--thirdparty/opus/wincerts.c (renamed from drivers/opus/wincerts.c)7
-rw-r--r--thirdparty/opus/winerrno.h (renamed from drivers/opus/winerrno.h)0
-rw-r--r--thirdparty/pvrtccompressor/AlphaBitmap.h (renamed from drivers/pvr/AlphaBitmap.h)0
-rw-r--r--thirdparty/pvrtccompressor/BitScale.cpp (renamed from drivers/pvr/BitScale.cpp)0
-rw-r--r--thirdparty/pvrtccompressor/BitScale.h (renamed from drivers/pvr/BitScale.h)0
-rw-r--r--thirdparty/pvrtccompressor/BitUtility.h (renamed from drivers/pvr/BitUtility.h)0
-rw-r--r--thirdparty/pvrtccompressor/Bitmap.h (renamed from drivers/pvr/Bitmap.h)0
-rw-r--r--thirdparty/pvrtccompressor/ColorRgba.h (renamed from drivers/pvr/ColorRgba.h)0
-rw-r--r--thirdparty/pvrtccompressor/Interval.h (renamed from drivers/pvr/Interval.h)0
-rw-r--r--thirdparty/pvrtccompressor/LICENSE.TXT25
-rw-r--r--thirdparty/pvrtccompressor/MortonTable.cpp (renamed from drivers/pvr/MortonTable.cpp)0
-rw-r--r--thirdparty/pvrtccompressor/MortonTable.h (renamed from drivers/pvr/MortonTable.h)0
-rw-r--r--thirdparty/pvrtccompressor/Point2.h (renamed from drivers/pvr/Point2.h)0
-rw-r--r--thirdparty/pvrtccompressor/PvrTcDecoder.cpp (renamed from drivers/pvr/PvrTcDecoder.cpp)0
-rw-r--r--thirdparty/pvrtccompressor/PvrTcDecoder.h (renamed from drivers/pvr/PvrTcDecoder.h)0
-rw-r--r--thirdparty/pvrtccompressor/PvrTcEncoder.cpp (renamed from drivers/pvr/PvrTcEncoder.cpp)0
-rw-r--r--thirdparty/pvrtccompressor/PvrTcEncoder.h (renamed from drivers/pvr/PvrTcEncoder.h)0
-rw-r--r--thirdparty/pvrtccompressor/PvrTcPacket.cpp (renamed from drivers/pvr/PvrTcPacket.cpp)0
-rw-r--r--thirdparty/pvrtccompressor/PvrTcPacket.h (renamed from drivers/pvr/PvrTcPacket.h)0
-rw-r--r--thirdparty/pvrtccompressor/RgbBitmap.h (renamed from drivers/pvr/RgbBitmap.h)0
-rw-r--r--thirdparty/pvrtccompressor/RgbaBitmap.h (renamed from drivers/pvr/RgbaBitmap.h)0
-rw-r--r--thirdparty/rg-etc1/rg_etc1.cpp (renamed from drivers/etc1/rg_etc1.cpp)0
-rw-r--r--thirdparty/rg-etc1/rg_etc1.h (renamed from drivers/etc1/rg_etc1.h)0
-rw-r--r--thirdparty/rtaudio/RtAudio.cpp (renamed from drivers/rtaudio/RtAudio.cpp)0
-rw-r--r--thirdparty/rtaudio/RtAudio.h (renamed from drivers/rtaudio/RtAudio.h)0
-rw-r--r--thirdparty/squish/alpha.cpp350
-rw-r--r--thirdparty/squish/alpha.h41
-rw-r--r--thirdparty/squish/clusterfit.cpp392
-rw-r--r--thirdparty/squish/clusterfit.h61
-rw-r--r--thirdparty/squish/colourblock.cpp214
-rw-r--r--thirdparty/squish/colourblock.h41
-rw-r--r--thirdparty/squish/colourfit.cpp54
-rw-r--r--thirdparty/squish/colourfit.h56
-rw-r--r--thirdparty/squish/colourset.cpp121
-rw-r--r--thirdparty/squish/colourset.h58
-rw-r--r--thirdparty/squish/config.h49
-rw-r--r--thirdparty/squish/maths.cpp259
-rw-r--r--thirdparty/squish/maths.h233
-rw-r--r--thirdparty/squish/rangefit.cpp201
-rw-r--r--thirdparty/squish/rangefit.h54
-rw-r--r--thirdparty/squish/simd.h40
-rw-r--r--thirdparty/squish/simd_float.h183
-rw-r--r--thirdparty/squish/simd_sse.h180
-rw-r--r--thirdparty/squish/simd_ve.h166
-rw-r--r--thirdparty/squish/singlecolourfit.cpp172
-rw-r--r--thirdparty/squish/singlecolourfit.h58
-rw-r--r--thirdparty/squish/singlecolourlookup.inl1064
-rw-r--r--thirdparty/squish/squish.cpp395
-rw-r--r--thirdparty/squish/squish.h300
-rw-r--r--thirdparty/zlib/adler32.c (renamed from drivers/builtin_zlib/zlib/adler32.c)0
-rw-r--r--thirdparty/zlib/compress.c (renamed from drivers/builtin_zlib/zlib/compress.c)0
-rw-r--r--thirdparty/zlib/crc32.c (renamed from drivers/builtin_zlib/zlib/crc32.c)0
-rw-r--r--thirdparty/zlib/crc32.h (renamed from drivers/builtin_zlib/zlib/crc32.h)0
-rw-r--r--thirdparty/zlib/deflate.c (renamed from drivers/builtin_zlib/zlib/deflate.c)0
-rw-r--r--thirdparty/zlib/deflate.h (renamed from drivers/builtin_zlib/zlib/deflate.h)0
-rw-r--r--thirdparty/zlib/infback.c (renamed from drivers/builtin_zlib/zlib/infback.c)0
-rw-r--r--thirdparty/zlib/inffast.c (renamed from drivers/builtin_zlib/zlib/inffast.c)0
-rw-r--r--thirdparty/zlib/inffast.h (renamed from drivers/builtin_zlib/zlib/inffast.h)0
-rw-r--r--thirdparty/zlib/inffixed.h (renamed from drivers/builtin_zlib/zlib/inffixed.h)0
-rw-r--r--thirdparty/zlib/inflate.c (renamed from drivers/builtin_zlib/zlib/inflate.c)0
-rw-r--r--thirdparty/zlib/inflate.h (renamed from drivers/builtin_zlib/zlib/inflate.h)0
-rw-r--r--thirdparty/zlib/inftrees.c (renamed from drivers/builtin_zlib/zlib/inftrees.c)0
-rw-r--r--thirdparty/zlib/inftrees.h (renamed from drivers/builtin_zlib/zlib/inftrees.h)0
-rw-r--r--thirdparty/zlib/trees.c (renamed from drivers/builtin_zlib/zlib/trees.c)0
-rw-r--r--thirdparty/zlib/trees.h (renamed from drivers/builtin_zlib/zlib/trees.h)0
-rw-r--r--thirdparty/zlib/uncompr.c (renamed from drivers/builtin_zlib/zlib/uncompr.c)0
-rw-r--r--thirdparty/zlib/zconf.h (renamed from drivers/builtin_zlib/zlib/zconf.h)0
-rw-r--r--thirdparty/zlib/zlib.h (renamed from drivers/builtin_zlib/zlib/zlib.h)0
-rw-r--r--thirdparty/zlib/zutil.c (renamed from drivers/builtin_zlib/zlib/zutil.c)0
-rw-r--r--thirdparty/zlib/zutil.h (renamed from drivers/builtin_zlib/zlib/zutil.h)0
-rw-r--r--tools/editor/code_editor.cpp1
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/scene_tree_dock.cpp30
-rw-r--r--tools/editor/scene_tree_dock.h1
2543 files changed, 12058 insertions, 45132 deletions
diff --git a/SConstruct b/SConstruct
index 524fb3fef..14aba2881 100644
--- a/SConstruct
+++ b/SConstruct
@@ -97,9 +97,8 @@ env_base.__class__.disable_module = methods.disable_module
env_base.__class__.add_source_files = methods.add_source_files
env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix
-env_base["x86_opt_gcc"]=False
-env_base["x86_opt_vc"]=False
-env_base["armv7_opt_gcc"]=False
+env_base["x86_libtheora_opt_gcc"]=False
+env_base["x86_libtheora_opt_vc"]=False
customs = ['custom.py']
@@ -119,24 +118,20 @@ opts.Add('platform','Platform: '+str(platform_list)+'.',"")
opts.Add('p','Platform (same as platform=).',"")
opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes')
opts.Add('gdscript','Build GDSCript support: (yes/no)','yes')
-opts.Add('vorbis','Build Ogg Vorbis Support: (yes/no)','yes')
-opts.Add('opus','Build Opus Audio Format Support: (yes/no)','yes')
+opts.Add('libogg','Ogg library for ogg container support (system/builtin)','builtin')
+opts.Add('libvorbis','Ogg Vorbis library for vorbis support (system/builtin)','builtin')
+opts.Add('libtheora','Theora library for theora module (system/builtin)','builtin')
+opts.Add('opus','Opus and opusfile library for Opus format support: (system/builtin)','builtin')
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
-opts.Add('squish','Squish BC Texture Compression in editor (yes/no)','yes')
-opts.Add('theora','Theora Video (yes/no)','yes')
-opts.Add('theoralib','Theora Video (yes/no)','no')
-opts.Add('freetype','Freetype support in editor','builtin')
-opts.Add('speex','Speex Audio (yes/no)','yes')
+opts.Add('squish','Squish library for BC Texture Compression in editor (system/builtin)','builtin')
+opts.Add('freetype','Freetype library for TTF support via freetype module (system/builtin)','builtin')
opts.Add('xml','XML Save/Load support (yes/no)','yes')
-opts.Add('png','PNG Image loader support (yes/no)','yes')
-opts.Add('jpg','JPG Image loader support (yes/no)','yes')
-opts.Add('webp','WEBP Image loader support (yes/no)','yes')
-opts.Add('dds','DDS Texture loader support (yes/no)','yes')
-opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes')
-opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
-opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
-opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
-opts.Add('musepack','Musepack Audio (yes/no)','yes')
+opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
+opts.Add('libwebp','libwebp library for webp module (system/builtin)','builtin')
+opts.Add('openssl','OpenSSL library for openssl module (system/builtin)','builtin')
+opts.Add('libmpcdec','libmpcdec library for mpc module (system/builtin)','builtin')
+opts.Add('enet','ENet library (system/builtin)','builtin')
+opts.Add('glew','GLEW library for the gl_context (system/builtin)','builtin')
opts.Add("CXX", "C++ Compiler")
opts.Add("CC", "C Compiler")
opts.Add("CCFLAGS", "Custom flags for the C++ compiler");
@@ -158,7 +153,7 @@ for k in platform_opts.keys():
opts.Add(o[0],o[1],o[2])
for x in module_list:
- opts.Add('module_'+x+'_enabled', "Enable module '"+x+"'.", "yes")
+ opts.Add('module_'+x+'_enabled', "Enable module '"+x+"' (yes/no)", "yes")
opts.Update(env_base) # update environment
Help(opts.GenerateHelpText(env_base)) # generate help
@@ -254,14 +249,6 @@ if selected_platform in platform_list:
#must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
detect.configure(env)
-
- if (env["freetype"]!="no"):
- env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
- if (env["freetype"]=="builtin"):
- env.Append(CPPPATH=['#drivers/freetype'])
- env.Append(CPPPATH=['#drivers/freetype/freetype/include'])
-
-
#env['platform_libsuffix'] = env['LIBSUFFIX']
suffix="."+selected_platform
@@ -322,49 +309,9 @@ if selected_platform in platform_list:
if (env.use_ptrcall):
env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']);
- if (env['musepack']=='yes'):
- env.Append(CPPFLAGS=['-DMUSEPACK_ENABLED']);
-
- #if (env['openssl']!='no'):
- # env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
- # if (env['openssl']=="builtin"):
- # env.Append(CPPPATH=['#drivers/builtin_openssl2'])
-
- if (env["builtin_zlib"]=='yes'):
- env.Append(CPPPATH=['#drivers/builtin_zlib/zlib'])
-
# to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64'])
- if (env_base['squish']=='yes'):
- env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
-
- if (env['vorbis']=='yes'):
- env.Append(CPPFLAGS=['-DVORBIS_ENABLED']);
- if (env['opus']=='yes'):
- env.Append(CPPFLAGS=['-DOPUS_ENABLED']);
-
-
- if (env['theora']=='yes'):
- env['theoralib']='yes'
- env.Append(CPPFLAGS=['-DTHEORA_ENABLED']);
- if (env['theoralib']=='yes'):
- env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);
-
- if (env['png']=='yes'):
- env.Append(CPPFLAGS=['-DPNG_ENABLED']);
- if (env['dds']=='yes'):
- env.Append(CPPFLAGS=['-DDDS_ENABLED']);
- if (env['pvr']=='yes'):
- env.Append(CPPFLAGS=['-DPVR_ENABLED']);
- if (env['jpg']=='yes'):
- env.Append(CPPFLAGS=['-DJPG_ENABLED']);
- if (env['webp']=='yes'):
- env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
-
- if (env['speex']=='yes'):
- env.Append(CPPFLAGS=['-DSPEEX_ENABLED']);
-
if (env['tools']=='yes'):
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d']=='yes'):
@@ -383,9 +330,6 @@ if selected_platform in platform_list:
if (env['colored']=='yes'):
methods.colored(sys,env)
- if (env['etc1']=='yes'):
- env.Append(CPPFLAGS=['-DETC1_ENABLED'])
-
Export('env')
#build subdirs, the build order is dependent on link order.
diff --git a/bin/tests/test_math.cpp b/bin/tests/test_math.cpp
index e5667bff6..9329002f7 100644
--- a/bin/tests/test_math.cpp
+++ b/bin/tests/test_math.cpp
@@ -516,7 +516,7 @@ MainLoop* test() {
{
- Vector<int32_t> hashes;
+ Vector<int> hashes;
List<StringName> tl;
ObjectTypeDB::get_type_list(&tl);
diff --git a/core/globals.cpp b/core/globals.cpp
index b822f52f1..bef40ff33 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -54,7 +54,7 @@ String Globals::localize_path(const String& p_path) const {
if (resource_path=="")
return p_path; //not initialied yet
- if (p_path.begins_with("res://") || p_path.begins_with("user://"))
+ if (p_path.begins_with("res://") || p_path.begins_with("user://") || p_path.is_abs_path())
return p_path.simplify_path();
diff --git a/core/hashfuncs.h b/core/hashfuncs.h
index a917ee5ed..6c029a345 100644
--- a/core/hashfuncs.h
+++ b/core/hashfuncs.h
@@ -74,7 +74,10 @@ static inline uint32_t hash_djb2_one_float(float p_in,uint32_t p_prev=5381) {
float f;
uint32_t i;
} u;
- u.f=p_in;
+
+ // handle -0 case
+ if (p_in==0.0f) u.f=0.0f;
+ else u.f=p_in;
return ((p_prev<<5)+p_prev)+u.i;
}
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 6b3828a57..5ed2415e3 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -1177,16 +1177,16 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
} else if (id=="IntArray") {
- Vector<int32_t> args;
- Error err = _parse_construct<int32_t>(p_stream,args,line,r_err_str);
+ Vector<int> args;
+ Error err = _parse_construct<int>(p_stream,args,line,r_err_str);
if (err)
return err;
- DVector<int32_t> arr;
+ DVector<int> arr;
{
int len=args.size();
arr.resize(len);
- DVector<int32_t>::Write w = arr.write();
+ DVector<int>::Write w = arr.write();
for(int i=0;i<len;i++) {
w[i]=int(args[i]);
}
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index f7abc8a3d..4e0ba53f4 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -5459,18 +5459,6 @@
<constants>
</constants>
</class>
-<class name="AudioStreamSpeex" inherits="AudioStream" category="Core">
- <brief_description>
- Speex audio stream driver.
- </brief_description>
- <description>
- Speex audio stream driver. Speex is very useful for compressed speech. It allows loading a very large amount of speech in memory at little IO/latency cost.
- </description>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
<class name="BackBufferCopy" inherits="Node2D" category="Core">
<brief_description>
Copies a region of the screen (or the whole screen) to a buffer so it can be accessed with the texscreen() shader instruction.
@@ -22274,8 +22262,10 @@
</class>
<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core">
<brief_description>
+ PacketPeer implementation using the ENet library.
</brief_description>
<description>
+ A connection (or a listening server) that should be passed to [method SceneTree.set_network_peer]. Socket events can be handled by connecting to [SceneTree] signals.
</description>
<methods>
<method name="close_connection">
@@ -22630,6 +22620,7 @@
Nodes can also process input events. When set, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it.
To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with [method set_owner]. This keeps track of who instanced what. This is mostly useful when writing editors and tools, though.
Finally, when a node is freed with [method free] or [method queue_free], it will also free all its children.
+ [b]Networking with nodes:[/b] After connecting to a server (or making one, see [NetworkedMultiplayerENet]) it is possible to use the built-in RPC (remote procedure call) system to easily communicate over the network. By calling [method rpc] with a method name, it will be called locally, and in all connected peers (peers = clients and the server that accepts connections), with behaviour varying depending on the network mode ([method set_network_mode]) on the receiving peer. To identify which [Node] receives the RPC call Godot will use it's [NodePath] (make sure node names are the same on all peers).
</description>
<methods>
<method name="_enter_tree" qualifiers="virtual">
@@ -23067,6 +23058,7 @@
<argument index="0" name="method" type="String">
</argument>
<description>
+ Send a remote procedure call request to all peers on the network (and locally), optionally sending additional data as arguments. Call request will be received by nodes with the same [NodePath].
</description>
</method>
<method name="rpc_config">
@@ -23075,6 +23067,7 @@
<argument index="1" name="mode" type="int">
</argument>
<description>
+ Change the method's RPC mode (one of RPC_MODE_* constants).
</description>
</method>
<method name="rpc_id" qualifiers="vararg">
@@ -23083,12 +23076,14 @@
<argument index="1" name="method" type="String">
</argument>
<description>
+ Send a [method rpc] to a specific peer identified by [i]peer_id[/i].
</description>
</method>
<method name="rpc_unreliable" qualifiers="vararg">
<argument index="0" name="method" type="String">
</argument>
<description>
+ Send a [method rpc] using an unreliable protocol.
</description>
</method>
<method name="rpc_unreliable_id" qualifiers="vararg">
@@ -23097,6 +23092,7 @@
<argument index="1" name="method" type="String">
</argument>
<description>
+ Send a [method rpc] to a specific peer identified by [i]peer_id[/i] using an unreliable protocol.
</description>
</method>
<method name="rset">
@@ -23105,6 +23101,7 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
+ Remotely change property's value on other peers (and locally).
</description>
</method>
<method name="rset_config">
@@ -23113,6 +23110,7 @@
<argument index="1" name="mode" type="int">
</argument>
<description>
+ Change the property's RPC mode (one of RPC_MODE_* constants).
</description>
</method>
<method name="rset_id">
@@ -23123,6 +23121,7 @@
<argument index="2" name="value" type="Variant">
</argument>
<description>
+ Remotely change property's value on a specific peer identified by [i]peer_id[/i].
</description>
</method>
<method name="rset_unreliable">
@@ -23131,6 +23130,7 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
+ Remotely change property's value on other peers (and locally) using an unreliable protocol.
</description>
</method>
<method name="rset_unreliable_id">
@@ -23141,6 +23141,7 @@
<argument index="2" name="value" type="Variant">
</argument>
<description>
+ Remotely change property's value on a specific peer identified by [i]peer_id[/i] using an unreliable protocol.
</description>
</method>
<method name="set_display_folded">
@@ -23174,6 +23175,7 @@
<argument index="0" name="mode" type="int">
</argument>
<description>
+ Change the networking mode of the [Node], where [i]mode[/i] is one of the constants NETWORK_MODE_*. Master nodes will only call gdscript methods defined as [i]master func[/i] if a RPC call is received (slave nodes will only call [i]slave func[/i]; both will call [i]remote func[/i] if the call is not local, and [i]sync func[/i] in any case). Inherit mode looks at the parent node to determine the value (root node depends on the [SceneTree] having a networking peer set with [method SceneTree.set_network_peer])
</description>
</method>
<method name="set_owner">
@@ -26265,7 +26267,7 @@
</methods>
<constants>
<constant name="PARAM_DIRECTION" value="0">
- Direction in radians at which the particles will be launched, Notice that when the direction is set to 0 the particles will be launched to the negative
+ Direction in degrees at which the particles will be launched, Notice that when the direction is set to 0 the particles will be launched to the negative
</constant>
<constant name="PARAM_SPREAD" value="1">
</constant>
@@ -26279,7 +26281,7 @@
Velocity at which the particles will orbit around the emitter center
</constant>
<constant name="PARAM_GRAVITY_DIRECTION" value="5">
- Direction in radians at which the particles will be attracted
+ Direction in degrees at which the particles will be attracted
</constant>
<constant name="PARAM_GRAVITY_STRENGTH" value="6">
Strength of the gravitation attraction for each particle
@@ -35273,6 +35275,7 @@
<return type="bool">
</return>
<description>
+ Returns true if this SceneTree's [NetworkedMultiplayerPeer] is in server mode (listening for connections).
</description>
</method>
<method name="is_paused" qualifiers="const">
@@ -35369,6 +35372,7 @@
<argument index="0" name="peer" type="NetworkedMultiplayerPeer">
</argument>
<description>
+ Set the peer object to handle the RPC system (effectively enabling networking). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.
</description>
</method>
<method name="set_pause">
diff --git a/drivers/SCsub b/drivers/SCsub
index 8243483e1..c496f46a1 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -1,81 +1,47 @@
Import('env')
-env_drivers = env.Clone()
-
env.drivers_sources=[]
-#env.add_source_files(env.drivers_sources,"*.cpp")
-env_drivers.Append(CPPPATH=["vorbis"])
-Export('env_drivers')
+if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
+ SConscript("zlib/SCsub");
+# OS drivers
SConscript('unix/SCsub');
+SConscript('windows/SCsub');
+
+# Sounds drivers
SConscript('alsa/SCsub');
SConscript('pulseaudio/SCsub');
-SConscript('windows/SCsub');
+if (env["platform"] == "windows"):
+ SConscript("rtaudio/SCsub");
+
+# Graphics drivers
SConscript('gles2/SCsub');
SConscript('gl_context/SCsub');
-SConscript('pnm/SCsub');
-
-if (env['openssl']!='no'):
- env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
- env_drivers.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
- if (env['openssl']=="builtin"):
- env_drivers.Append(CPPPATH=['#drivers/builtin_openssl2'])
- SConscript("builtin_openssl2/SCsub");
-
- SConscript('openssl/SCsub')
-
-if (env["png"]=="yes"):
- SConscript("png/SCsub");
-if (env["jpg"]=="yes"):
- #SConscript("jpg/SCsub");
- SConscript("jpegd/SCsub");
-if (env["webp"]=="yes"):
- SConscript("webp/SCsub");
-SConscript("dds/SCsub");
-SConscript("pvr/SCsub");
-SConscript("etc1/SCsub")
-if (env["builtin_zlib"]=="yes"):
- SConscript("builtin_zlib/SCsub");
-
-SConscript("rtaudio/SCsub");
-SConscript("nedmalloc/SCsub");
+# Core dependencies
+SConscript("png/SCsub");
SConscript("nrex/SCsub");
-SConscript("chibi/SCsub");
-if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theoralib"]=="yes" or env["opus"]=="yes"):
- SConscript("ogg/SCsub");
-if (env["vorbis"]=="yes"):
- SConscript("vorbis/SCsub");
-if (env["opus"]=="yes"):
- SConscript('opus/SCsub');
+
+# Tools override
+# FIXME: Should likely be integrated in the tools/ codebase
if (env["tools"]=="yes"):
SConscript("convex_decomp/SCsub");
-if (env["theoralib"]=="yes"):
- SConscript("theora/SCsub");
-if (env['speex']=='yes'):
- SConscript("speex/SCsub");
-if (env['musepack']=='yes'):
- SConscript("mpc/SCsub");
-if (env["squish"]=="yes" and env["tools"]=="yes"):
- SConscript("squish/SCsub");
-if (env["freetype"]!="no"):
- SConscript("freetype/SCsub");
-
-num = 0
-cur_base = ""
-total = len(env.drivers_sources)
-max_src = 64
-list = []
-lib_list = []
-
-import string
-
if env['vsproj']=="yes":
env.AddToVSProject(env.drivers_sources)
-if (env.split_drivers): #split drivers, this used to be needed for windows until separate builders for windows were created
+
+# Split drivers, this used to be needed for windows until separate builders for windows were created
+# FIXME: Check if still needed now that the drivers were made more lightweight
+if (env.split_drivers):
+ import string
+
+ num = 0
+ cur_base = ""
+ max_src = 64
+ list = []
+ lib_list = []
for f in env.drivers_sources:
fname = ""
@@ -87,14 +53,14 @@ if (env.split_drivers): #split drivers, this used to be needed for windows until
base = string.join(fname.split("/")[:2], "/")
if base != cur_base and len(list) > max_src:
if num > 0:
- lib = env_drivers.Library("drivers"+str(num), list)
+ lib = env.Library("drivers"+str(num), list)
lib_list.append(lib)
list = []
num = num+1
cur_base = base
list.append(f)
- lib = env_drivers.Library("drivers"+str(num), list)
+ lib = env.Library("drivers"+str(num), list)
lib_list.append(lib)
if len(lib_list) > 0:
@@ -102,15 +68,15 @@ if (env.split_drivers): #split drivers, this used to be needed for windows until
if os.name=='posix' and sys.platform=='msys':
env.Replace(ARFLAGS=['rcsT'])
- lib = env_drivers.Library("drivers_collated", lib_list)
+ lib = env.Library("drivers_collated", lib_list)
lib_list = [lib]
drivers_base=[]
- env_drivers.add_source_files(drivers_base,"*.cpp")
- lib_list.insert(0, env_drivers.Library("drivers", drivers_base))
+ env.add_source_files(drivers_base,"*.cpp")
+ lib_list.insert(0, env.Library("drivers", drivers_base))
env.Prepend(LIBS=lib_list)
else:
- env_drivers.add_source_files(env.drivers_sources,"*.cpp")
- lib = env_drivers.Library("drivers",env.drivers_sources)
+ env.add_source_files(env.drivers_sources,"*.cpp")
+ lib = env.Library("drivers",env.drivers_sources)
env.Prepend(LIBS=[lib])
diff --git a/drivers/alsa/SCsub b/drivers/alsa/SCsub
index 9fbb467ba..0582e0197 100644
--- a/drivers/alsa/SCsub
+++ b/drivers/alsa/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.drivers_sources,"*.cpp")
+env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')
diff --git a/drivers/builtin_openssl2/SCsub b/drivers/builtin_openssl2/SCsub
deleted file mode 100644
index 0c035cc4a..000000000
--- a/drivers/builtin_openssl2/SCsub
+++ /dev/null
@@ -1,663 +0,0 @@
-Import('env')
-Import('env_drivers')
-
-openssl_sources = [
-"ssl/t1_lib.c",
-"ssl/t1_ext.c",
-"ssl/s3_srvr.c",
-"ssl/t1_enc.c",
-"ssl/t1_meth.c",
-"ssl/s23_clnt.c",
-"ssl/ssl_asn1.c",
-"ssl/tls_srp.c",
-"ssl/kssl.c",
-"ssl/d1_both.c",
-"ssl/t1_clnt.c",
-"ssl/bio_ssl.c",
-"ssl/d1_srtp.c",
-"ssl/t1_reneg.c",
-"ssl/ssl_cert.c",
-"ssl/s3_lib.c",
-"ssl/d1_srvr.c",
-"ssl/s23_meth.c",
-"ssl/ssl_stat.c",
-"ssl/ssl_err.c",
-"ssl/ssl_algs.c",
-"ssl/s3_cbc.c",
-"ssl/d1_clnt.c",
-"ssl/s3_pkt.c",
-"ssl/d1_meth.c",
-"ssl/s3_both.c",
-"ssl/s2_enc.c",
-"ssl/s3_meth.c",
-"ssl/s3_enc.c",
-"ssl/s23_pkt.c",
-"ssl/s2_pkt.c",
-"ssl/d1_pkt.c",
-"ssl/ssl_rsa.c",
-"ssl/s23_srvr.c",
-"ssl/s2_meth.c",
-"ssl/s3_clnt.c",
-"ssl/s23_lib.c",
-"ssl/t1_srvr.c",
-"ssl/ssl_lib.c",
-"ssl/ssl_txt.c",
-"ssl/s2_srvr.c",
-"ssl/ssl_sess.c",
-"ssl/s2_clnt.c",
-"ssl/d1_lib.c",
-"ssl/s2_lib.c",
-"ssl/ssl_err2.c",
-"ssl/ssl_ciph.c",
-"crypto/dsa/dsa_lib.c",
-"crypto/dsa/dsa_pmeth.c",
-"crypto/dsa/dsa_ossl.c",
-"crypto/dsa/dsa_gen.c",
-"crypto/dsa/dsa_asn1.c",
-"crypto/dsa/dsa_prn.c",
-"crypto/dsa/dsa_sign.c",
-"crypto/dsa/dsa_key.c",
-"crypto/dsa/dsa_vrf.c",
-"crypto/dsa/dsa_err.c",
-"crypto/dsa/dsa_ameth.c",
-"crypto/dsa/dsa_depr.c",
-"crypto/x509/x509_lu.c",
-"crypto/x509/x509cset.c",
-"crypto/x509/x509_set.c",
-"crypto/x509/x509_d2.c",
-"crypto/x509/x509_txt.c",
-"crypto/x509/x509rset.c",
-"crypto/x509/by_dir.c",
-"crypto/x509/x509_vpm.c",
-"crypto/x509/x509_vfy.c",
-"crypto/x509/x509_trs.c",
-"crypto/x509/by_file.c",
-"crypto/x509/x509_obj.c",
-"crypto/x509/x509spki.c",
-"crypto/x509/x509_v3.c",
-"crypto/x509/x509_req.c",
-"crypto/x509/x509_att.c",
-"crypto/x509/x_all.c",
-"crypto/x509/x509_ext.c",
-"crypto/x509/x509type.c",
-"crypto/x509/x509_def.c",
-"crypto/x509/x509_err.c",
-"crypto/x509/x509name.c",
-"crypto/x509/x509_r2x.c",
-"crypto/x509/x509_cmp.c",
-"crypto/asn1/x_pkey.c",
-"crypto/asn1/a_gentm.c",
-"crypto/asn1/x_sig.c",
-"crypto/asn1/t_req.c",
-"crypto/asn1/t_pkey.c",
-"crypto/asn1/p8_pkey.c",
-"crypto/asn1/a_i2d_fp.c",
-"crypto/asn1/x_val.c",
-"crypto/asn1/f_string.c",
-"crypto/asn1/p5_pbe.c",
-"crypto/asn1/bio_ndef.c",
-"crypto/asn1/a_bool.c",
-"crypto/asn1/asn1_gen.c",
-"crypto/asn1/x_algor.c",
-"crypto/asn1/bio_asn1.c",
-"crypto/asn1/asn_mime.c",
-"crypto/asn1/t_x509.c",
-"crypto/asn1/a_strex.c",
-"crypto/asn1/x_nx509.c",
-"crypto/asn1/asn1_err.c",
-"crypto/asn1/x_crl.c",
-"crypto/asn1/a_print.c",
-"crypto/asn1/a_type.c",
-"crypto/asn1/tasn_new.c",
-"crypto/asn1/n_pkey.c",
-"crypto/asn1/x_bignum.c",
-"crypto/asn1/asn_pack.c",
-"crypto/asn1/evp_asn1.c",
-"crypto/asn1/t_bitst.c",
-"crypto/asn1/x_req.c",
-"crypto/asn1/a_time.c",
-"crypto/asn1/x_name.c",
-"crypto/asn1/x_pubkey.c",
-"crypto/asn1/tasn_typ.c",
-"crypto/asn1/asn_moid.c",
-"crypto/asn1/a_utctm.c",
-"crypto/asn1/asn1_lib.c",
-"crypto/asn1/x_x509a.c",
-"crypto/asn1/a_set.c",
-"crypto/asn1/t_crl.c",
-"crypto/asn1/p5_pbev2.c",
-"crypto/asn1/tasn_enc.c",
-"crypto/asn1/a_mbstr.c",
-"crypto/asn1/tasn_dec.c",
-"crypto/asn1/x_x509.c",
-"crypto/asn1/a_octet.c",
-"crypto/asn1/x_long.c",
-"crypto/asn1/a_bytes.c",
-"crypto/asn1/t_x509a.c",
-"crypto/asn1/a_enum.c",
-"crypto/asn1/a_int.c",
-"crypto/asn1/tasn_prn.c",
-"crypto/asn1/i2d_pr.c",
-"crypto/asn1/a_utf8.c",
-"crypto/asn1/t_spki.c",
-"crypto/asn1/a_digest.c",
-"crypto/asn1/a_dup.c",
-"crypto/asn1/i2d_pu.c",
-"crypto/asn1/a_verify.c",
-"crypto/asn1/f_enum.c",
-"crypto/asn1/a_sign.c",
-"crypto/asn1/d2i_pr.c",
-"crypto/asn1/asn1_par.c",
-"crypto/asn1/x_spki.c",
-"crypto/asn1/a_d2i_fp.c",
-"crypto/asn1/f_int.c",
-"crypto/asn1/x_exten.c",
-"crypto/asn1/tasn_utl.c",
-"crypto/asn1/nsseq.c",
-"crypto/asn1/a_bitstr.c",
-"crypto/asn1/x_info.c",
-"crypto/asn1/a_strnid.c",
-"crypto/asn1/a_object.c",
-"crypto/asn1/tasn_fre.c",
-"crypto/asn1/d2i_pu.c",
-"crypto/asn1/ameth_lib.c",
-"crypto/asn1/x_attrib.c",
-"crypto/evp/m_sha.c",
-"crypto/evp/e_camellia.c",
-"crypto/evp/e_aes.c",
-"crypto/evp/bio_b64.c",
-"crypto/evp/m_sigver.c",
-"crypto/evp/m_wp.c",
-"crypto/evp/m_sha1.c",
-"crypto/evp/p_seal.c",
-"crypto/evp/c_alld.c",
-"crypto/evp/p5_crpt.c",
-"crypto/evp/e_rc4.c",
-"crypto/evp/m_ecdsa.c",
-"crypto/evp/bio_enc.c",
-"crypto/evp/e_des3.c",
-"crypto/evp/m_null.c",
-"crypto/evp/bio_ok.c",
-"crypto/evp/pmeth_gn.c",
-"crypto/evp/e_rc5.c",
-"crypto/evp/e_rc2.c",
-"crypto/evp/p_dec.c",
-"crypto/evp/p_verify.c",
-"crypto/evp/e_rc4_hmac_md5.c",
-"crypto/evp/pmeth_lib.c",
-"crypto/evp/m_ripemd.c",
-"crypto/evp/m_md5.c",
-"crypto/evp/e_bf.c",
-"crypto/evp/p_enc.c",
-"crypto/evp/m_dss.c",
-"crypto/evp/bio_md.c",
-"crypto/evp/evp_pbe.c",
-"crypto/evp/e_seed.c",
-"crypto/evp/e_cast.c",
-"crypto/evp/p_open.c",
-"crypto/evp/p5_crpt2.c",
-"crypto/evp/m_dss1.c",
-"crypto/evp/names.c",
-"crypto/evp/evp_acnf.c",
-"crypto/evp/e_des.c",
-"crypto/evp/evp_cnf.c",
-"crypto/evp/evp_lib.c",
-"crypto/evp/digest.c",
-"crypto/evp/evp_err.c",
-"crypto/evp/evp_enc.c",
-"crypto/evp/e_old.c",
-"crypto/evp/c_all.c",
-"crypto/evp/m_md2.c",
-"crypto/evp/e_xcbc_d.c",
-"crypto/evp/pmeth_fn.c",
-"crypto/evp/p_lib.c",
-"crypto/evp/evp_key.c",
-"crypto/evp/encode.c",
-"crypto/evp/e_aes_cbc_hmac_sha1.c",
-"crypto/evp/e_aes_cbc_hmac_sha256.c",
-"crypto/evp/m_mdc2.c",
-"crypto/evp/e_null.c",
-"crypto/evp/p_sign.c",
-"crypto/evp/e_idea.c",
-"crypto/evp/c_allc.c",
-"crypto/evp/evp_pkey.c",
-"crypto/evp/m_md4.c",
-"crypto/ex_data.c",
-"crypto/pkcs12/p12_p8e.c",
-"crypto/pkcs12/p12_crt.c",
-"crypto/pkcs12/p12_utl.c",
-"crypto/pkcs12/p12_attr.c",
-"crypto/pkcs12/p12_npas.c",
-"crypto/pkcs12/p12_decr.c",
-"crypto/pkcs12/p12_init.c",
-"crypto/pkcs12/p12_kiss.c",
-"crypto/pkcs12/p12_add.c",
-"crypto/pkcs12/p12_p8d.c",
-"crypto/pkcs12/p12_mutl.c",
-"crypto/pkcs12/p12_crpt.c",
-"crypto/pkcs12/pk12err.c",
-"crypto/pkcs12/p12_asn.c",
-"crypto/pkcs12/p12_key.c",
-"crypto/ecdh/ech_key.c",
-"crypto/ecdh/ech_ossl.c",
-"crypto/ecdh/ech_lib.c",
-"crypto/ecdh/ech_err.c",
-"crypto/ecdh/ech_kdf.c",
-"crypto/o_str.c",
-"crypto/conf/conf_api.c",
-"crypto/conf/conf_err.c",
-"crypto/conf/conf_def.c",
-"crypto/conf/conf_lib.c",
-"crypto/conf/conf_mall.c",
-"crypto/conf/conf_sap.c",
-"crypto/conf/conf_mod.c",
-"crypto/ebcdic.c",
-"crypto/ecdsa/ecs_lib.c",
-"crypto/ecdsa/ecs_asn1.c",
-"crypto/ecdsa/ecs_ossl.c",
-"crypto/ecdsa/ecs_vrf.c",
-"crypto/ecdsa/ecs_sign.c",
-"crypto/ecdsa/ecs_err.c",
-"crypto/dso/dso_win32.c",
-"crypto/dso/dso_lib.c",
-"crypto/dso/dso_dlfcn.c",
-"crypto/dso/dso_dl.c",
-"crypto/dso/dso_beos.c",
-"crypto/dso/dso_null.c",
-"crypto/dso/dso_vms.c",
-"crypto/dso/dso_err.c",
-"crypto/dso/dso_openssl.c",
-"crypto/cryptlib.c",
-"crypto/md5/md5_one.c",
-"crypto/md5/md5_dgst.c",
-"crypto/pkcs7/pkcs7err.c",
-"crypto/pkcs7/pk7_smime.c",
-"crypto/pkcs7/bio_pk7.c",
-"crypto/pkcs7/pk7_mime.c",
-"crypto/pkcs7/pk7_lib.c",
-"crypto/pkcs7/pk7_asn1.c",
-"crypto/pkcs7/pk7_doit.c",
-"crypto/pkcs7/pk7_attr.c",
-"crypto/md4/md4_one.c",
-"crypto/md4/md4_dgst.c",
-"crypto/o_dir.c",
-"crypto/buffer/buf_err.c",
-"crypto/buffer/buf_str.c",
-"crypto/buffer/buffer.c",
-"crypto/cms/cms_lib.c",
-"crypto/cms/cms_io.c",
-"crypto/cms/cms_err.c",
-"crypto/cms/cms_dd.c",
-"crypto/cms/cms_smime.c",
-"crypto/cms/cms_att.c",
-"crypto/cms/cms_pwri.c",
-"crypto/cms/cms_cd.c",
-"crypto/cms/cms_sd.c",
-"crypto/cms/cms_asn1.c",
-"crypto/cms/cms_env.c",
-"crypto/cms/cms_enc.c",
-"crypto/cms/cms_ess.c",
-"crypto/cms/cms_kari.c",
-"crypto/mem_dbg.c",
-"crypto/uid.c",
-"crypto/stack/stack.c",
-"crypto/ec/ec_ameth.c",
-"crypto/ec/ec_err.c",
-"crypto/ec/ec_lib.c",
-"crypto/ec/ec_curve.c",
-"crypto/ec/ec_oct.c",
-"crypto/ec/ec_asn1.c",
-"crypto/ec/ecp_oct.c",
-"crypto/ec/ec_print.c",
-"crypto/ec/ec2_smpl.c",
-"crypto/ec/ecp_nistp224.c",
-"crypto/ec/ec2_oct.c",
-"crypto/ec/eck_prn.c",
-"crypto/ec/ec_key.c",
-"crypto/ec/ecp_nist.c",
-"crypto/ec/ec_check.c",
-"crypto/ec/ecp_smpl.c",
-"crypto/ec/ec2_mult.c",
-"crypto/ec/ecp_mont.c",
-"crypto/ec/ecp_nistp521.c",
-"crypto/ec/ec_mult.c",
-"crypto/ec/ecp_nistputil.c",
-"crypto/ec/ec_pmeth.c",
-"crypto/ec/ec_cvt.c",
-"crypto/ec/ecp_nistp256.c",
-"crypto/krb5/krb5_asn.c",
-"crypto/hmac/hmac.c",
-"crypto/hmac/hm_ameth.c",
-"crypto/hmac/hm_pmeth.c",
-"crypto/comp/c_rle.c",
-"crypto/comp/c_zlib.c",
-"crypto/comp/comp_lib.c",
-"crypto/comp/comp_err.c",
-"crypto/des/fcrypt.c",
-"crypto/des/str2key.c",
-"crypto/des/cbc_cksm.c",
-"crypto/des/des_enc.c",
-"crypto/des/ofb_enc.c",
-"crypto/des/read2pwd.c",
-"crypto/des/ecb3_enc.c",
-"crypto/des/rand_key.c",
-"crypto/des/cfb64ede.c",
-"crypto/des/rpc_enc.c",
-"crypto/des/ofb64ede.c",
-"crypto/des/qud_cksm.c",
-"crypto/des/enc_writ.c",
-"crypto/des/set_key.c",
-"crypto/des/xcbc_enc.c",
-"crypto/des/fcrypt_b.c",
-"crypto/des/ede_cbcm_enc.c",
-"crypto/des/des_old2.c",
-"crypto/des/cfb_enc.c",
-"crypto/des/ecb_enc.c",
-"crypto/des/enc_read.c",
-"crypto/des/des_old.c",
-"crypto/des/ofb64enc.c",
-"crypto/des/pcbc_enc.c",
-"crypto/des/cbc_enc.c",
-"crypto/des/cfb64enc.c",
-"crypto/lhash/lh_stats.c",
-"crypto/lhash/lhash.c",
-"crypto/x509v3/v3_genn.c",
-"crypto/x509v3/pcy_cache.c",
-"crypto/x509v3/v3_sxnet.c",
-"crypto/x509v3/v3_scts.c",
-"crypto/x509v3/v3err.c",
-"crypto/x509v3/v3_conf.c",
-"crypto/x509v3/v3_utl.c",
-"crypto/x509v3/v3_akeya.c",
-"crypto/x509v3/v3_lib.c",
-"crypto/x509v3/pcy_lib.c",
-"crypto/x509v3/v3_cpols.c",
-"crypto/x509v3/v3_ia5.c",
-"crypto/x509v3/v3_bitst.c",
-"crypto/x509v3/v3_skey.c",
-"crypto/x509v3/v3_info.c",
-"crypto/x509v3/v3_asid.c",
-"crypto/x509v3/pcy_tree.c",
-"crypto/x509v3/v3_pcons.c",
-"crypto/x509v3/v3_bcons.c",
-"crypto/x509v3/v3_pku.c",
-"crypto/x509v3/v3_ocsp.c",
-"crypto/x509v3/pcy_map.c",
-"crypto/x509v3/v3_ncons.c",
-"crypto/x509v3/v3_purp.c",
-"crypto/x509v3/v3_enum.c",
-"crypto/x509v3/v3_pmaps.c",
-"crypto/x509v3/pcy_node.c",
-"crypto/x509v3/v3_pcia.c",
-"crypto/x509v3/v3_crld.c",
-"crypto/x509v3/v3_pci.c",
-"crypto/x509v3/v3_akey.c",
-"crypto/x509v3/v3_addr.c",
-"crypto/x509v3/v3_int.c",
-"crypto/x509v3/v3_alt.c",
-"crypto/x509v3/v3_extku.c",
-"crypto/x509v3/v3_prn.c",
-"crypto/x509v3/pcy_data.c",
-"crypto/aes/aes_ofb.c",
-"crypto/aes/aes_ctr.c",
-"crypto/aes/aes_ecb.c",
-"crypto/aes/aes_cfb.c",
-"crypto/aes/aes_wrap.c",
-"crypto/aes/aes_ige.c",
-"crypto/aes/aes_misc.c",
-"crypto/pqueue/pqueue.c",
-"crypto/sha/sha_one.c",
-"crypto/sha/sha_dgst.c",
-"crypto/sha/sha512.c",
-"crypto/sha/sha1_one.c",
-"crypto/sha/sha1dgst.c",
-"crypto/sha/sha256.c",
-"crypto/whrlpool/wp_dgst.c",
-"crypto/objects/obj_xref.c",
-"crypto/objects/o_names.c",
-"crypto/objects/obj_err.c",
-"crypto/objects/obj_dat.c",
-"crypto/objects/obj_lib.c",
-"crypto/mem.c",
-"crypto/fips_ers.c",
-"crypto/o_fips.c",
-"crypto/engine/eng_rdrand.c",
-"crypto/engine/eng_err.c",
-"crypto/engine/tb_ecdsa.c",
-"crypto/engine/tb_rsa.c",
-"crypto/engine/tb_cipher.c",
-"crypto/engine/tb_dsa.c",
-"crypto/engine/eng_lib.c",
-"crypto/engine/tb_asnmth.c",
-"crypto/engine/tb_ecdh.c",
-"crypto/engine/tb_dh.c",
-"crypto/engine/tb_store.c",
-"crypto/engine/eng_init.c",
-"crypto/engine/eng_cnf.c",
-"crypto/engine/eng_all.c",
-"crypto/engine/tb_digest.c",
-"crypto/engine/tb_pkmeth.c",
-"crypto/engine/eng_table.c",
-"crypto/engine/eng_ctrl.c",
-"crypto/engine/eng_list.c",
-"crypto/engine/eng_cryptodev.c",
-"crypto/engine/eng_pkey.c",
-"crypto/engine/tb_rand.c",
-"crypto/engine/eng_openssl.c",
-"crypto/engine/eng_fat.c",
-"crypto/engine/eng_dyn.c",
-"crypto/ts/ts_rsp_verify.c",
-"crypto/ts/ts_req_print.c",
-"crypto/ts/ts_verify_ctx.c",
-"crypto/ts/ts_req_utils.c",
-"crypto/ts/ts_err.c",
-"crypto/ts/ts_rsp_print.c",
-"crypto/ts/ts_rsp_utils.c",
-"crypto/ts/ts_lib.c",
-"crypto/ts/ts_conf.c",
-"crypto/ts/ts_asn1.c",
-"crypto/ts/ts_rsp_sign.c",
-"crypto/ocsp/ocsp_ext.c",
-"crypto/ocsp/ocsp_cl.c",
-"crypto/ocsp/ocsp_ht.c",
-"crypto/ocsp/ocsp_lib.c",
-"crypto/ocsp/ocsp_srv.c",
-"crypto/ocsp/ocsp_vfy.c",
-"crypto/ocsp/ocsp_err.c",
-"crypto/ocsp/ocsp_prn.c",
-"crypto/ocsp/ocsp_asn.c",
-"crypto/bf/bf_cfb64.c",
-"crypto/bf/bf_ecb.c",
-"crypto/bf/bf_enc.c",
-"crypto/bf/bf_skey.c",
-"crypto/bf/bf_ofb64.c",
-"crypto/idea/i_skey.c",
-"crypto/idea/i_ofb64.c",
-"crypto/idea/i_cbc.c",
-"crypto/idea/i_ecb.c",
-"crypto/idea/i_cfb64.c",
-"crypto/cmac/cm_ameth.c",
-"crypto/cmac/cmac.c",
-"crypto/cmac/cm_pmeth.c",
-"crypto/dh/dh_lib.c",
-"crypto/dh/dh_key.c",
-"crypto/dh/dh_asn1.c",
-"crypto/dh/dh_depr.c",
-"crypto/dh/dh_pmeth.c",
-"crypto/dh/dh_prn.c",
-"crypto/dh/dh_gen.c",
-"crypto/dh/dh_ameth.c",
-"crypto/dh/dh_check.c",
-"crypto/dh/dh_err.c",
-"crypto/dh/dh_kdf.c",
-"crypto/dh/dh_rfc5114.c",
-"crypto/modes/ccm128.c",
-"crypto/modes/ofb128.c",
-"crypto/modes/cts128.c",
-"crypto/modes/ctr128.c",
-"crypto/modes/gcm128.c",
-"crypto/modes/cbc128.c",
-"crypto/modes/cfb128.c",
-"crypto/modes/xts128.c",
-"crypto/modes/wrap128.c",
-"crypto/camellia/cmll_cfb.c",
-"crypto/camellia/cmll_ecb.c",
-"crypto/camellia/cmll_utl.c",
-"crypto/camellia/cmll_misc.c",
-"crypto/camellia/cmll_ofb.c",
-"crypto/camellia/cmll_ctr.c",
-"crypto/seed/seed_ecb.c",
-"crypto/seed/seed_cbc.c",
-"crypto/seed/seed.c",
-"crypto/seed/seed_ofb.c",
-"crypto/seed/seed_cfb.c",
-"crypto/txt_db/txt_db.c",
-"crypto/cpt_err.c",
-"crypto/pem/pem_pk8.c",
-"crypto/pem/pem_lib.c",
-"crypto/pem/pem_sign.c",
-"crypto/pem/pem_all.c",
-"crypto/pem/pem_info.c",
-"crypto/pem/pem_pkey.c",
-"crypto/pem/pem_seal.c",
-"crypto/pem/pem_err.c",
-"crypto/pem/pem_xaux.c",
-"crypto/pem/pvkfmt.c",
-"crypto/pem/pem_x509.c",
-"crypto/pem/pem_oth.c",
-"crypto/rand/rand_lib.c",
-"crypto/rand/randfile.c",
-"crypto/rand/rand_os2.c",
-"crypto/rand/rand_unix.c",
-"crypto/rand/rand_nw.c",
-"crypto/rand/md_rand.c",
-"crypto/rand/rand_err.c",
-"crypto/rand/rand_win.c",
-"crypto/rand/rand_egd.c",
-"crypto/cversion.c",
-"crypto/cast/c_ecb.c",
-"crypto/cast/c_skey.c",
-"crypto/cast/c_ofb64.c",
-"crypto/cast/c_enc.c",
-"crypto/cast/c_cfb64.c",
-"crypto/o_time.c",
-"crypto/mdc2/mdc2dgst.c",
-"crypto/mdc2/mdc2_one.c",
-"crypto/rc4/rc4_utl.c",
-"crypto/ui/ui_compat.c",
-"crypto/ui/ui_util.c",
-"crypto/ui/ui_lib.c",
-"crypto/ui/ui_err.c",
-"crypto/ui/ui_openssl.c",
-"crypto/bio/bf_buff.c",
-"crypto/bio/bss_null.c",
-"crypto/bio/bss_acpt.c",
-"crypto/bio/bss_conn.c",
-"crypto/bio/bss_fd.c",
-"crypto/bio/bf_null.c",
-"crypto/bio/bio_err.c",
-"crypto/bio/bss_sock.c",
-"crypto/bio/bss_mem.c",
-"crypto/bio/b_dump.c",
-"crypto/bio/b_print.c",
-"crypto/bio/b_sock.c",
-"crypto/bio/bss_dgram.c",
-"crypto/bio/bf_nbio.c",
-"crypto/bio/bio_lib.c",
-"crypto/bio/bss_file.c",
-"crypto/bio/bss_bio.c",
-"crypto/bio/bss_log.c",
-"crypto/bio/bio_cb.c",
-"crypto/o_init.c",
-"crypto/rc2/rc2_skey.c",
-"crypto/rc2/rc2_cbc.c",
-"crypto/rc2/rc2cfb64.c",
-"crypto/rc2/rc2_ecb.c",
-"crypto/rc2/rc2ofb64.c",
-"crypto/bn/bn_x931p.c",
-"crypto/bn/bn_blind.c",
-"crypto/bn/bn_gf2m.c",
-"crypto/bn/bn_const.c",
-"crypto/bn/bn_sqr.c",
-"crypto/bn/bn_nist.c",
-"crypto/bn/bn_rand.c",
-"crypto/bn/bn_err.c",
-"crypto/bn/bn_div.c",
-"crypto/bn/bn_kron.c",
-"crypto/bn/bn_ctx.c",
-"crypto/bn/bn_shift.c",
-"crypto/bn/bn_mod.c",
-"crypto/bn/bn_exp2.c",
-"crypto/bn/bn_word.c",
-"crypto/bn/bn_add.c",
-"crypto/bn/bn_exp.c",
-"crypto/bn/bn_mont.c",
-"crypto/bn/bn_print.c",
-"crypto/bn/bn_mul.c",
-"crypto/bn/bn_prime.c",
-"crypto/bn/bn_depr.c",
-"crypto/bn/bn_gcd.c",
-"crypto/bn/bn_mpi.c",
-"crypto/bn/bn_sqrt.c",
-"crypto/bn/bn_recp.c",
-"crypto/bn/bn_lib.c",
-"crypto/ripemd/rmd_dgst.c",
-"crypto/ripemd/rmd_one.c",
-"crypto/rsa/rsa_x931.c",
-"crypto/rsa/rsa_depr.c",
-"crypto/rsa/rsa_saos.c",
-"crypto/rsa/rsa_crpt.c",
-"crypto/rsa/rsa_pss.c",
-"crypto/rsa/rsa_oaep.c",
-"crypto/rsa/rsa_null.c",
-"crypto/rsa/rsa_gen.c",
-"crypto/rsa/rsa_prn.c",
-"crypto/rsa/rsa_pmeth.c",
-"crypto/rsa/rsa_asn1.c",
-"crypto/rsa/rsa_ssl.c",
-"crypto/rsa/rsa_ameth.c",
-"crypto/rsa/rsa_pk1.c",
-"crypto/rsa/rsa_err.c",
-"crypto/rsa/rsa_lib.c",
-"crypto/rsa/rsa_none.c",
-"crypto/rsa/rsa_chk.c",
-"crypto/rsa/rsa_eay.c",
-"crypto/rsa/rsa_sign.c",
-"crypto/srp/srp_lib.c",
-"crypto/srp/srp_vfy.c",
-"crypto/err/err.c",
-"crypto/err/err_prn.c",
-"crypto/err/err_all.c",
-"crypto/mem_clr.c",
-"crypto/rc4/rc4_skey.c",
-"crypto/rc4/rc4_enc.c",
-"crypto/camellia/camellia.c",
-"crypto/camellia/cmll_cbc.c",
-#"crypto/aes/aes_x86core.c",
-"crypto/aes/aes_core.c",
-"crypto/aes/aes_cbc.c",
-"crypto/whrlpool/wp_block.c",
-"crypto/bn/bn_asm.c",
-]
-
-#env.drivers_sources+=openssl_sources
-
-env.Append(CPPPATH=["#drivers/builtin_openssl2"])
-env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto"])
-env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/openssl"])
-env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/evp"])
-env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/asn1"])
-env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/modes"])
-#env_ssl.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/store"])
-env_drivers.Append(CPPFLAGS=["-DOPENSSL_NO_ASM","-DOPENSSL_THREADS","-DL_ENDIAN"])
-
-if "platform" in env and env["platform"] == "winrt":
- openssl_sources += ['winrt.cpp']
-
-# Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
-import os
-import methods
-if not (os.name=="nt" and methods.msvc_is_detected() ): # not Windows and not MSVC
- env_drivers.Append(CFLAGS=["-Wno-error=implicit-function-declaration"])
-
-env_drivers.add_source_files(env.drivers_sources,openssl_sources)
diff --git a/drivers/builtin_zlib/SCsub b/drivers/builtin_zlib/SCsub
deleted file mode 100644
index e5c81c0b3..000000000
--- a/drivers/builtin_zlib/SCsub
+++ /dev/null
@@ -1,22 +0,0 @@
-Import('env')
-
-zlib_sources = [
-
- "builtin_zlib/zlib/adler32.c",
- "builtin_zlib/zlib/compress.c",
- "builtin_zlib/zlib/crc32.c",
- "builtin_zlib/zlib/deflate.c",
- "builtin_zlib/zlib/infback.c",
- "builtin_zlib/zlib/inffast.c",
- "builtin_zlib/zlib/inflate.c",
- "builtin_zlib/zlib/inftrees.c",
- "builtin_zlib/zlib/trees.c",
- "builtin_zlib/zlib/uncompr.c",
- "builtin_zlib/zlib/zutil.c",
- ]
-
-
-env.drivers_sources+=zlib_sources
-
-#env.add_source_files("core", png_sources)
-Export('env')
diff --git a/drivers/chibi/SCsub b/drivers/chibi/SCsub
deleted file mode 100644
index 9fbb467ba..000000000
--- a/drivers/chibi/SCsub
+++ /dev/null
@@ -1,5 +0,0 @@
-Import('env')
-
-env.add_source_files(env.drivers_sources,"*.cpp")
-
-Export('env')
diff --git a/drivers/convex_decomp/SCsub b/drivers/convex_decomp/SCsub
index 6699efef7..0582e0197 100644
--- a/drivers/convex_decomp/SCsub
+++ b/drivers/convex_decomp/SCsub
@@ -1,4 +1,5 @@
Import('env')
-Export('env');
-env.add_source_files(env.drivers_sources,"*.cpp")
+env.add_source_files(env.drivers_sources, "*.cpp")
+
+Export('env')
diff --git a/drivers/dds/SCsub b/drivers/dds/SCsub
deleted file mode 100644
index 159829384..000000000
--- a/drivers/dds/SCsub
+++ /dev/null
@@ -1,10 +0,0 @@
-Import('env')
-
-
-dds_sources = [
- "dds/texture_loader_dds.cpp"
- ]
-
-env.drivers_sources+=dds_sources
-
-#env.add_source_files(env.drivers_sources, dds_sources)
diff --git a/drivers/etc1/SCsub b/drivers/etc1/SCsub
deleted file mode 100644
index 2b9dc1b31..000000000
--- a/drivers/etc1/SCsub
+++ /dev/null
@@ -1,15 +0,0 @@
-Import('env')
-
-
-etc_sources = [
- "etc1/image_etc.cpp",
- "etc1/rg_etc1.cpp",
- "etc1/texture_loader_pkm.cpp"
-]
-
-if (env["etc1"] != "no"):
- env.drivers_sources+=etc_sources
-
-#env.add_source_files(env.drivers_sources, etc_sources)
-
-Export('env')
diff --git a/drivers/freetype/SCsub b/drivers/freetype/SCsub
deleted file mode 100644
index 4ddc78508..000000000
--- a/drivers/freetype/SCsub
+++ /dev/null
@@ -1,73 +0,0 @@
-Import('env')
-
-ft_sources=[\
-"src/autofit/autofit.c",\
-"src/base/ftapi.c",\
-"src/base/ftbase.c",\
-"src/base/ftbbox.c",\
-"src/base/ftbdf.c",\
-"src/base/ftbitmap.c",\
-"src/base/ftcid.c",\
-"src/base/ftdebug.c",\
-"src/base/ftfntfmt.c",\
-"src/base/ftfstype.c",\
-"src/base/ftgasp.c",\
-"src/base/ftglyph.c",\
-"src/base/ftgxval.c",\
-"src/base/ftinit.c",\
-"src/base/ftlcdfil.c",\
-"src/base/ftmm.c",\
-"src/base/ftotval.c",\
-"src/base/ftpatent.c",\
-"src/base/ftpfr.c",\
-"src/base/ftpic.c",\
-"src/base/ftstroke.c",\
-"src/base/ftsynth.c",\
-"src/base/ftsystem.c",\
-"src/base/fttype1.c",\
-"src/base/ftwinfnt.c",\
-"src/bdf/bdf.c",\
-"src/cache/ftcache.c",\
-"src/cff/cff.c",\
-"src/cid/type1cid.c",\
-"src/gxvalid/gxvalid.c",\
-"src/otvalid/otvalid.c",\
-"src/pcf/pcf.c",\
-"src/pfr/pfr.c",\
-"src/psaux/psaux.c",\
-"src/pshinter/pshinter.c",\
-"src/psnames/psnames.c",\
-"src/raster/raster.c",\
-"src/sfnt/sfnt.c",\
-"src/smooth/smooth.c",\
-"src/truetype/truetype.c",\
-"src/type1/type1.c",\
-"src/type42/type42.c",\
-"src/winfonts/winfnt.c",\
-]
-
-
-if (env["freetype"]=="builtin"):
-
- # Include header for WinRT to fix build issues
- if "platform" in env and env["platform"] == "winrt":
- env.Append(CCFLAGS=['/FI', '"drivers/freetype/winrtdef.h"'])
-
- # fix for Windows' shell miserably failing on long lines, split in two libraries
- half1=[]
- half2=[]
- for x in ft_sources:
- if (x.find("src/base")==0 or x.find("src/sfnt")==0):
- half2.append(x)
- else:
- half1.append(x)
-
- lib = env.Library("freetype_builtin1",half2)
- env.Append(LIBS=[lib])
- lib = env.Library("freetype_builtin2",half1)
- env.Append(LIBS=[lib])
-
- env.Append(CPPPATH=["#drivers/freetype/include"])
-
-
-Export('env')
diff --git a/drivers/freetype/src/Jamfile b/drivers/freetype/src/Jamfile
deleted file mode 100644
index ebc036983..000000000
--- a/drivers/freetype/src/Jamfile
+++ /dev/null
@@ -1,19 +0,0 @@
-# FreeType 2 src Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) ;
-
-for xx in $(FT2_COMPONENTS)
-{
- SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ;
-}
-
-# end of src Jamfile
diff --git a/drivers/freetype/src/autofit/Jamfile b/drivers/freetype/src/autofit/Jamfile
deleted file mode 100644
index 638b22972..000000000
--- a/drivers/freetype/src/autofit/Jamfile
+++ /dev/null
@@ -1,53 +0,0 @@
-# FreeType 2 src/autofit Jamfile
-#
-# Copyright 2003-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP src autofit ;
-
-{
- local _sources ;
-
- # define FT2_AUTOFIT2 to enable experimental latin hinter replacement
- if $(FT2_AUTOFIT2)
- {
- CCFLAGS += FT_OPTION_AUTOFIT2 ;
- }
- if $(FT2_MULTI)
- {
- _sources = afangles
- afblue
- afcjk
- afdummy
- afglobal
- afhints
- afindic
- aflatin
- afloader
- afmodule
- afpic
- afranges
- afshaper
- afwarp
- ;
-
- if $(FT2_AUTOFIT2)
- {
- _sources += aflatin2 ;
- }
- }
- else
- {
- _sources = autofit ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/autofit Jamfile
diff --git a/drivers/freetype/src/base/Jamfile b/drivers/freetype/src/base/Jamfile
deleted file mode 100644
index cfc69657f..000000000
--- a/drivers/freetype/src/base/Jamfile
+++ /dev/null
@@ -1,88 +0,0 @@
-# FreeType 2 src/base Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) base ;
-
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = basepic
- ftadvanc
- ftcalc
- ftdbgmem
- ftgloadr
- fthash
- ftobjs
- ftoutln
- ftpic
- ftrfork
- ftsnames
- ftstream
- fttrigon
- ftutil
- ;
- }
- else
- {
- _sources = ftbase ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# Add the optional/replaceable files.
-#
-{
- local _sources = ftapi
- ftbbox
- ftbdf
- ftbitmap
- ftcid
- ftdebug
- ftfntfmt
- ftfstype
- ftgasp
- ftglyph
- ftgxval
- ftinit
- ftlcdfil
- ftmm
- ftotval
- ftpatent
- ftpfr
- ftstroke
- ftsynth
- ftsystem
- fttype1
- ftwinfnt
- ;
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# Add Macintosh-specific file to the library when necessary.
-#
-if $(MAC)
-{
- Library $(FT2_LIB) : ftmac.c ;
-}
-else if $(OS) = MACOSX
-{
- if $(FT2_MULTI)
- {
- Library $(FT2_LIB) : ftmac.c ;
- }
-}
-
-# end of src/base Jamfile
diff --git a/drivers/freetype/src/bdf/Jamfile b/drivers/freetype/src/bdf/Jamfile
deleted file mode 100644
index 2f0147bbb..000000000
--- a/drivers/freetype/src/bdf/Jamfile
+++ /dev/null
@@ -1,31 +0,0 @@
-# FreeType 2 src/bdf Jamfile
-#
-# Copyright 2002-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) bdf ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = bdfdrivr
- bdflib
- ;
- }
- else
- {
- _sources = bdf ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/bdf Jamfile
diff --git a/drivers/freetype/src/cache/Jamfile b/drivers/freetype/src/cache/Jamfile
deleted file mode 100644
index da6551015..000000000
--- a/drivers/freetype/src/cache/Jamfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# FreeType 2 src/cache Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) cache ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = ftcbasic
- ftccache
- ftcglyph
- ftcimage
- ftcmanag
- ftccmap
- ftcmru
- ftcsbits
- ;
- }
- else
- {
- _sources = ftcache ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cache Jamfile
diff --git a/drivers/freetype/src/cff/Jamfile b/drivers/freetype/src/cff/Jamfile
deleted file mode 100644
index 8067e6b29..000000000
--- a/drivers/freetype/src/cff/Jamfile
+++ /dev/null
@@ -1,45 +0,0 @@
-# FreeType 2 src/cff Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) cff ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = cffcmap
- cffdrivr
- cffgload
- cffload
- cffobjs
- cffparse
- cffpic
- cf2arrst
- cf2blues
- cf2error
- cf2font
- cf2ft
- cf2hints
- cf2intrp
- cf2read
- cf2stack
- ;
- }
- else
- {
- _sources = cff ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cff Jamfile
diff --git a/drivers/freetype/src/cid/Jamfile b/drivers/freetype/src/cid/Jamfile
deleted file mode 100644
index 4b4eea17d..000000000
--- a/drivers/freetype/src/cid/Jamfile
+++ /dev/null
@@ -1,34 +0,0 @@
-# FreeType 2 src/cid Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) cid ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = cidgload
- cidload
- cidobjs
- cidparse
- cidriver
- ;
- }
- else
- {
- _sources = type1cid ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cid Jamfile
diff --git a/drivers/freetype/src/gxvalid/Jamfile b/drivers/freetype/src/gxvalid/Jamfile
deleted file mode 100644
index 9738677e0..000000000
--- a/drivers/freetype/src/gxvalid/Jamfile
+++ /dev/null
@@ -1,52 +0,0 @@
-# FreeType 2 src/gxvalid Jamfile
-#
-# Copyright 2005-2016 by
-# suzuki toshiya, Masatake YAMATO and Red Hat K.K.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) gxvalid ;
-
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = gxvbsln
- gxvcommn
- gxvfeat
- gxvjust
- gxvkern
- gxvlcar
- gxvmod
- gxvmort
- gxvmort0
- gxvmort1
- gxvmort2
- gxvmort4
- gxvmort5
- gxvmorx
- gxvmorx0
- gxvmorx1
- gxvmorx2
- gxvmorx4
- gxvmorx5
- gxvopbd
- gxvprop
- gxvtrak
- ;
- }
- else
- {
- _sources = gxvalid ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/gxvalid Jamfile
diff --git a/drivers/freetype/src/otvalid/Jamfile b/drivers/freetype/src/otvalid/Jamfile
deleted file mode 100644
index eded89ab9..000000000
--- a/drivers/freetype/src/otvalid/Jamfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# FreeType 2 src/otvalid Jamfile
-#
-# Copyright 2004-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) otvalid ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = otvbase
- otvcommn
- otvgdef
- otvgpos
- otvgsub
- otvjstf
- otvmath
- otvmod
- ;
- }
- else
- {
- _sources = otvalid ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/otvalid Jamfile
diff --git a/drivers/freetype/src/pcf/Jamfile b/drivers/freetype/src/pcf/Jamfile
deleted file mode 100644
index 9ebe6a2cb..000000000
--- a/drivers/freetype/src/pcf/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/pcf Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) pcf ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = pcfdrivr
- pcfread
- pcfutil
- ;
- }
- else
- {
- _sources = pcf ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pcf Jamfile
diff --git a/drivers/freetype/src/pfr/Jamfile b/drivers/freetype/src/pfr/Jamfile
deleted file mode 100644
index a5b294b79..000000000
--- a/drivers/freetype/src/pfr/Jamfile
+++ /dev/null
@@ -1,35 +0,0 @@
-# FreeType 2 src/pfr Jamfile
-#
-# Copyright 2002-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) pfr ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = pfrcmap
- pfrdrivr
- pfrgload
- pfrload
- pfrobjs
- pfrsbit
- ;
- }
- else
- {
- _sources = pfr ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pfr Jamfile
diff --git a/drivers/freetype/src/psaux/Jamfile b/drivers/freetype/src/psaux/Jamfile
deleted file mode 100644
index 9270eec68..000000000
--- a/drivers/freetype/src/psaux/Jamfile
+++ /dev/null
@@ -1,35 +0,0 @@
-# FreeType 2 src/psaux Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) psaux ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = afmparse
- psauxmod
- psconv
- psobjs
- t1cmap
- t1decode
- ;
- }
- else
- {
- _sources = psaux ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/psaux Jamfile
diff --git a/drivers/freetype/src/pshinter/Jamfile b/drivers/freetype/src/pshinter/Jamfile
deleted file mode 100644
index fcb225811..000000000
--- a/drivers/freetype/src/pshinter/Jamfile
+++ /dev/null
@@ -1,34 +0,0 @@
-# FreeType 2 src/pshinter Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = pshalgo
- pshglob
- pshmod
- pshpic
- pshrec
- ;
- }
- else
- {
- _sources = pshinter ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pshinter Jamfile
diff --git a/drivers/freetype/src/psnames/Jamfile b/drivers/freetype/src/psnames/Jamfile
deleted file mode 100644
index 35b8a99c8..000000000
--- a/drivers/freetype/src/psnames/Jamfile
+++ /dev/null
@@ -1,31 +0,0 @@
-# FreeType 2 src/psnames Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) psnames ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = psmodule
- pspic
- ;
- }
- else
- {
- _sources = psnames ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/psnames Jamfile
diff --git a/drivers/freetype/src/raster/Jamfile b/drivers/freetype/src/raster/Jamfile
deleted file mode 100644
index 2ec88f560..000000000
--- a/drivers/freetype/src/raster/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/raster Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) raster ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = ftraster
- ftrend1
- rastpic
- ;
- }
- else
- {
- _sources = raster ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/raster Jamfile
diff --git a/drivers/freetype/src/sfnt/Jamfile b/drivers/freetype/src/sfnt/Jamfile
deleted file mode 100644
index 089cc269b..000000000
--- a/drivers/freetype/src/sfnt/Jamfile
+++ /dev/null
@@ -1,40 +0,0 @@
-# FreeType 2 src/sfnt Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = pngshim
- sfdriver
- sfntpic
- sfobjs
- ttbdf
- ttcmap
- ttkern
- ttload
- ttmtx
- ttpost
- ttsbit
- ;
- }
- else
- {
- _sources = sfnt ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/sfnt Jamfile
diff --git a/drivers/freetype/src/smooth/Jamfile b/drivers/freetype/src/smooth/Jamfile
deleted file mode 100644
index a388c11d9..000000000
--- a/drivers/freetype/src/smooth/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/smooth Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) smooth ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = ftgrays
- ftsmooth
- ftspic
- ;
- }
- else
- {
- _sources = smooth ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/smooth Jamfile
diff --git a/drivers/freetype/src/truetype/Jamfile b/drivers/freetype/src/truetype/Jamfile
deleted file mode 100644
index ecbb2dbdd..000000000
--- a/drivers/freetype/src/truetype/Jamfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# FreeType 2 src/truetype Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) truetype ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = ttdriver
- ttgload
- ttgxvar
- ttinterp
- ttobjs
- ttpic
- ttpload
- ttsubpix
- ;
- }
- else
- {
- _sources = truetype ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/truetype Jamfile
diff --git a/drivers/freetype/src/type1/Jamfile b/drivers/freetype/src/type1/Jamfile
deleted file mode 100644
index 948b40854..000000000
--- a/drivers/freetype/src/type1/Jamfile
+++ /dev/null
@@ -1,35 +0,0 @@
-# FreeType 2 src/type1 Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) type1 ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = t1afm
- t1driver
- t1gload
- t1load
- t1objs
- t1parse
- ;
- }
- else
- {
- _sources = type1 ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/type1 Jamfile
diff --git a/drivers/freetype/src/type42/Jamfile b/drivers/freetype/src/type42/Jamfile
deleted file mode 100644
index a504ad17d..000000000
--- a/drivers/freetype/src/type42/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/type42 Jamfile
-#
-# Copyright 2002-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) type42 ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = t42drivr
- t42objs
- t42parse
- ;
- }
- else
- {
- _sources = type42 ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/type42 Jamfile
diff --git a/drivers/freetype/src/winfonts/Jamfile b/drivers/freetype/src/winfonts/Jamfile
deleted file mode 100644
index d81165e92..000000000
--- a/drivers/freetype/src/winfonts/Jamfile
+++ /dev/null
@@ -1,16 +0,0 @@
-# FreeType 2 src/winfonts Jamfile
-#
-# Copyright 2001-2016 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) winfonts ;
-
-Library $(FT2_LIB) : winfnt.c ;
-
-# end of src/winfonts Jamfile
diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub
index dac27c012..b05a96cb9 100644
--- a/drivers/gl_context/SCsub
+++ b/drivers/gl_context/SCsub
@@ -1,11 +1,21 @@
Import('env')
-env.add_source_files(env.drivers_sources,"*.cpp")
+if (env["platform"] in ["haiku","osx","windows","x11"]):
+ # Thirdparty source files
+ if (env["glew"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/glew/"
+ thirdparty_sources = [
+ "glew.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env.add_source_files(env.drivers_sources, thirdparty_sources)
+ env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
+ env.Append(CPPPATH = [thirdparty_dir])
-if (env.get('glew') == 'yes'):
- env.add_source_files(env.drivers_sources,"glew.c")
env.Append(CPPFLAGS = ['-DGLEW_ENABLED'])
- env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
- env.Append(CPPPATH = ['.'])
+
+# Godot source files
+env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')
diff --git a/drivers/gles2/SCsub b/drivers/gles2/SCsub
index a17335b41..89d7d8636 100644
--- a/drivers/gles2/SCsub
+++ b/drivers/gles2/SCsub
@@ -1,5 +1,7 @@
Import('env')
-env.add_source_files(env.drivers_sources,"*.cpp")
+env.add_source_files(env.drivers_sources, "*.cpp")
SConscript("shaders/SCsub")
+
+Export('env')
diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub
index 38177d725..88445f34c 100644
--- a/drivers/gles2/shaders/SCsub
+++ b/drivers/gles2/shaders/SCsub
@@ -6,3 +6,5 @@ if env['BUILDERS'].has_key('GLSL120GLES'):
env.GLSL120GLES('canvas_shadow.glsl');
env.GLSL120GLES('blur.glsl');
env.GLSL120GLES('copy.glsl');
+
+Export('env')
diff --git a/drivers/jpegd/SCsub b/drivers/jpegd/SCsub
deleted file mode 100644
index dfdb19402..000000000
--- a/drivers/jpegd/SCsub
+++ /dev/null
@@ -1,11 +0,0 @@
-Import('env')
-
-
-jpg_sources = [
- "jpegd/jpgd.cpp",
- "jpegd/image_loader_jpegd.cpp"
- ]
-
-env.drivers_sources+=jpg_sources
-
-#env.add_source_files(env.drivers_sources, jpg_sources)
diff --git a/drivers/mpc/SCsub b/drivers/mpc/SCsub
deleted file mode 100644
index 32ffdb863..000000000
--- a/drivers/mpc/SCsub
+++ /dev/null
@@ -1,21 +0,0 @@
-Import('env')
-
-
-mpc_sources = [
- "mpc/huffman.c",
- "mpc/mpc_bits_reader.c",
- "mpc/mpc_decoder.c",
- "mpc/mpc_demux.c",
- "mpc/mpc_reader.c",
- "mpc/requant.c",
- "mpc/streaminfo.c",
- "mpc/synth_filter.c",
-]
-
-env.drivers_sources+=mpc_sources
-
-env.add_source_files(env.drivers_sources,"*.cpp")
-
-#env.add_source_files(env.drivers_sources, mpc_sources)
-
-Export('env')
diff --git a/drivers/nedmalloc/License.txt b/drivers/nedmalloc/License.txt
deleted file mode 100644
index 1dad8e934..000000000
--- a/drivers/nedmalloc/License.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/drivers/nedmalloc/Readme.txt b/drivers/nedmalloc/Readme.txt
deleted file mode 100644
index 85f9b6a0f..000000000
--- a/drivers/nedmalloc/Readme.txt
+++ /dev/null
@@ -1,136 +0,0 @@
-nedalloc v1.05 15th June 2008:
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-by Niall Douglas (http://www.nedprod.com/programs/portable/nedmalloc/)
-
-Enclosed is nedalloc, an alternative malloc implementation for multiple
-threads without lock contention based on dlmalloc v2.8.4. It is more
-or less a newer implementation of ptmalloc2, the standard allocator in
-Linux (which is based on dlmalloc v2.7.0) but also contains a per-thread
-cache for maximum CPU scalability.
-
-It is licensed under the Boost Software License which basically means
-you can do anything you like with it. This does not apply to the malloc.c.h
-file which remains copyright to others.
-
-It has been tested on win32 (x86), win64 (x64), Linux (x64), FreeBSD (x64)
-and Apple MacOS X (x86). It works very well on all of these and is very
-significantly faster than the system allocator on all of these platforms.
-
-By literally dropping in this allocator as a replacement for your system
-allocator, you can see real world improvements of up to three times in normal
-code!
-
-To use:
--=-=-=-
-Drop in nedmalloc.h, nedmalloc.c and malloc.c.h into your project.
-Configure using the instructions in nedmalloc.h. Run and enjoy.
-
-To test, compile test.c. It will run a comparison between your system
-allocator and nedalloc and tell you how much faster nedalloc is. It also
-serves as an example of usage.
-
-Notes:
--=-=-=
-If you want the very latest version of this allocator, get it from the
-TnFOX SVN repository at svn://svn.berlios.de/viewcvs/tnfox/trunk/src/nedmalloc
-
-Because of how nedalloc allocates an mspace per thread, it can cause
-severe bloating of memory usage under certain allocation patterns.
-You can substantially reduce this wastage by setting MAXTHREADSINPOOL
-or the threads parameter to nedcreatepool() to a fraction of the number of
-threads which would normally be in a pool at once. This will reduce
-bloating at the cost of an increase in lock contention. If allocated size
-is less than THREADCACHEMAX, locking is avoided 90-99% of the time and
-if most of your allocations are below this value, you can safely set
-MAXTHREADSINPOOL to one.
-
-You will suffer memory leakage unless you call neddisablethreadcache()
-per pool for every thread which exits. This is because nedalloc cannot
-portably know when a thread exits and thus when its thread cache can
-be returned for use by other code. Don't forget pool zero, the system pool.
-
-For C++ type allocation patterns (where the same sizes of memory are
-regularly allocated and deallocated as objects are created and destroyed),
-the threadcache always benefits performance. If however your allocation
-patterns are different, searching the threadcache may significantly slow
-down your code - as a rule of thumb, if cache utilisation is below 80%
-(see the source for neddisablethreadcache() for how to enable debug
-printing in release mode) then you should disable the thread cache for
-that thread. You can compile out the threadcache code by setting
-THREADCACHEMAX to zero.
-
-Speed comparisons:
--=-=-=-=-=-=-=-=-=
-See Benchmarks.xls for details.
-
-The enclosed test.c can do two things: it can be a torture test or a speed
-test. The speed test is designed to be a representative synthetic
-memory allocator test. It works by randomly mixing allocations with frees
-with half of the allocation sizes being a two power multiple less than
-512 bytes (to mimic C++ stack instantiated objects) and the other half
-being a simple random value less than 16Kb.
-
-The real world code results are from Tn's TestIO benchmark. This is a
-heavily multithreaded and memory intensive benchmark with a lot of branching
-and other stuff modern processors don't like so much. As you'll note, the
-test doesn't show the benefits of the threadcache mostly due to the saturation
-of the memory bus being the limiting factor.
-
-ChangeLog:
--=-=-=-=-=
-v1.05 15th June 2008:
- * { 1042 } Added error check for TLSSET() and TLSFREE() macros. Thanks to
-Markus Elfring for reporting this.
- * { 1043 } Fixed a segfault when freeing memory allocated using
-nedindependent_comalloc(). Thanks to Pavel Vozenilek for reporting this.
-
-v1.04 14th July 2007:
- * Fixed a bug with the new optimised implementation that failed to lock
-on a realloc under certain conditions.
- * Fixed lack of thread synchronisation in InitPool() causing pool corruption
- * Fixed a memory leak of thread cache contents on disabling. Thanks to Earl
-Chew for reporting this.
- * Added a sanity check for freed blocks being valid.
- * Reworked test.c into being a torture test.
- * Fixed GCC assembler optimisation misspecification
-
-v1.04alpha_svn915 7th October 2006:
- * Fixed failure to unlock thread cache list if allocating a new list failed.
-Thanks to Dmitry Chichkov for reporting this. Futher thanks to Aleksey Sanin.
- * Fixed realloc(0, <size>) segfaulting. Thanks to Dmitry Chichkov for
-reporting this.
- * Made config defines #ifndef so they can be overriden by the build system.
-Thanks to Aleksey Sanin for suggesting this.
- * Fixed deadlock in nedprealloc() due to unnecessary locking of preferred
-thread mspace when mspace_realloc() always uses the original block's mspace
-anyway. Thanks to Aleksey Sanin for reporting this.
- * Made some speed improvements by hacking mspace_malloc() to no longer lock
-its mspace, thus allowing the recursive mutex implementation to be removed
-with an associated speed increase. Thanks to Aleksey Sanin for suggesting this.
- * Fixed a bug where allocating mspaces overran its max limit. Thanks to
-Aleksey Sanin for reporting this.
-
-v1.03 10th July 2006:
- * Fixed memory corruption bug in threadcache code which only appeared with >4
-threads and in heavy use of the threadcache.
-
-v1.02 15th May 2006:
- * Integrated dlmalloc v2.8.4, fixing the win32 memory release problem and
-improving performance still further. Speed is now up to twice the speed of v1.01
-(average is 67% faster).
- * Fixed win32 critical section implementation. Thanks to Pavel Kuznetsov
-for reporting this.
- * Wasn't locking mspace if all mspaces were locked. Thanks to Pavel Kuznetsov
-for reporting this.
- * Added Apple Mac OS X support.
-
-v1.01 24th February 2006:
- * Fixed multiprocessor scaling problems by removing sources of cache sloshing
- * Earl Chew <earl_chew <at> agilent <dot> com> sent patches for the following:
- 1. size2binidx() wasn't working for default code path (non x86)
- 2. Fixed failure to release mspace lock under certain circumstances which
- caused a deadlock
-
-v1.00 1st January 2006:
- * First release
diff --git a/drivers/nedmalloc/SCsub b/drivers/nedmalloc/SCsub
deleted file mode 100644
index 6699efef7..000000000
--- a/drivers/nedmalloc/SCsub
+++ /dev/null
@@ -1,4 +0,0 @@
-Import('env')
-Export('env');
-
-env.add_source_files(env.drivers_sources,"*.cpp")
diff --git a/drivers/nedmalloc/malloc.c.h b/drivers/nedmalloc/malloc.c.h
deleted file mode 100644
index 4fec5cc9d..000000000
--- a/drivers/nedmalloc/malloc.c.h
+++ /dev/null
@@ -1,5814 +0,0 @@
-#ifdef NEDMALLOC_ENABLED
-/*
- This is a version (aka dlmalloc) of malloc/free/realloc written by
- Doug Lea and released to the public domain, as explained at
- http://creativecommons.org/licenses/publicdomain. Send questions,
- comments, complaints, performance data, etc to dl@cs.oswego.edu
-
-* Version 2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee)
-
- Note: There may be an updated version of this malloc obtainable at
- ftp://gee.cs.oswego.edu/pub/misc/malloc.c
- Check before installing!
-
-* Quickstart
-
- This library is all in one file to simplify the most common usage:
- ftp it, compile it (-O3), and link it into another program. All of
- the compile-time options default to reasonable values for use on
- most platforms. You might later want to step through various
- compile-time and dynamic tuning options.
-
- For convenience, an include file for code using this malloc is at:
- ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.4.h
- You don't really need this .h file unless you call functions not
- defined in your system include files. The .h file contains only the
- excerpts from this file needed for using this malloc on ANSI C/C++
- systems, so long as you haven't changed compile-time options about
- naming and tuning parameters. If you do, then you can create your
- own malloc.h that does include all settings by cutting at the point
- indicated below. Note that you may already by default be using a C
- library containing a malloc that is based on some version of this
- malloc (for example in linux). You might still want to use the one
- in this file to customize settings or to avoid overheads associated
- with library versions.
-
-* Vital statistics:
-
- Supported pointer/size_t representation: 4 or 8 bytes
- size_t MUST be an unsigned type of the same width as
- pointers. (If you are using an ancient system that declares
- size_t as a signed type, or need it to be a different width
- than pointers, you can use a previous release of this malloc
- (e.g. 2.7.2) supporting these.)
-
- Alignment: 8 bytes (default)
- This suffices for nearly all current machines and C compilers.
- However, you can define MALLOC_ALIGNMENT to be wider than this
- if necessary (up to 128bytes), at the expense of using more space.
-
- Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes)
- 8 or 16 bytes (if 8byte sizes)
- Each malloced chunk has a hidden word of overhead holding size
- and status information, and additional cross-check word
- if FOOTERS is defined.
-
- Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead)
- 8-byte ptrs: 32 bytes (including overhead)
-
- Even a request for zero bytes (i.e., malloc(0)) returns a
- pointer to something of the minimum allocatable size.
- The maximum overhead wastage (i.e., number of extra bytes
- allocated than were requested in malloc) is less than or equal
- to the minimum size, except for requests >= mmap_threshold that
- are serviced via mmap(), where the worst case wastage is about
- 32 bytes plus the remainder from a system page (the minimal
- mmap unit); typically 4096 or 8192 bytes.
-
- Security: static-safe; optionally more or less
- The "security" of malloc refers to the ability of malicious
- code to accentuate the effects of errors (for example, freeing
- space that is not currently malloc'ed or overwriting past the
- ends of chunks) in code that calls malloc. This malloc
- guarantees not to modify any memory locations below the base of
- heap, i.e., static variables, even in the presence of usage
- errors. The routines additionally detect most improper frees
- and reallocs. All this holds as long as the static bookkeeping
- for malloc itself is not corrupted by some other means. This
- is only one aspect of security -- these checks do not, and
- cannot, detect all possible programming errors.
-
- If FOOTERS is defined nonzero, then each allocated chunk
- carries an additional check word to verify that it was malloced
- from its space. These check words are the same within each
- execution of a program using malloc, but differ across
- executions, so externally crafted fake chunks cannot be
- freed. This improves security by rejecting frees/reallocs that
- could corrupt heap memory, in addition to the checks preventing
- writes to statics that are always on. This may further improve
- security at the expense of time and space overhead. (Note that
- FOOTERS may also be worth using with MSPACES.)
-
- By default detected errors cause the program to abort (calling
- "abort()"). You can override this to instead proceed past
- errors by defining PROCEED_ON_ERROR. In this case, a bad free
- has no effect, and a malloc that encounters a bad address
- caused by user overwrites will ignore the bad address by
- dropping pointers and indices to all known memory. This may
- be appropriate for programs that should continue if at all
- possible in the face of programming errors, although they may
- run out of memory because dropped memory is never reclaimed.
-
- If you don't like either of these options, you can define
- CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything
- else. And if if you are sure that your program using malloc has
- no errors or vulnerabilities, you can define INSECURE to 1,
- which might (or might not) provide a small performance improvement.
-
- Thread-safety: NOT thread-safe unless USE_LOCKS defined
- When USE_LOCKS is defined, each public call to malloc, free,
- etc is surrounded with either a pthread mutex or a win32
- spinlock (depending on WIN32). This is not especially fast, and
- can be a major bottleneck. It is designed only to provide
- minimal protection in concurrent environments, and to provide a
- basis for extensions. If you are using malloc in a concurrent
- program, consider instead using nedmalloc
- (http://www.nedprod.com/programs/portable/nedmalloc/) or
- ptmalloc (See http://www.malloc.de), which are derived
- from versions of this malloc.
-
- System requirements: Any combination of MORECORE and/or MMAP/MUNMAP
- This malloc can use unix sbrk or any emulation (invoked using
- the CALL_MORECORE macro) and/or mmap/munmap or any emulation
- (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system
- memory. On most unix systems, it tends to work best if both
- MORECORE and MMAP are enabled. On Win32, it uses emulations
- based on VirtualAlloc. It also uses common C library functions
- like memset.
-
- Compliance: I believe it is compliant with the Single Unix Specification
- (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably
- others as well.
-
-* Overview of algorithms
-
- This is not the fastest, most space-conserving, most portable, or
- most tunable malloc ever written. However it is among the fastest
- while also being among the most space-conserving, portable and
- tunable. Consistent balance across these factors results in a good
- general-purpose allocator for malloc-intensive programs.
-
- In most ways, this malloc is a best-fit allocator. Generally, it
- chooses the best-fitting existing chunk for a request, with ties
- broken in approximately least-recently-used order. (This strategy
- normally maintains low fragmentation.) However, for requests less
- than 256bytes, it deviates from best-fit when there is not an
- exactly fitting available chunk by preferring to use space adjacent
- to that used for the previous small request, as well as by breaking
- ties in approximately most-recently-used order. (These enhance
- locality of series of small allocations.) And for very large requests
- (>= 256Kb by default), it relies on system memory mapping
- facilities, if supported. (This helps avoid carrying around and
- possibly fragmenting memory used only for large chunks.)
-
- All operations (except malloc_stats and mallinfo) have execution
- times that are bounded by a constant factor of the number of bits in
- a size_t, not counting any clearing in calloc or copying in realloc,
- or actions surrounding MORECORE and MMAP that have times
- proportional to the number of non-contiguous regions returned by
- system allocation routines, which is often just 1. In real-time
- applications, you can optionally suppress segment traversals using
- NO_SEGMENT_TRAVERSAL, which assures bounded execution even when
- system allocators return non-contiguous spaces, at the typical
- expense of carrying around more memory and increased fragmentation.
-
- The implementation is not very modular and seriously overuses
- macros. Perhaps someday all C compilers will do as good a job
- inlining modular code as can now be done by brute-force expansion,
- but now, enough of them seem not to.
-
- Some compilers issue a lot of warnings about code that is
- dead/unreachable only on some platforms, and also about intentional
- uses of negation on unsigned types. All known cases of each can be
- ignored.
-
- For a longer but out of date high-level description, see
- http://gee.cs.oswego.edu/dl/html/malloc.html
-
-* MSPACES
- If MSPACES is defined, then in addition to malloc, free, etc.,
- this file also defines mspace_malloc, mspace_free, etc. These
- are versions of malloc routines that take an "mspace" argument
- obtained using create_mspace, to control all internal bookkeeping.
- If ONLY_MSPACES is defined, only these versions are compiled.
- So if you would like to use this allocator for only some allocations,
- and your system malloc for others, you can compile with
- ONLY_MSPACES and then do something like...
- static mspace mymspace = create_mspace(0,0); // for example
- #define mymalloc(bytes) mspace_malloc(mymspace, bytes)
-
- (Note: If you only need one instance of an mspace, you can instead
- use "USE_DL_PREFIX" to relabel the global malloc.)
-
- You can similarly create thread-local allocators by storing
- mspaces as thread-locals. For example:
- static __thread mspace tlms = 0;
- void* tlmalloc(size_t bytes) {
- if (tlms == 0) tlms = create_mspace(0, 0);
- return mspace_malloc(tlms, bytes);
- }
- void tlfree(void* mem) { mspace_free(tlms, mem); }
-
- Unless FOOTERS is defined, each mspace is completely independent.
- You cannot allocate from one and free to another (although
- conformance is only weakly checked, so usage errors are not always
- caught). If FOOTERS is defined, then each chunk carries around a tag
- indicating its originating mspace, and frees are directed to their
- originating spaces.
-
- ------------------------- Compile-time options ---------------------------
-
-Be careful in setting #define values for numerical constants of type
-size_t. On some systems, literal values are not automatically extended
-to size_t precision unless they are explicitly casted. You can also
-use the symbolic values MAX_SIZE_T, SIZE_T_ONE, etc below.
-
-WIN32 default: defined if _WIN32 defined
- Defining WIN32 sets up defaults for MS environment and compilers.
- Otherwise defaults are for unix. Beware that there seem to be some
- cases where this malloc might not be a pure drop-in replacement for
- Win32 malloc: Random-looking failures from Win32 GDI API's (eg;
- SetDIBits()) may be due to bugs in some video driver implementations
- when pixel buffers are malloc()ed, and the region spans more than
- one VirtualAlloc()ed region. Because dlmalloc uses a small (64Kb)
- default granularity, pixel buffers may straddle virtual allocation
- regions more often than when using the Microsoft allocator. You can
- avoid this by using VirtualAlloc() and VirtualFree() for all pixel
- buffers rather than using malloc(). If this is not possible,
- recompile this malloc with a larger DEFAULT_GRANULARITY.
-
-MALLOC_ALIGNMENT default: (size_t)8
- Controls the minimum alignment for malloc'ed chunks. It must be a
- power of two and at least 8, even on machines for which smaller
- alignments would suffice. It may be defined as larger than this
- though. Note however that code and data structures are optimized for
- the case of 8-byte alignment.
-
-MSPACES default: 0 (false)
- If true, compile in support for independent allocation spaces.
- This is only supported if HAVE_MMAP is true.
-
-ONLY_MSPACES default: 0 (false)
- If true, only compile in mspace versions, not regular versions.
-
-USE_LOCKS default: 0 (false)
- Causes each call to each public routine to be surrounded with
- pthread or WIN32 mutex lock/unlock. (If set true, this can be
- overridden on a per-mspace basis for mspace versions.) If set to a
- non-zero value other than 1, locks are used, but their
- implementation is left out, so lock functions must be supplied manually,
- as described below.
-
-USE_SPIN_LOCKS default: 1 iff USE_LOCKS and on x86 using gcc or MSC
- If true, uses custom spin locks for locking. This is currently
- supported only for x86 platforms using gcc or recent MS compilers.
- Otherwise, posix locks or win32 critical sections are used.
-
-FOOTERS default: 0
- If true, provide extra checking and dispatching by placing
- information in the footers of allocated chunks. This adds
- space and time overhead.
-
-INSECURE default: 0
- If true, omit checks for usage errors and heap space overwrites.
-
-USE_DL_PREFIX default: NOT defined
- Causes compiler to prefix all public routines with the string 'dl'.
- This can be useful when you only want to use this malloc in one part
- of a program, using your regular system malloc elsewhere.
-
-ABORT default: defined as abort()
- Defines how to abort on failed checks. On most systems, a failed
- check cannot die with an "assert" or even print an informative
- message, because the underlying print routines in turn call malloc,
- which will fail again. Generally, the best policy is to simply call
- abort(). It's not very useful to do more than this because many
- errors due to overwriting will show up as address faults (null, odd
- addresses etc) rather than malloc-triggered checks, so will also
- abort. Also, most compilers know that abort() does not return, so
- can better optimize code conditionally calling it.
-
-PROCEED_ON_ERROR default: defined as 0 (false)
- Controls whether detected bad addresses cause them to bypassed
- rather than aborting. If set, detected bad arguments to free and
- realloc are ignored. And all bookkeeping information is zeroed out
- upon a detected overwrite of freed heap space, thus losing the
- ability to ever return it from malloc again, but enabling the
- application to proceed. If PROCEED_ON_ERROR is defined, the
- static variable malloc_corruption_error_count is compiled in
- and can be examined to see if errors have occurred. This option
- generates slower code than the default abort policy.
-
-DEBUG default: NOT defined
- The DEBUG setting is mainly intended for people trying to modify
- this code or diagnose problems when porting to new platforms.
- However, it may also be able to better isolate user errors than just
- using runtime checks. The assertions in the check routines spell
- out in more detail the assumptions and invariants underlying the
- algorithms. The checking is fairly extensive, and will slow down
- execution noticeably. Calling malloc_stats or mallinfo with DEBUG
- set will attempt to check every non-mmapped allocated and free chunk
- in the course of computing the summaries.
-
-ABORT_ON_ASSERT_FAILURE default: defined as 1 (true)
- Debugging assertion failures can be nearly impossible if your
- version of the assert macro causes malloc to be called, which will
- lead to a cascade of further failures, blowing the runtime stack.
- ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(),
- which will usually make debugging easier.
-
-MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32
- The action to take before "return 0" when malloc fails to be able to
- return memory because there is none available.
-
-HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES
- True if this system supports sbrk or an emulation of it.
-
-MORECORE default: sbrk
- The name of the sbrk-style system routine to call to obtain more
- memory. See below for guidance on writing custom MORECORE
- functions. The type of the argument to sbrk/MORECORE varies across
- systems. It cannot be size_t, because it supports negative
- arguments, so it is normally the signed type of the same width as
- size_t (sometimes declared as "intptr_t"). It doesn't much matter
- though. Internally, we only call it with arguments less than half
- the max value of a size_t, which should work across all reasonable
- possibilities, although sometimes generating compiler warnings.
-
-MORECORE_CONTIGUOUS default: 1 (true) if HAVE_MORECORE
- If true, take advantage of fact that consecutive calls to MORECORE
- with positive arguments always return contiguous increasing
- addresses. This is true of unix sbrk. It does not hurt too much to
- set it true anyway, since malloc copes with non-contiguities.
- Setting it false when definitely non-contiguous saves time
- and possibly wasted space it would take to discover this though.
-
-MORECORE_CANNOT_TRIM default: NOT defined
- True if MORECORE cannot release space back to the system when given
- negative arguments. This is generally necessary only if you are
- using a hand-crafted MORECORE function that cannot handle negative
- arguments.
-
-NO_SEGMENT_TRAVERSAL default: 0
- If non-zero, suppresses traversals of memory segments
- returned by either MORECORE or CALL_MMAP. This disables
- merging of segments that are contiguous, and selectively
- releasing them to the OS if unused, but bounds execution times.
-
-HAVE_MMAP default: 1 (true)
- True if this system supports mmap or an emulation of it. If so, and
- HAVE_MORECORE is not true, MMAP is used for all system
- allocation. If set and HAVE_MORECORE is true as well, MMAP is
- primarily used to directly allocate very large blocks. It is also
- used as a backup strategy in cases where MORECORE fails to provide
- space from system. Note: A single call to MUNMAP is assumed to be
- able to unmap memory that may have be allocated using multiple calls
- to MMAP, so long as they are adjacent.
-
-HAVE_MREMAP default: 1 on linux, else 0
- If true realloc() uses mremap() to re-allocate large blocks and
- extend or shrink allocation spaces.
-
-MMAP_CLEARS default: 1 except on WINCE.
- True if mmap clears memory so calloc doesn't need to. This is true
- for standard unix mmap using /dev/zero and on WIN32 except for WINCE.
-
-USE_BUILTIN_FFS default: 0 (i.e., not used)
- Causes malloc to use the builtin ffs() function to compute indices.
- Some compilers may recognize and intrinsify ffs to be faster than the
- supplied C version. Also, the case of x86 using gcc is special-cased
- to an asm instruction, so is already as fast as it can be, and so
- this setting has no effect. Similarly for Win32 under recent MS compilers.
- (On most x86s, the asm version is only slightly faster than the C version.)
-
-malloc_getpagesize default: derive from system includes, or 4096.
- The system page size. To the extent possible, this malloc manages
- memory from the system in page-size units. This may be (and
- usually is) a function rather than a constant. This is ignored
- if WIN32, where page size is determined using getSystemInfo during
- initialization. This may be several megabytes if ENABLE_LARGE_PAGES
- is enabled.
-
-ENABLE_LARGE_PAGES default: NOT defined
- Causes the system page size to be the value of GetLargePageMinimum()
- if that function is available (Windows Server 2003/Vista or later).
- This allows the use of large page entries in the MMU which can
- significantly improve performance in large working set applications
- as TLB cache load is reduced by a factor of three. Note that enabling
- this option is equal to locking the process' memory in current
- implementations of Windows and requires the SE_LOCK_MEMORY_PRIVILEGE
- to be held by the process in order to succeed.
-
-USE_DEV_RANDOM default: 0 (i.e., not used)
- Causes malloc to use /dev/random to initialize secure magic seed for
- stamping footers. Otherwise, the current time is used.
-
-NO_MALLINFO default: 0
- If defined, don't compile "mallinfo". This can be a simple way
- of dealing with mismatches between system declarations and
- those in this file.
-
-MALLINFO_FIELD_TYPE default: size_t
- The type of the fields in the mallinfo struct. This was originally
- defined as "int" in SVID etc, but is more usefully defined as
- size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set
-
-REALLOC_ZERO_BYTES_FREES default: not defined
- This should be set if a call to realloc with zero bytes should
- be the same as a call to free. Some people think it should. Otherwise,
- since this malloc returns a unique pointer for malloc(0), so does
- realloc(p, 0).
-
-LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H
-LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H
-LACKS_STDLIB_H default: NOT defined unless on WIN32
- Define these if your system does not have these header files.
- You might need to manually insert some of the declarations they provide.
-
-DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS,
- system_info.dwAllocationGranularity in WIN32,
- GetLargePageMinimum() if ENABLE_LARGE_PAGES,
- otherwise 64K.
- Also settable using mallopt(M_GRANULARITY, x)
- The unit for allocating and deallocating memory from the system. On
- most systems with contiguous MORECORE, there is no reason to
- make this more than a page. However, systems with MMAP tend to
- either require or encourage larger granularities. You can increase
- this value to prevent system allocation functions to be called so
- often, especially if they are slow. The value must be at least one
- page and must be a power of two. Setting to 0 causes initialization
- to either page size or win32 region size. (Note: In previous
- versions of malloc, the equivalent of this option was called
- "TOP_PAD")
-
-DEFAULT_GRANULARITY_ALIGNED default: undefined (which means page size)
- Whether to enforce alignment when allocating and deallocating memory
- from the system i.e. the base address of all allocations will be
- aligned to DEFAULT_GRANULARITY if it is set. Note that enabling this carries
- some overhead as multiple calls must now be made when probing for a valid
- aligned value, however it does greatly ease the checking for whether
- a given memory pointer was allocated by this allocator rather than
- some other.
-
-DEFAULT_TRIM_THRESHOLD default: 2MB
- Also settable using mallopt(M_TRIM_THRESHOLD, x)
- The maximum amount of unused top-most memory to keep before
- releasing via malloc_trim in free(). Automatic trimming is mainly
- useful in long-lived programs using contiguous MORECORE. Because
- trimming via sbrk can be slow on some systems, and can sometimes be
- wasteful (in cases where programs immediately afterward allocate
- more large chunks) the value should be high enough so that your
- overall system performance would improve by releasing this much
- memory. As a rough guide, you might set to a value close to the
- average size of a process (program) running on your system.
- Releasing this much memory would allow such a process to run in
- memory. Generally, it is worth tuning trim thresholds when a
- program undergoes phases where several large chunks are allocated
- and released in ways that can reuse each other's storage, perhaps
- mixed with phases where there are no such chunks at all. The trim
- value must be greater than page size to have any useful effect. To
- disable trimming completely, you can set to MAX_SIZE_T. Note that the trick
- some people use of mallocing a huge space and then freeing it at
- program startup, in an attempt to reserve system memory, doesn't
- have the intended effect under automatic trimming, since that memory
- will immediately be returned to the system.
-
-DEFAULT_MMAP_THRESHOLD default: 256K
- Also settable using mallopt(M_MMAP_THRESHOLD, x)
- The request size threshold for using MMAP to directly service a
- request. Requests of at least this size that cannot be allocated
- using already-existing space will be serviced via mmap. (If enough
- normal freed space already exists it is used instead.) Using mmap
- segregates relatively large chunks of memory so that they can be
- individually obtained and released from the host system. A request
- serviced through mmap is never reused by any other request (at least
- not directly; the system may just so happen to remap successive
- requests to the same locations). Segregating space in this way has
- the benefits that: Mmapped space can always be individually released
- back to the system, which helps keep the system level memory demands
- of a long-lived program low. Also, mapped memory doesn't become
- `locked' between other chunks, as can happen with normally allocated
- chunks, which means that even trimming via malloc_trim would not
- release them. However, it has the disadvantage that the space
- cannot be reclaimed, consolidated, and then used to service later
- requests, as happens with normal chunks. The advantages of mmap
- nearly always outweigh disadvantages for "large" chunks, but the
- value of "large" may vary across systems. The default is an
- empirically derived value that works well in most systems. You can
- disable mmap by setting to MAX_SIZE_T.
-
-MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
- The number of consolidated frees between checks to release
- unused segments when freeing. When using non-contiguous segments,
- especially with multiple mspaces, checking only for topmost space
- doesn't always suffice to trigger trimming. To compensate for this,
- free() will, with a period of MAX_RELEASE_CHECK_RATE (or the
- current number of segments, if greater) try to release unused
- segments to the OS when freeing chunks that result in
- consolidation. The best value for this parameter is a compromise
- between slowing down frees with relatively costly checks that
- rarely trigger versus holding on to unused memory. To effectively
- disable, set to MAX_SIZE_T. This may lead to a very slight speed
- improvement at the expense of carrying around more memory.
-*/
-
-/* Version identifier to allow people to support multiple versions */
-#ifndef DLMALLOC_VERSION
-#define DLMALLOC_VERSION 20804
-#endif /* DLMALLOC_VERSION */
-
-#ifndef WIN32
-#ifdef _WIN32
-#define WIN32 1
-#endif /* _WIN32 */
-#ifdef _WIN32_WCE
-#define LACKS_FCNTL_H
-#define WIN32 1
-#endif /* _WIN32_WCE */
-#endif /* WIN32 */
-#ifdef WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <tchar.h>
-#define HAVE_MMAP 1
-#define HAVE_MORECORE 0
-#define LACKS_UNISTD_H
-#define LACKS_SYS_PARAM_H
-#define LACKS_SYS_MMAN_H
-#define LACKS_STRING_H
-#define LACKS_STRINGS_H
-#define LACKS_SYS_TYPES_H
-#define LACKS_ERRNO_H
-#ifndef MALLOC_FAILURE_ACTION
-#define MALLOC_FAILURE_ACTION
-#endif /* MALLOC_FAILURE_ACTION */
-#ifdef _WIN32_WCE /* WINCE reportedly does not clear */
-#define MMAP_CLEARS 0
-#else
-#define MMAP_CLEARS 1
-#endif /* _WIN32_WCE */
-#endif /* WIN32 */
-
-#if defined(DARWIN) || defined(_DARWIN)
-/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */
-#ifndef HAVE_MORECORE
-#define HAVE_MORECORE 0
-#define HAVE_MMAP 1
-/* OSX allocators provide 16 byte alignment */
-#ifndef MALLOC_ALIGNMENT
-#define MALLOC_ALIGNMENT ((size_t)16U)
-#endif
-#endif /* HAVE_MORECORE */
-#endif /* DARWIN */
-
-#ifndef LACKS_SYS_TYPES_H
-#include <sys/types.h> /* For size_t */
-#endif /* LACKS_SYS_TYPES_H */
-
-#if (defined(__GNUC__) && ((defined(__i386__) || defined(__x86_64__)))) || (defined(_MSC_VER) && _MSC_VER>=1310)
-#define SPIN_LOCKS_AVAILABLE 1
-#else
-#define SPIN_LOCKS_AVAILABLE 0
-#endif
-
-/* The maximum possible size_t value has all bits set */
-#define MAX_SIZE_T (~(size_t)0)
-
-#ifndef ONLY_MSPACES
-#define ONLY_MSPACES 0 /* define to a value */
-#else
-#define ONLY_MSPACES 1
-#endif /* ONLY_MSPACES */
-#ifndef MSPACES
-#if ONLY_MSPACES
-#define MSPACES 1
-#else /* ONLY_MSPACES */
-#define MSPACES 0
-#endif /* ONLY_MSPACES */
-#endif /* MSPACES */
-#ifndef MALLOC_ALIGNMENT
-#define MALLOC_ALIGNMENT ((size_t)8U)
-#endif /* MALLOC_ALIGNMENT */
-#ifndef FOOTERS
-#define FOOTERS 0
-#endif /* FOOTERS */
-#ifndef ABORT
-#define ABORT abort()
-#endif /* ABORT */
-#ifndef ABORT_ON_ASSERT_FAILURE
-#define ABORT_ON_ASSERT_FAILURE 1
-#endif /* ABORT_ON_ASSERT_FAILURE */
-#ifndef PROCEED_ON_ERROR
-#define PROCEED_ON_ERROR 0
-#endif /* PROCEED_ON_ERROR */
-#ifndef USE_LOCKS
-#define USE_LOCKS 0
-#endif /* USE_LOCKS */
-#ifndef USE_SPIN_LOCKS
-#if USE_LOCKS && SPIN_LOCKS_AVAILABLE
-#define USE_SPIN_LOCKS 1
-#else
-#define USE_SPIN_LOCKS 0
-#endif /* USE_LOCKS && SPIN_LOCKS_AVAILABLE. */
-#endif /* USE_SPIN_LOCKS */
-#ifndef INSECURE
-#define INSECURE 0
-#endif /* INSECURE */
-#ifndef HAVE_MMAP
-#define HAVE_MMAP 1
-#endif /* HAVE_MMAP */
-#ifndef MMAP_CLEARS
-#define MMAP_CLEARS 1
-#endif /* MMAP_CLEARS */
-#ifndef HAVE_MREMAP
-#ifdef linux
-#define HAVE_MREMAP 1
-#else /* linux */
-#define HAVE_MREMAP 0
-#endif /* linux */
-#endif /* HAVE_MREMAP */
-#ifndef MALLOC_FAILURE_ACTION
-#define MALLOC_FAILURE_ACTION errno = ENOMEM;
-#endif /* MALLOC_FAILURE_ACTION */
-#ifndef HAVE_MORECORE
-#if ONLY_MSPACES
-#define HAVE_MORECORE 0
-#else /* ONLY_MSPACES */
-#define HAVE_MORECORE 1
-#endif /* ONLY_MSPACES */
-#endif /* HAVE_MORECORE */
-#if !HAVE_MORECORE
-#define MORECORE_CONTIGUOUS 0
-#else /* !HAVE_MORECORE */
-#define MORECORE_DEFAULT sbrk
-#ifndef MORECORE_CONTIGUOUS
-#define MORECORE_CONTIGUOUS 1
-#endif /* MORECORE_CONTIGUOUS */
-#endif /* HAVE_MORECORE */
-#ifndef DEFAULT_GRANULARITY
-#if (MORECORE_CONTIGUOUS || defined(WIN32))
-#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */
-#else /* MORECORE_CONTIGUOUS */
-#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
-#endif /* MORECORE_CONTIGUOUS */
-#endif /* DEFAULT_GRANULARITY */
-#ifndef DEFAULT_TRIM_THRESHOLD
-#ifndef MORECORE_CANNOT_TRIM
-#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
-#else /* MORECORE_CANNOT_TRIM */
-#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
-#endif /* MORECORE_CANNOT_TRIM */
-#endif /* DEFAULT_TRIM_THRESHOLD */
-#ifndef DEFAULT_MMAP_THRESHOLD
-#if HAVE_MMAP
-#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
-#else /* HAVE_MMAP */
-#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
-#endif /* HAVE_MMAP */
-#endif /* DEFAULT_MMAP_THRESHOLD */
-#ifndef MAX_RELEASE_CHECK_RATE
-#if HAVE_MMAP
-#define MAX_RELEASE_CHECK_RATE 4095
-#else
-#define MAX_RELEASE_CHECK_RATE MAX_SIZE_T
-#endif /* HAVE_MMAP */
-#endif /* MAX_RELEASE_CHECK_RATE */
-#ifndef USE_BUILTIN_FFS
-#define USE_BUILTIN_FFS 0
-#endif /* USE_BUILTIN_FFS */
-#ifndef USE_DEV_RANDOM
-#define USE_DEV_RANDOM 0
-#endif /* USE_DEV_RANDOM */
-#ifndef NO_MALLINFO
-#define NO_MALLINFO 0
-#endif /* NO_MALLINFO */
-#ifndef MALLINFO_FIELD_TYPE
-#define MALLINFO_FIELD_TYPE size_t
-#endif /* MALLINFO_FIELD_TYPE */
-#ifndef NO_SEGMENT_TRAVERSAL
-#define NO_SEGMENT_TRAVERSAL 0
-#endif /* NO_SEGMENT_TRAVERSAL */
-
-/*
- mallopt tuning options. SVID/XPG defines four standard parameter
- numbers for mallopt, normally defined in malloc.h. None of these
- are used in this malloc, so setting them has no effect. But this
- malloc does support the following options.
-*/
-
-#define M_TRIM_THRESHOLD (-1)
-#define M_GRANULARITY (-2)
-#define M_MMAP_THRESHOLD (-3)
-
-/* ------------------------ Mallinfo declarations ------------------------ */
-
-#if !NO_MALLINFO
-/*
- This version of malloc supports the standard SVID/XPG mallinfo
- routine that returns a struct containing usage properties and
- statistics. It should work on any system that has a
- /usr/include/malloc.h defining struct mallinfo. The main
- declaration needed is the mallinfo struct that is returned (by-copy)
- by mallinfo(). The malloinfo struct contains a bunch of fields that
- are not even meaningful in this version of malloc. These fields are
- are instead filled by mallinfo() with other numbers that might be of
- interest.
-
- HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
- /usr/include/malloc.h file that includes a declaration of struct
- mallinfo. If so, it is included; else a compliant version is
- declared below. These must be precisely the same for mallinfo() to
- work. The original SVID version of this struct, defined on most
- systems with mallinfo, declares all fields as ints. But some others
- define as unsigned long. If your system defines the fields using a
- type of different width than listed here, you MUST #include your
- system version and #define HAVE_USR_INCLUDE_MALLOC_H.
-*/
-
-/* #define HAVE_USR_INCLUDE_MALLOC_H */
-
-#ifdef HAVE_USR_INCLUDE_MALLOC_H
-#include "/usr/include/malloc.h"
-#else /* HAVE_USR_INCLUDE_MALLOC_H */
-#ifndef STRUCT_MALLINFO_DECLARED
-#define STRUCT_MALLINFO_DECLARED 1
-struct mallinfo {
- MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */
- MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */
- MALLINFO_FIELD_TYPE smblks; /* always 0 */
- MALLINFO_FIELD_TYPE hblks; /* always 0 */
- MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */
- MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */
- MALLINFO_FIELD_TYPE fsmblks; /* always 0 */
- MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
- MALLINFO_FIELD_TYPE fordblks; /* total free space */
- MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
-};
-#endif /* STRUCT_MALLINFO_DECLARED */
-#endif /* HAVE_USR_INCLUDE_MALLOC_H */
-#endif /* NO_MALLINFO */
-
-/*
- Try to persuade compilers to inline. The most critical functions for
- inlining are defined as macros, so these aren't used for them.
-*/
-
-#ifndef FORCEINLINE
- #if defined(__GNUC__)
-#define FORCEINLINE __inline __attribute__ ((always_inline))
- #elif defined(_MSC_VER)
- #define FORCEINLINE __forceinline
- #endif
-#endif
-#ifndef NOINLINE
- #if defined(__GNUC__)
- #define NOINLINE __attribute__ ((noinline))
- #elif defined(_MSC_VER)
- #define NOINLINE __declspec(noinline)
- #else
- #define NOINLINE
- #endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#ifndef FORCEINLINE
- #define FORCEINLINE inline
-#endif
-#endif /* __cplusplus */
-#ifndef FORCEINLINE
- #define FORCEINLINE
-#endif
-
-#if !ONLY_MSPACES
-
-/* ------------------- Declarations of public routines ------------------- */
-
-#ifndef USE_DL_PREFIX
-#define dlcalloc calloc
-#define dlfree free
-#define dlmalloc malloc
-#define dlmemalign memalign
-#define dlrealloc realloc
-#define dlvalloc valloc
-#define dlpvalloc pvalloc
-#define dlmallinfo mallinfo
-#define dlmallopt mallopt
-#define dlmalloc_trim malloc_trim
-#define dlmalloc_stats malloc_stats
-#define dlmalloc_usable_size malloc_usable_size
-#define dlmalloc_footprint malloc_footprint
-#define dlmalloc_max_footprint malloc_max_footprint
-#define dlindependent_calloc independent_calloc
-#define dlindependent_comalloc independent_comalloc
-#endif /* USE_DL_PREFIX */
-
-
-/*
- malloc(size_t n)
- Returns a pointer to a newly allocated chunk of at least n bytes, or
- null if no space is available, in which case errno is set to ENOMEM
- on ANSI C systems.
-
- If n is zero, malloc returns a minimum-sized chunk. (The minimum
- size is 16 bytes on most 32bit systems, and 32 bytes on 64bit
- systems.) Note that size_t is an unsigned type, so calls with
- arguments that would be negative if signed are interpreted as
- requests for huge amounts of space, which will often fail. The
- maximum supported value of n differs across systems, but is in all
- cases less than the maximum representable value of a size_t.
-*/
-void* dlmalloc(size_t);
-
-/*
- free(void* p)
- Releases the chunk of memory pointed to by p, that had been previously
- allocated using malloc or a related routine such as realloc.
- It has no effect if p is null. If p was not malloced or already
- freed, free(p) will by default cause the current program to abort.
-*/
-void dlfree(void*);
-
-/*
- calloc(size_t n_elements, size_t element_size);
- Returns a pointer to n_elements * element_size bytes, with all locations
- set to zero.
-*/
-void* dlcalloc(size_t, size_t);
-
-/*
- realloc(void* p, size_t n)
- Returns a pointer to a chunk of size n that contains the same data
- as does chunk p up to the minimum of (n, p's size) bytes, or null
- if no space is available.
-
- The returned pointer may or may not be the same as p. The algorithm
- prefers extending p in most cases when possible, otherwise it
- employs the equivalent of a malloc-copy-free sequence.
-
- If p is null, realloc is equivalent to malloc.
-
- If space is not available, realloc returns null, errno is set (if on
- ANSI) and p is NOT freed.
-
- if n is for fewer bytes than already held by p, the newly unused
- space is lopped off and freed if possible. realloc with a size
- argument of zero (re)allocates a minimum-sized chunk.
-
- The old unix realloc convention of allowing the last-free'd chunk
- to be used as an argument to realloc is not supported.
-*/
-
-void* dlrealloc(void*, size_t);
-
-/*
- memalign(size_t alignment, size_t n);
- Returns a pointer to a newly allocated chunk of n bytes, aligned
- in accord with the alignment argument.
-
- The alignment argument should be a power of two. If the argument is
- not a power of two, the nearest greater power is used.
- 8-byte alignment is guaranteed by normal malloc calls, so don't
- bother calling memalign with an argument of 8 or less.
-
- Overreliance on memalign is a sure way to fragment space.
-*/
-void* dlmemalign(size_t, size_t);
-
-/*
- valloc(size_t n);
- Equivalent to memalign(pagesize, n), where pagesize is the page
- size of the system. If the pagesize is unknown, 4096 is used.
-*/
-void* dlvalloc(size_t);
-
-/*
- mallopt(int parameter_number, int parameter_value)
- Sets tunable parameters The format is to provide a
- (parameter-number, parameter-value) pair. mallopt then sets the
- corresponding parameter to the argument value if it can (i.e., so
- long as the value is meaningful), and returns 1 if successful else
- 0. To workaround the fact that mallopt is specified to use int,
- not size_t parameters, the value -1 is specially treated as the
- maximum unsigned size_t value.
-
- SVID/XPG/ANSI defines four standard param numbers for mallopt,
- normally defined in malloc.h. None of these are use in this malloc,
- so setting them has no effect. But this malloc also supports other
- options in mallopt. See below for details. Briefly, supported
- parameters are as follows (listed defaults are for "typical"
- configurations).
-
- Symbol param # default allowed param values
- M_TRIM_THRESHOLD -1 2*1024*1024 any (-1 disables)
- M_GRANULARITY -2 page size any power of 2 >= page size
- M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support)
-*/
-int dlmallopt(int, int);
-
-/*
- malloc_footprint();
- Returns the number of bytes obtained from the system. The total
- number of bytes allocated by malloc, realloc etc., is less than this
- value. Unlike mallinfo, this function returns only a precomputed
- result, so can be called frequently to monitor memory consumption.
- Even if locks are otherwise defined, this function does not use them,
- so results might not be up to date.
-*/
-size_t dlmalloc_footprint(void);
-
-/*
- malloc_max_footprint();
- Returns the maximum number of bytes obtained from the system. This
- value will be greater than current footprint if deallocated space
- has been reclaimed by the system. The peak number of bytes allocated
- by malloc, realloc etc., is less than this value. Unlike mallinfo,
- this function returns only a precomputed result, so can be called
- frequently to monitor memory consumption. Even if locks are
- otherwise defined, this function does not use them, so results might
- not be up to date.
-*/
-size_t dlmalloc_max_footprint(void);
-
-#if !NO_MALLINFO
-/*
- mallinfo()
- Returns (by copy) a struct containing various summary statistics:
-
- arena: current total non-mmapped bytes allocated from system
- ordblks: the number of free chunks
- smblks: always zero.
- hblks: current number of mmapped regions
- hblkhd: total bytes held in mmapped regions
- usmblks: the maximum total allocated space. This will be greater
- than current total if trimming has occurred.
- fsmblks: always zero
- uordblks: current total allocated space (normal or mmapped)
- fordblks: total free space
- keepcost: the maximum number of bytes that could ideally be released
- back to system via malloc_trim. ("ideally" means that
- it ignores page restrictions etc.)
-
- Because these fields are ints, but internal bookkeeping may
- be kept as longs, the reported values may wrap around zero and
- thus be inaccurate.
-*/
-struct mallinfo dlmallinfo(void);
-#endif /* NO_MALLINFO */
-
-/*
- independent_calloc(size_t n_elements, size_t element_size, void* chunks[]);
-
- independent_calloc is similar to calloc, but instead of returning a
- single cleared space, it returns an array of pointers to n_elements
- independent elements that can hold contents of size elem_size, each
- of which starts out cleared, and can be independently freed,
- realloc'ed etc. The elements are guaranteed to be adjacently
- allocated (this is not guaranteed to occur with multiple callocs or
- mallocs), which may also improve cache locality in some
- applications.
-
- The "chunks" argument is optional (i.e., may be null, which is
- probably the most typical usage). If it is null, the returned array
- is itself dynamically allocated and should also be freed when it is
- no longer needed. Otherwise, the chunks array must be of at least
- n_elements in length. It is filled in with the pointers to the
- chunks.
-
- In either case, independent_calloc returns this pointer array, or
- null if the allocation failed. If n_elements is zero and "chunks"
- is null, it returns a chunk representing an array with zero elements
- (which should be freed if not wanted).
-
- Each element must be individually freed when it is no longer
- needed. If you'd like to instead be able to free all at once, you
- should instead use regular calloc and assign pointers into this
- space to represent elements. (In this case though, you cannot
- independently free elements.)
-
- independent_calloc simplifies and speeds up implementations of many
- kinds of pools. It may also be useful when constructing large data
- structures that initially have a fixed number of fixed-sized nodes,
- but the number is not known at compile time, and some of the nodes
- may later need to be freed. For example:
-
- struct Node { int item; struct Node* next; };
-
- struct Node* build_list() {
- struct Node** pool;
- int n = read_number_of_nodes_needed();
- if (n <= 0) return 0;
- pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
- if (pool == 0) die();
- // organize into a linked list...
- struct Node* first = pool[0];
- for (i = 0; i < n-1; ++i)
- pool[i]->next = pool[i+1];
- free(pool); // Can now free the array (or not, if it is needed later)
- return first;
- }
-*/
-void** dlindependent_calloc(size_t, size_t, void**);
-
-/*
- independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
-
- independent_comalloc allocates, all at once, a set of n_elements
- chunks with sizes indicated in the "sizes" array. It returns
- an array of pointers to these elements, each of which can be
- independently freed, realloc'ed etc. The elements are guaranteed to
- be adjacently allocated (this is not guaranteed to occur with
- multiple callocs or mallocs), which may also improve cache locality
- in some applications.
-
- The "chunks" argument is optional (i.e., may be null). If it is null
- the returned array is itself dynamically allocated and should also
- be freed when it is no longer needed. Otherwise, the chunks array
- must be of at least n_elements in length. It is filled in with the
- pointers to the chunks.
-
- In either case, independent_comalloc returns this pointer array, or
- null if the allocation failed. If n_elements is zero and chunks is
- null, it returns a chunk representing an array with zero elements
- (which should be freed if not wanted).
-
- Each element must be individually freed when it is no longer
- needed. If you'd like to instead be able to free all at once, you
- should instead use a single regular malloc, and assign pointers at
- particular offsets in the aggregate space. (In this case though, you
- cannot independently free elements.)
-
- independent_comallac differs from independent_calloc in that each
- element may have a different size, and also that it does not
- automatically clear elements.
-
- independent_comalloc can be used to speed up allocation in cases
- where several structs or objects must always be allocated at the
- same time. For example:
-
- struct Head { ... }
- struct Foot { ... }
-
- void send_message(char* msg) {
- int msglen = strlen(msg);
- size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
- void* chunks[3];
- if (independent_comalloc(3, sizes, chunks) == 0)
- die();
- struct Head* head = (struct Head*)(chunks[0]);
- char* body = (char*)(chunks[1]);
- struct Foot* foot = (struct Foot*)(chunks[2]);
- // ...
- }
-
- In general though, independent_comalloc is worth using only for
- larger values of n_elements. For small values, you probably won't
- detect enough difference from series of malloc calls to bother.
-
- Overuse of independent_comalloc can increase overall memory usage,
- since it cannot reuse existing noncontiguous small chunks that
- might be available for some of the elements.
-*/
-void** dlindependent_comalloc(size_t, size_t*, void**);
-
-
-/*
- pvalloc(size_t n);
- Equivalent to valloc(minimum-page-that-holds(n)), that is,
- round up n to nearest pagesize.
- */
-void* dlpvalloc(size_t);
-
-/*
- malloc_trim(size_t pad);
-
- If possible, gives memory back to the system (via negative arguments
- to sbrk) if there is unused memory at the `high' end of the malloc
- pool or in unused MMAP segments. You can call this after freeing
- large blocks of memory to potentially reduce the system-level memory
- requirements of a program. However, it cannot guarantee to reduce
- memory. Under some allocation patterns, some large free blocks of
- memory will be locked between two used chunks, so they cannot be
- given back to the system.
-
- The `pad' argument to malloc_trim represents the amount of free
- trailing space to leave untrimmed. If this argument is zero, only
- the minimum amount of memory to maintain internal data structures
- will be left. Non-zero arguments can be supplied to maintain enough
- trailing space to service future expected allocations without having
- to re-obtain memory from the system.
-
- Malloc_trim returns 1 if it actually released any memory, else 0.
-*/
-int dlmalloc_trim(size_t);
-
-/*
- malloc_stats();
- Prints on stderr the amount of space obtained from the system (both
- via sbrk and mmap), the maximum amount (which may be more than
- current if malloc_trim and/or munmap got called), and the current
- number of bytes allocated via malloc (or realloc, etc) but not yet
- freed. Note that this is the number of bytes allocated, not the
- number requested. It will be larger than the number requested
- because of alignment and bookkeeping overhead. Because it includes
- alignment wastage as being in use, this figure may be greater than
- zero even when no user-level chunks are allocated.
-
- The reported current and maximum system memory can be inaccurate if
- a program makes other calls to system memory allocation functions
- (normally sbrk) outside of malloc.
-
- malloc_stats prints only the most commonly interesting statistics.
- More information can be obtained by calling mallinfo.
-*/
-void dlmalloc_stats(void);
-
-#endif /* ONLY_MSPACES */
-
-/*
- malloc_usable_size(void* p);
-
- Returns the number of bytes you can actually use in
- an allocated chunk, which may be more than you requested (although
- often not) due to alignment and minimum size constraints.
- You can use this many bytes without worrying about
- overwriting other allocated objects. This is not a particularly great
- programming practice. malloc_usable_size can be more useful in
- debugging and assertions, for example:
-
- p = malloc(n);
- assert(malloc_usable_size(p) >= 256);
-*/
-size_t dlmalloc_usable_size(void*);
-
-
-#if MSPACES
-
-/*
- mspace is an opaque type representing an independent
- region of space that supports mspace_malloc, etc.
-*/
-typedef void* mspace;
-
-/*
- create_mspace creates and returns a new independent space with the
- given initial capacity, or, if 0, the default granularity size. It
- returns null if there is no system memory available to create the
- space. If argument locked is non-zero, the space uses a separate
- lock to control access. The capacity of the space will grow
- dynamically as needed to service mspace_malloc requests. You can
- control the sizes of incremental increases of this space by
- compiling with a different DEFAULT_GRANULARITY or dynamically
- setting with mallopt(M_GRANULARITY, value).
-*/
-mspace create_mspace(size_t capacity, int locked);
-
-/*
- destroy_mspace destroys the given space, and attempts to return all
- of its memory back to the system, returning the total number of
- bytes freed. After destruction, the results of access to all memory
- used by the space become undefined.
-*/
-size_t destroy_mspace(mspace msp);
-
-/*
- create_mspace_with_base uses the memory supplied as the initial base
- of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
- space is used for bookkeeping, so the capacity must be at least this
- large. (Otherwise 0 is returned.) When this initial space is
- exhausted, additional memory will be obtained from the system.
- Destroying this space will deallocate all additionally allocated
- space (if possible) but not the initial base.
-*/
-mspace create_mspace_with_base(void* base, size_t capacity, int locked);
-
-/*
- mspace_track_large_chunks controls whether requests for large chunks
- are allocated in their own untracked mmapped regions, separate from
- others in this mspace. By default large chunks are not tracked,
- which reduces fragmentation. However, such chunks are not
- necessarily released to the system upon destroy_mspace. Enabling
- tracking by setting to true may increase fragmentation, but avoids
- leakage when relying on destroy_mspace to release all memory
- allocated using this space. The function returns the previous
- setting.
-*/
-int mspace_track_large_chunks(mspace msp, int enable);
-
-
-/*
- mspace_malloc behaves as malloc, but operates within
- the given space.
-*/
-void* mspace_malloc(mspace msp, size_t bytes);
-
-/*
- mspace_free behaves as free, but operates within
- the given space.
-
- If compiled with FOOTERS==1, mspace_free is not actually needed.
- free may be called instead of mspace_free because freed chunks from
- any space are handled by their originating spaces.
-*/
-void mspace_free(mspace msp, void* mem);
-
-/*
- mspace_realloc behaves as realloc, but operates within
- the given space.
-
- If compiled with FOOTERS==1, mspace_realloc is not actually
- needed. realloc may be called instead of mspace_realloc because
- realloced chunks from any space are handled by their originating
- spaces.
-*/
-void* mspace_realloc(mspace msp, void* mem, size_t newsize);
-
-/*
- mspace_calloc behaves as calloc, but operates within
- the given space.
-*/
-void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
-
-/*
- mspace_memalign behaves as memalign, but operates within
- the given space.
-*/
-void* mspace_memalign(mspace msp, size_t alignment, size_t bytes);
-
-/*
- mspace_independent_calloc behaves as independent_calloc, but
- operates within the given space.
-*/
-void** mspace_independent_calloc(mspace msp, size_t n_elements,
- size_t elem_size, void* chunks[]);
-
-/*
- mspace_independent_comalloc behaves as independent_comalloc, but
- operates within the given space.
-*/
-void** mspace_independent_comalloc(mspace msp, size_t n_elements,
- size_t sizes[], void* chunks[]);
-
-/*
- mspace_footprint() returns the number of bytes obtained from the
- system for this space.
-*/
-size_t mspace_footprint(mspace msp);
-
-/*
- mspace_max_footprint() returns the peak number of bytes obtained from the
- system for this space.
-*/
-size_t mspace_max_footprint(mspace msp);
-
-
-#if !NO_MALLINFO
-/*
- mspace_mallinfo behaves as mallinfo, but reports properties of
- the given space.
-*/
-struct mallinfo mspace_mallinfo(mspace msp);
-#endif /* NO_MALLINFO */
-
-/*
- malloc_usable_size(void* p) behaves the same as malloc_usable_size;
-*/
- size_t mspace_usable_size(void* mem);
-
-/*
- mspace_malloc_stats behaves as malloc_stats, but reports
- properties of the given space.
-*/
-void mspace_malloc_stats(mspace msp);
-
-/*
- mspace_trim behaves as malloc_trim, but
- operates within the given space.
-*/
-int mspace_trim(mspace msp, size_t pad);
-
-/*
- An alias for mallopt.
-*/
-int mspace_mallopt(int, int);
-
-#endif /* MSPACES */
-
-#ifdef __cplusplus
-} /* end of extern "C" */
-#endif /* __cplusplus */
-
-/*
- ========================================================================
- To make a fully customizable malloc.h header file, cut everything
- above this line, put into file malloc.h, edit to suit, and #include it
- on the next line, as well as in programs that use this malloc.
- ========================================================================
-*/
-
-/* #include "malloc.h" */
-
-/*------------------------------ internal #includes ---------------------- */
-
-#ifdef WIN32
-#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
-#endif /* WIN32 */
-
-#include <stdio.h> /* for printing in malloc_stats */
-
-#ifndef LACKS_ERRNO_H
-#include <errno.h> /* for MALLOC_FAILURE_ACTION */
-#endif /* LACKS_ERRNO_H */
-#if FOOTERS || DEBUG
-#include <time.h> /* for magic initialization */
-#endif /* FOOTERS */
-#ifndef LACKS_STDLIB_H
-#include <stdlib.h> /* for abort() */
-#endif /* LACKS_STDLIB_H */
-#ifdef DEBUG
-#if ABORT_ON_ASSERT_FAILURE
-#undef assert
-#define assert(x) if(!(x)) ABORT
-#else /* ABORT_ON_ASSERT_FAILURE */
-#include <assert.h>
-#endif /* ABORT_ON_ASSERT_FAILURE */
-#else /* DEBUG */
-#ifndef assert
-#define assert(x)
-#endif
-#define DEBUG 0
-#endif /* DEBUG */
-#ifndef LACKS_STRING_H
-#include <string.h> /* for memset etc */
-#endif /* LACKS_STRING_H */
-#if USE_BUILTIN_FFS
-#ifndef LACKS_STRINGS_H
-#include <strings.h> /* for ffs */
-#endif /* LACKS_STRINGS_H */
-#endif /* USE_BUILTIN_FFS */
-#if HAVE_MMAP
-#ifndef LACKS_SYS_MMAN_H
-/* On some versions of linux, mremap decl in mman.h needs __USE_GNU set */
-#if (defined(linux) && !defined(__USE_GNU))
-#define __USE_GNU 1
-#include <sys/mman.h> /* for mmap */
-#undef __USE_GNU
-#else
-#include <sys/mman.h> /* for mmap */
-#endif /* linux */
-#endif /* LACKS_SYS_MMAN_H */
-#ifndef LACKS_FCNTL_H
-#include <fcntl.h>
-#endif /* LACKS_FCNTL_H */
-#endif /* HAVE_MMAP */
-#ifndef LACKS_UNISTD_H
-#include <unistd.h> /* for sbrk, sysconf */
-#else /* LACKS_UNISTD_H */
-#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
-extern void* sbrk(ptrdiff_t);
-#endif /* FreeBSD etc */
-#endif /* LACKS_UNISTD_H */
-
-/* Declarations for locking */
-#if USE_LOCKS
-#ifndef WIN32
-#include <pthread.h>
-#if defined (__SVR4) && defined (__sun) /* solaris */
-#include <thread.h>
-#endif /* solaris */
-#else
-#ifndef _M_AMD64
-/* These are already defined on AMD64 builds */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-LONG __cdecl _InterlockedCompareExchange(LONG volatile *Dest, LONG Exchange, LONG Comp);
-LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* _M_AMD64 */
-#pragma intrinsic (_InterlockedCompareExchange)
-#pragma intrinsic (_InterlockedExchange)
-#define interlockedcompareexchange _InterlockedCompareExchange
-#define interlockedexchange _InterlockedExchange
-#endif /* Win32 */
-#endif /* USE_LOCKS */
-
-/* Declarations for bit scanning on win32 */
-#if defined(_MSC_VER) && _MSC_VER>=1300
-#ifndef BitScanForward /* Try to avoid pulling in WinNT.h */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-unsigned char _BitScanForward(unsigned long *index, unsigned long mask);
-unsigned char _BitScanReverse(unsigned long *index, unsigned long mask);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#define BitScanForward _BitScanForward
-#define BitScanReverse _BitScanReverse
-#pragma intrinsic(_BitScanForward)
-#pragma intrinsic(_BitScanReverse)
-#endif /* BitScanForward */
-#endif /* defined(_MSC_VER) && _MSC_VER>=1300 */
-
-#ifndef WIN32
-#ifndef malloc_getpagesize
-# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
-# ifndef _SC_PAGE_SIZE
-# define _SC_PAGE_SIZE _SC_PAGESIZE
-# endif
-# endif
-# ifdef _SC_PAGE_SIZE
-# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
-# else
-# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
- extern size_t getpagesize();
-# define malloc_getpagesize getpagesize()
-# else
-# ifdef WIN32 /* use supplied emulation of getpagesize */
-# define malloc_getpagesize getpagesize()
-# else
-# ifndef LACKS_SYS_PARAM_H
-# include <sys/param.h>
-# endif
-# ifdef EXEC_PAGESIZE
-# define malloc_getpagesize EXEC_PAGESIZE
-# else
-# ifdef NBPG
-# ifndef CLSIZE
-# define malloc_getpagesize NBPG
-# else
-# define malloc_getpagesize (NBPG * CLSIZE)
-# endif
-# else
-# ifdef NBPC
-# define malloc_getpagesize NBPC
-# else
-# ifdef PAGESIZE
-# define malloc_getpagesize PAGESIZE
-# else /* just guess */
-# define malloc_getpagesize ((size_t)4096U)
-# endif
-# endif
-# endif
-# endif
-# endif
-# endif
-# endif
-#endif
-#endif
-
-
-
-/* ------------------- size_t and alignment properties -------------------- */
-
-/* The byte and bit size of a size_t */
-#define SIZE_T_SIZE (sizeof(size_t))
-#define SIZE_T_BITSIZE (sizeof(size_t) << 3)
-
-/* Some constants coerced to size_t */
-/* Annoying but necessary to avoid errors on some platforms */
-#define SIZE_T_ZERO ((size_t)0)
-#define SIZE_T_ONE ((size_t)1)
-#define SIZE_T_TWO ((size_t)2)
-#define SIZE_T_FOUR ((size_t)4)
-#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1)
-#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2)
-#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
-#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U)
-
-/* The bit mask value corresponding to MALLOC_ALIGNMENT */
-#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE)
-
-/* True if address a has acceptable alignment */
-#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
-
-/* the number of bytes to offset an address to align it */
-#define align_offset(A)\
- ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
- ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
-
-/*
- malloc_params holds global properties, including those that can be
- dynamically set using mallopt. There is a single instance, mparams,
- initialized in init_mparams. Note that the non-zeroness of "magic"
- also serves as an initialization flag.
-*/
-typedef unsigned int flag_t;
-struct malloc_params {
- volatile size_t magic;
- size_t page_size;
- size_t granularity;
- size_t mmap_threshold;
- size_t trim_threshold;
- flag_t default_mflags;
-};
-
-static struct malloc_params mparams;
-
-/* Ensure mparams initialized */
-#define ensure_initialization() (void)(mparams.magic != 0 || init_mparams())
-
-/* -------------------------- MMAP preliminaries ------------------------- */
-
-/*
- If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and
- checks to fail so compiler optimizer can delete code rather than
- using so many "#if"s.
-*/
-
-
-/* MORECORE and MMAP must return MFAIL on failure */
-#define MFAIL ((void*)(MAX_SIZE_T))
-#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */
-
-#if HAVE_MMAP
-
-#ifndef WIN32
-#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
-#define MAP_ANONYMOUS MAP_ANON
-#endif /* MAP_ANON */
-#ifdef DEFAULT_GRANULARITY_ALIGNED
-#define MMAP_IMPL mmap_aligned
-static void* lastAlignedmmap; /* Used as a hint */
-static void* mmap_aligned(void *start, size_t length, int prot, int flags, int fd, off_t offset) {
- void* baseaddress = 0;
- void* ptr = 0;
- if(!start) {
- baseaddress = lastAlignedmmap;
- for(;;) {
- if(baseaddress) flags|=MAP_FIXED;
- ptr = mmap(baseaddress, length, prot, flags, fd, offset);
- if(!ptr)
- baseaddress = (void*)((size_t)baseaddress + mparams.granularity);
- else if((size_t)ptr & (mparams.granularity - SIZE_T_ONE)) {
- munmap(ptr, length);
- baseaddress = (void*)(((size_t)ptr + mparams.granularity) & ~(mparams.granularity - SIZE_T_ONE));
- }
- else break;
- }
- }
- else ptr = mmap(start, length, prot, flags, fd, offset);
- if(ptr) lastAlignedmmap = (void*)((size_t) ptr + mparams.granularity);
- return ptr;
-}
-#else
-#define MMAP_IMPL mmap
-#endif /* DEFAULT_GRANULARITY_ALIGNED */
-#define MUNMAP_DEFAULT(a, s) munmap((a), (s))
-#define MMAP_PROT (PROT_READ|PROT_WRITE)
-#ifdef MAP_ANONYMOUS
-#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS)
-#define MMAP_DEFAULT(s) MMAP_IMPL(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0)
-#else /* MAP_ANONYMOUS */
-/*
- Nearly all versions of mmap support MAP_ANONYMOUS, so the following
- is unlikely to be needed, but is supplied just in case.
-*/
-#define MMAP_FLAGS (MAP_PRIVATE)
-static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
-#define MMAP_DEFAULT(s) ((dev_zero_fd < 0) ? \
- (dev_zero_fd = open("/dev/zero", O_RDWR), \
- MMAP_IMPL(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
- MMAP_IMPL(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))
-#endif /* MAP_ANONYMOUS */
-
-#define DIRECT_MMAP_DEFAULT(s) MMAP_DEFAULT(s)
-
-#else /* WIN32 */
-
-/* Win32 MMAP via VirtualAlloc */
-#ifdef DEFAULT_GRANULARITY_ALIGNED
-static void* lastWin32mmap; /* Used as a hint */
-#endif /* DEFAULT_GRANULARITY_ALIGNED */
-#ifdef ENABLE_LARGE_PAGES
-static int largepagesavailable = 1;
-#endif /* ENABLE_LARGE_PAGES */
-static FORCEINLINE void* win32mmap(size_t size) {
- void* baseaddress = 0;
- void* ptr = 0;
-#ifdef ENABLE_LARGE_PAGES
- /* Note that large pages are *always* allocated on a large page boundary.
- If however granularity is small then don't waste a kernel call if size
- isn't around the size of a large page */
- if(largepagesavailable && size >= 1*1024*1024) {
- ptr = VirtualAlloc(baseaddress, size, MEM_RESERVE|MEM_COMMIT|MEM_LARGE_PAGES, PAGE_READWRITE);
- if(!ptr && ERROR_PRIVILEGE_NOT_HELD==GetLastError()) largepagesavailable=0;
- }
-#endif
- if(!ptr) {
-#ifdef DEFAULT_GRANULARITY_ALIGNED
- /* We try to avoid overhead by speculatively reserving at aligned
- addresses until we succeed */
- baseaddress = lastWin32mmap;
- for(;;) {
- void* reserveaddr = VirtualAlloc(baseaddress, size, MEM_RESERVE, PAGE_READWRITE);
- if(!reserveaddr)
- baseaddress = (void*)((size_t)baseaddress + mparams.granularity);
- else if((size_t)reserveaddr & (mparams.granularity - SIZE_T_ONE)) {
- VirtualFree(reserveaddr, 0, MEM_RELEASE);
- baseaddress = (void*)(((size_t)reserveaddr + mparams.granularity) & ~(mparams.granularity - SIZE_T_ONE));
- }
- else break;
- }
-#endif
- if(!ptr) ptr = VirtualAlloc(baseaddress, size, baseaddress ? MEM_COMMIT : MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
-#if DEBUG
- if(lastWin32mmap && ptr!=lastWin32mmap) printf("Non-contiguous VirtualAlloc between %p and %p\n", ptr, lastWin32mmap);
-#endif
-#ifdef DEFAULT_GRANULARITY_ALIGNED
- if(ptr) lastWin32mmap = (void*)((size_t) ptr + mparams.granularity);
-#endif
- }
-#if DEBUG
-#ifdef ENABLE_LARGE_PAGES
- printf("VirtualAlloc returns %p size %u. LargePagesAvailable=%d\n", ptr, size, largepagesavailable);
-#else
- printf("VirtualAlloc returns %p size %u\n", ptr, size);
-#endif
-#endif
- return (ptr != 0)? ptr: MFAIL;
-}
-
-/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
-static FORCEINLINE void* win32direct_mmap(size_t size) {
- void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
- PAGE_READWRITE);
- return (ptr != 0)? ptr: MFAIL;
-}
-
-/* This function supports releasing coalesed segments */
-static FORCEINLINE int win32munmap(void* ptr, size_t size) {
- MEMORY_BASIC_INFORMATION minfo;
- char* cptr = (char*)ptr;
- while (size) {
- if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0)
- return -1;
- if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr ||
- minfo.State != MEM_COMMIT || minfo.RegionSize > size)
- return -1;
- if (VirtualFree(cptr, 0, MEM_RELEASE) == 0)
- return -1;
- cptr += minfo.RegionSize;
- size -= minfo.RegionSize;
- }
- return 0;
-}
-
-#define MMAP_DEFAULT(s) win32mmap(s)
-#define MUNMAP_DEFAULT(a, s) win32munmap((a), (s))
-#define DIRECT_MMAP_DEFAULT(s) win32direct_mmap(s)
-#endif /* WIN32 */
-#endif /* HAVE_MMAP */
-
-#if HAVE_MREMAP
-#ifndef WIN32
-#define MREMAP_DEFAULT(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
-#endif /* WIN32 */
-#endif /* HAVE_MREMAP */
-
-
-/**
- * Define CALL_MORECORE
- */
-#if HAVE_MORECORE
- #ifdef MORECORE
- #define CALL_MORECORE(S) MORECORE(S)
- #else /* MORECORE */
- #define CALL_MORECORE(S) MORECORE_DEFAULT(S)
- #endif /* MORECORE */
-#else /* HAVE_MORECORE */
- #define CALL_MORECORE(S) MFAIL
-#endif /* HAVE_MORECORE */
-
-/**
- * Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP
- */
-#if HAVE_MMAP
- #define USE_MMAP_BIT (SIZE_T_ONE)
-
- #ifdef MMAP
- #define CALL_MMAP(s) MMAP(s)
- #else /* MMAP */
- #define CALL_MMAP(s) MMAP_DEFAULT(s)
- #endif /* MMAP */
- #ifdef MUNMAP
- #define CALL_MUNMAP(a, s) MUNMAP((a), (s))
- #else /* MUNMAP */
- #define CALL_MUNMAP(a, s) MUNMAP_DEFAULT((a), (s))
- #endif /* MUNMAP */
- #ifdef DIRECT_MMAP
- #define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s)
- #else /* DIRECT_MMAP */
- #define CALL_DIRECT_MMAP(s) DIRECT_MMAP_DEFAULT(s)
- #endif /* DIRECT_MMAP */
-#else /* HAVE_MMAP */
- #define USE_MMAP_BIT (SIZE_T_ZERO)
-
- #define MMAP(s) MFAIL
- #define MUNMAP(a, s) (-1)
- #define DIRECT_MMAP(s) MFAIL
- #define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s)
- #define CALL_MMAP(s) MMAP(s)
- #define CALL_MUNMAP(a, s) MUNMAP((a), (s))
-#endif /* HAVE_MMAP */
-
-/**
- * Define CALL_MREMAP
- */
-#if HAVE_MMAP && HAVE_MREMAP
- #ifdef MREMAP
- #define CALL_MREMAP(addr, osz, nsz, mv) MREMAP((addr), (osz), (nsz), (mv))
- #else /* MREMAP */
- #define CALL_MREMAP(addr, osz, nsz, mv) MREMAP_DEFAULT((addr), (osz), (nsz), (mv))
- #endif /* MREMAP */
-#else /* HAVE_MMAP && HAVE_MREMAP */
- #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
-#endif /* HAVE_MMAP && HAVE_MREMAP */
-
-/* mstate bit set if continguous morecore disabled or failed */
-#define USE_NONCONTIGUOUS_BIT (4U)
-
-/* segment bit set in create_mspace_with_base */
-#define EXTERN_BIT (8U)
-
-
-/* --------------------------- Lock preliminaries ------------------------ */
-
-/*
- When locks are defined, there is one global lock, plus
- one per-mspace lock.
-
- The global lock_ensures that mparams.magic and other unique
- mparams values are initialized only once. It also protects
- sequences of calls to MORECORE. In many cases sys_alloc requires
- two calls, that should not be interleaved with calls by other
- threads. This does not protect against direct calls to MORECORE
- by other threads not using this lock, so there is still code to
- cope the best we can on interference.
-
- Per-mspace locks surround calls to malloc, free, etc. To enable use
- in layered extensions, per-mspace locks are reentrant.
-
- Because lock-protected regions generally have bounded times, it is
- OK to use the supplied simple spinlocks in the custom versions for
- x86. Spinlocks are likely to improve performance for lightly
- contended applications, but worsen performance under heavy
- contention.
-
- If USE_LOCKS is > 1, the definitions of lock routines here are
- bypassed, in which case you will need to define the type MLOCK_T,
- and at least INITIAL_LOCK, ACQUIRE_LOCK, RELEASE_LOCK and possibly
- TRY_LOCK (which is not used in this malloc, but commonly needed in
- extensions.) You must also declare a
- static MLOCK_T malloc_global_mutex = { initialization values };.
-
-*/
-
-#if USE_LOCKS == 1
-
-#if USE_SPIN_LOCKS && SPIN_LOCKS_AVAILABLE
-#ifndef WIN32
-
-/* Custom pthread-style spin locks on x86 and x64 for gcc */
-struct pthread_mlock_t {
- volatile unsigned int l;
- char cachelinepadding[64];
- unsigned int c;
- pthread_t threadid;
-};
-#define MLOCK_T struct pthread_mlock_t
-#define CURRENT_THREAD pthread_self()
-#define INITIAL_LOCK(sl) ((sl)->threadid = 0, (sl)->l = (sl)->c = 0, 0)
-#define ACQUIRE_LOCK(sl) pthread_acquire_lock(sl)
-#define RELEASE_LOCK(sl) pthread_release_lock(sl)
-#define TRY_LOCK(sl) pthread_try_lock(sl)
-#define SPINS_PER_YIELD 63
-
-static MLOCK_T malloc_global_mutex = { 0, "", 0, 0};
-
-static FORCEINLINE int pthread_acquire_lock (MLOCK_T *sl) {
- int spins = 0;
- volatile unsigned int* lp = &sl->l;
- for (;;) {
- if (*lp != 0) {
- if (sl->threadid == CURRENT_THREAD) {
- ++sl->c;
- return 0;
- }
- }
- else {
- /* place args to cmpxchgl in locals to evade oddities in some gccs */
- int cmp = 0;
- int val = 1;
- int ret;
- __asm__ __volatile__ ("lock; cmpxchgl %1, %2"
- : "=a" (ret)
- : "r" (val), "m" (*(lp)), "0"(cmp)
- : "memory", "cc");
- if (!ret) {
- assert(!sl->threadid);
- sl->threadid = CURRENT_THREAD;
- sl->c = 1;
- return 0;
- }
- }
- if ((++spins & SPINS_PER_YIELD) == 0) {
-#if defined (__SVR4) && defined (__sun) /* solaris */
- thr_yield();
-#else
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
- sched_yield();
-#else /* no-op yield on unknown systems */
- ;
-#endif /* __linux__ || __FreeBSD__ || __APPLE__ */
-#endif /* solaris */
- }
- }
-}
-
-static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) {
- volatile unsigned int* lp = &sl->l;
- assert(*lp != 0);
- assert(sl->threadid == CURRENT_THREAD);
- if (--sl->c == 0) {
- sl->threadid = 0;
- int prev = 0;
- int ret;
- __asm__ __volatile__ ("lock; xchgl %0, %1"
- : "=r" (ret)
- : "m" (*(lp)), "0"(prev)
- : "memory");
- }
-}
-
-static FORCEINLINE int pthread_try_lock (MLOCK_T *sl) {
- volatile unsigned int* lp = &sl->l;
- if (*lp != 0) {
- if (sl->threadid == CURRENT_THREAD) {
- ++sl->c;
- return 1;
- }
- }
- else {
- int cmp = 0;
- int val = 1;
- int ret;
- __asm__ __volatile__ ("lock; cmpxchgl %1, %2"
- : "=a" (ret)
- : "r" (val), "m" (*(lp)), "0"(cmp)
- : "memory", "cc");
- if (!ret) {
- assert(!sl->threadid);
- sl->threadid = CURRENT_THREAD;
- sl->c = 1;
- return 1;
- }
- }
- return 0;
-}
-
-
-#else /* WIN32 */
-/* Custom win32-style spin locks on x86 and x64 for MSC */
-struct win32_mlock_t {
- volatile long l;
- char cachelinepadding[64];
- unsigned int c;
- long threadid;
-};
-
-#define MLOCK_T struct win32_mlock_t
-#define CURRENT_THREAD ((long)GetCurrentThreadId())
-#define INITIAL_LOCK(sl) ((sl)->threadid = 0, (sl)->l = (sl)->c = 0, 0)
-#define ACQUIRE_LOCK(sl) win32_acquire_lock(sl)
-#define RELEASE_LOCK(sl) win32_release_lock(sl)
-#define TRY_LOCK(sl) win32_try_lock(sl)
-#define SPINS_PER_YIELD 63
-
-static MLOCK_T malloc_global_mutex = { 0, 0, 0};
-
-static FORCEINLINE int win32_acquire_lock (MLOCK_T *sl) {
- int spins = 0;
- for (;;) {
- if (sl->l != 0) {
- if (sl->threadid == CURRENT_THREAD) {
- ++sl->c;
- return 0;
- }
- }
- else {
- if (!interlockedexchange(&sl->l, 1)) {
- assert(!sl->threadid);
- sl->threadid = CURRENT_THREAD;
- sl->c = 1;
- return 0;
- }
- }
- if ((++spins & SPINS_PER_YIELD) == 0)
- SleepEx(0, FALSE);
- }
-}
-
-static FORCEINLINE void win32_release_lock (MLOCK_T *sl) {
- assert(sl->threadid == CURRENT_THREAD);
- assert(sl->l != 0);
- if (--sl->c == 0) {
- sl->threadid = 0;
- interlockedexchange (&sl->l, 0);
- }
-}
-
-static FORCEINLINE int win32_try_lock (MLOCK_T *sl) {
- if (sl->l != 0) {
- if (sl->threadid == CURRENT_THREAD) {
- ++sl->c;
- return 1;
- }
- }
- else {
- if (!interlockedexchange(&sl->l, 1)){
- assert(!sl->threadid);
- sl->threadid = CURRENT_THREAD;
- sl->c = 1;
- return 1;
- }
- }
- return 0;
-}
-
-#endif /* WIN32 */
-#else /* USE_SPIN_LOCKS */
-
-#ifndef WIN32
-/* pthreads-based locks */
-
-#define MLOCK_T pthread_mutex_t
-#define CURRENT_THREAD pthread_self()
-#define INITIAL_LOCK(sl) pthread_init_lock(sl)
-#define ACQUIRE_LOCK(sl) pthread_mutex_lock(sl)
-#define RELEASE_LOCK(sl) pthread_mutex_unlock(sl)
-#define TRY_LOCK(sl) (!pthread_mutex_trylock(sl))
-
-static MLOCK_T malloc_global_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-/* Cope with old-style linux recursive lock initialization by adding */
-/* skipped internal declaration from pthread.h */
-#ifdef linux
-#ifndef PTHREAD_MUTEX_RECURSIVE
-extern int pthread_mutexattr_setkind_np __P ((pthread_mutexattr_t *__attr,
- int __kind));
-#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
-#define pthread_mutexattr_settype(x,y) pthread_mutexattr_setkind_np(x,y)
-#endif
-#endif
-
-static int pthread_init_lock (MLOCK_T *sl) {
- pthread_mutexattr_t attr;
- if (pthread_mutexattr_init(&attr)) return 1;
- if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) return 1;
- if (pthread_mutex_init(sl, &attr)) return 1;
- if (pthread_mutexattr_destroy(&attr)) return 1;
- return 0;
-}
-
-#else /* WIN32 */
-/* Win32 critical sections */
-#define MLOCK_T CRITICAL_SECTION
-#define CURRENT_THREAD GetCurrentThreadId()
-#define INITIAL_LOCK(s) (!InitializeCriticalSectionAndSpinCount((s), 0x80000000|4000))
-#define ACQUIRE_LOCK(s) (EnterCriticalSection(sl), 0)
-#define RELEASE_LOCK(s) LeaveCriticalSection(sl)
-#define TRY_LOCK(s) TryEnterCriticalSection(sl)
-#define NEED_GLOBAL_LOCK_INIT
-
-static MLOCK_T malloc_global_mutex;
-static volatile long malloc_global_mutex_status;
-
-/* Use spin loop to initialize global lock */
-static void init_malloc_global_mutex() {
- for (;;) {
- long stat = malloc_global_mutex_status;
- if (stat > 0)
- return;
- /* transition to < 0 while initializing, then to > 0) */
- if (stat == 0 &&
- interlockedcompareexchange(&malloc_global_mutex_status, -1, 0) == 0) {
- InitializeCriticalSection(&malloc_global_mutex);
- interlockedexchange(&malloc_global_mutex_status,1);
- return;
- }
- SleepEx(0, FALSE);
- }
-}
-
-#endif /* WIN32 */
-#endif /* USE_SPIN_LOCKS */
-#endif /* USE_LOCKS == 1 */
-
-/* ----------------------- User-defined locks ------------------------ */
-
-#if USE_LOCKS > 1
-/* Define your own lock implementation here */
-/* #define INITIAL_LOCK(sl) ... */
-/* #define ACQUIRE_LOCK(sl) ... */
-/* #define RELEASE_LOCK(sl) ... */
-/* #define TRY_LOCK(sl) ... */
-/* static MLOCK_T malloc_global_mutex = ... */
-#endif /* USE_LOCKS > 1 */
-
-/* ----------------------- Lock-based state ------------------------ */
-
-#if USE_LOCKS
-#define USE_LOCK_BIT (2U)
-#else /* USE_LOCKS */
-#define USE_LOCK_BIT (0U)
-#define INITIAL_LOCK(l)
-#endif /* USE_LOCKS */
-
-#if USE_LOCKS
-#ifndef ACQUIRE_MALLOC_GLOBAL_LOCK
-#define ACQUIRE_MALLOC_GLOBAL_LOCK() ACQUIRE_LOCK(&malloc_global_mutex);
-#endif
-#ifndef RELEASE_MALLOC_GLOBAL_LOCK
-#define RELEASE_MALLOC_GLOBAL_LOCK() RELEASE_LOCK(&malloc_global_mutex);
-#endif
-#else /* USE_LOCKS */
-#define ACQUIRE_MALLOC_GLOBAL_LOCK()
-#define RELEASE_MALLOC_GLOBAL_LOCK()
-#endif /* USE_LOCKS */
-
-
-/* ----------------------- Chunk representations ------------------------ */
-
-/*
- (The following includes lightly edited explanations by Colin Plumb.)
-
- The malloc_chunk declaration below is misleading (but accurate and
- necessary). It declares a "view" into memory allowing access to
- necessary fields at known offsets from a given base.
-
- Chunks of memory are maintained using a `boundary tag' method as
- originally described by Knuth. (See the paper by Paul Wilson
- ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such
- techniques.) Sizes of free chunks are stored both in the front of
- each chunk and at the end. This makes consolidating fragmented
- chunks into bigger chunks fast. The head fields also hold bits
- representing whether chunks are free or in use.
-
- Here are some pictures to make it clearer. They are "exploded" to
- show that the state of a chunk can be thought of as extending from
- the high 31 bits of the head field of its header through the
- prev_foot and PINUSE_BIT bit of the following chunk header.
-
- A chunk that's in use looks like:
-
- chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Size of previous chunk (if P = 0) |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
- | Size of this chunk 1| +-+
- mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | |
- +- -+
- | |
- +- -+
- | :
- +- size - sizeof(size_t) available payload bytes -+
- : |
- chunk-> +- -+
- | |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1|
- | Size of next chunk (may or may not be in use) | +-+
- mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
- And if it's free, it looks like this:
-
- chunk-> +- -+
- | User payload (must be in use, or we would have merged!) |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
- | Size of this chunk 0| +-+
- mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Next pointer |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Prev pointer |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | :
- +- size - sizeof(struct chunk) unused bytes -+
- : |
- chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Size of this chunk |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0|
- | Size of next chunk (must be in use, or we would have merged)| +-+
- mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | :
- +- User payload -+
- : |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- |0|
- +-+
- Note that since we always merge adjacent free chunks, the chunks
- adjacent to a free chunk must be in use.
-
- Given a pointer to a chunk (which can be derived trivially from the
- payload pointer) we can, in O(1) time, find out whether the adjacent
- chunks are free, and if so, unlink them from the lists that they
- are on and merge them with the current chunk.
-
- Chunks always begin on even word boundaries, so the mem portion
- (which is returned to the user) is also on an even word boundary, and
- thus at least double-word aligned.
-
- The P (PINUSE_BIT) bit, stored in the unused low-order bit of the
- chunk size (which is always a multiple of two words), is an in-use
- bit for the *previous* chunk. If that bit is *clear*, then the
- word before the current chunk size contains the previous chunk
- size, and can be used to find the front of the previous chunk.
- The very first chunk allocated always has this bit set, preventing
- access to non-existent (or non-owned) memory. If pinuse is set for
- any given chunk, then you CANNOT determine the size of the
- previous chunk, and might even get a memory addressing fault when
- trying to do so.
-
- The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of
- the chunk size redundantly records whether the current chunk is
- inuse (unless the chunk is mmapped). This redundancy enables usage
- checks within free and realloc, and reduces indirection when freeing
- and consolidating chunks.
-
- Each freshly allocated chunk must have both cinuse and pinuse set.
- That is, each allocated chunk borders either a previously allocated
- and still in-use chunk, or the base of its memory arena. This is
- ensured by making all allocations from the the `lowest' part of any
- found chunk. Further, no free chunk physically borders another one,
- so each free chunk is known to be preceded and followed by either
- inuse chunks or the ends of memory.
-
- Note that the `foot' of the current chunk is actually represented
- as the prev_foot of the NEXT chunk. This makes it easier to
- deal with alignments etc but can be very confusing when trying
- to extend or adapt this code.
-
- The exceptions to all this are
-
- 1. The special chunk `top' is the top-most available chunk (i.e.,
- the one bordering the end of available memory). It is treated
- specially. Top is never included in any bin, is used only if
- no other chunk is available, and is released back to the
- system if it is very large (see M_TRIM_THRESHOLD). In effect,
- the top chunk is treated as larger (and thus less well
- fitting) than any other available chunk. The top chunk
- doesn't update its trailing size field since there is no next
- contiguous chunk that would have to index off it. However,
- space is still allocated for it (TOP_FOOT_SIZE) to enable
- separation or merging when space is extended.
-
- 3. Chunks allocated via mmap, have both cinuse and pinuse bits
- cleared in their head fields. Because they are allocated
- one-by-one, each must carry its own prev_foot field, which is
- also used to hold the offset this chunk has within its mmapped
- region, which is needed to preserve alignment. Each mmapped
- chunk is trailed by the first two fields of a fake next-chunk
- for sake of usage checks.
-
-*/
-
-struct malloc_chunk {
- size_t prev_foot; /* Size of previous chunk (if free). */
- size_t head; /* Size and inuse bits. */
- struct malloc_chunk* fd; /* double links -- used only if free. */
- struct malloc_chunk* bk;
-};
-
-typedef struct malloc_chunk mchunk;
-typedef struct malloc_chunk* mchunkptr;
-typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */
-typedef unsigned int bindex_t; /* Described below */
-typedef unsigned int binmap_t; /* Described below */
-
-/* ------------------- Chunks sizes and alignments ----------------------- */
-
-#define MCHUNK_SIZE (sizeof(mchunk))
-
-#if FOOTERS
-#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
-#else /* FOOTERS */
-#define CHUNK_OVERHEAD (SIZE_T_SIZE)
-#endif /* FOOTERS */
-
-/* MMapped chunks need a second word of overhead ... */
-#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
-/* ... and additional padding for fake next-chunk at foot */
-#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES)
-
-/* The smallest size we can malloc is an aligned minimal chunk */
-#define MIN_CHUNK_SIZE\
- ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
-
-/* conversion from malloc headers to user pointers, and back */
-#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES))
-#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))
-/* chunk associated with aligned address A */
-#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A)))
-
-/* Bounds on request (not chunk) sizes. */
-#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2)
-#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
-
-/* pad request bytes into a usable size */
-#define pad_request(req) \
- (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
-
-/* pad request, checking for minimum (but not maximum) */
-#define request2size(req) \
- (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))
-
-
-/* ------------------ Operations on head and foot fields ----------------- */
-
-/*
- The head field of a chunk is or'ed with PINUSE_BIT when previous
- adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in
- use, unless mmapped, in which case both bits are cleared.
-
- FLAG4_BIT is not used by this malloc, but might be useful in extensions.
-*/
-
-#define PINUSE_BIT (SIZE_T_ONE)
-#define CINUSE_BIT (SIZE_T_TWO)
-#define FLAG4_BIT (SIZE_T_FOUR)
-#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT)
-#define FLAG_BITS (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT)
-
-/* Head value for fenceposts */
-#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE)
-
-/* extraction of fields from head words */
-#define cinuse(p) ((p)->head & CINUSE_BIT)
-#define pinuse(p) ((p)->head & PINUSE_BIT)
-#define is_inuse(p) (((p)->head & INUSE_BITS) != PINUSE_BIT)
-#define is_mmapped(p) (((p)->head & INUSE_BITS) == 0)
-
-#define chunksize(p) ((p)->head & ~(FLAG_BITS))
-
-#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT)
-
-/* Treat space at ptr +/- offset as a chunk */
-#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))
-#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s)))
-
-/* Ptr to next or previous physical malloc_chunk. */
-#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS)))
-#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) ))
-
-/* extract next chunk's pinuse bit */
-#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT)
-
-/* Get/set size at footer */
-#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot)
-#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s))
-
-/* Set size, pinuse bit, and foot */
-#define set_size_and_pinuse_of_free_chunk(p, s)\
- ((p)->head = (s|PINUSE_BIT), set_foot(p, s))
-
-/* Set size, pinuse bit, foot, and clear next pinuse */
-#define set_free_with_pinuse(p, s, n)\
- (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))
-
-/* Get the internal overhead associated with chunk p */
-#define overhead_for(p)\
- (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
-
-/* Return true if malloced space is not necessarily cleared */
-#if MMAP_CLEARS
-#define calloc_must_clear(p) (!is_mmapped(p))
-#else /* MMAP_CLEARS */
-#define calloc_must_clear(p) (1)
-#endif /* MMAP_CLEARS */
-
-/* ---------------------- Overlaid data structures ----------------------- */
-
-/*
- When chunks are not in use, they are treated as nodes of either
- lists or trees.
-
- "Small" chunks are stored in circular doubly-linked lists, and look
- like this:
-
- chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Size of previous chunk |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- `head:' | Size of chunk, in bytes |P|
- mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Forward pointer to next chunk in list |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Back pointer to previous chunk in list |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Unused space (may be 0 bytes long) .
- . .
- . |
-nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- `foot:' | Size of chunk, in bytes |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
- Larger chunks are kept in a form of bitwise digital trees (aka
- tries) keyed on chunksizes. Because malloc_tree_chunks are only for
- free chunks greater than 256 bytes, their size doesn't impose any
- constraints on user chunk sizes. Each node looks like:
-
- chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Size of previous chunk |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- `head:' | Size of chunk, in bytes |P|
- mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Forward pointer to next chunk of same size |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Back pointer to previous chunk of same size |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Pointer to left child (child[0]) |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Pointer to right child (child[1]) |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Pointer to parent |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | bin index of this chunk |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Unused space .
- . |
-nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- `foot:' | Size of chunk, in bytes |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
- Each tree holding treenodes is a tree of unique chunk sizes. Chunks
- of the same size are arranged in a circularly-linked list, with only
- the oldest chunk (the next to be used, in our FIFO ordering)
- actually in the tree. (Tree members are distinguished by a non-null
- parent pointer.) If a chunk with the same size an an existing node
- is inserted, it is linked off the existing node using pointers that
- work in the same way as fd/bk pointers of small chunks.
-
- Each tree contains a power of 2 sized range of chunk sizes (the
- smallest is 0x100 <= x < 0x180), which is is divided in half at each
- tree level, with the chunks in the smaller half of the range (0x100
- <= x < 0x140 for the top nose) in the left subtree and the larger
- half (0x140 <= x < 0x180) in the right subtree. This is, of course,
- done by inspecting individual bits.
-
- Using these rules, each node's left subtree contains all smaller
- sizes than its right subtree. However, the node at the root of each
- subtree has no particular ordering relationship to either. (The
- dividing line between the subtree sizes is based on trie relation.)
- If we remove the last chunk of a given size from the interior of the
- tree, we need to replace it with a leaf node. The tree ordering
- rules permit a node to be replaced by any leaf below it.
-
- The smallest chunk in a tree (a common operation in a best-fit
- allocator) can be found by walking a path to the leftmost leaf in
- the tree. Unlike a usual binary tree, where we follow left child
- pointers until we reach a null, here we follow the right child
- pointer any time the left one is null, until we reach a leaf with
- both child pointers null. The smallest chunk in the tree will be
- somewhere along that path.
-
- The worst case number of steps to add, find, or remove a node is
- bounded by the number of bits differentiating chunks within
- bins. Under current bin calculations, this ranges from 6 up to 21
- (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case
- is of course much better.
-*/
-
-struct malloc_tree_chunk {
- /* The first four fields must be compatible with malloc_chunk */
- size_t prev_foot;
- size_t head;
- struct malloc_tree_chunk* fd;
- struct malloc_tree_chunk* bk;
-
- struct malloc_tree_chunk* child[2];
- struct malloc_tree_chunk* parent;
- bindex_t index;
-};
-
-typedef struct malloc_tree_chunk tchunk;
-typedef struct malloc_tree_chunk* tchunkptr;
-typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */
-
-/* A little helper macro for trees */
-#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
-
-/* ----------------------------- Segments -------------------------------- */
-
-/*
- Each malloc space may include non-contiguous segments, held in a
- list headed by an embedded malloc_segment record representing the
- top-most space. Segments also include flags holding properties of
- the space. Large chunks that are directly allocated by mmap are not
- included in this list. They are instead independently created and
- destroyed without otherwise keeping track of them.
-
- Segment management mainly comes into play for spaces allocated by
- MMAP. Any call to MMAP might or might not return memory that is
- adjacent to an existing segment. MORECORE normally contiguously
- extends the current space, so this space is almost always adjacent,
- which is simpler and faster to deal with. (This is why MORECORE is
- used preferentially to MMAP when both are available -- see
- sys_alloc.) When allocating using MMAP, we don't use any of the
- hinting mechanisms (inconsistently) supported in various
- implementations of unix mmap, or distinguish reserving from
- committing memory. Instead, we just ask for space, and exploit
- contiguity when we get it. It is probably possible to do
- better than this on some systems, but no general scheme seems
- to be significantly better.
-
- Management entails a simpler variant of the consolidation scheme
- used for chunks to reduce fragmentation -- new adjacent memory is
- normally prepended or appended to an existing segment. However,
- there are limitations compared to chunk consolidation that mostly
- reflect the fact that segment processing is relatively infrequent
- (occurring only when getting memory from system) and that we
- don't expect to have huge numbers of segments:
-
- * Segments are not indexed, so traversal requires linear scans. (It
- would be possible to index these, but is not worth the extra
- overhead and complexity for most programs on most platforms.)
- * New segments are only appended to old ones when holding top-most
- memory; if they cannot be prepended to others, they are held in
- different segments.
-
- Except for the top-most segment of an mstate, each segment record
- is kept at the tail of its segment. Segments are added by pushing
- segment records onto the list headed by &mstate.seg for the
- containing mstate.
-
- Segment flags control allocation/merge/deallocation policies:
- * If EXTERN_BIT set, then we did not allocate this segment,
- and so should not try to deallocate or merge with others.
- (This currently holds only for the initial segment passed
- into create_mspace_with_base.)
- * If USE_MMAP_BIT set, the segment may be merged with
- other surrounding mmapped segments and trimmed/de-allocated
- using munmap.
- * If neither bit is set, then the segment was obtained using
- MORECORE so can be merged with surrounding MORECORE'd segments
- and deallocated/trimmed using MORECORE with negative arguments.
-*/
-
-struct malloc_segment {
- char* base; /* base address */
- size_t size; /* allocated size */
- struct malloc_segment* next; /* ptr to next segment */
- flag_t sflags; /* mmap and extern flag */
-};
-
-#define is_mmapped_segment(S) ((S)->sflags & USE_MMAP_BIT)
-#define is_extern_segment(S) ((S)->sflags & EXTERN_BIT)
-
-typedef struct malloc_segment msegment;
-typedef struct malloc_segment* msegmentptr;
-
-/* ---------------------------- malloc_state ----------------------------- */
-
-/*
- A malloc_state holds all of the bookkeeping for a space.
- The main fields are:
-
- Top
- The topmost chunk of the currently active segment. Its size is
- cached in topsize. The actual size of topmost space is
- topsize+TOP_FOOT_SIZE, which includes space reserved for adding
- fenceposts and segment records if necessary when getting more
- space from the system. The size at which to autotrim top is
- cached from mparams in trim_check, except that it is disabled if
- an autotrim fails.
-
- Designated victim (dv)
- This is the preferred chunk for servicing small requests that
- don't have exact fits. It is normally the chunk split off most
- recently to service another small request. Its size is cached in
- dvsize. The link fields of this chunk are not maintained since it
- is not kept in a bin.
-
- SmallBins
- An array of bin headers for free chunks. These bins hold chunks
- with sizes less than MIN_LARGE_SIZE bytes. Each bin contains
- chunks of all the same size, spaced 8 bytes apart. To simplify
- use in double-linked lists, each bin header acts as a malloc_chunk
- pointing to the real first node, if it exists (else pointing to
- itself). This avoids special-casing for headers. But to avoid
- waste, we allocate only the fd/bk pointers of bins, and then use
- repositioning tricks to treat these as the fields of a chunk.
-
- TreeBins
- Treebins are pointers to the roots of trees holding a range of
- sizes. There are 2 equally spaced treebins for each power of two
- from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything
- larger.
-
- Bin maps
- There is one bit map for small bins ("smallmap") and one for
- treebins ("treemap). Each bin sets its bit when non-empty, and
- clears the bit when empty. Bit operations are then used to avoid
- bin-by-bin searching -- nearly all "search" is done without ever
- looking at bins that won't be selected. The bit maps
- conservatively use 32 bits per map word, even if on 64bit system.
- For a good description of some of the bit-based techniques used
- here, see Henry S. Warren Jr's book "Hacker's Delight" (and
- supplement at http://hackersdelight.org/). Many of these are
- intended to reduce the branchiness of paths through malloc etc, as
- well as to reduce the number of memory locations read or written.
-
- Segments
- A list of segments headed by an embedded malloc_segment record
- representing the initial space.
-
- Address check support
- The least_addr field is the least address ever obtained from
- MORECORE or MMAP. Attempted frees and reallocs of any address less
- than this are trapped (unless INSECURE is defined).
-
- Magic tag
- A cross-check field that should always hold same value as mparams.magic.
-
- Flags
- Bits recording whether to use MMAP, locks, or contiguous MORECORE
-
- Statistics
- Each space keeps track of current and maximum system memory
- obtained via MORECORE or MMAP.
-
- Trim support
- Fields holding the amount of unused topmost memory that should trigger
- timming, and a counter to force periodic scanning to release unused
- non-topmost segments.
-
- Locking
- If USE_LOCKS is defined, the "mutex" lock is acquired and released
- around every public call using this mspace.
-
- Extension support
- A void* pointer and a size_t field that can be used to help implement
- extensions to this malloc.
-*/
-
-/* Bin types, widths and sizes */
-#define NSMALLBINS (32U)
-#define NTREEBINS (32U)
-#define SMALLBIN_SHIFT (3U)
-#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT)
-#define TREEBIN_SHIFT (8U)
-#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT)
-#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE)
-#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)
-
-struct malloc_state {
- binmap_t smallmap;
- binmap_t treemap;
- size_t dvsize;
- size_t topsize;
- char* least_addr;
- mchunkptr dv;
- mchunkptr top;
- size_t trim_check;
- size_t release_checks;
- size_t magic;
- mchunkptr smallbins[(NSMALLBINS+1)*2];
- tbinptr treebins[NTREEBINS];
- size_t footprint;
- size_t max_footprint;
- flag_t mflags;
- msegment seg;
-#if USE_LOCKS
- MLOCK_T mutex; /* locate lock among fields that rarely change */
-#endif /* USE_LOCKS */
- void* extp; /* Unused but available for extensions */
- size_t exts;
-};
-
-typedef struct malloc_state* mstate;
-
-/* ------------- Global malloc_state and malloc_params ------------------- */
-
-#if !ONLY_MSPACES
-
-/* The global malloc_state used for all non-"mspace" calls */
-static struct malloc_state _gm_;
-#define gm (&_gm_)
-#define is_global(M) ((M) == &_gm_)
-
-#endif /* !ONLY_MSPACES */
-
-#define is_initialized(M) ((M)->top != 0)
-
-/* -------------------------- system alloc setup ------------------------- */
-
-/* Operations on mflags */
-
-#define use_lock(M) ((M)->mflags & USE_LOCK_BIT)
-#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT)
-#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT)
-
-#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT)
-#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT)
-#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT)
-
-#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT)
-#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT)
-
-#define set_lock(M,L)\
- ((M)->mflags = (L)?\
- ((M)->mflags | USE_LOCK_BIT) :\
- ((M)->mflags & ~USE_LOCK_BIT))
-
-/* page-align a size */
-#define page_align(S)\
- (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
-
-/* granularity-align a size */
-#define granularity_align(S)\
- (((S) + (mparams.granularity - SIZE_T_ONE))\
- & ~(mparams.granularity - SIZE_T_ONE))
-
-
-/* For mmap, use granularity alignment on windows, else page-align */
-#ifdef WIN32
-#define mmap_align(S) granularity_align(S)
-#else
-#define mmap_align(S) page_align(S)
-#endif
-
-/* For sys_alloc, enough padding to ensure can malloc request on success */
-#define SYS_ALLOC_PADDING (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)
-
-#define is_page_aligned(S)\
- (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)
-#define is_granularity_aligned(S)\
- (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)
-
-/* True if segment S holds address A */
-#define segment_holds(S, A)\
- ((char*)(A) >= S->base && (char*)(A) < S->base + S->size)
-
-/* Return segment holding given address */
-static msegmentptr segment_holding(mstate m, char* addr) {
- msegmentptr sp = &m->seg;
- for (;;) {
- if (addr >= sp->base && addr < sp->base + sp->size)
- return sp;
- if ((sp = sp->next) == 0)
- return 0;
- }
-}
-
-/* Return true if segment contains a segment link */
-static int has_segment_link(mstate m, msegmentptr ss) {
- msegmentptr sp = &m->seg;
- for (;;) {
- if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size)
- return 1;
- if ((sp = sp->next) == 0)
- return 0;
- }
-}
-
-#ifndef MORECORE_CANNOT_TRIM
-#define should_trim(M,s) ((s) > (M)->trim_check)
-#else /* MORECORE_CANNOT_TRIM */
-#define should_trim(M,s) (0)
-#endif /* MORECORE_CANNOT_TRIM */
-
-/*
- TOP_FOOT_SIZE is padding at the end of a segment, including space
- that may be needed to place segment records and fenceposts when new
- noncontiguous segments are added.
-*/
-#define TOP_FOOT_SIZE\
- (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
-
-
-/* ------------------------------- Hooks -------------------------------- */
-
-/*
- PREACTION should be defined to return 0 on success, and nonzero on
- failure. If you are not using locking, you can redefine these to do
- anything you like.
-*/
-
-#if USE_LOCKS
-
-#define PREACTION(M) ((use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0)
-#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); }
-#else /* USE_LOCKS */
-
-#ifndef PREACTION
-#define PREACTION(M) (0)
-#endif /* PREACTION */
-
-#ifndef POSTACTION
-#define POSTACTION(M)
-#endif /* POSTACTION */
-
-#endif /* USE_LOCKS */
-
-/*
- CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses.
- USAGE_ERROR_ACTION is triggered on detected bad frees and
- reallocs. The argument p is an address that might have triggered the
- fault. It is ignored by the two predefined actions, but might be
- useful in custom actions that try to help diagnose errors.
-*/
-
-#if PROCEED_ON_ERROR
-
-/* A count of the number of corruption errors causing resets */
-int malloc_corruption_error_count;
-
-/* default corruption action */
-static void reset_on_error(mstate m);
-
-#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m)
-#define USAGE_ERROR_ACTION(m, p)
-
-#else /* PROCEED_ON_ERROR */
-
-#ifndef CORRUPTION_ERROR_ACTION
-#define CORRUPTION_ERROR_ACTION(m) ABORT
-#endif /* CORRUPTION_ERROR_ACTION */
-
-#ifndef USAGE_ERROR_ACTION
-#define USAGE_ERROR_ACTION(m,p) ABORT
-#endif /* USAGE_ERROR_ACTION */
-
-#endif /* PROCEED_ON_ERROR */
-
-/* -------------------------- Debugging setup ---------------------------- */
-
-#if ! DEBUG
-
-#define check_free_chunk(M,P)
-#define check_inuse_chunk(M,P)
-#define check_malloced_chunk(M,P,N)
-#define check_mmapped_chunk(M,P)
-#define check_malloc_state(M)
-#define check_top_chunk(M,P)
-
-#else /* DEBUG */
-#define check_free_chunk(M,P) do_check_free_chunk(M,P)
-#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P)
-#define check_top_chunk(M,P) do_check_top_chunk(M,P)
-#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N)
-#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P)
-#define check_malloc_state(M) do_check_malloc_state(M)
-
-static void do_check_any_chunk(mstate m, mchunkptr p);
-static void do_check_top_chunk(mstate m, mchunkptr p);
-static void do_check_mmapped_chunk(mstate m, mchunkptr p);
-static void do_check_inuse_chunk(mstate m, mchunkptr p);
-static void do_check_free_chunk(mstate m, mchunkptr p);
-static void do_check_malloced_chunk(mstate m, void* mem, size_t s);
-static void do_check_tree(mstate m, tchunkptr t);
-static void do_check_treebin(mstate m, bindex_t i);
-static void do_check_smallbin(mstate m, bindex_t i);
-static void do_check_malloc_state(mstate m);
-static int bin_find(mstate m, mchunkptr x);
-static size_t traverse_and_check(mstate m);
-#endif /* DEBUG */
-
-/* ---------------------------- Indexing Bins ---------------------------- */
-
-#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)
-#define small_index(s) (bindex_t)((s) >> SMALLBIN_SHIFT)
-#define small_index2size(i) ((i) << SMALLBIN_SHIFT)
-#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE))
-
-/* addressing by index. See above about smallbin repositioning */
-#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1])))
-#define treebin_at(M,i) (&((M)->treebins[i]))
-
-/* assign tree index for size S to variable I. Use x86 asm if possible */
-#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-#define compute_tree_index(S, I)\
-{\
- unsigned int X = S >> TREEBIN_SHIFT;\
- if (X == 0)\
- I = 0;\
- else if (X > 0xFFFF)\
- I = NTREEBINS-1;\
- else {\
- unsigned int K;\
- __asm__("bsrl\t%1, %0\n\t" : "=r" (K) : "g" (X));\
- I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
- }\
-}
-
-#elif defined (__INTEL_COMPILER)
-#define compute_tree_index(S, I)\
-{\
- size_t X = S >> TREEBIN_SHIFT;\
- if (X == 0)\
- I = 0;\
- else if (X > 0xFFFF)\
- I = NTREEBINS-1;\
- else {\
- unsigned int K = _bit_scan_reverse (X); \
- I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
- }\
-}
-
-#elif defined(_MSC_VER) && _MSC_VER>=1300
-#define compute_tree_index(S, I)\
-{\
- size_t X = S >> TREEBIN_SHIFT;\
- if (X == 0)\
- I = 0;\
- else if (X > 0xFFFF)\
- I = NTREEBINS-1;\
- else {\
- unsigned int K;\
- _BitScanReverse((DWORD *) &K, (DWORD) X);\
- I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
- }\
-}
-
-#else /* GNUC */
-#define compute_tree_index(S, I)\
-{\
- size_t X = S >> TREEBIN_SHIFT;\
- if (X == 0)\
- I = 0;\
- else if (X > 0xFFFF)\
- I = NTREEBINS-1;\
- else {\
- unsigned int Y = (unsigned int)X;\
- unsigned int N = ((Y - 0x100) >> 16) & 8;\
- unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\
- N += K;\
- N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\
- K = 14 - N + ((Y <<= K) >> 15);\
- I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\
- }\
-}
-#endif /* GNUC */
-
-/* Bit representing maximum resolved size in a treebin at i */
-#define bit_for_tree_index(i) \
- (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
-
-/* Shift placing maximum resolved bit in a treebin at i as sign bit */
-#define leftshift_for_tree_index(i) \
- ((i == NTREEBINS-1)? 0 : \
- ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))
-
-/* The size of the smallest chunk held in bin with index i */
-#define minsize_for_tree_index(i) \
- ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \
- (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
-
-
-/* ------------------------ Operations on bin maps ----------------------- */
-
-/* bit corresponding to given index */
-#define idx2bit(i) ((binmap_t)(1) << (i))
-
-/* Mark/Clear bits with given index */
-#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i))
-#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i))
-#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i))
-
-#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i))
-#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i))
-#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i))
-
-/* isolate the least set bit of a bitmap */
-#define least_bit(x) ((x) & -(x))
-
-/* mask with all bits to left of least bit of x on */
-#define left_bits(x) ((x<<1) | -(x<<1))
-
-/* mask with all bits to left of or equal to least bit of x on */
-#define same_or_left_bits(x) ((x) | -(x))
-
-/* index corresponding to given bit. Use x86 asm if possible */
-
-#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-#define compute_bit2idx(X, I)\
-{\
- unsigned int J;\
- __asm__("bsfl\t%1, %0\n\t" : "=r" (J) : "g" (X));\
- I = (bindex_t)J;\
-}
-
-#elif defined (__INTEL_COMPILER)
-#define compute_bit2idx(X, I)\
-{\
- unsigned int J;\
- J = _bit_scan_forward (X); \
- I = (bindex_t)J;\
-}
-
-#elif defined(_MSC_VER) && _MSC_VER>=1300
-#define compute_bit2idx(X, I)\
-{\
- unsigned int J;\
- _BitScanForward((DWORD *) &J, X);\
- I = (bindex_t)J;\
-}
-
-#elif USE_BUILTIN_FFS
-#define compute_bit2idx(X, I) I = ffs(X)-1
-
-#else
-#define compute_bit2idx(X, I)\
-{\
- unsigned int Y = X - 1;\
- unsigned int K = Y >> (16-4) & 16;\
- unsigned int N = K; Y >>= K;\
- N += K = Y >> (8-3) & 8; Y >>= K;\
- N += K = Y >> (4-2) & 4; Y >>= K;\
- N += K = Y >> (2-1) & 2; Y >>= K;\
- N += K = Y >> (1-0) & 1; Y >>= K;\
- I = (bindex_t)(N + Y);\
-}
-#endif /* GNUC */
-
-
-/* ----------------------- Runtime Check Support ------------------------- */
-
-/*
- For security, the main invariant is that malloc/free/etc never
- writes to a static address other than malloc_state, unless static
- malloc_state itself has been corrupted, which cannot occur via
- malloc (because of these checks). In essence this means that we
- believe all pointers, sizes, maps etc held in malloc_state, but
- check all of those linked or offsetted from other embedded data
- structures. These checks are interspersed with main code in a way
- that tends to minimize their run-time cost.
-
- When FOOTERS is defined, in addition to range checking, we also
- verify footer fields of inuse chunks, which can be used guarantee
- that the mstate controlling malloc/free is intact. This is a
- streamlined version of the approach described by William Robertson
- et al in "Run-time Detection of Heap-based Overflows" LISA'03
- http://www.usenix.org/events/lisa03/tech/robertson.html The footer
- of an inuse chunk holds the xor of its mstate and a random seed,
- that is checked upon calls to free() and realloc(). This is
- (probablistically) unguessable from outside the program, but can be
- computed by any code successfully malloc'ing any chunk, so does not
- itself provide protection against code that has already broken
- security through some other means. Unlike Robertson et al, we
- always dynamically check addresses of all offset chunks (previous,
- next, etc). This turns out to be cheaper than relying on hashes.
-*/
-
-#if !INSECURE
-/* Check if address a is at least as high as any from MORECORE or MMAP */
-#define ok_address(M, a) ((char*)(a) >= (M)->least_addr)
-/* Check if address of next chunk n is higher than base chunk p */
-#define ok_next(p, n) ((char*)(p) < (char*)(n))
-/* Check if p has inuse status */
-#define ok_inuse(p) is_inuse(p)
-/* Check if p has its pinuse bit on */
-#define ok_pinuse(p) pinuse(p)
-
-#else /* !INSECURE */
-#define ok_address(M, a) (1)
-#define ok_next(b, n) (1)
-#define ok_inuse(p) (1)
-#define ok_pinuse(p) (1)
-#endif /* !INSECURE */
-
-#if (FOOTERS && !INSECURE)
-/* Check if (alleged) mstate m has expected magic field */
-#define ok_magic(M) ((M)->magic == mparams.magic)
-#else /* (FOOTERS && !INSECURE) */
-#define ok_magic(M) (1)
-#endif /* (FOOTERS && !INSECURE) */
-
-
-/* In gcc, use __builtin_expect to minimize impact of checks */
-#if !INSECURE
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define RTCHECK(e) __builtin_expect(e, 1)
-#else /* GNUC */
-#define RTCHECK(e) (e)
-#endif /* GNUC */
-#else /* !INSECURE */
-#define RTCHECK(e) (1)
-#endif /* !INSECURE */
-
-/* macros to set up inuse chunks with or without footers */
-
-#if !FOOTERS
-
-#define mark_inuse_foot(M,p,s)
-
-/* Macros for setting head/foot of non-mmapped chunks */
-
-/* Set cinuse bit and pinuse bit of next chunk */
-#define set_inuse(M,p,s)\
- ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
- ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
-
-/* Set cinuse and pinuse of this chunk and pinuse of next chunk */
-#define set_inuse_and_pinuse(M,p,s)\
- ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
- ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
-
-/* Set size, cinuse and pinuse bit of this chunk */
-#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
- ((p)->head = (s|PINUSE_BIT|CINUSE_BIT))
-
-#else /* FOOTERS */
-
-/* Set foot of inuse chunk to be xor of mstate and seed */
-#define mark_inuse_foot(M,p,s)\
- (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic))
-
-#define get_mstate_for(p)\
- ((mstate)(((mchunkptr)((char*)(p) +\
- (chunksize(p))))->prev_foot ^ mparams.magic))
-
-#define set_inuse(M,p,s)\
- ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
- (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \
- mark_inuse_foot(M,p,s))
-
-#define set_inuse_and_pinuse(M,p,s)\
- ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
- (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\
- mark_inuse_foot(M,p,s))
-
-#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
- ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
- mark_inuse_foot(M, p, s))
-
-#endif /* !FOOTERS */
-
-/* ---------------------------- setting mparams -------------------------- */
-
-#ifdef ENABLE_LARGE_PAGES
-typedef size_t (WINAPI *GetLargePageMinimum_t)(void);
-#endif
-
-/* Initialize mparams */
-static int init_mparams(void) {
-#ifdef NEED_GLOBAL_LOCK_INIT
- if (malloc_global_mutex_status <= 0)
- init_malloc_global_mutex();
-#endif
-
- ACQUIRE_MALLOC_GLOBAL_LOCK();
- if (mparams.magic == 0) {
- size_t magic;
- size_t psize;
- size_t gsize;
-
-#ifndef WIN32
- psize = malloc_getpagesize;
- gsize = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : psize);
-#else /* WIN32 */
- {
- SYSTEM_INFO system_info;
- GetSystemInfo(&system_info);
- psize = system_info.dwPageSize;
- gsize = ((DEFAULT_GRANULARITY != 0)?
- DEFAULT_GRANULARITY : system_info.dwAllocationGranularity);
-#ifdef ENABLE_LARGE_PAGES
- {
- GetLargePageMinimum_t GetLargePageMinimum_ = (GetLargePageMinimum_t) GetProcAddress(GetModuleHandle(__T("kernel32.dll")), "GetLargePageMinimum");
- if(GetLargePageMinimum_) {
- size_t largepagesize = GetLargePageMinimum_();
- if(largepagesize) {
- psize = largepagesize;
- gsize = ((DEFAULT_GRANULARITY != 0)?
- DEFAULT_GRANULARITY : largepagesize);
- if(gsize < largepagesize) gsize = largepagesize;
- }
- }
- }
-#endif
- }
-#endif /* WIN32 */
-
- /* Sanity-check configuration:
- size_t must be unsigned and as wide as pointer type.
- ints must be at least 4 bytes.
- alignment must be at least 8.
- Alignment, min chunk size, and page size must all be powers of 2.
- */
- if ((sizeof(size_t) != sizeof(char*)) ||
- (MAX_SIZE_T < MIN_CHUNK_SIZE) ||
- (sizeof(int) < 4) ||
- (MALLOC_ALIGNMENT < (size_t)8U) ||
- ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) ||
- ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) ||
- ((gsize & (gsize-SIZE_T_ONE)) != 0) ||
- ((psize & (psize-SIZE_T_ONE)) != 0))
- ABORT;
-
- mparams.granularity = gsize;
- mparams.page_size = psize;
- mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
- mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD;
-#if MORECORE_CONTIGUOUS
- mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT;
-#else /* MORECORE_CONTIGUOUS */
- mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT;
-#endif /* MORECORE_CONTIGUOUS */
-
-#if !ONLY_MSPACES
- /* Set up lock for main malloc area */
- gm->mflags = mparams.default_mflags;
- INITIAL_LOCK(&gm->mutex);
-#endif
-
- {
-#if USE_DEV_RANDOM
- int fd;
- unsigned char buf[sizeof(size_t)];
- /* Try to use /dev/urandom, else fall back on using time */
- if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 &&
- read(fd, buf, sizeof(buf)) == sizeof(buf)) {
- magic = *((size_t *) buf);
- close(fd);
- }
- else
-#endif /* USE_DEV_RANDOM */
-#ifdef WIN32
- magic = (size_t)(GetTickCount() ^ (size_t)0x55555555U);
-#else
- magic = (size_t)(time(0) ^ (size_t)0x55555555U);
-#endif
- magic |= (size_t)8U; /* ensure nonzero */
- magic &= ~(size_t)7U; /* improve chances of fault for bad values */
- mparams.magic = magic;
- }
- }
-
- RELEASE_MALLOC_GLOBAL_LOCK();
- return 1;
-}
-
-/* support for mallopt */
-static int change_mparam(int param_number, int value) {
- size_t val;
- ensure_initialization();
- val = (value == -1)? MAX_SIZE_T : (size_t)value;
- switch(param_number) {
- case M_TRIM_THRESHOLD:
- mparams.trim_threshold = val;
- return 1;
- case M_GRANULARITY:
- if (val >= mparams.page_size && ((val & (val-1)) == 0)) {
- mparams.granularity = val;
- return 1;
- }
- else
- return 0;
- case M_MMAP_THRESHOLD:
- mparams.mmap_threshold = val;
- return 1;
- default:
- return 0;
- }
-}
-
-#if DEBUG
-/* ------------------------- Debugging Support --------------------------- */
-
-/* Check properties of any chunk, whether free, inuse, mmapped etc */
-static void do_check_any_chunk(mstate m, mchunkptr p) {
- assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
- assert(ok_address(m, p));
-}
-
-/* Check properties of top chunk */
-static void do_check_top_chunk(mstate m, mchunkptr p) {
- msegmentptr sp = segment_holding(m, (char*)p);
- size_t sz = p->head & ~INUSE_BITS; /* third-lowest bit can be set! */
- assert(sp != 0);
- assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
- assert(ok_address(m, p));
- assert(sz == m->topsize);
- assert(sz > 0);
- assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE);
- assert(pinuse(p));
- assert(!pinuse(chunk_plus_offset(p, sz)));
-}
-
-/* Check properties of (inuse) mmapped chunks */
-static void do_check_mmapped_chunk(mstate m, mchunkptr p) {
- size_t sz = chunksize(p);
- size_t len = (sz + (p->prev_foot) + MMAP_FOOT_PAD);
- assert(is_mmapped(p));
- assert(use_mmap(m));
- assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
- assert(ok_address(m, p));
- assert(!is_small(sz));
- assert((len & (mparams.page_size-SIZE_T_ONE)) == 0);
- assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD);
- assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0);
-}
-
-/* Check properties of inuse chunks */
-static void do_check_inuse_chunk(mstate m, mchunkptr p) {
- do_check_any_chunk(m, p);
- assert(is_inuse(p));
- assert(next_pinuse(p));
- /* If not pinuse and not mmapped, previous chunk has OK offset */
- assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p);
- if (is_mmapped(p))
- do_check_mmapped_chunk(m, p);
-}
-
-/* Check properties of free chunks */
-static void do_check_free_chunk(mstate m, mchunkptr p) {
- size_t sz = chunksize(p);
- mchunkptr next = chunk_plus_offset(p, sz);
- do_check_any_chunk(m, p);
- assert(!is_inuse(p));
- assert(!next_pinuse(p));
- assert (!is_mmapped(p));
- if (p != m->dv && p != m->top) {
- if (sz >= MIN_CHUNK_SIZE) {
- assert((sz & CHUNK_ALIGN_MASK) == 0);
- assert(is_aligned(chunk2mem(p)));
- assert(next->prev_foot == sz);
- assert(pinuse(p));
- assert (next == m->top || is_inuse(next));
- assert(p->fd->bk == p);
- assert(p->bk->fd == p);
- }
- else /* markers are always of size SIZE_T_SIZE */
- assert(sz == SIZE_T_SIZE);
- }
-}
-
-/* Check properties of malloced chunks at the point they are malloced */
-static void do_check_malloced_chunk(mstate m, void* mem, size_t s) {
- if (mem != 0) {
- mchunkptr p = mem2chunk(mem);
- size_t sz = p->head & ~INUSE_BITS;
- do_check_inuse_chunk(m, p);
- assert((sz & CHUNK_ALIGN_MASK) == 0);
- assert(sz >= MIN_CHUNK_SIZE);
- assert(sz >= s);
- /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */
- assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE));
- }
-}
-
-/* Check a tree and its subtrees. */
-static void do_check_tree(mstate m, tchunkptr t) {
- tchunkptr head = 0;
- tchunkptr u = t;
- bindex_t tindex = t->index;
- size_t tsize = chunksize(t);
- bindex_t idx;
- compute_tree_index(tsize, idx);
- assert(tindex == idx);
- assert(tsize >= MIN_LARGE_SIZE);
- assert(tsize >= minsize_for_tree_index(idx));
- assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1))));
-
- do { /* traverse through chain of same-sized nodes */
- do_check_any_chunk(m, ((mchunkptr)u));
- assert(u->index == tindex);
- assert(chunksize(u) == tsize);
- assert(!is_inuse(u));
- assert(!next_pinuse(u));
- assert(u->fd->bk == u);
- assert(u->bk->fd == u);
- if (u->parent == 0) {
- assert(u->child[0] == 0);
- assert(u->child[1] == 0);
- }
- else {
- assert(head == 0); /* only one node on chain has parent */
- head = u;
- assert(u->parent != u);
- assert (u->parent->child[0] == u ||
- u->parent->child[1] == u ||
- *((tbinptr*)(u->parent)) == u);
- if (u->child[0] != 0) {
- assert(u->child[0]->parent == u);
- assert(u->child[0] != u);
- do_check_tree(m, u->child[0]);
- }
- if (u->child[1] != 0) {
- assert(u->child[1]->parent == u);
- assert(u->child[1] != u);
- do_check_tree(m, u->child[1]);
- }
- if (u->child[0] != 0 && u->child[1] != 0) {
- assert(chunksize(u->child[0]) < chunksize(u->child[1]));
- }
- }
- u = u->fd;
- } while (u != t);
- assert(head != 0);
-}
-
-/* Check all the chunks in a treebin. */
-static void do_check_treebin(mstate m, bindex_t i) {
- tbinptr* tb = treebin_at(m, i);
- tchunkptr t = *tb;
- int empty = (m->treemap & (1U << i)) == 0;
- if (t == 0)
- assert(empty);
- if (!empty)
- do_check_tree(m, t);
-}
-
-/* Check all the chunks in a smallbin. */
-static void do_check_smallbin(mstate m, bindex_t i) {
- sbinptr b = smallbin_at(m, i);
- mchunkptr p = b->bk;
- unsigned int empty = (m->smallmap & (1U << i)) == 0;
- if (p == b)
- assert(empty);
- if (!empty) {
- for (; p != b; p = p->bk) {
- size_t size = chunksize(p);
- mchunkptr q;
- /* each chunk claims to be free */
- do_check_free_chunk(m, p);
- /* chunk belongs in bin */
- assert(small_index(size) == i);
- assert(p->bk == b || chunksize(p->bk) == chunksize(p));
- /* chunk is followed by an inuse chunk */
- q = next_chunk(p);
- if (q->head != FENCEPOST_HEAD)
- do_check_inuse_chunk(m, q);
- }
- }
-}
-
-/* Find x in a bin. Used in other check functions. */
-static int bin_find(mstate m, mchunkptr x) {
- size_t size = chunksize(x);
- if (is_small(size)) {
- bindex_t sidx = small_index(size);
- sbinptr b = smallbin_at(m, sidx);
- if (smallmap_is_marked(m, sidx)) {
- mchunkptr p = b;
- do {
- if (p == x)
- return 1;
- } while ((p = p->fd) != b);
- }
- }
- else {
- bindex_t tidx;
- compute_tree_index(size, tidx);
- if (treemap_is_marked(m, tidx)) {
- tchunkptr t = *treebin_at(m, tidx);
- size_t sizebits = size << leftshift_for_tree_index(tidx);
- while (t != 0 && chunksize(t) != size) {
- t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
- sizebits <<= 1;
- }
- if (t != 0) {
- tchunkptr u = t;
- do {
- if (u == (tchunkptr)x)
- return 1;
- } while ((u = u->fd) != t);
- }
- }
- }
- return 0;
-}
-
-/* Traverse each chunk and check it; return total */
-static size_t traverse_and_check(mstate m) {
- size_t sum = 0;
- if (is_initialized(m)) {
- msegmentptr s = &m->seg;
- sum += m->topsize + TOP_FOOT_SIZE;
- while (s != 0) {
- mchunkptr q = align_as_chunk(s->base);
- mchunkptr lastq = 0;
- assert(pinuse(q));
- while (segment_holds(s, q) &&
- q != m->top && q->head != FENCEPOST_HEAD) {
- sum += chunksize(q);
- if (is_inuse(q)) {
- assert(!bin_find(m, q));
- do_check_inuse_chunk(m, q);
- }
- else {
- assert(q == m->dv || bin_find(m, q));
- assert(lastq == 0 || is_inuse(lastq)); /* Not 2 consecutive free */
- do_check_free_chunk(m, q);
- }
- lastq = q;
- q = next_chunk(q);
- }
- s = s->next;
- }
- }
- return sum;
-}
-
-/* Check all properties of malloc_state. */
-static void do_check_malloc_state(mstate m) {
- bindex_t i;
- size_t total;
- /* check bins */
- for (i = 0; i < NSMALLBINS; ++i)
- do_check_smallbin(m, i);
- for (i = 0; i < NTREEBINS; ++i)
- do_check_treebin(m, i);
-
- if (m->dvsize != 0) { /* check dv chunk */
- do_check_any_chunk(m, m->dv);
- assert(m->dvsize == chunksize(m->dv));
- assert(m->dvsize >= MIN_CHUNK_SIZE);
- assert(bin_find(m, m->dv) == 0);
- }
-
- if (m->top != 0) { /* check top chunk */
- do_check_top_chunk(m, m->top);
- /*assert(m->topsize == chunksize(m->top)); redundant */
- assert(m->topsize > 0);
- assert(bin_find(m, m->top) == 0);
- }
-
- total = traverse_and_check(m);
- assert(total <= m->footprint);
- assert(m->footprint <= m->max_footprint);
-}
-#endif /* DEBUG */
-
-/* ----------------------------- statistics ------------------------------ */
-
-#if !NO_MALLINFO
-static struct mallinfo internal_mallinfo(mstate m) {
- struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- ensure_initialization();
- if (!PREACTION(m)) {
- check_malloc_state(m);
- if (is_initialized(m)) {
- size_t nfree = SIZE_T_ONE; /* top always free */
- size_t mfree = m->topsize + TOP_FOOT_SIZE;
- size_t sum = mfree;
- msegmentptr s = &m->seg;
- while (s != 0) {
- mchunkptr q = align_as_chunk(s->base);
- while (segment_holds(s, q) &&
- q != m->top && q->head != FENCEPOST_HEAD) {
- size_t sz = chunksize(q);
- sum += sz;
- if (!is_inuse(q)) {
- mfree += sz;
- ++nfree;
- }
- q = next_chunk(q);
- }
- s = s->next;
- }
-
- nm.arena = sum;
- nm.ordblks = nfree;
- nm.hblkhd = m->footprint - sum;
- nm.usmblks = m->max_footprint;
- nm.uordblks = m->footprint - mfree;
- nm.fordblks = mfree;
- nm.keepcost = m->topsize;
- }
-
- POSTACTION(m);
- }
- return nm;
-}
-#endif /* !NO_MALLINFO */
-
-static void internal_malloc_stats(mstate m) {
- ensure_initialization();
- if (!PREACTION(m)) {
- size_t maxfp = 0;
- size_t fp = 0;
- size_t used = 0;
- check_malloc_state(m);
- if (is_initialized(m)) {
- msegmentptr s = &m->seg;
- maxfp = m->max_footprint;
- fp = m->footprint;
- used = fp - (m->topsize + TOP_FOOT_SIZE);
-
- while (s != 0) {
- mchunkptr q = align_as_chunk(s->base);
- while (segment_holds(s, q) &&
- q != m->top && q->head != FENCEPOST_HEAD) {
- if (!is_inuse(q))
- used -= chunksize(q);
- q = next_chunk(q);
- }
- s = s->next;
- }
- }
-
- fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp));
- fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp));
- fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used));
-
- POSTACTION(m);
- }
-}
-
-/* ----------------------- Operations on smallbins ----------------------- */
-
-/*
- Various forms of linking and unlinking are defined as macros. Even
- the ones for trees, which are very long but have very short typical
- paths. This is ugly but reduces reliance on inlining support of
- compilers.
-*/
-
-/* Link a free chunk into a smallbin */
-#define insert_small_chunk(M, P, S) {\
- bindex_t I = small_index(S);\
- mchunkptr B = smallbin_at(M, I);\
- mchunkptr F = B;\
- assert(S >= MIN_CHUNK_SIZE);\
- if (!smallmap_is_marked(M, I))\
- mark_smallmap(M, I);\
- else if (RTCHECK(ok_address(M, B->fd)))\
- F = B->fd;\
- else {\
- CORRUPTION_ERROR_ACTION(M);\
- }\
- B->fd = P;\
- F->bk = P;\
- P->fd = F;\
- P->bk = B;\
-}
-
-/* Unlink a chunk from a smallbin */
-#define unlink_small_chunk(M, P, S) {\
- mchunkptr F = P->fd;\
- mchunkptr B = P->bk;\
- bindex_t I = small_index(S);\
- assert(P != B);\
- assert(P != F);\
- assert(chunksize(P) == small_index2size(I));\
- if (F == B)\
- clear_smallmap(M, I);\
- else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\
- (B == smallbin_at(M,I) || ok_address(M, B)))) {\
- F->bk = B;\
- B->fd = F;\
- }\
- else {\
- CORRUPTION_ERROR_ACTION(M);\
- }\
-}
-
-/* Unlink the first chunk from a smallbin */
-#define unlink_first_small_chunk(M, B, P, I) {\
- mchunkptr F = P->fd;\
- assert(P != B);\
- assert(P != F);\
- assert(chunksize(P) == small_index2size(I));\
- if (B == F)\
- clear_smallmap(M, I);\
- else if (RTCHECK(ok_address(M, F))) {\
- B->fd = F;\
- F->bk = B;\
- }\
- else {\
- CORRUPTION_ERROR_ACTION(M);\
- }\
-}
-
-
-
-/* Replace dv node, binning the old one */
-/* Used only when dvsize known to be small */
-#define replace_dv(M, P, S) {\
- size_t DVS = M->dvsize;\
- if (DVS != 0) {\
- mchunkptr DV = M->dv;\
- assert(is_small(DVS));\
- insert_small_chunk(M, DV, DVS);\
- }\
- M->dvsize = S;\
- M->dv = P;\
-}
-
-/* ------------------------- Operations on trees ------------------------- */
-
-/* Insert chunk into tree */
-#define insert_large_chunk(M, X, S) {\
- tbinptr* H;\
- bindex_t I;\
- compute_tree_index(S, I);\
- H = treebin_at(M, I);\
- X->index = I;\
- X->child[0] = X->child[1] = 0;\
- if (!treemap_is_marked(M, I)) {\
- mark_treemap(M, I);\
- *H = X;\
- X->parent = (tchunkptr)H;\
- X->fd = X->bk = X;\
- }\
- else {\
- tchunkptr T = *H;\
- size_t K = S << leftshift_for_tree_index(I);\
- for (;;) {\
- if (chunksize(T) != S) {\
- tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\
- K <<= 1;\
- if (*C != 0)\
- T = *C;\
- else if (RTCHECK(ok_address(M, C))) {\
- *C = X;\
- X->parent = T;\
- X->fd = X->bk = X;\
- break;\
- }\
- else {\
- CORRUPTION_ERROR_ACTION(M);\
- break;\
- }\
- }\
- else {\
- tchunkptr F = T->fd;\
- if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\
- T->fd = F->bk = X;\
- X->fd = F;\
- X->bk = T;\
- X->parent = 0;\
- break;\
- }\
- else {\
- CORRUPTION_ERROR_ACTION(M);\
- break;\
- }\
- }\
- }\
- }\
-}
-
-/*
- Unlink steps:
-
- 1. If x is a chained node, unlink it from its same-sized fd/bk links
- and choose its bk node as its replacement.
- 2. If x was the last node of its size, but not a leaf node, it must
- be replaced with a leaf node (not merely one with an open left or
- right), to make sure that lefts and rights of descendents
- correspond properly to bit masks. We use the rightmost descendent
- of x. We could use any other leaf, but this is easy to locate and
- tends to counteract removal of leftmosts elsewhere, and so keeps
- paths shorter than minimally guaranteed. This doesn't loop much
- because on average a node in a tree is near the bottom.
- 3. If x is the base of a chain (i.e., has parent links) relink
- x's parent and children to x's replacement (or null if none).
-*/
-
-#define unlink_large_chunk(M, X) {\
- tchunkptr XP = X->parent;\
- tchunkptr R;\
- if (X->bk != X) {\
- tchunkptr F = X->fd;\
- R = X->bk;\
- if (RTCHECK(ok_address(M, F))) {\
- F->bk = R;\
- R->fd = F;\
- }\
- else {\
- CORRUPTION_ERROR_ACTION(M);\
- }\
- }\
- else {\
- tchunkptr* RP;\
- if (((R = *(RP = &(X->child[1]))) != 0) ||\
- ((R = *(RP = &(X->child[0]))) != 0)) {\
- tchunkptr* CP;\
- while ((*(CP = &(R->child[1])) != 0) ||\
- (*(CP = &(R->child[0])) != 0)) {\
- R = *(RP = CP);\
- }\
- if (RTCHECK(ok_address(M, RP)))\
- *RP = 0;\
- else {\
- CORRUPTION_ERROR_ACTION(M);\
- }\
- }\
- }\
- if (XP != 0) {\
- tbinptr* H = treebin_at(M, X->index);\
- if (X == *H) {\
- if ((*H = R) == 0) \
- clear_treemap(M, X->index);\
- }\
- else if (RTCHECK(ok_address(M, XP))) {\
- if (XP->child[0] == X) \
- XP->child[0] = R;\
- else \
- XP->child[1] = R;\
- }\
- else\
- CORRUPTION_ERROR_ACTION(M);\
- if (R != 0) {\
- if (RTCHECK(ok_address(M, R))) {\
- tchunkptr C0, C1;\
- R->parent = XP;\
- if ((C0 = X->child[0]) != 0) {\
- if (RTCHECK(ok_address(M, C0))) {\
- R->child[0] = C0;\
- C0->parent = R;\
- }\
- else\
- CORRUPTION_ERROR_ACTION(M);\
- }\
- if ((C1 = X->child[1]) != 0) {\
- if (RTCHECK(ok_address(M, C1))) {\
- R->child[1] = C1;\
- C1->parent = R;\
- }\
- else\
- CORRUPTION_ERROR_ACTION(M);\
- }\
- }\
- else\
- CORRUPTION_ERROR_ACTION(M);\
- }\
- }\
-}
-
-/* Relays to large vs small bin operations */
-
-#define insert_chunk(M, P, S)\
- if (is_small(S)) insert_small_chunk(M, P, S)\
- else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); }
-
-#define unlink_chunk(M, P, S)\
- if (is_small(S)) unlink_small_chunk(M, P, S)\
- else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); }
-
-
-/* Relays to internal calls to malloc/free from realloc, memalign etc */
-
-#if ONLY_MSPACES
-#define internal_malloc(m, b) mspace_malloc(m, b)
-#define internal_free(m, mem) mspace_free(m,mem);
-#else /* ONLY_MSPACES */
-#if MSPACES
-#define internal_malloc(m, b)\
- (m == gm)? dlmalloc(b) : mspace_malloc(m, b)
-#define internal_free(m, mem)\
- if (m == gm) dlfree(mem); else mspace_free(m,mem);
-#else /* MSPACES */
-#define internal_malloc(m, b) dlmalloc(b)
-#define internal_free(m, mem) dlfree(mem)
-#endif /* MSPACES */
-#endif /* ONLY_MSPACES */
-
-/* ----------------------- Direct-mmapping chunks ----------------------- */
-
-/*
- Directly mmapped chunks are set up with an offset to the start of
- the mmapped region stored in the prev_foot field of the chunk. This
- allows reconstruction of the required argument to MUNMAP when freed,
- and also allows adjustment of the returned chunk to meet alignment
- requirements (especially in memalign).
-*/
-
-/* Malloc using mmap */
-static void* mmap_alloc(mstate m, size_t nb) {
- size_t mmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
- if (mmsize > nb) { /* Check for wrap around 0 */
- char* mm = (char*)(CALL_DIRECT_MMAP(mmsize));
- if (mm != CMFAIL) {
- size_t offset = align_offset(chunk2mem(mm));
- size_t psize = mmsize - offset - MMAP_FOOT_PAD;
- mchunkptr p = (mchunkptr)(mm + offset);
- p->prev_foot = offset;
- p->head = psize;
- mark_inuse_foot(m, p, psize);
- chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD;
- chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0;
-
- if (m->least_addr == 0 || mm < m->least_addr)
- m->least_addr = mm;
- if ((m->footprint += mmsize) > m->max_footprint)
- m->max_footprint = m->footprint;
- assert(is_aligned(chunk2mem(p)));
- check_mmapped_chunk(m, p);
- return chunk2mem(p);
- }
- }
- return 0;
-}
-
-/* Realloc using mmap */
-static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb) {
- size_t oldsize = chunksize(oldp);
- if (is_small(nb)) /* Can't shrink mmap regions below small size */
- return 0;
- /* Keep old chunk if big enough but not too big */
- if (oldsize >= nb + SIZE_T_SIZE &&
- (oldsize - nb) <= (mparams.granularity << 1))
- return oldp;
- else {
- size_t offset = oldp->prev_foot;
- size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD;
- size_t newmmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
- char* cp = (char*)CALL_MREMAP((char*)oldp - offset,
- oldmmsize, newmmsize, 1);
- if (cp != CMFAIL) {
- mchunkptr newp = (mchunkptr)(cp + offset);
- size_t psize = newmmsize - offset - MMAP_FOOT_PAD;
- newp->head = psize;
- mark_inuse_foot(m, newp, psize);
- chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD;
- chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0;
-
- if (cp < m->least_addr)
- m->least_addr = cp;
- if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint)
- m->max_footprint = m->footprint;
- check_mmapped_chunk(m, newp);
- return newp;
- }
- }
- return 0;
-}
-
-/* -------------------------- mspace management -------------------------- */
-
-/* Initialize top chunk and its size */
-static void init_top(mstate m, mchunkptr p, size_t psize) {
- /* Ensure alignment */
- size_t offset = align_offset(chunk2mem(p));
- p = (mchunkptr)((char*)p + offset);
- psize -= offset;
-
- m->top = p;
- m->topsize = psize;
- p->head = psize | PINUSE_BIT;
- /* set size of fake trailing chunk holding overhead space only once */
- chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE;
- m->trim_check = mparams.trim_threshold; /* reset on each update */
-}
-
-/* Initialize bins for a new mstate that is otherwise zeroed out */
-static void init_bins(mstate m) {
- /* Establish circular links for smallbins */
- bindex_t i;
- for (i = 0; i < NSMALLBINS; ++i) {
- sbinptr bin = smallbin_at(m,i);
- bin->fd = bin->bk = bin;
- }
-}
-
-#if PROCEED_ON_ERROR
-
-/* default corruption action */
-static void reset_on_error(mstate m) {
- int i;
- ++malloc_corruption_error_count;
- /* Reinitialize fields to forget about all memory */
- m->smallbins = m->treebins = 0;
- m->dvsize = m->topsize = 0;
- m->seg.base = 0;
- m->seg.size = 0;
- m->seg.next = 0;
- m->top = m->dv = 0;
- for (i = 0; i < NTREEBINS; ++i)
- *treebin_at(m, i) = 0;
- init_bins(m);
-}
-#endif /* PROCEED_ON_ERROR */
-
-/* Allocate chunk and prepend remainder with chunk in successor base. */
-static void* prepend_alloc(mstate m, char* newbase, char* oldbase,
- size_t nb) {
- mchunkptr p = align_as_chunk(newbase);
- mchunkptr oldfirst = align_as_chunk(oldbase);
- size_t psize = (char*)oldfirst - (char*)p;
- mchunkptr q = chunk_plus_offset(p, nb);
- size_t qsize = psize - nb;
- set_size_and_pinuse_of_inuse_chunk(m, p, nb);
-
- assert((char*)oldfirst > (char*)q);
- assert(pinuse(oldfirst));
- assert(qsize >= MIN_CHUNK_SIZE);
-
- /* consolidate remainder with first chunk of old base */
- if (oldfirst == m->top) {
- size_t tsize = m->topsize += qsize;
- m->top = q;
- q->head = tsize | PINUSE_BIT;
- check_top_chunk(m, q);
- }
- else if (oldfirst == m->dv) {
- size_t dsize = m->dvsize += qsize;
- m->dv = q;
- set_size_and_pinuse_of_free_chunk(q, dsize);
- }
- else {
- if (!is_inuse(oldfirst)) {
- size_t nsize = chunksize(oldfirst);
- unlink_chunk(m, oldfirst, nsize);
- oldfirst = chunk_plus_offset(oldfirst, nsize);
- qsize += nsize;
- }
- set_free_with_pinuse(q, qsize, oldfirst);
- insert_chunk(m, q, qsize);
- check_free_chunk(m, q);
- }
-
- check_malloced_chunk(m, chunk2mem(p), nb);
- return chunk2mem(p);
-}
-
-/* Add a segment to hold a new noncontiguous region */
-static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) {
- /* Determine locations and sizes of segment, fenceposts, old top */
- char* old_top = (char*)m->top;
- msegmentptr oldsp = segment_holding(m, old_top);
- char* old_end = oldsp->base + oldsp->size;
- size_t ssize = pad_request(sizeof(struct malloc_segment));
- char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
- size_t offset = align_offset(chunk2mem(rawsp));
- char* asp = rawsp + offset;
- char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp;
- mchunkptr sp = (mchunkptr)csp;
- msegmentptr ss = (msegmentptr)(chunk2mem(sp));
- mchunkptr tnext = chunk_plus_offset(sp, ssize);
- mchunkptr p = tnext;
- int nfences = 0;
-
- /* reset top to new space */
- init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
-
- /* Set up segment record */
- assert(is_aligned(ss));
- set_size_and_pinuse_of_inuse_chunk(m, sp, ssize);
- *ss = m->seg; /* Push current record */
- m->seg.base = tbase;
- m->seg.size = tsize;
- m->seg.sflags = mmapped;
- m->seg.next = ss;
-
- /* Insert trailing fenceposts */
- for (;;) {
- mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE);
- p->head = FENCEPOST_HEAD;
- ++nfences;
- if ((char*)(&(nextp->head)) < old_end)
- p = nextp;
- else
- break;
- }
- assert(nfences >= 2);
-
- /* Insert the rest of old top into a bin as an ordinary free chunk */
- if (csp != old_top) {
- mchunkptr q = (mchunkptr)old_top;
- size_t psize = csp - old_top;
- mchunkptr tn = chunk_plus_offset(q, psize);
- set_free_with_pinuse(q, psize, tn);
- insert_chunk(m, q, psize);
- }
-
- check_top_chunk(m, m->top);
-}
-
-/* -------------------------- System allocation -------------------------- */
-
-/* Get memory from system using MORECORE or MMAP */
-static void* sys_alloc(mstate m, size_t nb) {
- char* tbase = CMFAIL;
- size_t tsize = 0;
- flag_t mmap_flag = 0;
-
- ensure_initialization();
-
- /* Directly map large chunks, but only if already initialized */
- if (use_mmap(m) && nb >= mparams.mmap_threshold && m->topsize != 0) {
- void* mem = mmap_alloc(m, nb);
- if (mem != 0)
- return mem;
- }
-
- /*
- Try getting memory in any of three ways (in most-preferred to
- least-preferred order):
- 1. A call to MORECORE that can normally contiguously extend memory.
- (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or
- or main space is mmapped or a previous contiguous call failed)
- 2. A call to MMAP new space (disabled if not HAVE_MMAP).
- Note that under the default settings, if MORECORE is unable to
- fulfill a request, and HAVE_MMAP is true, then mmap is
- used as a noncontiguous system allocator. This is a useful backup
- strategy for systems with holes in address spaces -- in this case
- sbrk cannot contiguously expand the heap, but mmap may be able to
- find space.
- 3. A call to MORECORE that cannot usually contiguously extend memory.
- (disabled if not HAVE_MORECORE)
-
- In all cases, we need to request enough bytes from system to ensure
- we can malloc nb bytes upon success, so pad with enough space for
- top_foot, plus alignment-pad to make sure we don't lose bytes if
- not on boundary, and round this up to a granularity unit.
- */
-
- if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) {
- char* br = CMFAIL;
- msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top);
- size_t asize = 0;
- ACQUIRE_MALLOC_GLOBAL_LOCK();
-
- if (ss == 0) { /* First time through or recovery */
- char* base = (char*)CALL_MORECORE(0);
- if (base != CMFAIL) {
- asize = granularity_align(nb + SYS_ALLOC_PADDING);
- /* Adjust to end on a page boundary */
- if (!is_page_aligned(base))
- asize += (page_align((size_t)base) - (size_t)base);
- /* Can't call MORECORE if size is negative when treated as signed */
- if (asize < HALF_MAX_SIZE_T &&
- (br = (char*)(CALL_MORECORE(asize))) == base) {
- tbase = base;
- tsize = asize;
- }
- }
- }
- else {
- /* Subtract out existing available top space from MORECORE request. */
- asize = granularity_align(nb - m->topsize + SYS_ALLOC_PADDING);
- /* Use mem here only if it did continuously extend old space */
- if (asize < HALF_MAX_SIZE_T &&
- (br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) {
- tbase = br;
- tsize = asize;
- }
- }
-
- if (tbase == CMFAIL) { /* Cope with partial failure */
- if (br != CMFAIL) { /* Try to use/extend the space we did get */
- if (asize < HALF_MAX_SIZE_T &&
- asize < nb + SYS_ALLOC_PADDING) {
- size_t esize = granularity_align(nb + SYS_ALLOC_PADDING - asize);
- if (esize < HALF_MAX_SIZE_T) {
- char* end = (char*)CALL_MORECORE(esize);
- if (end != CMFAIL)
- asize += esize;
- else { /* Can't use; try to release */
- (void) CALL_MORECORE(-asize);
- br = CMFAIL;
- }
- }
- }
- }
- if (br != CMFAIL) { /* Use the space we did get */
- tbase = br;
- tsize = asize;
- }
- else
- disable_contiguous(m); /* Don't try contiguous path in the future */
- }
-
- RELEASE_MALLOC_GLOBAL_LOCK();
- }
-
- if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */
- size_t rsize = granularity_align(nb + SYS_ALLOC_PADDING);
- if (rsize > nb) { /* Fail if wraps around zero */
- char* mp = (char*)(CALL_MMAP(rsize));
- if (mp != CMFAIL) {
- tbase = mp;
- tsize = rsize;
- mmap_flag = USE_MMAP_BIT;
- }
- }
- }
-
- if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */
- size_t asize = granularity_align(nb + SYS_ALLOC_PADDING);
- if (asize < HALF_MAX_SIZE_T) {
- char* br = CMFAIL;
- char* end = CMFAIL;
- ACQUIRE_MALLOC_GLOBAL_LOCK();
- br = (char*)(CALL_MORECORE(asize));
- end = (char*)(CALL_MORECORE(0));
- RELEASE_MALLOC_GLOBAL_LOCK();
- if (br != CMFAIL && end != CMFAIL && br < end) {
- size_t ssize = end - br;
- if (ssize > nb + TOP_FOOT_SIZE) {
- tbase = br;
- tsize = ssize;
- }
- }
- }
- }
-
- if (tbase != CMFAIL) {
-
- if ((m->footprint += tsize) > m->max_footprint)
- m->max_footprint = m->footprint;
-
- if (!is_initialized(m)) { /* first-time initialization */
- if (m->least_addr == 0 || tbase < m->least_addr)
- m->least_addr = tbase;
- m->seg.base = tbase;
- m->seg.size = tsize;
- m->seg.sflags = mmap_flag;
- m->magic = mparams.magic;
- m->release_checks = MAX_RELEASE_CHECK_RATE;
- init_bins(m);
-#if !ONLY_MSPACES
- if (is_global(m))
- init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
- else
-#endif
- {
- /* Offset top by embedded malloc_state */
- mchunkptr mn = next_chunk(mem2chunk(m));
- init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE);
- }
- }
-
- else {
- /* Try to merge with an existing segment */
- msegmentptr sp = &m->seg;
- /* Only consider most recent segment if traversal suppressed */
- while (sp != 0 && tbase != sp->base + sp->size)
- sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next;
- if (sp != 0 &&
- !is_extern_segment(sp) &&
- (sp->sflags & USE_MMAP_BIT) == mmap_flag &&
- segment_holds(sp, m->top)) { /* append */
- sp->size += tsize;
- init_top(m, m->top, m->topsize + tsize);
- }
- else {
- if (tbase < m->least_addr)
- m->least_addr = tbase;
- sp = &m->seg;
- while (sp != 0 && sp->base != tbase + tsize)
- sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next;
- if (sp != 0 &&
- !is_extern_segment(sp) &&
- (sp->sflags & USE_MMAP_BIT) == mmap_flag) {
- char* oldbase = sp->base;
- sp->base = tbase;
- sp->size += tsize;
- return prepend_alloc(m, tbase, oldbase, nb);
- }
- else
- add_segment(m, tbase, tsize, mmap_flag);
- }
- }
-
- if (nb < m->topsize) { /* Allocate from new or extended top space */
- size_t rsize = m->topsize -= nb;
- mchunkptr p = m->top;
- mchunkptr r = m->top = chunk_plus_offset(p, nb);
- r->head = rsize | PINUSE_BIT;
- set_size_and_pinuse_of_inuse_chunk(m, p, nb);
- check_top_chunk(m, m->top);
- check_malloced_chunk(m, chunk2mem(p), nb);
- return chunk2mem(p);
- }
- }
-
- MALLOC_FAILURE_ACTION;
- return 0;
-}
-
-/* ----------------------- system deallocation -------------------------- */
-
-/* Unmap and unlink any mmapped segments that don't contain used chunks */
-static size_t release_unused_segments(mstate m) {
- size_t released = 0;
- int nsegs = 0;
- msegmentptr pred = &m->seg;
- msegmentptr sp = pred->next;
- while (sp != 0) {
- char* base = sp->base;
- size_t size = sp->size;
- msegmentptr next = sp->next;
- ++nsegs;
- if (is_mmapped_segment(sp) && !is_extern_segment(sp)) {
- mchunkptr p = align_as_chunk(base);
- size_t psize = chunksize(p);
- /* Can unmap if first chunk holds entire segment and not pinned */
- if (!is_inuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) {
- tchunkptr tp = (tchunkptr)p;
- assert(segment_holds(sp, (char*)sp));
- if (p == m->dv) {
- m->dv = 0;
- m->dvsize = 0;
- }
- else {
- unlink_large_chunk(m, tp);
- }
- if (CALL_MUNMAP(base, size) == 0) {
- released += size;
- m->footprint -= size;
- /* unlink obsoleted record */
- sp = pred;
- sp->next = next;
- }
- else { /* back out if cannot unmap */
- insert_large_chunk(m, tp, psize);
- }
- }
- }
- if (NO_SEGMENT_TRAVERSAL) /* scan only first segment */
- break;
- pred = sp;
- sp = next;
- }
- /* Reset check counter */
- m->release_checks = ((nsegs > MAX_RELEASE_CHECK_RATE)?
- nsegs : MAX_RELEASE_CHECK_RATE);
- return released;
-}
-
-static int sys_trim(mstate m, size_t pad) {
- size_t released = 0;
- ensure_initialization();
- if (pad < MAX_REQUEST && is_initialized(m)) {
- pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */
-
- if (m->topsize > pad) {
- /* Shrink top space in granularity-size units, keeping at least one */
- size_t unit = mparams.granularity;
- size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit -
- SIZE_T_ONE) * unit;
- msegmentptr sp = segment_holding(m, (char*)m->top);
-
- if (!is_extern_segment(sp)) {
- if (is_mmapped_segment(sp)) {
- if (HAVE_MMAP &&
- sp->size >= extra &&
- !has_segment_link(m, sp)) { /* can't shrink if pinned */
- size_t newsize = sp->size - extra;
- /* Prefer mremap, fall back to munmap */
- if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) ||
- (CALL_MUNMAP(sp->base + newsize, extra) == 0)) {
- released = extra;
- }
- }
- }
- else if (HAVE_MORECORE) {
- if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */
- extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit;
- ACQUIRE_MALLOC_GLOBAL_LOCK();
- {
- /* Make sure end of memory is where we last set it. */
- char* old_br = (char*)(CALL_MORECORE(0));
- if (old_br == sp->base + sp->size) {
- char* rel_br = (char*)(CALL_MORECORE(-extra));
- char* new_br = (char*)(CALL_MORECORE(0));
- if (rel_br != CMFAIL && new_br < old_br)
- released = old_br - new_br;
- }
- }
- RELEASE_MALLOC_GLOBAL_LOCK();
- }
- }
-
- if (released != 0) {
- sp->size -= released;
- m->footprint -= released;
- init_top(m, m->top, m->topsize - released);
- check_top_chunk(m, m->top);
- }
- }
-
- /* Unmap any unused mmapped segments */
- if (HAVE_MMAP)
- released += release_unused_segments(m);
-
- /* On failure, disable autotrim to avoid repeated failed future calls */
- if (released == 0 && m->topsize > m->trim_check)
- m->trim_check = MAX_SIZE_T;
- }
-
- return (released != 0)? 1 : 0;
-}
-
-
-/* ---------------------------- malloc support --------------------------- */
-
-/* allocate a large request from the best fitting chunk in a treebin */
-static void* tmalloc_large(mstate m, size_t nb) {
- tchunkptr v = 0;
- size_t rsize = -nb; /* Unsigned negation */
- tchunkptr t;
- bindex_t idx;
- compute_tree_index(nb, idx);
- if ((t = *treebin_at(m, idx)) != 0) {
- /* Traverse tree for this bin looking for node with size == nb */
- size_t sizebits = nb << leftshift_for_tree_index(idx);
- tchunkptr rst = 0; /* The deepest untaken right subtree */
- for (;;) {
- tchunkptr rt;
- size_t trem = chunksize(t) - nb;
- if (trem < rsize) {
- v = t;
- if ((rsize = trem) == 0)
- break;
- }
- rt = t->child[1];
- t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
- if (rt != 0 && rt != t)
- rst = rt;
- if (t == 0) {
- t = rst; /* set t to least subtree holding sizes > nb */
- break;
- }
- sizebits <<= 1;
- }
- }
- if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */
- binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap;
- if (leftbits != 0) {
- bindex_t i;
- binmap_t leastbit = least_bit(leftbits);
- compute_bit2idx(leastbit, i);
- t = *treebin_at(m, i);
- }
- }
-
- while (t != 0) { /* find smallest of tree or subtree */
- size_t trem = chunksize(t) - nb;
- if (trem < rsize) {
- rsize = trem;
- v = t;
- }
- t = leftmost_child(t);
- }
-
- /* If dv is a better fit, return 0 so malloc will use it */
- if (v != 0 && rsize < (size_t)(m->dvsize - nb)) {
- if (RTCHECK(ok_address(m, v))) { /* split */
- mchunkptr r = chunk_plus_offset(v, nb);
- assert(chunksize(v) == rsize + nb);
- if (RTCHECK(ok_next(v, r))) {
- unlink_large_chunk(m, v);
- if (rsize < MIN_CHUNK_SIZE)
- set_inuse_and_pinuse(m, v, (rsize + nb));
- else {
- set_size_and_pinuse_of_inuse_chunk(m, v, nb);
- set_size_and_pinuse_of_free_chunk(r, rsize);
- insert_chunk(m, r, rsize);
- }
- return chunk2mem(v);
- }
- }
- CORRUPTION_ERROR_ACTION(m);
- }
- return 0;
-}
-
-/* allocate a small request from the best fitting chunk in a treebin */
-static void* tmalloc_small(mstate m, size_t nb) {
- tchunkptr t, v;
- size_t rsize;
- bindex_t i;
- binmap_t leastbit = least_bit(m->treemap);
- compute_bit2idx(leastbit, i);
- v = t = *treebin_at(m, i);
- rsize = chunksize(t) - nb;
-
- while ((t = leftmost_child(t)) != 0) {
- size_t trem = chunksize(t) - nb;
- if (trem < rsize) {
- rsize = trem;
- v = t;
- }
- }
-
- if (RTCHECK(ok_address(m, v))) {
- mchunkptr r = chunk_plus_offset(v, nb);
- assert(chunksize(v) == rsize + nb);
- if (RTCHECK(ok_next(v, r))) {
- unlink_large_chunk(m, v);
- if (rsize < MIN_CHUNK_SIZE)
- set_inuse_and_pinuse(m, v, (rsize + nb));
- else {
- set_size_and_pinuse_of_inuse_chunk(m, v, nb);
- set_size_and_pinuse_of_free_chunk(r, rsize);
- replace_dv(m, r, rsize);
- }
- return chunk2mem(v);
- }
- }
-
- CORRUPTION_ERROR_ACTION(m);
- return 0;
-}
-
-/* --------------------------- realloc support --------------------------- */
-
-static void* internal_realloc(mstate m, void* oldmem, size_t bytes) {
- if (bytes >= MAX_REQUEST) {
- MALLOC_FAILURE_ACTION;
- return 0;
- }
- if (!PREACTION(m)) {
- mchunkptr oldp = mem2chunk(oldmem);
- size_t oldsize = chunksize(oldp);
- mchunkptr next = chunk_plus_offset(oldp, oldsize);
- mchunkptr newp = 0;
- void* extra = 0;
-
- /* Try to either shrink or extend into top. Else malloc-copy-free */
-
- if (RTCHECK(ok_address(m, oldp) && ok_inuse(oldp) &&
- ok_next(oldp, next) && ok_pinuse(next))) {
- size_t nb = request2size(bytes);
- if (is_mmapped(oldp))
- newp = mmap_resize(m, oldp, nb);
- else if (oldsize >= nb) { /* already big enough */
- size_t rsize = oldsize - nb;
- newp = oldp;
- if (rsize >= MIN_CHUNK_SIZE) {
- mchunkptr remainder = chunk_plus_offset(newp, nb);
- set_inuse(m, newp, nb);
- set_inuse_and_pinuse(m, remainder, rsize);
- extra = chunk2mem(remainder);
- }
- }
- else if (next == m->top && oldsize + m->topsize > nb) {
- /* Expand into top */
- size_t newsize = oldsize + m->topsize;
- size_t newtopsize = newsize - nb;
- mchunkptr newtop = chunk_plus_offset(oldp, nb);
- set_inuse(m, oldp, nb);
- newtop->head = newtopsize |PINUSE_BIT;
- m->top = newtop;
- m->topsize = newtopsize;
- newp = oldp;
- }
- }
- else {
- USAGE_ERROR_ACTION(m, oldmem);
- POSTACTION(m);
- return 0;
- }
-#if DEBUG
- if (newp != 0) {
- check_inuse_chunk(m, newp); /* Check requires lock */
- }
-#endif
-
- POSTACTION(m);
-
- if (newp != 0) {
- if (extra != 0) {
- internal_free(m, extra);
- }
- return chunk2mem(newp);
- }
- else {
- void* newmem = internal_malloc(m, bytes);
- if (newmem != 0) {
- size_t oc = oldsize - overhead_for(oldp);
- memcpy(newmem, oldmem, (oc < bytes)? oc : bytes);
- internal_free(m, oldmem);
- }
- return newmem;
- }
- }
- return 0;
-}
-
-/* --------------------------- memalign support -------------------------- */
-
-static void* internal_memalign(mstate m, size_t alignment, size_t bytes) {
- if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */
- return internal_malloc(m, bytes);
- if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */
- alignment = MIN_CHUNK_SIZE;
- if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */
- size_t a = MALLOC_ALIGNMENT << 1;
- while (a < alignment) a <<= 1;
- alignment = a;
- }
-
- if (bytes >= MAX_REQUEST - alignment) {
- if (m != 0) { /* Test isn't needed but avoids compiler warning */
- MALLOC_FAILURE_ACTION;
- }
- }
- else {
- size_t nb = request2size(bytes);
- size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD;
- char* mem = (char*)internal_malloc(m, req);
- if (mem != 0) {
- void* leader = 0;
- void* trailer = 0;
- mchunkptr p = mem2chunk(mem);
-
- if (PREACTION(m)) return 0;
- if ((((size_t)(mem)) % alignment) != 0) { /* misaligned */
- /*
- Find an aligned spot inside chunk. Since we need to give
- back leading space in a chunk of at least MIN_CHUNK_SIZE, if
- the first calculation places us at a spot with less than
- MIN_CHUNK_SIZE leader, we can move to the next aligned spot.
- We've allocated enough total room so that this is always
- possible.
- */
- char* br = (char*)mem2chunk((size_t)(((size_t)(mem +
- alignment -
- SIZE_T_ONE)) &
- -alignment));
- char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)?
- br : br+alignment;
- mchunkptr newp = (mchunkptr)pos;
- size_t leadsize = pos - (char*)(p);
- size_t newsize = chunksize(p) - leadsize;
-
- if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */
- newp->prev_foot = p->prev_foot + leadsize;
- newp->head = newsize;
- }
- else { /* Otherwise, give back leader, use the rest */
- set_inuse(m, newp, newsize);
- set_inuse(m, p, leadsize);
- leader = chunk2mem(p);
- }
- p = newp;
- }
-
- /* Give back spare room at the end */
- if (!is_mmapped(p)) {
- size_t size = chunksize(p);
- if (size > nb + MIN_CHUNK_SIZE) {
- size_t remainder_size = size - nb;
- mchunkptr remainder = chunk_plus_offset(p, nb);
- set_inuse(m, p, nb);
- set_inuse(m, remainder, remainder_size);
- trailer = chunk2mem(remainder);
- }
- }
-
- assert (chunksize(p) >= nb);
- assert((((size_t)(chunk2mem(p))) % alignment) == 0);
- check_inuse_chunk(m, p);
- POSTACTION(m);
- if (leader != 0) {
- internal_free(m, leader);
- }
- if (trailer != 0) {
- internal_free(m, trailer);
- }
- return chunk2mem(p);
- }
- }
- return 0;
-}
-
-/* ------------------------ comalloc/coalloc support --------------------- */
-
-static void** ialloc(mstate m,
- size_t n_elements,
- size_t* sizes,
- int opts,
- void* chunks[]) {
- /*
- This provides common support for independent_X routines, handling
- all of the combinations that can result.
-
- The opts arg has:
- bit 0 set if all elements are same size (using sizes[0])
- bit 1 set if elements should be zeroed
- */
-
- size_t element_size; /* chunksize of each element, if all same */
- size_t contents_size; /* total size of elements */
- size_t array_size; /* request size of pointer array */
- void* mem; /* malloced aggregate space */
- mchunkptr p; /* corresponding chunk */
- size_t remainder_size; /* remaining bytes while splitting */
- void** marray; /* either "chunks" or malloced ptr array */
- mchunkptr array_chunk; /* chunk for malloced ptr array */
- flag_t was_enabled; /* to disable mmap */
- size_t size;
- size_t i;
-
- ensure_initialization();
- /* compute array length, if needed */
- if (chunks != 0) {
- if (n_elements == 0)
- return chunks; /* nothing to do */
- marray = chunks;
- array_size = 0;
- }
- else {
- /* if empty req, must still return chunk representing empty array */
- if (n_elements == 0)
- return (void**)internal_malloc(m, 0);
- marray = 0;
- array_size = request2size(n_elements * (sizeof(void*)));
- }
-
- /* compute total element size */
- if (opts & 0x1) { /* all-same-size */
- element_size = request2size(*sizes);
- contents_size = n_elements * element_size;
- }
- else { /* add up all the sizes */
- element_size = 0;
- contents_size = 0;
- for (i = 0; i != n_elements; ++i)
- contents_size += request2size(sizes[i]);
- }
-
- size = contents_size + array_size;
-
- /*
- Allocate the aggregate chunk. First disable direct-mmapping so
- malloc won't use it, since we would not be able to later
- free/realloc space internal to a segregated mmap region.
- */
- was_enabled = use_mmap(m);
- disable_mmap(m);
- mem = internal_malloc(m, size - CHUNK_OVERHEAD);
- if (was_enabled)
- enable_mmap(m);
- if (mem == 0)
- return 0;
-
- if (PREACTION(m)) return 0;
- p = mem2chunk(mem);
- remainder_size = chunksize(p);
-
- assert(!is_mmapped(p));
-
- if (opts & 0x2) { /* optionally clear the elements */
- memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size);
- }
-
- /* If not provided, allocate the pointer array as final part of chunk */
- if (marray == 0) {
- size_t array_chunk_size;
- array_chunk = chunk_plus_offset(p, contents_size);
- array_chunk_size = remainder_size - contents_size;
- marray = (void**) (chunk2mem(array_chunk));
- set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size);
- remainder_size = contents_size;
- }
-
- /* split out elements */
- for (i = 0; ; ++i) {
- marray[i] = chunk2mem(p);
- if (i != n_elements-1) {
- if (element_size != 0)
- size = element_size;
- else
- size = request2size(sizes[i]);
- remainder_size -= size;
- set_size_and_pinuse_of_inuse_chunk(m, p, size);
- p = chunk_plus_offset(p, size);
- }
- else { /* the final element absorbs any overallocation slop */
- set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size);
- break;
- }
- }
-
-#if DEBUG
- if (marray != chunks) {
- /* final element must have exactly exhausted chunk */
- if (element_size != 0) {
- assert(remainder_size == element_size);
- }
- else {
- assert(remainder_size == request2size(sizes[i]));
- }
- check_inuse_chunk(m, mem2chunk(marray));
- }
- for (i = 0; i != n_elements; ++i)
- check_inuse_chunk(m, mem2chunk(marray[i]));
-
-#endif /* DEBUG */
-
- POSTACTION(m);
- return marray;
-}
-
-
-/* -------------------------- public routines ---------------------------- */
-
-#if !ONLY_MSPACES
-
-void* dlmalloc(size_t bytes) {
- /*
- Basic algorithm:
- If a small request (< 256 bytes minus per-chunk overhead):
- 1. If one exists, use a remainderless chunk in associated smallbin.
- (Remainderless means that there are too few excess bytes to
- represent as a chunk.)
- 2. If it is big enough, use the dv chunk, which is normally the
- chunk adjacent to the one used for the most recent small request.
- 3. If one exists, split the smallest available chunk in a bin,
- saving remainder in dv.
- 4. If it is big enough, use the top chunk.
- 5. If available, get memory from system and use it
- Otherwise, for a large request:
- 1. Find the smallest available binned chunk that fits, and use it
- if it is better fitting than dv chunk, splitting if necessary.
- 2. If better fitting than any binned chunk, use the dv chunk.
- 3. If it is big enough, use the top chunk.
- 4. If request size >= mmap threshold, try to directly mmap this chunk.
- 5. If available, get memory from system and use it
-
- The ugly goto's here ensure that postaction occurs along all paths.
- */
-
-#if USE_LOCKS
- ensure_initialization(); /* initialize in sys_alloc if not using locks */
-#endif
-
- if (!PREACTION(gm)) {
- void* mem;
- size_t nb;
- if (bytes <= MAX_SMALL_REQUEST) {
- bindex_t idx;
- binmap_t smallbits;
- nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
- idx = small_index(nb);
- smallbits = gm->smallmap >> idx;
-
- if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
- mchunkptr b, p;
- idx += ~smallbits & 1; /* Uses next bin if idx empty */
- b = smallbin_at(gm, idx);
- p = b->fd;
- assert(chunksize(p) == small_index2size(idx));
- unlink_first_small_chunk(gm, b, p, idx);
- set_inuse_and_pinuse(gm, p, small_index2size(idx));
- mem = chunk2mem(p);
- check_malloced_chunk(gm, mem, nb);
- goto postaction;
- }
-
- else if (nb > gm->dvsize) {
- if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
- mchunkptr b, p, r;
- size_t rsize;
- bindex_t i;
- binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
- binmap_t leastbit = least_bit(leftbits);
- compute_bit2idx(leastbit, i);
- b = smallbin_at(gm, i);
- p = b->fd;
- assert(chunksize(p) == small_index2size(i));
- unlink_first_small_chunk(gm, b, p, i);
- rsize = small_index2size(i) - nb;
- /* Fit here cannot be remainderless if 4byte sizes */
- if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
- set_inuse_and_pinuse(gm, p, small_index2size(i));
- else {
- set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
- r = chunk_plus_offset(p, nb);
- set_size_and_pinuse_of_free_chunk(r, rsize);
- replace_dv(gm, r, rsize);
- }
- mem = chunk2mem(p);
- check_malloced_chunk(gm, mem, nb);
- goto postaction;
- }
-
- else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) {
- check_malloced_chunk(gm, mem, nb);
- goto postaction;
- }
- }
- }
- else if (bytes >= MAX_REQUEST)
- nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
- else {
- nb = pad_request(bytes);
- if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) {
- check_malloced_chunk(gm, mem, nb);
- goto postaction;
- }
- }
-
- if (nb <= gm->dvsize) {
- size_t rsize = gm->dvsize - nb;
- mchunkptr p = gm->dv;
- if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
- mchunkptr r = gm->dv = chunk_plus_offset(p, nb);
- gm->dvsize = rsize;
- set_size_and_pinuse_of_free_chunk(r, rsize);
- set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
- }
- else { /* exhaust dv */
- size_t dvs = gm->dvsize;
- gm->dvsize = 0;
- gm->dv = 0;
- set_inuse_and_pinuse(gm, p, dvs);
- }
- mem = chunk2mem(p);
- check_malloced_chunk(gm, mem, nb);
- goto postaction;
- }
-
- else if (nb < gm->topsize) { /* Split top */
- size_t rsize = gm->topsize -= nb;
- mchunkptr p = gm->top;
- mchunkptr r = gm->top = chunk_plus_offset(p, nb);
- r->head = rsize | PINUSE_BIT;
- set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
- mem = chunk2mem(p);
- check_top_chunk(gm, gm->top);
- check_malloced_chunk(gm, mem, nb);
- goto postaction;
- }
-
- mem = sys_alloc(gm, nb);
-
- postaction:
- POSTACTION(gm);
- return mem;
- }
-
- return 0;
-}
-
-void dlfree(void* mem) {
- /*
- Consolidate freed chunks with preceeding or succeeding bordering
- free chunks, if they exist, and then place in a bin. Intermixed
- with special cases for top, dv, mmapped chunks, and usage errors.
- */
-
- if (mem != 0) {
- mchunkptr p = mem2chunk(mem);
-#if FOOTERS
- mstate fm = get_mstate_for(p);
- if (!ok_magic(fm)) {
- USAGE_ERROR_ACTION(fm, p);
- return;
- }
-#else /* FOOTERS */
-#define fm gm
-#endif /* FOOTERS */
- if (!PREACTION(fm)) {
- check_inuse_chunk(fm, p);
- if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) {
- size_t psize = chunksize(p);
- mchunkptr next = chunk_plus_offset(p, psize);
- if (!pinuse(p)) {
- size_t prevsize = p->prev_foot;
- if (is_mmapped(p)) {
- psize += prevsize + MMAP_FOOT_PAD;
- if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
- fm->footprint -= psize;
- goto postaction;
- }
- else {
- mchunkptr prev = chunk_minus_offset(p, prevsize);
- psize += prevsize;
- p = prev;
- if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
- if (p != fm->dv) {
- unlink_chunk(fm, p, prevsize);
- }
- else if ((next->head & INUSE_BITS) == INUSE_BITS) {
- fm->dvsize = psize;
- set_free_with_pinuse(p, psize, next);
- goto postaction;
- }
- }
- else
- goto erroraction;
- }
- }
-
- if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
- if (!cinuse(next)) { /* consolidate forward */
- if (next == fm->top) {
- size_t tsize = fm->topsize += psize;
- fm->top = p;
- p->head = tsize | PINUSE_BIT;
- if (p == fm->dv) {
- fm->dv = 0;
- fm->dvsize = 0;
- }
- if (should_trim(fm, tsize))
- sys_trim(fm, 0);
- goto postaction;
- }
- else if (next == fm->dv) {
- size_t dsize = fm->dvsize += psize;
- fm->dv = p;
- set_size_and_pinuse_of_free_chunk(p, dsize);
- goto postaction;
- }
- else {
- size_t nsize = chunksize(next);
- psize += nsize;
- unlink_chunk(fm, next, nsize);
- set_size_and_pinuse_of_free_chunk(p, psize);
- if (p == fm->dv) {
- fm->dvsize = psize;
- goto postaction;
- }
- }
- }
- else
- set_free_with_pinuse(p, psize, next);
-
- if (is_small(psize)) {
- insert_small_chunk(fm, p, psize);
- check_free_chunk(fm, p);
- }
- else {
- tchunkptr tp = (tchunkptr)p;
- insert_large_chunk(fm, tp, psize);
- check_free_chunk(fm, p);
- if (--fm->release_checks == 0)
- release_unused_segments(fm);
- }
- goto postaction;
- }
- }
- erroraction:
- USAGE_ERROR_ACTION(fm, p);
- postaction:
- POSTACTION(fm);
- }
- }
-#if !FOOTERS
-#undef fm
-#endif /* FOOTERS */
-}
-
-void* dlcalloc(size_t n_elements, size_t elem_size) {
- void* mem;
- size_t req = 0;
- if (n_elements != 0) {
- req = n_elements * elem_size;
- if (((n_elements | elem_size) & ~(size_t)0xffff) &&
- (req / n_elements != elem_size))
- req = MAX_SIZE_T; /* force downstream failure on overflow */
- }
- mem = dlmalloc(req);
- if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
- memset(mem, 0, req);
- return mem;
-}
-
-void* dlrealloc(void* oldmem, size_t bytes) {
- if (oldmem == 0)
- return dlmalloc(bytes);
-#ifdef REALLOC_ZERO_BYTES_FREES
- if (bytes == 0) {
- dlfree(oldmem);
- return 0;
- }
-#endif /* REALLOC_ZERO_BYTES_FREES */
- else {
-#if ! FOOTERS
- mstate m = gm;
-#else /* FOOTERS */
- mstate m = get_mstate_for(mem2chunk(oldmem));
- if (!ok_magic(m)) {
- USAGE_ERROR_ACTION(m, oldmem);
- return 0;
- }
-#endif /* FOOTERS */
- return internal_realloc(m, oldmem, bytes);
- }
-}
-
-void* dlmemalign(size_t alignment, size_t bytes) {
- return internal_memalign(gm, alignment, bytes);
-}
-
-void** dlindependent_calloc(size_t n_elements, size_t elem_size,
- void* chunks[]) {
- size_t sz = elem_size; /* serves as 1-element array */
- return ialloc(gm, n_elements, &sz, 3, chunks);
-}
-
-void** dlindependent_comalloc(size_t n_elements, size_t sizes[],
- void* chunks[]) {
- return ialloc(gm, n_elements, sizes, 0, chunks);
-}
-
-void* dlvalloc(size_t bytes) {
- size_t pagesz;
- ensure_initialization();
- pagesz = mparams.page_size;
- return dlmemalign(pagesz, bytes);
-}
-
-void* dlpvalloc(size_t bytes) {
- size_t pagesz;
- ensure_initialization();
- pagesz = mparams.page_size;
- return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE));
-}
-
-int dlmalloc_trim(size_t pad) {
- int result = 0;
- ensure_initialization();
- if (!PREACTION(gm)) {
- result = sys_trim(gm, pad);
- POSTACTION(gm);
- }
- return result;
-}
-
-size_t dlmalloc_footprint(void) {
- return gm->footprint;
-}
-
-size_t dlmalloc_max_footprint(void) {
- return gm->max_footprint;
-}
-
-#if !NO_MALLINFO
-struct mallinfo dlmallinfo(void) {
- return internal_mallinfo(gm);
-}
-#endif /* NO_MALLINFO */
-
-void dlmalloc_stats() {
- internal_malloc_stats(gm);
-}
-
-int dlmallopt(int param_number, int value) {
- return change_mparam(param_number, value);
-}
-
-#endif /* !ONLY_MSPACES */
-
-size_t dlmalloc_usable_size(void* mem) {
- if (mem != 0) {
- mchunkptr p = mem2chunk(mem);
- if (is_inuse(p))
- return chunksize(p) - overhead_for(p);
- }
- return 0;
-}
-
-/* ----------------------------- user mspaces ---------------------------- */
-
-#if MSPACES
-
-static mstate init_user_mstate(char* tbase, size_t tsize) {
- size_t msize = pad_request(sizeof(struct malloc_state));
- mchunkptr mn;
- mchunkptr msp = align_as_chunk(tbase);
- mstate m = (mstate)(chunk2mem(msp));
- memset(m, 0, msize);
- INITIAL_LOCK(&m->mutex);
- msp->head = (msize|INUSE_BITS);
- m->seg.base = m->least_addr = tbase;
- m->seg.size = m->footprint = m->max_footprint = tsize;
- m->magic = mparams.magic;
- m->release_checks = MAX_RELEASE_CHECK_RATE;
- m->mflags = mparams.default_mflags;
- m->extp = 0;
- m->exts = 0;
- disable_contiguous(m);
- init_bins(m);
- mn = next_chunk(mem2chunk(m));
- init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE);
- check_top_chunk(m, m->top);
- return m;
-}
-
-mspace create_mspace(size_t capacity, int locked) {
- mstate m = 0;
- size_t msize;
- ensure_initialization();
- msize = pad_request(sizeof(struct malloc_state));
- if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
- size_t rs = ((capacity == 0)? mparams.granularity :
- (capacity + TOP_FOOT_SIZE + msize));
- size_t tsize = granularity_align(rs);
- char* tbase = (char*)(CALL_MMAP(tsize));
- if (tbase != CMFAIL) {
- m = init_user_mstate(tbase, tsize);
- m->seg.sflags = USE_MMAP_BIT;
- set_lock(m, locked);
- }
- }
- return (mspace)m;
-}
-
-mspace create_mspace_with_base(void* base, size_t capacity, int locked) {
- mstate m = 0;
- size_t msize;
- ensure_initialization();
- msize = pad_request(sizeof(struct malloc_state));
- if (capacity > msize + TOP_FOOT_SIZE &&
- capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
- m = init_user_mstate((char*)base, capacity);
- m->seg.sflags = EXTERN_BIT;
- set_lock(m, locked);
- }
- return (mspace)m;
-}
-
-int mspace_track_large_chunks(mspace msp, int enable) {
- int ret = 0;
- mstate ms = (mstate)msp;
- if (!PREACTION(ms)) {
- if (!use_mmap(ms))
- ret = 1;
- if (!enable)
- enable_mmap(ms);
- else
- disable_mmap(ms);
- POSTACTION(ms);
- }
- return ret;
-}
-
-size_t destroy_mspace(mspace msp) {
- size_t freed = 0;
- mstate ms = (mstate)msp;
- if (ok_magic(ms)) {
- msegmentptr sp = &ms->seg;
- while (sp != 0) {
- char* base = sp->base;
- size_t size = sp->size;
- flag_t flag = sp->sflags;
- sp = sp->next;
- if ((flag & USE_MMAP_BIT) && !(flag & EXTERN_BIT) &&
- CALL_MUNMAP(base, size) == 0)
- freed += size;
- }
- }
- else {
- USAGE_ERROR_ACTION(ms,ms);
- }
- return freed;
-}
-
-/*
- mspace versions of routines are near-clones of the global
- versions. This is not so nice but better than the alternatives.
-*/
-
-
-void* mspace_malloc(mspace msp, size_t bytes) {
- mstate ms = (mstate)msp;
- if (!ok_magic(ms)) {
- USAGE_ERROR_ACTION(ms,ms);
- return 0;
- }
- if (!PREACTION(ms)) {
- void* mem;
- size_t nb;
- if (bytes <= MAX_SMALL_REQUEST) {
- bindex_t idx;
- binmap_t smallbits;
- nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
- idx = small_index(nb);
- smallbits = ms->smallmap >> idx;
-
- if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
- mchunkptr b, p;
- idx += ~smallbits & 1; /* Uses next bin if idx empty */
- b = smallbin_at(ms, idx);
- p = b->fd;
- assert(chunksize(p) == small_index2size(idx));
- unlink_first_small_chunk(ms, b, p, idx);
- set_inuse_and_pinuse(ms, p, small_index2size(idx));
- mem = chunk2mem(p);
- check_malloced_chunk(ms, mem, nb);
- goto postaction;
- }
-
- else if (nb > ms->dvsize) {
- if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
- mchunkptr b, p, r;
- size_t rsize;
- bindex_t i;
- binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
- binmap_t leastbit = least_bit(leftbits);
- compute_bit2idx(leastbit, i);
- b = smallbin_at(ms, i);
- p = b->fd;
- assert(chunksize(p) == small_index2size(i));
- unlink_first_small_chunk(ms, b, p, i);
- rsize = small_index2size(i) - nb;
- /* Fit here cannot be remainderless if 4byte sizes */
- if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
- set_inuse_and_pinuse(ms, p, small_index2size(i));
- else {
- set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
- r = chunk_plus_offset(p, nb);
- set_size_and_pinuse_of_free_chunk(r, rsize);
- replace_dv(ms, r, rsize);
- }
- mem = chunk2mem(p);
- check_malloced_chunk(ms, mem, nb);
- goto postaction;
- }
-
- else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) {
- check_malloced_chunk(ms, mem, nb);
- goto postaction;
- }
- }
- }
- else if (bytes >= MAX_REQUEST)
- nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
- else {
- nb = pad_request(bytes);
- if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) {
- check_malloced_chunk(ms, mem, nb);
- goto postaction;
- }
- }
-
- if (nb <= ms->dvsize) {
- size_t rsize = ms->dvsize - nb;
- mchunkptr p = ms->dv;
- if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
- mchunkptr r = ms->dv = chunk_plus_offset(p, nb);
- ms->dvsize = rsize;
- set_size_and_pinuse_of_free_chunk(r, rsize);
- set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
- }
- else { /* exhaust dv */
- size_t dvs = ms->dvsize;
- ms->dvsize = 0;
- ms->dv = 0;
- set_inuse_and_pinuse(ms, p, dvs);
- }
- mem = chunk2mem(p);
- check_malloced_chunk(ms, mem, nb);
- goto postaction;
- }
-
- else if (nb < ms->topsize) { /* Split top */
- size_t rsize = ms->topsize -= nb;
- mchunkptr p = ms->top;
- mchunkptr r = ms->top = chunk_plus_offset(p, nb);
- r->head = rsize | PINUSE_BIT;
- set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
- mem = chunk2mem(p);
- check_top_chunk(ms, ms->top);
- check_malloced_chunk(ms, mem, nb);
- goto postaction;
- }
-
- mem = sys_alloc(ms, nb);
-
- postaction:
- POSTACTION(ms);
- return mem;
- }
-
- return 0;
-}
-
-void mspace_free(mspace msp, void* mem) {
- if (mem != 0) {
- mchunkptr p = mem2chunk(mem);
-#if FOOTERS
- mstate fm = get_mstate_for(p);
- msp = msp; /* placate people compiling -Wunused */
-#else /* FOOTERS */
- mstate fm = (mstate)msp;
-#endif /* FOOTERS */
- if (!ok_magic(fm)) {
- USAGE_ERROR_ACTION(fm, p);
- return;
- }
- if (!PREACTION(fm)) {
- check_inuse_chunk(fm, p);
- if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) {
- size_t psize = chunksize(p);
- mchunkptr next = chunk_plus_offset(p, psize);
- if (!pinuse(p)) {
- size_t prevsize = p->prev_foot;
- if (is_mmapped(p)) {
- psize += prevsize + MMAP_FOOT_PAD;
- if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
- fm->footprint -= psize;
- goto postaction;
- }
- else {
- mchunkptr prev = chunk_minus_offset(p, prevsize);
- psize += prevsize;
- p = prev;
- if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
- if (p != fm->dv) {
- unlink_chunk(fm, p, prevsize);
- }
- else if ((next->head & INUSE_BITS) == INUSE_BITS) {
- fm->dvsize = psize;
- set_free_with_pinuse(p, psize, next);
- goto postaction;
- }
- }
- else
- goto erroraction;
- }
- }
-
- if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
- if (!cinuse(next)) { /* consolidate forward */
- if (next == fm->top) {
- size_t tsize = fm->topsize += psize;
- fm->top = p;
- p->head = tsize | PINUSE_BIT;
- if (p == fm->dv) {
- fm->dv = 0;
- fm->dvsize = 0;
- }
- if (should_trim(fm, tsize))
- sys_trim(fm, 0);
- goto postaction;
- }
- else if (next == fm->dv) {
- size_t dsize = fm->dvsize += psize;
- fm->dv = p;
- set_size_and_pinuse_of_free_chunk(p, dsize);
- goto postaction;
- }
- else {
- size_t nsize = chunksize(next);
- psize += nsize;
- unlink_chunk(fm, next, nsize);
- set_size_and_pinuse_of_free_chunk(p, psize);
- if (p == fm->dv) {
- fm->dvsize = psize;
- goto postaction;
- }
- }
- }
- else
- set_free_with_pinuse(p, psize, next);
-
- if (is_small(psize)) {
- insert_small_chunk(fm, p, psize);
- check_free_chunk(fm, p);
- }
- else {
- tchunkptr tp = (tchunkptr)p;
- insert_large_chunk(fm, tp, psize);
- check_free_chunk(fm, p);
- if (--fm->release_checks == 0)
- release_unused_segments(fm);
- }
- goto postaction;
- }
- }
- erroraction:
- USAGE_ERROR_ACTION(fm, p);
- postaction:
- POSTACTION(fm);
- }
- }
-}
-
-void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) {
- void* mem;
- size_t req = 0;
- mstate ms = (mstate)msp;
- if (!ok_magic(ms)) {
- USAGE_ERROR_ACTION(ms,ms);
- return 0;
- }
- if (n_elements != 0) {
- req = n_elements * elem_size;
- if (((n_elements | elem_size) & ~(size_t)0xffff) &&
- (req / n_elements != elem_size))
- req = MAX_SIZE_T; /* force downstream failure on overflow */
- }
- mem = internal_malloc(ms, req);
- if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
- memset(mem, 0, req);
- return mem;
-}
-
-void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) {
- if (oldmem == 0)
- return mspace_malloc(msp, bytes);
-#ifdef REALLOC_ZERO_BYTES_FREES
- if (bytes == 0) {
- mspace_free(msp, oldmem);
- return 0;
- }
-#endif /* REALLOC_ZERO_BYTES_FREES */
- else {
-#if FOOTERS
- mchunkptr p = mem2chunk(oldmem);
- mstate ms = get_mstate_for(p);
-#else /* FOOTERS */
- mstate ms = (mstate)msp;
-#endif /* FOOTERS */
- if (!ok_magic(ms)) {
- USAGE_ERROR_ACTION(ms,ms);
- return 0;
- }
- return internal_realloc(ms, oldmem, bytes);
- }
-}
-
-void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) {
- mstate ms = (mstate)msp;
- if (!ok_magic(ms)) {
- USAGE_ERROR_ACTION(ms,ms);
- return 0;
- }
- return internal_memalign(ms, alignment, bytes);
-}
-
-void** mspace_independent_calloc(mspace msp, size_t n_elements,
- size_t elem_size, void* chunks[]) {
- size_t sz = elem_size; /* serves as 1-element array */
- mstate ms = (mstate)msp;
- if (!ok_magic(ms)) {
- USAGE_ERROR_ACTION(ms,ms);
- return 0;
- }
- return ialloc(ms, n_elements, &sz, 3, chunks);
-}
-
-void** mspace_independent_comalloc(mspace msp, size_t n_elements,
- size_t sizes[], void* chunks[]) {
- mstate ms = (mstate)msp;
- if (!ok_magic(ms)) {
- USAGE_ERROR_ACTION(ms,ms);
- return 0;
- }
- return ialloc(ms, n_elements, sizes, 0, chunks);
-}
-
-int mspace_trim(mspace msp, size_t pad) {
- int result = 0;
- mstate ms = (mstate)msp;
- if (ok_magic(ms)) {
- if (!PREACTION(ms)) {
- result = sys_trim(ms, pad);
- POSTACTION(ms);
- }
- }
- else {
- USAGE_ERROR_ACTION(ms,ms);
- }
- return result;
-}
-
-void mspace_malloc_stats(mspace msp) {
- mstate ms = (mstate)msp;
- if (ok_magic(ms)) {
- internal_malloc_stats(ms);
- }
- else {
- USAGE_ERROR_ACTION(ms,ms);
- }
-}
-
-size_t mspace_footprint(mspace msp) {
- size_t result = 0;
- mstate ms = (mstate)msp;
- if (ok_magic(ms)) {
- result = ms->footprint;
- }
- else {
- USAGE_ERROR_ACTION(ms,ms);
- }
- return result;
-}
-
-
-size_t mspace_max_footprint(mspace msp) {
- size_t result = 0;
- mstate ms = (mstate)msp;
- if (ok_magic(ms)) {
- result = ms->max_footprint;
- }
- else {
- USAGE_ERROR_ACTION(ms,ms);
- }
- return result;
-}
-
-
-#if !NO_MALLINFO
-struct mallinfo mspace_mallinfo(mspace msp) {
- mstate ms = (mstate)msp;
- if (!ok_magic(ms)) {
- USAGE_ERROR_ACTION(ms,ms);
- }
- return internal_mallinfo(ms);
-}
-#endif /* NO_MALLINFO */
-
-size_t mspace_usable_size(void* mem) {
- if (mem != 0) {
- mchunkptr p = mem2chunk(mem);
- if (is_inuse(p))
- return chunksize(p) - overhead_for(p);
- }
- return 0;
-}
-
-int mspace_mallopt(int param_number, int value) {
- return change_mparam(param_number, value);
-}
-
-#endif /* MSPACES */
-
-
-/* -------------------- Alternative MORECORE functions ------------------- */
-
-/*
- Guidelines for creating a custom version of MORECORE:
-
- * For best performance, MORECORE should allocate in multiples of pagesize.
- * MORECORE may allocate more memory than requested. (Or even less,
- but this will usually result in a malloc failure.)
- * MORECORE must not allocate memory when given argument zero, but
- instead return one past the end address of memory from previous
- nonzero call.
- * For best performance, consecutive calls to MORECORE with positive
- arguments should return increasing addresses, indicating that
- space has been contiguously extended.
- * Even though consecutive calls to MORECORE need not return contiguous
- addresses, it must be OK for malloc'ed chunks to span multiple
- regions in those cases where they do happen to be contiguous.
- * MORECORE need not handle negative arguments -- it may instead
- just return MFAIL when given negative arguments.
- Negative arguments are always multiples of pagesize. MORECORE
- must not misinterpret negative args as large positive unsigned
- args. You can suppress all such calls from even occurring by defining
- MORECORE_CANNOT_TRIM,
-
- As an example alternative MORECORE, here is a custom allocator
- kindly contributed for pre-OSX macOS. It uses virtually but not
- necessarily physically contiguous non-paged memory (locked in,
- present and won't get swapped out). You can use it by uncommenting
- this section, adding some #includes, and setting up the appropriate
- defines above:
-
- #define MORECORE osMoreCore
-
- There is also a shutdown routine that should somehow be called for
- cleanup upon program exit.
-
- #define MAX_POOL_ENTRIES 100
- #define MINIMUM_MORECORE_SIZE (64 * 1024U)
- static int next_os_pool;
- void *our_os_pools[MAX_POOL_ENTRIES];
-
- void *osMoreCore(int size)
- {
- void *ptr = 0;
- static void *sbrk_top = 0;
-
- if (size > 0)
- {
- if (size < MINIMUM_MORECORE_SIZE)
- size = MINIMUM_MORECORE_SIZE;
- if (CurrentExecutionLevel() == kTaskLevel)
- ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0);
- if (ptr == 0)
- {
- return (void *) MFAIL;
- }
- // save ptrs so they can be freed during cleanup
- our_os_pools[next_os_pool] = ptr;
- next_os_pool++;
- ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK);
- sbrk_top = (char *) ptr + size;
- return ptr;
- }
- else if (size < 0)
- {
- // we don't currently support shrink behavior
- return (void *) MFAIL;
- }
- else
- {
- return sbrk_top;
- }
- }
-
- // cleanup any allocated memory pools
- // called as last thing before shutting down driver
-
- void osCleanupMem(void)
- {
- void **ptr;
-
- for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++)
- if (*ptr)
- {
- PoolDeallocate(*ptr);
- *ptr = 0;
- }
- }
-
-*/
-
-
-/* -----------------------------------------------------------------------
-History:
- V2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee)
- * Use zeros instead of prev foot for is_mmapped
- * Add mspace_track_large_chunks; thanks to Jean Brouwers
- * Fix set_inuse in internal_realloc; thanks to Jean Brouwers
- * Fix insufficient sys_alloc padding when using 16byte alignment
- * Fix bad error check in mspace_footprint
- * Adaptations for ptmalloc; thanks to Wolfram Gloger.
- * Reentrant spin locks; thanks to Earl Chew and others
- * Win32 improvements; thanks to Niall Douglas and Earl Chew
- * Add NO_SEGMENT_TRAVERSAL and MAX_RELEASE_CHECK_RATE options
- * Extension hook in malloc_state
- * Various small adjustments to reduce warnings on some compilers
- * Various configuration extensions/changes for more platforms. Thanks
- to all who contributed these.
-
- V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee)
- * Add max_footprint functions
- * Ensure all appropriate literals are size_t
- * Fix conditional compilation problem for some #define settings
- * Avoid concatenating segments with the one provided
- in create_mspace_with_base
- * Rename some variables to avoid compiler shadowing warnings
- * Use explicit lock initialization.
- * Better handling of sbrk interference.
- * Simplify and fix segment insertion, trimming and mspace_destroy
- * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x
- * Thanks especially to Dennis Flanagan for help on these.
-
- V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee)
- * Fix memalign brace error.
-
- V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee)
- * Fix improper #endif nesting in C++
- * Add explicit casts needed for C++
-
- V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee)
- * Use trees for large bins
- * Support mspaces
- * Use segments to unify sbrk-based and mmap-based system allocation,
- removing need for emulation on most platforms without sbrk.
- * Default safety checks
- * Optional footer checks. Thanks to William Robertson for the idea.
- * Internal code refactoring
- * Incorporate suggestions and platform-specific changes.
- Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas,
- Aaron Bachmann, Emery Berger, and others.
- * Speed up non-fastbin processing enough to remove fastbins.
- * Remove useless cfree() to avoid conflicts with other apps.
- * Remove internal memcpy, memset. Compilers handle builtins better.
- * Remove some options that no one ever used and rename others.
-
- V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee)
- * Fix malloc_state bitmap array misdeclaration
-
- V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee)
- * Allow tuning of FIRST_SORTED_BIN_SIZE
- * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte.
- * Better detection and support for non-contiguousness of MORECORE.
- Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger
- * Bypass most of malloc if no frees. Thanks To Emery Berger.
- * Fix freeing of old top non-contiguous chunk im sysmalloc.
- * Raised default trim and map thresholds to 256K.
- * Fix mmap-related #defines. Thanks to Lubos Lunak.
- * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield.
- * Branch-free bin calculation
- * Default trim and mmap thresholds now 256K.
-
- V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee)
- * Introduce independent_comalloc and independent_calloc.
- Thanks to Michael Pachos for motivation and help.
- * Make optional .h file available
- * Allow > 2GB requests on 32bit systems.
- * new WIN32 sbrk, mmap, munmap, lock code from <Walter@GeNeSys-e.de>.
- Thanks also to Andreas Mueller <a.mueller at paradatec.de>,
- and Anonymous.
- * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for
- helping test this.)
- * memalign: check alignment arg
- * realloc: don't try to shift chunks backwards, since this
- leads to more fragmentation in some programs and doesn't
- seem to help in any others.
- * Collect all cases in malloc requiring system memory into sysmalloc
- * Use mmap as backup to sbrk
- * Place all internal state in malloc_state
- * Introduce fastbins (although similar to 2.5.1)
- * Many minor tunings and cosmetic improvements
- * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK
- * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS
- Thanks to Tony E. Bennett <tbennett@nvidia.com> and others.
- * Include errno.h to support default failure action.
-
- V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee)
- * return null for negative arguments
- * Added Several WIN32 cleanups from Martin C. Fong <mcfong at yahoo.com>
- * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h'
- (e.g. WIN32 platforms)
- * Cleanup header file inclusion for WIN32 platforms
- * Cleanup code to avoid Microsoft Visual C++ compiler complaints
- * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing
- memory allocation routines
- * Set 'malloc_getpagesize' for WIN32 platforms (needs more work)
- * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to
- usage of 'assert' in non-WIN32 code
- * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to
- avoid infinite loop
- * Always call 'fREe()' rather than 'free()'
-
- V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee)
- * Fixed ordering problem with boundary-stamping
-
- V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee)
- * Added pvalloc, as recommended by H.J. Liu
- * Added 64bit pointer support mainly from Wolfram Gloger
- * Added anonymously donated WIN32 sbrk emulation
- * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
- * malloc_extend_top: fix mask error that caused wastage after
- foreign sbrks
- * Add linux mremap support code from HJ Liu
-
- V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee)
- * Integrated most documentation with the code.
- * Add support for mmap, with help from
- Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
- * Use last_remainder in more cases.
- * Pack bins using idea from colin@nyx10.cs.du.edu
- * Use ordered bins instead of best-fit threshhold
- * Eliminate block-local decls to simplify tracing and debugging.
- * Support another case of realloc via move into top
- * Fix error occuring when initial sbrk_base not word-aligned.
- * Rely on page size for units instead of SBRK_UNIT to
- avoid surprises about sbrk alignment conventions.
- * Add mallinfo, mallopt. Thanks to Raymond Nijssen
- (raymond@es.ele.tue.nl) for the suggestion.
- * Add `pad' argument to malloc_trim and top_pad mallopt parameter.
- * More precautions for cases where other routines call sbrk,
- courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
- * Added macros etc., allowing use in linux libc from
- H.J. Lu (hjl@gnu.ai.mit.edu)
- * Inverted this history list
-
- V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee)
- * Re-tuned and fixed to behave more nicely with V2.6.0 changes.
- * Removed all preallocation code since under current scheme
- the work required to undo bad preallocations exceeds
- the work saved in good cases for most test programs.
- * No longer use return list or unconsolidated bins since
- no scheme using them consistently outperforms those that don't
- given above changes.
- * Use best fit for very large chunks to prevent some worst-cases.
- * Added some support for debugging
-
- V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee)
- * Removed footers when chunks are in use. Thanks to
- Paul Wilson (wilson@cs.texas.edu) for the suggestion.
-
- V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee)
- * Added malloc_trim, with help from Wolfram Gloger
- (wmglo@Dent.MED.Uni-Muenchen.DE).
-
- V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g)
-
- V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g)
- * realloc: try to expand in both directions
- * malloc: swap order of clean-bin strategy;
- * realloc: only conditionally expand backwards
- * Try not to scavenge used bins
- * Use bin counts as a guide to preallocation
- * Occasionally bin return list chunks in first scan
- * Add a few optimizations from colin@nyx10.cs.du.edu
-
- V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g)
- * faster bin computation & slightly different binning
- * merged all consolidations to one part of malloc proper
- (eliminating old malloc_find_space & malloc_clean_bin)
- * Scan 2 returns chunks (not just 1)
- * Propagate failure in realloc if malloc returns 0
- * Add stuff to allow compilation on non-ANSI compilers
- from kpv@research.att.com
-
- V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu)
- * removed potential for odd address access in prev_chunk
- * removed dependency on getpagesize.h
- * misc cosmetics and a bit more internal documentation
- * anticosmetics: mangled names in macros to evade debugger strangeness
- * tested on sparc, hp-700, dec-mips, rs6000
- with gcc & native cc (hp, dec only) allowing
- Detlefs & Zorn comparison study (in SIGPLAN Notices.)
-
- Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu)
- * Based loosely on libg++-1.2X malloc. (It retains some of the overall
- structure of old version, but most details differ.)
-
-*/
-
-#endif
diff --git a/drivers/nedmalloc/memory_pool_static_nedmalloc.cpp b/drivers/nedmalloc/memory_pool_static_nedmalloc.cpp
deleted file mode 100644
index 21da056f0..000000000
--- a/drivers/nedmalloc/memory_pool_static_nedmalloc.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*************************************************************************/
-/* memory_pool_static_nedmalloc.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifdef NEDMALLOC_ENABLED
-
-//
-// C++ Implementation: memory_static_malloc
-//
-// Description:
-//
-//
-// Author: Juan Linietsky <red@lunatea>, (C) 2006
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-#include "memory_pool_static_nedmalloc.h"
-#include "error_macros.h"
-#include "os/memory.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include "os/copymem.h"
-#include "os/os.h"
-
-#include "nedmalloc.h"
-
-/**
- * NOTE NOTE NOTE NOTE
- * in debug mode, this appends the memory size before the allocated, returned pointer
- * so BE CAREFUL!
- */
-
-void* MemoryPoolStaticNedMalloc::alloc(size_t p_bytes,const char *p_description) {
-
- ERR_FAIL_COND_V(p_bytes==0,0);
-
- MutexLock lock(mutex);
-
- void *mem=nedalloc::nedmalloc(p_bytes);
-
- ERR_FAIL_COND_V(!mem,0); //out of memory, or unreasonable request
- return mem;
-}
-
-
-void* MemoryPoolStaticNedMalloc::realloc(void *p_memory,size_t p_bytes) {
-
- if (p_memory==NULL) {
-
- return alloc( p_bytes );
- }
-
- if (p_bytes<=0) {
-
- this->free(p_memory);
- ERR_FAIL_COND_V( p_bytes < 0 , NULL );
- return NULL;
- }
-
- MutexLock lock(mutex);
-
- return nedalloc::nedrealloc( p_memory, p_bytes );
-}
-
-void MemoryPoolStaticNedMalloc::free(void *p_ptr) {
-
- MutexLock lock(mutex);
-
- ERR_FAIL_COND(p_ptr==0);
-
- nedalloc::nedfree(p_ptr);
-}
-
-
-size_t MemoryPoolStaticNedMalloc::get_available_mem() const {
-
- return 0xffffffff;
-}
-
-size_t MemoryPoolStaticNedMalloc::get_total_usage() {
-
- return nedalloc::nedmalloc_footprint();
-}
-
-/* Most likely available only if memory debugger was compiled in */
-int MemoryPoolStaticNedMalloc::get_alloc_count() {
-
- return 0;
-}
-void * MemoryPoolStaticNedMalloc::get_alloc_ptr(int p_alloc_idx) {
-
- return 0;
-}
-const char* MemoryPoolStaticNedMalloc::get_alloc_description(int p_alloc_idx) {
-
-
- return "";
-}
-size_t MemoryPoolStaticNedMalloc::get_alloc_size(int p_alloc_idx) {
-
- return 0;
-}
-
-
-void MemoryPoolStaticNedMalloc::debug_print_all_memory() {
-
- nedalloc::nedmalloc_stats();
-}
-
-MemoryPoolStaticNedMalloc::MemoryPoolStaticNedMalloc() {
-
- mutex=NULL;
-#ifndef NO_THREADS
-
- mutex=Mutex::create(); // at this point, this should work
-#endif
-
-}
-
-
-MemoryPoolStaticNedMalloc::~MemoryPoolStaticNedMalloc() {
-
- Mutex *old_mutex=mutex;
- mutex=NULL;
- if (old_mutex)
- memdelete(old_mutex);
-
-#ifdef DEBUG_ENABLED
-
- if (OS::get_singleton()->is_stdout_verbose())
- nedalloc::nedmalloc_stats();
-
-#endif
-}
-
-
-#endif
-
diff --git a/drivers/nedmalloc/nedmalloc.cpp b/drivers/nedmalloc/nedmalloc.cpp
deleted file mode 100644
index 9aac277a2..000000000
--- a/drivers/nedmalloc/nedmalloc.cpp
+++ /dev/null
@@ -1,1467 +0,0 @@
-#ifdef NEDMALLOC_ENABLED
-/* Alternative malloc implementation for multiple threads without
-lock contention based on dlmalloc. (C) 2005-2009 Niall Douglas
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-*/
-
-#ifdef _MSC_VER
-/* Enable full aliasing on MSVC */
-/*#pragma optimize("a", on)*/
-#pragma warning(push)
-#pragma warning(disable:4100) /* unreferenced formal parameter */
-#pragma warning(disable:4127) /* conditional expression is constant */
-#pragma warning(disable:4706) /* assignment within conditional expression */
-#endif
-
-/*#define ENABLE_TOLERANT_NEDMALLOC 1*/
-/*#define ENABLE_FAST_HEAP_DETECTION 1*/
-/*#define NEDMALLOC_DEBUG 1*/
-
-/*#define FULLSANITYCHECKS*/
-/* If link time code generation is on, don't force or prevent inlining */
-#if defined(_MSC_VER) && defined(NEDMALLOC_DLL_EXPORTS)
-#define FORCEINLINE
-#define NOINLINE
-#endif
-
-
-#include "nedmalloc.h"
-#ifdef WIN32
- #include <malloc.h>
- #include <stddef.h>
-#endif
-#if USE_ALLOCATOR==1
- #define MSPACES 1
- #define ONLY_MSPACES 1
-#endif
-#define USE_DL_PREFIX 1
-#ifndef USE_LOCKS
- #define USE_LOCKS 1
-#endif
-#define FOOTERS 1 /* Need to enable footers so frees lock the right mspace */
-#ifndef NEDMALLOC_DEBUG
- #if defined(DEBUG) || defined(_DEBUG)
- #define NEDMALLOC_DEBUG 1
- #else
- #define NEDMALLOC_DEBUG 0
- #endif
-#endif
-/* We need to consistently define DEBUG=0|1, _DEBUG and NDEBUG for dlmalloc */
-#undef DEBUG
-#undef _DEBUG
-#if NEDMALLOC_DEBUG
- #define _DEBUG
- #define DEBUG 1
-#else
- #define DEBUG 0
-#endif
-#ifdef NDEBUG /* Disable assert checking on release builds */
- #undef DEBUG
- #undef _DEBUG
-#endif
-/* The default of 64Kb means we spend too much time kernel-side */
-#ifndef DEFAULT_GRANULARITY
-#define DEFAULT_GRANULARITY (1*1024*1024)
-#if DEBUG
-#define DEFAULT_GRANULARITY_ALIGNED
-#endif
-#endif
-/*#define USE_SPIN_LOCKS 0*/
-
-
-#include "malloc.c.h"
-#ifdef NDEBUG /* Disable assert checking on release builds */
- #undef DEBUG
-#elif !NEDMALLOC_DEBUG
- #ifdef __GNUC__
- #warning DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.
- #elif defined(_MSC_VER)
- #pragma message(__FILE__ ": WARNING: DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.")
- #endif
-#endif
-
-/* The maximum concurrent threads in a pool possible */
-#ifndef MAXTHREADSINPOOL
-#define MAXTHREADSINPOOL 16
-#endif
-/* The maximum number of threadcaches which can be allocated */
-#ifndef THREADCACHEMAXCACHES
-#define THREADCACHEMAXCACHES 256
-#endif
-/* The maximum size to be allocated from the thread cache */
-#ifndef THREADCACHEMAX
-#define THREADCACHEMAX 8192
-#endif
-#if 0
-/* The number of cache entries for finer grained bins. This is (topbitpos(THREADCACHEMAX)-4)*2 */
-#define THREADCACHEMAXBINS ((13-4)*2)
-#else
-/* The number of cache entries. This is (topbitpos(THREADCACHEMAX)-4) */
-#define THREADCACHEMAXBINS (13-4)
-#endif
-/* Point at which the free space in a thread cache is garbage collected */
-#ifndef THREADCACHEMAXFREESPACE
-#define THREADCACHEMAXFREESPACE (512*1024)
-#endif
-
-
-#ifdef WIN32
- #define TLSVAR DWORD
- #define TLSALLOC(k) (*(k)=TlsAlloc(), TLS_OUT_OF_INDEXES==*(k))
- #define TLSFREE(k) (!TlsFree(k))
- #define TLSGET(k) TlsGetValue(k)
- #define TLSSET(k, a) (!TlsSetValue(k, a))
- #ifdef DEBUG
-static LPVOID ChkedTlsGetValue(DWORD idx)
-{
- LPVOID ret=TlsGetValue(idx);
- assert(S_OK==GetLastError());
- return ret;
-}
- #undef TLSGET
- #define TLSGET(k) ChkedTlsGetValue(k)
- #endif
-#else
- #define TLSVAR pthread_key_t
- #define TLSALLOC(k) pthread_key_create(k, 0)
- #define TLSFREE(k) pthread_key_delete(k)
- #define TLSGET(k) pthread_getspecific(k)
- #define TLSSET(k, a) pthread_setspecific(k, a)
-#endif
-
-#if defined(__cplusplus)
-#if !defined(NO_NED_NAMESPACE)
-namespace nedalloc {
-#else
-extern "C" {
-#endif
-#endif
-
-#if USE_ALLOCATOR==0
-static void *unsupported_operation(const char *opname) THROWSPEC
-{
- fprintf(stderr, "nedmalloc: The operation %s is not supported under this build configuration\n", opname);
- abort();
- return 0;
-}
-static size_t mspacecounter=(size_t) 0xdeadbeef;
-#endif
-#ifndef ENABLE_FAST_HEAP_DETECTION
-static void *RESTRICT leastusedaddress;
-static size_t largestusedblock;
-#endif
-
-static FORCEINLINE void *CallMalloc(void *RESTRICT mspace, size_t size, size_t alignment) THROWSPEC
-{
- void *RESTRICT ret=0;
- size_t _alignment=alignment;
-#if USE_MAGIC_HEADERS
- size_t *_ret=0;
- size+=alignment+3*sizeof(size_t);
- _alignment=0;
-#endif
-#if USE_ALLOCATOR==0
- ret=_alignment ?
-#ifdef _MSC_VER
- /* This is the MSVCRT equivalent */
- _aligned_malloc(size, _alignment)
-#elif defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
- /* This is the glibc/ptmalloc2/dlmalloc/BSD libc equivalent. */
- memalign(_alignment, size)
-#else
-#error Cannot aligned allocate with the memory allocator of an unknown system!
-#endif
- : malloc(size);
-#elif USE_ALLOCATOR==1
- ret=_alignment ? mspace_memalign((mstate) mspace, _alignment, size) : mspace_malloc((mstate) mspace, size);
-#ifndef ENABLE_FAST_HEAP_DETECTION
- if(ret)
- {
- size_t truesize=chunksize(mem2chunk(ret));
- if(!leastusedaddress || (void *)((mstate) mspace)->least_addr<leastusedaddress) leastusedaddress=(void *)((mstate) mspace)->least_addr;
- if(!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1);
- }
-#endif
-#endif
- if(!ret) return 0;
-#if USE_MAGIC_HEADERS
- _ret=(size_t *) ret;
- ret=(void *)(_ret+3);
- if(alignment) ret=(void *)(((size_t) ret+alignment-1)&~(alignment-1));
- for(; _ret<(size_t *)ret-2; _ret++) *_ret=*(size_t *)"NEDMALOC";
- _ret[0]=(size_t) mspace;
- _ret[1]=size-3*sizeof(size_t);
-#endif
- return ret;
-}
-
-static FORCEINLINE void *CallCalloc(void *RESTRICT mspace, size_t size, size_t alignment) THROWSPEC
-{
- void *RESTRICT ret=0;
-#if USE_MAGIC_HEADERS
- size_t *_ret=0;
- size+=alignment+3*sizeof(size_t);
-#endif
-#if USE_ALLOCATOR==0
- ret=calloc(1, size);
-#elif USE_ALLOCATOR==1
- ret=mspace_calloc((mstate) mspace, 1, size);
-#ifndef ENABLE_FAST_HEAP_DETECTION
- if(ret)
- {
- size_t truesize=chunksize(mem2chunk(ret));
- if(!leastusedaddress || (void *)((mstate) mspace)->least_addr<leastusedaddress) leastusedaddress=(void *)((mstate) mspace)->least_addr;
- if(!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1);
- }
-#endif
-#endif
- if(!ret) return 0;
-#if USE_MAGIC_HEADERS
- _ret=(size_t *) ret;
- ret=(void *)(_ret+3);
- if(alignment) ret=(void *)(((size_t) ret+alignment-1)&~(alignment-1));
- for(; _ret<(size_t *)ret-2; _ret++) *_ret=*(size_t *) "NEDMALOC";
- _ret[0]=(size_t) mspace;
- _ret[1]=size-3*sizeof(size_t);
-#endif
- return ret;
-}
-
-static FORCEINLINE void *CallRealloc(void *RESTRICT mspace, void *RESTRICT mem, int isforeign, size_t oldsize, size_t newsize) THROWSPEC
-{
- void *RESTRICT ret=0;
-#if USE_MAGIC_HEADERS
- mstate oldmspace=0;
- size_t *_ret=0, *_mem=(size_t *) mem-3;
-#endif
- if(isforeign)
- { /* Transfer */
-#if USE_MAGIC_HEADERS
- assert(_mem[0]!=*(size_t *) "NEDMALOC");
-#endif
- if((ret=CallMalloc(mspace, newsize, 0)))
- {
-#if defined(DEBUG)
- printf("*** nedmalloc frees system allocated block %p\n", mem);
-#endif
- memcpy(ret, mem, oldsize<newsize ? oldsize : newsize);
- free(mem);
- }
- return ret;
- }
-#if USE_MAGIC_HEADERS
- assert(_mem[0]==*(size_t *) "NEDMALOC");
- newsize+=3*sizeof(size_t);
- oldmspace=(mstate) _mem[1];
- assert(oldsize>=_mem[2]);
- for(; *_mem==*(size_t *) "NEDMALOC"; *_mem--=*(size_t *) "nedmaloc");
- mem=(void *)(++_mem);
-#endif
-#if USE_ALLOCATOR==0
- ret=realloc(mem, newsize);
-#elif USE_ALLOCATOR==1
- ret=mspace_realloc((mstate) mspace, mem, newsize);
-#ifndef ENABLE_FAST_HEAP_DETECTION
- if(ret)
- {
- size_t truesize=chunksize(mem2chunk(ret));
- if(!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1);
- }
-#endif
-#endif
- if(!ret)
- { /* Put it back the way it was */
-#if USE_MAGIC_HEADERS
- for(; *_mem==0; *_mem++=*(size_t *) "NEDMALOC");
-#endif
- return 0;
- }
-#if USE_MAGIC_HEADERS
- _ret=(size_t *) ret;
- ret=(void *)(_ret+3);
- for(; _ret<(size_t *)ret-2; _ret++) *_ret=*(size_t *) "NEDMALOC";
- _ret[0]=(size_t) mspace;
- _ret[1]=newsize-3*sizeof(size_t);
-#endif
- return ret;
-}
-
-static FORCEINLINE void CallFree(void *RESTRICT mspace, void *RESTRICT mem, int isforeign) THROWSPEC
-{
-#if USE_MAGIC_HEADERS
- mstate oldmspace=0;
- size_t *_mem=(size_t *) mem-3, oldsize=0;
-#endif
- if(isforeign)
- {
-#if USE_MAGIC_HEADERS
- assert(_mem[0]!=*(size_t *) "NEDMALOC");
-#endif
-#if defined(DEBUG)
- printf("*** nedmalloc frees system allocated block %p\n", mem);
-#endif
- free(mem);
- return;
- }
-#if USE_MAGIC_HEADERS
- assert(_mem[0]==*(size_t *) "NEDMALOC");
- oldmspace=(mstate) _mem[1];
- oldsize=_mem[2];
- for(; *_mem==*(size_t *) "NEDMALOC"; *_mem--=*(size_t *) "nedmaloc");
- mem=(void *)(++_mem);
-#endif
-#if USE_ALLOCATOR==0
- free(mem);
-#elif USE_ALLOCATOR==1
- mspace_free((mstate) mspace, mem);
-#endif
-}
-
-static NEDMALLOCNOALIASATTR mstate nedblkmstate(void *RESTRICT mem) THROWSPEC
-{
- if(mem)
- {
-#if USE_MAGIC_HEADERS
- size_t *_mem=(size_t *) mem-3;
- if(_mem[0]==*(size_t *) "NEDMALOC")
- {
- return (mstate) _mem[1];
- }
- else return 0;
-#else
-#if USE_ALLOCATOR==0
- /* Fail everything */
- return 0;
-#elif USE_ALLOCATOR==1
-#ifdef ENABLE_FAST_HEAP_DETECTION
-#ifdef WIN32
- /* On Windows for RELEASE both x86 and x64 the NT heap precedes each block with an eight byte header
- which looks like:
- normal: 4 bytes of size, 4 bytes of [char < 64, char < 64, char < 64 bit 0 always set, char random ]
- mmaped: 4 bytes of size 4 bytes of [zero, zero, 0xb, zero ]
-
- On Windows for DEBUG both x86 and x64 the preceding four bytes is always 0xfdfdfdfd (no man's land).
- */
-#pragma pack(push, 1)
- struct _HEAP_ENTRY
- {
- USHORT Size;
- USHORT PreviousSize;
- UCHAR Cookie; /* SegmentIndex */
- UCHAR Flags; /* always bit 0 (HEAP_ENTRY_BUSY). bit 1=(HEAP_ENTRY_EXTRA_PRESENT), bit 2=normal block (HEAP_ENTRY_FILL_PATTERN), bit 3=mmap block (HEAP_ENTRY_VIRTUAL_ALLOC). Bit 4 (HEAP_ENTRY_LAST_ENTRY) could be set */
- UCHAR UnusedBytes;
- UCHAR SmallTagIndex; /* fastbin index. Always one of 0x02, 0x03, 0x04 < 0x80 */
- } *RESTRICT he=((struct _HEAP_ENTRY *) mem)-1;
-#pragma pack(pop)
- unsigned int header=((unsigned int *)mem)[-1], mask1=0x8080E100, result1, mask2=0xFFFFFF06, result2;
- result1=header & mask1; /* Positive testing for NT heap */
- result2=header & mask2; /* Positive testing for dlmalloc */
- if(result1==0x00000100 && result2!=0x00000102)
- { /* This is likely a NT heap block */
- return 0;
- }
-#endif
-#ifdef __linux__
- /* On Linux glibc uses ptmalloc2 (really dlmalloc) just as we do, but prev_foot contains rubbish
- when the preceding block is allocated because ptmalloc2 finds the local mstate by rounding the ptr
- down to the nearest megabyte. It's like dlmalloc with FOOTERS disabled. */
- mchunkptr p=mem2chunk(mem);
- mstate fm=get_mstate_for(p);
- /* If it's a ptmalloc2 block, fm is likely to be some crazy value */
- if(!is_aligned(fm)) return 0;
- if((size_t)mem-(size_t)fm>=(size_t)1<<(SIZE_T_BITSIZE-1)) return 0;
- if(ok_magic(fm))
- return fm;
- else
- return 0;
- if(1) { }
-#endif
- else
- {
- mchunkptr p=mem2chunk(mem);
- mstate fm=get_mstate_for(p);
- assert(ok_magic(fm)); /* If this fails, someone tried to free a block twice */
- if(ok_magic(fm))
- return fm;
- }
-#else
-//#ifdef WIN32
-// __try
-//#endif
- {
- /* We try to return zero here if it isn't one of our own blocks, however
- the current block annotation scheme used by dlmalloc makes it impossible
- to be absolutely sure of avoiding a segfault.
-
- mchunkptr->prev_foot = mem-(2*size_t) = mstate ^ mparams.magic for PRECEDING block;
- mchunkptr->head = mem-(1*size_t) = 8 multiple size of this block with bottom three bits = FLAG_BITS
- FLAG_BITS = bit 0 is CINUSE (currently in use unless is mmap), bit 1 is PINUSE (previous block currently
- in use unless mmap), bit 2 is UNUSED and currently is always zero.
- */
- register void *RESTRICT leastusedaddress_=leastusedaddress; /* Cache these to avoid register reloading */
- register size_t largestusedblock_=largestusedblock;
- if(!is_aligned(mem)) return 0; /* Would fail very rarely as all allocators return aligned blocks */
- if(mem<leastusedaddress_) return 0; /* Simple but effective */
- {
- mchunkptr p=mem2chunk(mem);
- mstate fm=0;
- int ismmapped=is_mmapped(p);
- if((!ismmapped && !is_inuse(p)) || (p->head & FLAG4_BIT)) return 0;
- /* Reduced uncertainty by 0.5^2 = 25.0% */
- /* size should never exceed largestusedblock */
- if(chunksize(p)>largestusedblock_) return 0;
- /* Reduced uncertainty by a minimum of 0.5^3 = 12.5%, maximum 0.5^16 = 0.0015% */
- /* Having sanity checked prev_foot and head, check next block */
- if(!ismmapped && (!next_pinuse(p) || (next_chunk(p)->head & FLAG4_BIT))) return 0;
- /* Reduced uncertainty by 0.5^5 = 3.13% or 0.5^18 = 0.00038% */
- #if 0
- /* If previous block is free, check that its next block pointer equals us */
- if(!ismmapped && !pinuse(p))
- if(next_chunk(prev_chunk(p))!=p) return 0;
- /* We could start comparing prev_foot's for similarity but it starts getting slow. */
- #endif
- fm = get_mstate_for(p);
- if(!is_aligned(fm) || (void *)fm<leastusedaddress_) return 0;
- if((size_t)mem-(size_t)fm>=(size_t)1<<(SIZE_T_BITSIZE-1)) return 0;
- assert(ok_magic(fm)); /* If this fails, someone tried to free a block twice */
- if(ok_magic(fm))
- return fm;
- }
- }
-//#ifdef WIN32
-// __except(1) { }
-//#endif
-#endif
-#endif
-#endif
- }
- return 0;
-}
-NEDMALLOCNOALIASATTR size_t nedblksize(int *RESTRICT isforeign, void *RESTRICT mem) THROWSPEC
-{
- if(mem)
- {
- if(isforeign) *isforeign=1;
-#if USE_MAGIC_HEADERS
- {
- size_t *_mem=(size_t *) mem-3;
- if(_mem[0]==*(size_t *) "NEDMALOC")
- {
- mstate mspace=(mstate) _mem[1];
- size_t size=_mem[2];
- if(isforeign) *isforeign=0;
- return size;
- }
- }
-#elif USE_ALLOCATOR==1
- if(nedblkmstate(mem))
- {
- mchunkptr p=mem2chunk(mem);
- if(isforeign) *isforeign=0;
- return chunksize(p)-overhead_for(p);
- }
-#ifdef DEBUG
- else
- {
- int a=1; /* Set breakpoints here if needed */
- }
-#endif
-#endif
-#if defined(ENABLE_TOLERANT_NEDMALLOC) || USE_ALLOCATOR==0
-#ifdef _MSC_VER
- /* This is the MSVCRT equivalent */
- return _msize(mem);
-#elif defined(__linux__)
- /* This is the glibc/ptmalloc2/dlmalloc equivalent. */
- return malloc_usable_size(mem);
-#elif defined(__FreeBSD__) || defined(__APPLE__)
- /* This is the BSD libc equivalent. */
- return malloc_size(mem);
-#else
-#error Cannot tolerate the memory allocator of an unknown system!
-#endif
-#endif
- }
- return 0;
-}
-
-NEDMALLOCNOALIASATTR void nedsetvalue(void *v) THROWSPEC { nedpsetvalue((nedpool *) 0, v); }
-NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedmalloc(size_t size) THROWSPEC { return nedpmalloc((nedpool *) 0, size); }
-NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedcalloc(size_t no, size_t size) THROWSPEC { return nedpcalloc((nedpool *) 0, no, size); }
-NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedrealloc(void *mem, size_t size) THROWSPEC { return nedprealloc((nedpool *) 0, mem, size); }
-NEDMALLOCNOALIASATTR void nedfree(void *mem) THROWSPEC { nedpfree((nedpool *) 0, mem); }
-NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedmemalign(size_t alignment, size_t bytes) THROWSPEC { return nedpmemalign((nedpool *) 0, alignment, bytes); }
-NEDMALLOCNOALIASATTR struct nedmallinfo nedmallinfo(void) THROWSPEC { return nedpmallinfo((nedpool *) 0); }
-NEDMALLOCNOALIASATTR int nedmallopt(int parno, int value) THROWSPEC { return nedpmallopt((nedpool *) 0, parno, value); }
-NEDMALLOCNOALIASATTR int nedmalloc_trim(size_t pad) THROWSPEC { return nedpmalloc_trim((nedpool *) 0, pad); }
-void nedmalloc_stats() THROWSPEC { nedpmalloc_stats((nedpool *) 0); }
-NEDMALLOCNOALIASATTR size_t nedmalloc_footprint() THROWSPEC { return nedpmalloc_footprint((nedpool *) 0); }
-NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC { return nedpindependent_calloc((nedpool *) 0, elemsno, elemsize, chunks); }
-NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC { return nedpindependent_comalloc((nedpool *) 0, elems, sizes, chunks); }
-
-struct threadcacheblk_t;
-typedef struct threadcacheblk_t threadcacheblk;
-struct threadcacheblk_t
-{ /* Keep less than 16 bytes on 32 bit systems and 32 bytes on 64 bit systems */
-#ifdef FULLSANITYCHECKS
- unsigned int magic;
-#endif
- unsigned int lastUsed, size;
- threadcacheblk *next, *prev;
-};
-typedef struct threadcache_t
-{
-#ifdef FULLSANITYCHECKS
- unsigned int magic1;
-#endif
- int mymspace; /* Last mspace entry this thread used */
- long threadid;
- unsigned int mallocs, frees, successes;
- size_t freeInCache; /* How much free space is stored in this cache */
- threadcacheblk *bins[(THREADCACHEMAXBINS+1)*2];
-#ifdef FULLSANITYCHECKS
- unsigned int magic2;
-#endif
-} threadcache;
-struct nedpool_t
-{
- MLOCK_T mutex;
- void *uservalue;
- int threads; /* Max entries in m to use */
- threadcache *caches[THREADCACHEMAXCACHES];
- TLSVAR mycache; /* Thread cache for this thread. 0 for unset, negative for use mspace-1 directly, otherwise is cache-1 */
- mstate m[MAXTHREADSINPOOL+1]; /* mspace entries for this pool */
-};
-static nedpool syspool;
-
-static FORCEINLINE NEDMALLOCNOALIASATTR unsigned int size2binidx(size_t _size) THROWSPEC
-{ /* 8=1000 16=10000 20=10100 24=11000 32=100000 48=110000 4096=1000000000000 */
- unsigned int topbit, size=(unsigned int)(_size>>4);
- /* 16=1 20=1 24=1 32=10 48=11 64=100 96=110 128=1000 4096=100000000 */
-
-#if defined(__GNUC__)
- topbit = sizeof(size)*__CHAR_BIT__ - 1 - __builtin_clz(size);
-#elif defined(_MSC_VER) && _MSC_VER>=1300
- {
- unsigned long bsrTopBit;
-
- _BitScanReverse(&bsrTopBit, size);
-
- topbit = bsrTopBit;
- }
-#else
-#if 0
- union {
- unsigned asInt[2];
- double asDouble;
- };
- int n;
-
- asDouble = (double)size + 0.5;
- topbit = (asInt[!FOX_BIGENDIAN] >> 20) - 1023;
-#else
- {
- unsigned int x=size;
- x = x | (x >> 1);
- x = x | (x >> 2);
- x = x | (x >> 4);
- x = x | (x >> 8);
- x = x | (x >>16);
- x = ~x;
- x = x - ((x >> 1) & 0x55555555);
- x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
- x = (x + (x >> 4)) & 0x0F0F0F0F;
- x = x + (x << 8);
- x = x + (x << 16);
- topbit=31 - (x >> 24);
- }
-#endif
-#endif
- return topbit;
-}
-
-
-#ifdef FULLSANITYCHECKS
-static void tcsanitycheck(threadcacheblk **ptr) THROWSPEC
-{
- assert((ptr[0] && ptr[1]) || (!ptr[0] && !ptr[1]));
- if(ptr[0] && ptr[1])
- {
- assert(nedblksize(ptr[0])>=sizeof(threadcacheblk));
- assert(nedblksize(ptr[1])>=sizeof(threadcacheblk));
- assert(*(unsigned int *) "NEDN"==ptr[0]->magic);
- assert(*(unsigned int *) "NEDN"==ptr[1]->magic);
- assert(!ptr[0]->prev);
- assert(!ptr[1]->next);
- if(ptr[0]==ptr[1])
- {
- assert(!ptr[0]->next);
- assert(!ptr[1]->prev);
- }
- }
-}
-static void tcfullsanitycheck(threadcache *tc) THROWSPEC
-{
- threadcacheblk **tcbptr=tc->bins;
- int n;
- for(n=0; n<=THREADCACHEMAXBINS; n++, tcbptr+=2)
- {
- threadcacheblk *b, *ob=0;
- tcsanitycheck(tcbptr);
- for(b=tcbptr[0]; b; ob=b, b=b->next)
- {
- assert(*(unsigned int *) "NEDN"==b->magic);
- assert(!ob || ob->next==b);
- assert(!ob || b->prev==ob);
- }
- }
-}
-#endif
-
-static NOINLINE void RemoveCacheEntries(nedpool *RESTRICT p, threadcache *RESTRICT tc, unsigned int age) THROWSPEC
-{
-#ifdef FULLSANITYCHECKS
- tcfullsanitycheck(tc);
-#endif
- if(tc->freeInCache)
- {
- threadcacheblk **tcbptr=tc->bins;
- int n;
- for(n=0; n<=THREADCACHEMAXBINS; n++, tcbptr+=2)
- {
- threadcacheblk **tcb=tcbptr+1; /* come from oldest end of list */
- /*tcsanitycheck(tcbptr);*/
- for(; *tcb && tc->frees-(*tcb)->lastUsed>=age; )
- {
- threadcacheblk *f=*tcb;
- size_t blksize=f->size; /*nedblksize(f);*/
- assert(blksize<=nedblksize(0, f));
- assert(blksize);
-#ifdef FULLSANITYCHECKS
- assert(*(unsigned int *) "NEDN"==(*tcb)->magic);
-#endif
- *tcb=(*tcb)->prev;
- if(*tcb)
- (*tcb)->next=0;
- else
- *tcbptr=0;
- tc->freeInCache-=blksize;
- assert((long) tc->freeInCache>=0);
- CallFree(0, f, 0);
- /*tcsanitycheck(tcbptr);*/
- }
- }
- }
-#ifdef FULLSANITYCHECKS
- tcfullsanitycheck(tc);
-#endif
-}
-static void DestroyCaches(nedpool *RESTRICT p) THROWSPEC
-{
- if(p->caches)
- {
- threadcache *tc;
- int n;
- for(n=0; n<THREADCACHEMAXCACHES; n++)
- {
- if((tc=p->caches[n]))
- {
- tc->frees++;
- RemoveCacheEntries(p, tc, 0);
- assert(!tc->freeInCache);
- tc->mymspace=-1;
- tc->threadid=0;
- CallFree(0, tc, 0);
- p->caches[n]=0;
- }
- }
- }
-}
-
-static NOINLINE threadcache *AllocCache(nedpool *RESTRICT p) THROWSPEC
-{
- threadcache *tc=0;
- int n, end;
- ACQUIRE_LOCK(&p->mutex);
- for(n=0; n<THREADCACHEMAXCACHES && p->caches[n]; n++);
- if(THREADCACHEMAXCACHES==n)
- { /* List exhausted, so disable for this thread */
- RELEASE_LOCK(&p->mutex);
- return 0;
- }
- tc=p->caches[n]=(threadcache *) CallCalloc(p->m[0], sizeof(threadcache), 0);
- if(!tc)
- {
- RELEASE_LOCK(&p->mutex);
- return 0;
- }
-#ifdef FULLSANITYCHECKS
- tc->magic1=*(unsigned int *)"NEDMALC1";
- tc->magic2=*(unsigned int *)"NEDMALC2";
-#endif
- tc->threadid=(long)(size_t)CURRENT_THREAD;
- for(end=0; p->m[end]; end++);
- tc->mymspace=abs(tc->threadid) % end;
- RELEASE_LOCK(&p->mutex);
- if(TLSSET(p->mycache, (void *)(size_t)(n+1))) abort();
- return tc;
-}
-
-static void *threadcache_malloc(nedpool *RESTRICT p, threadcache *RESTRICT tc, size_t *RESTRICT _size) THROWSPEC
-{
- void *RESTRICT ret=0;
- size_t size=*_size, blksize=0;
- unsigned int bestsize;
- unsigned int idx=size2binidx(size);
- threadcacheblk *RESTRICT blk, **RESTRICT binsptr;
-#ifdef FULLSANITYCHECKS
- tcfullsanitycheck(tc);
-#endif
- /* Calculate best fit bin size */
- bestsize=1<<(idx+4);
-#if 0
- /* Finer grained bin fit */
- idx<<=1;
- if(size>bestsize)
- {
- idx++;
- bestsize+=bestsize>>1;
- }
- if(size>bestsize)
- {
- idx++;
- bestsize=1<<(4+(idx>>1));
- }
-#else
- if(size>bestsize)
- {
- idx++;
- bestsize<<=1;
- }
-#endif
- assert(bestsize>=size);
- if(size<bestsize) size=bestsize;
- assert(size<=THREADCACHEMAX);
- assert(idx<=THREADCACHEMAXBINS);
- binsptr=&tc->bins[idx*2];
- /* Try to match close, but move up a bin if necessary */
- blk=*binsptr;
- if(!blk || blk->size<size)
- { /* Bump it up a bin */
- if(idx<THREADCACHEMAXBINS)
- {
- idx++;
- binsptr+=2;
- blk=*binsptr;
- }
- }
- if(blk)
- {
- blksize=blk->size; /*nedblksize(blk);*/
- assert(nedblksize(0, blk)>=blksize);
- assert(blksize>=size);
- if(blk->next)
- blk->next->prev=0;
- *binsptr=blk->next;
- if(!*binsptr)
- binsptr[1]=0;
-#ifdef FULLSANITYCHECKS
- blk->magic=0;
-#endif
- assert(binsptr[0]!=blk && binsptr[1]!=blk);
- assert(nedblksize(0, blk)>=sizeof(threadcacheblk) && nedblksize(0, blk)<=THREADCACHEMAX+CHUNK_OVERHEAD);
- /*printf("malloc: %p, %p, %p, %lu\n", p, tc, blk, (long) _size);*/
- ret=(void *) blk;
- }
- ++tc->mallocs;
- if(ret)
- {
- assert(blksize>=size);
- ++tc->successes;
- tc->freeInCache-=blksize;
- assert((long) tc->freeInCache>=0);
- }
-#if defined(DEBUG) && 0
- if(!(tc->mallocs & 0xfff))
- {
- printf("*** threadcache=%u, mallocs=%u (%f), free=%u (%f), freeInCache=%u\n", (unsigned int) tc->threadid, tc->mallocs,
- (float) tc->successes/tc->mallocs, tc->frees, (float) tc->successes/tc->frees, (unsigned int) tc->freeInCache);
- }
-#endif
-#ifdef FULLSANITYCHECKS
- tcfullsanitycheck(tc);
-#endif
- *_size=size;
- return ret;
-}
-static NOINLINE void ReleaseFreeInCache(nedpool *RESTRICT p, threadcache *RESTRICT tc, int mymspace) THROWSPEC
-{
- unsigned int age=THREADCACHEMAXFREESPACE/8192;
- /*ACQUIRE_LOCK(&p->m[mymspace]->mutex);*/
- while(age && tc->freeInCache>=THREADCACHEMAXFREESPACE)
- {
- RemoveCacheEntries(p, tc, age);
- /*printf("*** Removing cache entries older than %u (%u)\n", age, (unsigned int) tc->freeInCache);*/
- age>>=1;
- }
- /*RELEASE_LOCK(&p->m[mymspace]->mutex);*/
-}
-static void threadcache_free(nedpool *RESTRICT p, threadcache *RESTRICT tc, int mymspace, void *RESTRICT mem, size_t size) THROWSPEC
-{
- unsigned int bestsize;
- unsigned int idx=size2binidx(size);
- threadcacheblk **RESTRICT binsptr, *RESTRICT tck=(threadcacheblk *) mem;
- assert(size>=sizeof(threadcacheblk) && size<=THREADCACHEMAX+CHUNK_OVERHEAD);
-#ifdef DEBUG
- /* Make sure this is a valid memory block */
- assert(nedblksize(0, mem));
-#endif
-#ifdef FULLSANITYCHECKS
- tcfullsanitycheck(tc);
-#endif
- /* Calculate best fit bin size */
- bestsize=1<<(idx+4);
-#if 0
- /* Finer grained bin fit */
- idx<<=1;
- if(size>bestsize)
- {
- unsigned int biggerbestsize=bestsize+bestsize<<1;
- if(size>=biggerbestsize)
- {
- idx++;
- bestsize=biggerbestsize;
- }
- }
-#endif
- if(bestsize!=size) /* dlmalloc can round up, so we round down to preserve indexing */
- size=bestsize;
- binsptr=&tc->bins[idx*2];
- assert(idx<=THREADCACHEMAXBINS);
- if(tck==*binsptr)
- {
- fprintf(stderr, "nedmalloc: Attempt to free already freed memory block %p - aborting!\n", tck);
- abort();
- }
-#ifdef FULLSANITYCHECKS
- tck->magic=*(unsigned int *) "NEDN";
-#endif
- tck->lastUsed=++tc->frees;
- tck->size=(unsigned int) size;
- tck->next=*binsptr;
- tck->prev=0;
- if(tck->next)
- tck->next->prev=tck;
- else
- binsptr[1]=tck;
- assert(!*binsptr || (*binsptr)->size==tck->size);
- *binsptr=tck;
- assert(tck==tc->bins[idx*2]);
- assert(tc->bins[idx*2+1]==tck || binsptr[0]->next->prev==tck);
- /*printf("free: %p, %p, %p, %lu\n", p, tc, mem, (long) size);*/
- tc->freeInCache+=size;
-#ifdef FULLSANITYCHECKS
- tcfullsanitycheck(tc);
-#endif
-#if 1
- if(tc->freeInCache>=THREADCACHEMAXFREESPACE)
- ReleaseFreeInCache(p, tc, mymspace);
-#endif
-}
-
-
-
-
-static NOINLINE int InitPool(nedpool *RESTRICT p, size_t capacity, int threads) THROWSPEC
-{ /* threads is -1 for system pool */
- ensure_initialization();
- ACQUIRE_MALLOC_GLOBAL_LOCK();
- if(p->threads) goto done;
- if(INITIAL_LOCK(&p->mutex)) goto err;
- if(TLSALLOC(&p->mycache)) goto err;
-#if USE_ALLOCATOR==0
- p->m[0]=(mstate) mspacecounter++;
-#elif USE_ALLOCATOR==1
- if(!(p->m[0]=(mstate) create_mspace(capacity, 1))) goto err;
- p->m[0]->extp=p;
-#endif
- p->threads=(threads<1 || threads>MAXTHREADSINPOOL) ? MAXTHREADSINPOOL : threads;
-done:
- RELEASE_MALLOC_GLOBAL_LOCK();
- return 1;
-err:
- if(threads<0)
- abort(); /* If you can't allocate for system pool, we're screwed */
- DestroyCaches(p);
- if(p->m[0])
- {
-#if USE_ALLOCATOR==1
- destroy_mspace(p->m[0]);
-#endif
- p->m[0]=0;
- }
- if(p->mycache)
- {
- if(TLSFREE(p->mycache)) abort();
- p->mycache=0;
- }
- RELEASE_MALLOC_GLOBAL_LOCK();
- return 0;
-}
-static NOINLINE mstate FindMSpace(nedpool *RESTRICT p, threadcache *RESTRICT tc, int *RESTRICT lastUsed, size_t size) THROWSPEC
-{ /* Gets called when thread's last used mspace is in use. The strategy
- is to run through the list of all available mspaces looking for an
- unlocked one and if we fail, we create a new one so long as we don't
- exceed p->threads */
- int n, end;
- for(n=end=*lastUsed+1; p->m[n]; end=++n)
- {
- if(TRY_LOCK(&p->m[n]->mutex)) goto found;
- }
- for(n=0; n<*lastUsed && p->m[n]; n++)
- {
- if(TRY_LOCK(&p->m[n]->mutex)) goto found;
- }
- if(end<p->threads)
- {
- mstate temp;
-#if USE_ALLOCATOR==0
- temp=(mstate) mspacecounter++;
-#elif USE_ALLOCATOR==1
- if(!(temp=(mstate) create_mspace(size, 1)))
- goto badexit;
-#endif
- /* Now we're ready to modify the lists, we lock */
- ACQUIRE_LOCK(&p->mutex);
- while(p->m[end] && end<p->threads)
- end++;
- if(end>=p->threads)
- { /* Drat, must destroy it now */
- RELEASE_LOCK(&p->mutex);
-#if USE_ALLOCATOR==1
- destroy_mspace((mstate) temp);
-#endif
- goto badexit;
- }
- /* We really want to make sure this goes into memory now but we
- have to be careful of breaking aliasing rules, so write it twice */
- *((volatile struct malloc_state **) &p->m[end])=p->m[end]=temp;
- ACQUIRE_LOCK(&p->m[end]->mutex);
- /*printf("Created mspace idx %d\n", end);*/
- RELEASE_LOCK(&p->mutex);
- n=end;
- goto found;
- }
- /* Let it lock on the last one it used */
-badexit:
- ACQUIRE_LOCK(&p->m[*lastUsed]->mutex);
- return p->m[*lastUsed];
-found:
- *lastUsed=n;
- if(tc)
- tc->mymspace=n;
- else
- {
- if(TLSSET(p->mycache, (void *)(size_t)(-(n+1)))) abort();
- }
- return p->m[n];
-}
-
-typedef struct PoolList_t
-{
- size_t size; /* Size of list */
- size_t length; /* Actual entries in list */
-#ifdef DEBUG
- nedpool *list[1]; /* Force testing of list expansion */
-#else
- nedpool *list[16];
-#endif
-} PoolList;
-static MLOCK_T poollistlock;
-static PoolList *poollist;
-NEDMALLOCPTRATTR nedpool *nedcreatepool(size_t capacity, int threads) THROWSPEC
-{
- nedpool *ret=0;
- if(!poollist)
- {
- PoolList *newpoollist=0;
- if(!(newpoollist=(PoolList *) nedpcalloc(0, 1, sizeof(PoolList)+sizeof(nedpool *)))) return 0;
- INITIAL_LOCK(&poollistlock);
- ACQUIRE_LOCK(&poollistlock);
- poollist=newpoollist;
- poollist->size=sizeof(poollist->list)/sizeof(nedpool *);
- }
- else
- ACQUIRE_LOCK(&poollistlock);
- if(poollist->length==poollist->size)
- {
- PoolList *newpoollist=0;
- size_t newsize=0;
- newsize=sizeof(PoolList)+(poollist->size+1)*sizeof(nedpool *);
- if(!(newpoollist=(PoolList *) nedprealloc(0, poollist, newsize))) goto badexit;
- poollist=newpoollist;
- memset(&poollist->list[poollist->size], 0, newsize-((size_t)&poollist->list[poollist->size]-(size_t)&poollist->list[0]));
- poollist->size=((newsize-((char *)&poollist->list[0]-(char *)poollist))/sizeof(nedpool *))-1;
- assert(poollist->size>poollist->length);
- }
- if(!(ret=(nedpool *) nedpcalloc(0, 1, sizeof(nedpool)))) goto badexit;
- if(!InitPool(ret, capacity, threads))
- {
- nedpfree(0, ret);
- goto badexit;
- }
- poollist->list[poollist->length++]=ret;
-badexit:
- RELEASE_LOCK(&poollistlock);
- return ret;
-}
-void neddestroypool(nedpool *p) THROWSPEC
-{
- unsigned int n;
- ACQUIRE_LOCK(&p->mutex);
- DestroyCaches(p);
- for(n=0; p->m[n]; n++)
- {
-#if USE_ALLOCATOR==1
- destroy_mspace(p->m[n]);
-#endif
- p->m[n]=0;
- }
- RELEASE_LOCK(&p->mutex);
- if(TLSFREE(p->mycache)) abort();
- nedpfree(0, p);
- ACQUIRE_LOCK(&poollistlock);
- assert(poollist);
- for(n=0; n<poollist->length && poollist->list[n]!=p; n++);
- assert(n!=poollist->length);
- memmove(&poollist->list[n], &poollist->list[n+1], (size_t)&poollist->list[poollist->length]-(size_t)&poollist->list[n]);
- if(!--poollist->length)
- {
- assert(!poollist->list[0]);
- nedpfree(0, poollist);
- poollist=0;
- }
- RELEASE_LOCK(&poollistlock);
-}
-void neddestroysyspool() THROWSPEC
-{
- nedpool *p=&syspool;
- int n;
- ACQUIRE_LOCK(&p->mutex);
- DestroyCaches(p);
- for(n=0; p->m[n]; n++)
- {
-#if USE_ALLOCATOR==1
- destroy_mspace(p->m[n]);
-#endif
- p->m[n]=0;
- }
- /* Render syspool unusable */
- for(n=0; n<THREADCACHEMAXCACHES; n++)
- p->caches[n]=(threadcache *)(size_t)(sizeof(size_t)>4 ? 0xdeadbeefdeadbeefULL : 0xdeadbeefUL);
- for(n=0; n<MAXTHREADSINPOOL+1; n++)
- p->m[n]=(mstate)(size_t)(sizeof(size_t)>4 ? 0xdeadbeefdeadbeefULL : 0xdeadbeefUL);
- if(TLSFREE(p->mycache)) abort();
- RELEASE_LOCK(&p->mutex);
-}
-nedpool **nedpoollist() THROWSPEC
-{
- nedpool **ret=0;
- if(poollist)
- {
- ACQUIRE_LOCK(&poollistlock);
- if(!(ret=(nedpool **) nedmalloc((poollist->length+1)*sizeof(nedpool *)))) goto badexit;
- memcpy(ret, poollist->list, (poollist->length+1)*sizeof(nedpool *));
-badexit:
- RELEASE_LOCK(&poollistlock);
- }
- return ret;
-}
-
-void nedpsetvalue(nedpool *p, void *v) THROWSPEC
-{
- if(!p) { p=&syspool; if(!syspool.threads) InitPool(&syspool, 0, -1); }
- p->uservalue=v;
-}
-void *nedgetvalue(nedpool **p, void *mem) THROWSPEC
-{
- nedpool *np=0;
- mstate fm=nedblkmstate(mem);
- if(!fm || !fm->extp) return 0;
- np=(nedpool *) fm->extp;
- if(p) *p=np;
- return np->uservalue;
-}
-
-void nedtrimthreadcache(nedpool *p, int disable) THROWSPEC
-{
- int mycache;
- if(!p)
- {
- p=&syspool;
- if(!syspool.threads) InitPool(&syspool, 0, -1);
- }
- mycache=(int)(size_t) TLSGET(p->mycache);
- if(!mycache)
- { /* Set to mspace 0 */
- if(disable && TLSSET(p->mycache, (void *)(size_t)-1)) abort();
- }
- else if(mycache>0)
- { /* Set to last used mspace */
- threadcache *tc=p->caches[mycache-1];
-#if defined(DEBUG)
- printf("Threadcache utilisation: %lf%% in cache with %lf%% lost to other threads\n",
- 100.0*tc->successes/tc->mallocs, 100.0*((double) tc->mallocs-tc->frees)/tc->mallocs);
-#endif
- if(disable && TLSSET(p->mycache, (void *)(size_t)(-tc->mymspace))) abort();
- tc->frees++;
- RemoveCacheEntries(p, tc, 0);
- assert(!tc->freeInCache);
- if(disable)
- {
- tc->mymspace=-1;
- tc->threadid=0;
- CallFree(0, p->caches[mycache-1], 0);
- p->caches[mycache-1]=0;
- }
- }
-}
-void neddisablethreadcache(nedpool *p) THROWSPEC
-{
- nedtrimthreadcache(p, 1);
-}
-
-#define GETMSPACE(m,p,tc,ms,s,action) \
- do \
- { \
- mstate m = GetMSpace((p),(tc),(ms),(s)); \
- action; \
- if(USE_ALLOCATOR==1) { RELEASE_LOCK(&m->mutex); } \
- } while (0)
-
-static FORCEINLINE mstate GetMSpace(nedpool *RESTRICT p, threadcache *RESTRICT tc, int mymspace, size_t size) THROWSPEC
-{ /* Returns a locked and ready for use mspace */
- mstate m=p->m[mymspace];
- assert(m);
-#if USE_ALLOCATOR==1
- if(!TRY_LOCK(&p->m[mymspace]->mutex)) m=FindMSpace(p, tc, &mymspace, size);
- /*assert(IS_LOCKED(&p->m[mymspace]->mutex));*/
-#endif
- return m;
-}
-static NOINLINE void GetThreadCache_cold1(nedpool *RESTRICT *RESTRICT p) THROWSPEC
-{
- *p=&syspool;
- if(!syspool.threads) InitPool(&syspool, 0, -1);
-}
-static NOINLINE void GetThreadCache_cold2(nedpool *RESTRICT *RESTRICT p, threadcache *RESTRICT *RESTRICT tc, int *RESTRICT mymspace, int mycache) THROWSPEC
-{
- if(!mycache)
- { /* Need to allocate a new cache */
- *tc=AllocCache(*p);
- if(!*tc)
- { /* Disable */
- if(TLSSET((*p)->mycache, (void *)(size_t)-1)) abort();
- *mymspace=0;
- }
- else
- *mymspace=(*tc)->mymspace;
- }
- else
- { /* Cache disabled, but we do have an assigned thread pool */
- *tc=0;
- *mymspace=-mycache-1;
- }
-}
-static FORCEINLINE void GetThreadCache(nedpool *RESTRICT *RESTRICT p, threadcache *RESTRICT *RESTRICT tc, int *RESTRICT mymspace, size_t *RESTRICT size) THROWSPEC
-{
- int mycache;
- if(size && *size<sizeof(threadcacheblk)) *size=sizeof(threadcacheblk);
- if(!*p)
- GetThreadCache_cold1(p);
- mycache=(int)(size_t) TLSGET((*p)->mycache);
- if(mycache>0)
- { /* Already have a cache */
- *tc=(*p)->caches[mycache-1];
- *mymspace=(*tc)->mymspace;
- }
- else GetThreadCache_cold2(p, tc, mymspace, mycache);
- assert(*mymspace>=0);
- assert(!(*tc) || (long)(size_t)CURRENT_THREAD==(*tc)->threadid);
-#ifdef FULLSANITYCHECKS
- if(*tc)
- {
- if(*(unsigned int *)"NEDMALC1"!=(*tc)->magic1 || *(unsigned int *)"NEDMALC2"!=(*tc)->magic2)
- {
- abort();
- }
- }
-#endif
-}
-
-NEDMALLOCPTRATTR void * nedpmalloc(nedpool *p, size_t size) THROWSPEC
-{
- void *ret=0;
- threadcache *tc;
- int mymspace;
- GetThreadCache(&p, &tc, &mymspace, &size);
-#if THREADCACHEMAX
- if(tc && size<=THREADCACHEMAX)
- { /* Use the thread cache */
- ret=threadcache_malloc(p, tc, &size);
- }
-#endif
- if(!ret)
- { /* Use this thread's mspace */
- GETMSPACE(m, p, tc, mymspace, size,
- ret=CallMalloc(m, size, 0));
- }
- return ret;
-}
-NEDMALLOCPTRATTR void * nedpcalloc(nedpool *p, size_t no, size_t size) THROWSPEC
-{
- size_t rsize=size*no;
- void *ret=0;
- threadcache *tc;
- int mymspace;
- GetThreadCache(&p, &tc, &mymspace, &rsize);
-#if THREADCACHEMAX
- if(tc && rsize<=THREADCACHEMAX)
- { /* Use the thread cache */
- if((ret=threadcache_malloc(p, tc, &rsize)))
- memset(ret, 0, rsize);
- }
-#endif
- if(!ret)
- { /* Use this thread's mspace */
- GETMSPACE(m, p, tc, mymspace, rsize,
- ret=CallCalloc(m, rsize, 0));
- }
- return ret;
-}
-NEDMALLOCPTRATTR void * nedprealloc(nedpool *p, void *mem, size_t size) THROWSPEC
-{
- void *ret=0;
- threadcache *tc;
- int mymspace, isforeign=1;
- size_t memsize;
- if(!mem) return nedpmalloc(p, size);
- memsize=nedblksize(&isforeign, mem);
- assert(memsize);
- if(!memsize)
- {
- fprintf(stderr, "nedmalloc: nedprealloc() called with a block not created by nedmalloc!\n");
- abort();
- }
- else if(size<=memsize && memsize-size<
-#ifdef DEBUG
- 32
-#else
- 1024
-#endif
- ) /* If realloc size is within 1Kb smaller than existing, noop it */
- return mem;
- GetThreadCache(&p, &tc, &mymspace, &size);
-#if THREADCACHEMAX
- if(tc && size && size<=THREADCACHEMAX)
- { /* Use the thread cache */
- if((ret=threadcache_malloc(p, tc, &size)))
- {
- memcpy(ret, mem, memsize<size ? memsize : size);
- if(memsize>=sizeof(threadcacheblk) && memsize<=(THREADCACHEMAX+CHUNK_OVERHEAD))
- threadcache_free(p, tc, mymspace, mem, memsize);
- else
- CallFree(0, mem, isforeign);
- }
- }
-#endif
- if(!ret)
- { /* Reallocs always happen in the mspace they happened in, so skip
- locking the preferred mspace for this thread */
- ret=CallRealloc(p->m[mymspace], mem, isforeign, memsize, size);
- }
- return ret;
-}
-void nedpfree(nedpool *p, void *mem) THROWSPEC
-{ /* Frees always happen in the mspace they happened in, so skip
- locking the preferred mspace for this thread */
- threadcache *tc;
- int mymspace, isforeign=1;
- size_t memsize;
- if(!mem)
- { /* If you tried this on FreeBSD you'd be sorry! */
-#ifdef DEBUG
- fprintf(stderr, "nedmalloc: WARNING nedpfree() called with zero. This is not portable behaviour!\n");
-#endif
- return;
- }
- memsize=nedblksize(&isforeign, mem);
- assert(memsize);
- if(!memsize)
- {
- fprintf(stderr, "nedmalloc: nedpfree() called with a block not created by nedmalloc!\n");
- abort();
- }
- GetThreadCache(&p, &tc, &mymspace, 0);
-#if THREADCACHEMAX
- if(mem && tc && memsize>=sizeof(threadcacheblk) && memsize<=(THREADCACHEMAX+CHUNK_OVERHEAD))
- threadcache_free(p, tc, mymspace, mem, memsize);
- else
-#endif
- CallFree(0, mem, isforeign);
-}
-NEDMALLOCPTRATTR void * nedpmemalign(nedpool *p, size_t alignment, size_t bytes) THROWSPEC
-{
- void *ret;
- threadcache *tc;
- int mymspace;
- GetThreadCache(&p, &tc, &mymspace, &bytes);
- { /* Use this thread's mspace */
- GETMSPACE(m, p, tc, mymspace, bytes,
- ret=CallMalloc(m, bytes, alignment));
- }
- return ret;
-}
-struct nedmallinfo nedpmallinfo(nedpool *p) THROWSPEC
-{
- int n;
- struct nedmallinfo ret={0};
- if(!p) { p=&syspool; if(!syspool.threads) InitPool(&syspool, 0, -1); }
- for(n=0; p->m[n]; n++)
- {
-#if USE_ALLOCATOR==1 && !NO_MALLINFO
- struct mallinfo t=mspace_mallinfo(p->m[n]);
- ret.arena+=t.arena;
- ret.ordblks+=t.ordblks;
- ret.hblkhd+=t.hblkhd;
- ret.usmblks+=t.usmblks;
- ret.uordblks+=t.uordblks;
- ret.fordblks+=t.fordblks;
- ret.keepcost+=t.keepcost;
-#endif
- }
- return ret;
-}
-int nedpmallopt(nedpool *p, int parno, int value) THROWSPEC
-{
-#if USE_ALLOCATOR==1
- return mspace_mallopt(parno, value);
-#else
- return 0;
-#endif
-}
-NEDMALLOCNOALIASATTR void* nedmalloc_internals(size_t *granularity, size_t *magic) THROWSPEC
-{
-#if USE_ALLOCATOR==1
- if(granularity) *granularity=mparams.granularity;
- if(magic) *magic=mparams.magic;
- return (void *) &syspool;
-#else
- if(granularity) *granularity=0;
- if(magic) *magic=0;
- return 0;
-#endif
-}
-int nedpmalloc_trim(nedpool *p, size_t pad) THROWSPEC
-{
- int n, ret=0;
- if(!p) { p=&syspool; if(!syspool.threads) InitPool(&syspool, 0, -1); }
- for(n=0; p->m[n]; n++)
- {
-#if USE_ALLOCATOR==1
- ret+=mspace_trim(p->m[n], pad);
-#endif
- }
- return ret;
-}
-void nedpmalloc_stats(nedpool *p) THROWSPEC
-{
- int n;
- if(!p) { p=&syspool; if(!syspool.threads) InitPool(&syspool, 0, -1); }
- for(n=0; p->m[n]; n++)
- {
-#if USE_ALLOCATOR==1
- mspace_malloc_stats(p->m[n]);
-#endif
- }
-}
-size_t nedpmalloc_footprint(nedpool *p) THROWSPEC
-{
- size_t ret=0;
- int n;
- if(!p) { p=&syspool; if(!syspool.threads) InitPool(&syspool, 0, -1); }
- for(n=0; p->m[n]; n++)
- {
-#if USE_ALLOCATOR==1
- ret+=mspace_footprint(p->m[n]);
-#endif
- }
- return ret;
-}
-NEDMALLOCPTRATTR void **nedpindependent_calloc(nedpool *p, size_t elemsno, size_t elemsize, void **chunks) THROWSPEC
-{
- void **ret;
- threadcache *tc;
- int mymspace;
- GetThreadCache(&p, &tc, &mymspace, &elemsize);
-#if USE_ALLOCATOR==0
- GETMSPACE(m, p, tc, mymspace, elemsno*elemsize,
- ret=unsupported_operation("independent_calloc"));
-#elif USE_ALLOCATOR==1
- GETMSPACE(m, p, tc, mymspace, elemsno*elemsize,
- ret=mspace_independent_calloc(m, elemsno, elemsize, chunks));
-#endif
- return ret;
-}
-NEDMALLOCPTRATTR void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **chunks) THROWSPEC
-{
- void **ret;
- threadcache *tc;
- int mymspace;
- size_t i, *adjustedsizes=(size_t *) alloca(elems*sizeof(size_t));
- if(!adjustedsizes) return 0;
- for(i=0; i<elems; i++)
- adjustedsizes[i]=sizes[i]<sizeof(threadcacheblk) ? sizeof(threadcacheblk) : sizes[i];
- GetThreadCache(&p, &tc, &mymspace, 0);
-#if USE_ALLOCATOR==0
- GETMSPACE(m, p, tc, mymspace, 0,
- ret=unsupported_operation("independent_comalloc"));
-#elif USE_ALLOCATOR==1
- GETMSPACE(m, p, tc, mymspace, 0,
- ret=mspace_independent_comalloc(m, elems, adjustedsizes, chunks));
-#endif
- return ret;
-}
-
-#if defined(__cplusplus)
-}
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif
diff --git a/drivers/nedmalloc/nedmalloc.h b/drivers/nedmalloc/nedmalloc.h
deleted file mode 100644
index 7ec65849f..000000000
--- a/drivers/nedmalloc/nedmalloc.h
+++ /dev/null
@@ -1,302 +0,0 @@
-#ifdef NEDMALLOC_ENABLED
-
-/* nedalloc, an alternative malloc implementation for multiple threads without
-lock contention based on dlmalloc v2.8.3. (C) 2005-2009 Niall Douglas
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef NEDMALLOC_H
-#define NEDMALLOC_H
-
-#include "typedefs.h"
-#define MALLOC_ALIGNMENT DEFAULT_ALIGNMENT
-
-#ifdef PSP_ENABLED
-#define USE_LOCKS 0
-#define HAVE_MMAP 0
-#endif
-
-/* See malloc.c.h for what each function does.
-
-REPLACE_SYSTEM_ALLOCATOR on POSIX causes nedalloc's functions to be called
-malloc, free etc. instead of nedmalloc, nedfree etc. You may or may not want
-this. On Windows it causes nedmalloc to patch all loaded DLLs and binaries
-to replace usage of the system allocator.
-
-NO_NED_NAMESPACE prevents the functions from being defined in the nedalloc
-namespace when in C++ (uses the global namespace instead).
-
-NEDMALLOCEXTSPEC can be defined to be __declspec(dllexport) or
-__attribute__ ((visibility("default"))) or whatever you like. It defaults
-to extern unless NEDMALLOC_DLL_EXPORTS is set as it would be when building
-nedmalloc.dll.
-
-USE_LOCKS can be 2 if you want to define your own MLOCK_T, INITIAL_LOCK,
-ACQUIRE_LOCK, RELEASE_LOCK, TRY_LOCK, IS_LOCKED and NULL_LOCK_INITIALIZER.
-
-NEDMALLOC_DEBUG can be defined to cause DEBUG to be set differently for nedmalloc
-than for the rest of the build. Remember to set NDEBUG to disable all assertion
-checking too.
-
-USE_MAGIC_HEADERS causes nedalloc to allocate an extra three sizeof(size_t)
-to each block. nedpfree() and nedprealloc() can then automagically know when
-to free a system allocated block. Enabling this typically adds 20-50% to
-application memory usage.
-
-ENABLE_TOLERANT_NEDMALLOC is automatically turned on if REPLACE_SYSTEM_ALLOCATOR
-is set or the Windows DLL is being built. This causes nedmalloc to detect when a
-system allocator block is passed to it and to handle it appropriately. Note that
-without USE_MAGIC_HEADERS there is a very tiny chance that nedmalloc will segfault
-on non-Windows builds (it uses Win32 SEH to trap segfaults on Windows and there
-is no comparable system on POSIX).
-
-USE_ALLOCATOR can be one of these settings (it defaults to 1):
- 0: System allocator (nedmalloc now simply acts as a threadcache).
- WARNING: Intended for DEBUG USE ONLY - not all functions work correctly.
- 1: dlmalloc
-
-ENABLE_LARGE_PAGES enables support for requesting memory from the system in large
-(typically >=2Mb) pages if the host OS supports this. These occupy just a single
-TLB entry and can significantly improve performance in large working set applications.
-
-ENABLE_FAST_HEAP_DETECTION enables special logic to detect blocks allocated
-by the system heap. This avoids 1.5%-2% overhead when checking for non-nedmalloc
-blocks, but it assumes that the NT and glibc heaps function in a very specific
-fashion which may not hold true across OS upgrades.
-*/
-
-#include <stddef.h> /* for size_t */
-
-#ifndef NEDMALLOCEXTSPEC
- #ifdef NEDMALLOC_DLL_EXPORTS
- #ifdef WIN32
- #define NEDMALLOCEXTSPEC extern __declspec(dllexport)
- #elif defined(__GNUC__)
- #define NEDMALLOCEXTSPEC extern __attribute__ ((visibility("default")))
- #endif
- #ifndef ENABLE_TOLERANT_NEDMALLOC
- #define ENABLE_TOLERANT_NEDMALLOC 1
- #endif
- #else
- #define NEDMALLOCEXTSPEC extern
- #endif
-#endif
-
-#if __STDC_VERSION__ >= 199901L /* C99 or better */
- #define RESTRICT restrict
-#else
- #if defined(_MSC_VER) && _MSC_VER>=1400
- #define RESTRICT __restrict
- #endif
- #ifdef __GNUC__
- #define RESTRICT __restrict
- #endif
-#endif
-#ifndef RESTRICT
- #define RESTRICT
-#endif
-
-#if defined(_MSC_VER) && _MSC_VER>=1400
- #define NEDMALLOCPTRATTR __declspec(restrict)
- #define NEDMALLOCNOALIASATTR __declspec(noalias)
-#endif
-#ifdef __GNUC__
- #define NEDMALLOCPTRATTR __attribute__ ((malloc))
-#endif
-#ifndef NEDMALLOCPTRATTR
- #define NEDMALLOCPTRATTR
-#endif
-#ifndef NEDMALLOCNOALIASATTR
- #define NEDMALLOCNOALIASATTR
-#endif
-
-#ifndef USE_MAGIC_HEADERS
- #define USE_MAGIC_HEADERS 0
-#endif
-
-#ifndef USE_ALLOCATOR
- #define USE_ALLOCATOR 1 /* dlmalloc */
-#endif
-
-#if !USE_ALLOCATOR && !USE_MAGIC_HEADERS
-#error If you are using the system allocator then you MUST use magic headers
-#endif
-
-#ifdef REPLACE_SYSTEM_ALLOCATOR
- #if USE_ALLOCATOR==0
- #error Cannot combine using the system allocator with replacing the system allocator
- #endif
- #ifndef ENABLE_TOLERANT_NEDMALLOC
- #define ENABLE_TOLERANT_NEDMALLOC 1
- #endif
- #ifndef WIN32 /* We have a dedicated patcher for Windows */
- #define nedmalloc malloc
- #define nedcalloc calloc
- #define nedrealloc realloc
- #define nedfree free
- #define nedmemalign memalign
- #define nedmallinfo mallinfo
- #define nedmallopt mallopt
- #define nedmalloc_trim malloc_trim
- #define nedmalloc_stats malloc_stats
- #define nedmalloc_footprint malloc_footprint
- #define nedindependent_calloc independent_calloc
- #define nedindependent_comalloc independent_comalloc
- #ifdef _MSC_VER
- #define nedblksize _msize
- #endif
- #endif
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-struct nedmallinfo {
- size_t arena; /* non-mmapped space allocated from system */
- size_t ordblks; /* number of free chunks */
- size_t smblks; /* always 0 */
- size_t hblks; /* always 0 */
- size_t hblkhd; /* space in mmapped regions */
- size_t usmblks; /* maximum total allocated space */
- size_t fsmblks; /* always 0 */
- size_t uordblks; /* total allocated space */
- size_t fordblks; /* total free space */
- size_t keepcost; /* releasable (via malloc_trim) space */
-};
-#if defined(__cplusplus)
-}
-#endif
-
-#if defined(__cplusplus)
- #if !defined(NO_NED_NAMESPACE)
-namespace nedalloc {
- #else
-extern "C" {
- #endif
- #define THROWSPEC throw()
-#else
- #define THROWSPEC
-#endif
-
-/* These are the global functions */
-
-/* Gets the usable size of an allocated block. Note this will always be bigger than what was
-asked for due to rounding etc. Optionally returns 1 in isforeign if the block came from the
-system allocator - note that there is a small (>0.01%) but real chance of segfault on non-Windows
-systems when passing non-nedmalloc blocks if you don't use USE_MAGIC_HEADERS.
-*/
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR size_t nedblksize(int *RESTRICT isforeign, void *RESTRICT mem) THROWSPEC;
-
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void nedsetvalue(void *v) THROWSPEC;
-
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedmalloc(size_t size) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedcalloc(size_t no, size_t size) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedrealloc(void *mem, size_t size) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void nedfree(void *mem) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedmemalign(size_t alignment, size_t bytes) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR struct nedmallinfo nedmallinfo(void) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR int nedmallopt(int parno, int value) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void* nedmalloc_internals(size_t *granularity, size_t *magic) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR int nedmalloc_trim(size_t pad) THROWSPEC;
-NEDMALLOCEXTSPEC void nedmalloc_stats(void) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR size_t nedmalloc_footprint(void) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC;
-
-/* Destroys the system memory pool used by the functions above.
-Useful for when you have nedmalloc in a DLL you're about to unload.
-If you call ANY nedmalloc functions after calling this you will
-get a fatal exception!
-*/
-NEDMALLOCEXTSPEC void neddestroysyspool() THROWSPEC;
-
-/* These are the pool functions */
-struct nedpool_t;
-typedef struct nedpool_t nedpool;
-
-/* Creates a memory pool for use with the nedp* functions below.
-Capacity is how much to allocate immediately (if you know you'll be allocating a lot
-of memory very soon) which you can leave at zero. Threads specifies how many threads
-will *normally* be accessing the pool concurrently. Setting this to zero means it
-extends on demand, but be careful of this as it can rapidly consume system resources
-where bursts of concurrent threads use a pool at once.
-*/
-NEDMALLOCEXTSPEC NEDMALLOCPTRATTR nedpool *nedcreatepool(size_t capacity, int threads) THROWSPEC;
-
-/* Destroys a memory pool previously created by nedcreatepool().
-*/
-NEDMALLOCEXTSPEC void neddestroypool(nedpool *p) THROWSPEC;
-
-/* Returns a zero terminated snapshot of threadpools existing at the time of call. Call
-nedfree() on the returned list when you are done. Returns zero if there is only the
-system pool in existence.
-*/
-NEDMALLOCEXTSPEC nedpool **nedpoollist() THROWSPEC;
-
-/* Sets a value to be associated with a pool. You can retrieve this value by passing
-any memory block allocated from that pool.
-*/
-NEDMALLOCEXTSPEC void nedpsetvalue(nedpool *p, void *v) THROWSPEC;
-
-/* Gets a previously set value using nedpsetvalue() or zero if memory is unknown.
-Optionally can also retrieve pool. You can detect an unknown block by the return
-being zero and *p being unmodifed.
-*/
-NEDMALLOCEXTSPEC void *nedgetvalue(nedpool **p, void *mem) THROWSPEC;
-
-/* Trims the thread cache for the calling thread, returning any existing cache
-data to the central pool. Remember to ALWAYS call with zero if you used the
-system pool. Setting disable to non-zero replicates neddisablethreadcache().
-*/
-NEDMALLOCEXTSPEC void nedtrimthreadcache(nedpool *p, int disable) THROWSPEC;
-
-/* Disables the thread cache for the calling thread, returning any existing cache
-data to the central pool. Remember to ALWAYS call with zero if you used the
-system pool.
-*/
-NEDMALLOCEXTSPEC void neddisablethreadcache(nedpool *p) THROWSPEC;
-
-
-NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpmalloc(nedpool *p, size_t size) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpcalloc(nedpool *p, size_t no, size_t size) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedprealloc(nedpool *p, void *mem, size_t size) THROWSPEC;
-NEDMALLOCEXTSPEC void nedpfree(nedpool *p, void *mem) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpmemalign(nedpool *p, size_t alignment, size_t bytes) THROWSPEC;
-NEDMALLOCEXTSPEC struct nedmallinfo nedpmallinfo(nedpool *p) THROWSPEC;
-NEDMALLOCEXTSPEC int nedpmallopt(nedpool *p, int parno, int value) THROWSPEC;
-NEDMALLOCEXTSPEC int nedpmalloc_trim(nedpool *p, size_t pad) THROWSPEC;
-NEDMALLOCEXTSPEC void nedpmalloc_stats(nedpool *p) THROWSPEC;
-NEDMALLOCEXTSPEC size_t nedpmalloc_footprint(nedpool *p) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void **nedpindependent_calloc(nedpool *p, size_t elemsno, size_t elemsize, void **chunks) THROWSPEC;
-NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **chunks) THROWSPEC;
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
-
-#endif
diff --git a/drivers/nrex/SCsub b/drivers/nrex/SCsub
index a00c7b86f..0582e0197 100644
--- a/drivers/nrex/SCsub
+++ b/drivers/nrex/SCsub
@@ -1,7 +1,5 @@
Import('env')
-sources = [
- 'nrex.cpp',
- 'regex.cpp',
-]
-env.add_source_files(env.drivers_sources, sources)
+env.add_source_files(env.drivers_sources, "*.cpp")
+
+Export('env')
diff --git a/drivers/ogg/SCsub b/drivers/ogg/SCsub
deleted file mode 100644
index 3ee1bb640..000000000
--- a/drivers/ogg/SCsub
+++ /dev/null
@@ -1,9 +0,0 @@
-Import('env')
-
-ogg_sources = [
-
- "ogg/bitwise.c",
- "ogg/framing.c",
-]
-
-env.drivers_sources+=ogg_sources
diff --git a/drivers/openssl/SCsub b/drivers/openssl/SCsub
deleted file mode 100644
index 40e3d0c0f..000000000
--- a/drivers/openssl/SCsub
+++ /dev/null
@@ -1,6 +0,0 @@
-Import('env_drivers')
-Import('env')
-
-env_drivers.add_source_files(env.drivers_sources,"*.cpp")
-env_drivers.add_source_files(env.drivers_sources,"*.c")
-
diff --git a/drivers/opus/SCsub b/drivers/opus/SCsub
deleted file mode 100644
index bed8b496f..000000000
--- a/drivers/opus/SCsub
+++ /dev/null
@@ -1,196 +0,0 @@
-Import('env')
-
-opus_sources = [
- "opus/audio_stream_opus.cpp",
-]
-
-opus_sources_silk=[]
-
-opus_sources_lib = [
- "opus/silk/tables_other.c",
- "opus/silk/sum_sqr_shift.c",
- "opus/silk/PLC.c",
- "opus/silk/dec_API.c",
- "opus/silk/decode_pulses.c",
- "opus/silk/inner_prod_aligned.c",
- "opus/silk/init_encoder.c",
- "opus/silk/interpolate.c",
- "opus/silk/stereo_encode_pred.c",
- "opus/silk/decode_frame.c",
- "opus/silk/NLSF_del_dec_quant.c",
- "opus/silk/VAD.c",
- "opus/silk/resampler_private_AR2.c",
- "opus/silk/NLSF_unpack.c",
- "opus/silk/resampler_down2.c",
- "opus/silk/sort.c",
- "opus/silk/resampler_private_IIR_FIR.c",
- "opus/silk/resampler_down2_3.c",
- "opus/silk/resampler_private_up2_HQ.c",
- "opus/silk/tables_gain.c",
- "opus/silk/stereo_find_predictor.c",
- "opus/silk/stereo_quant_pred.c",
- "opus/silk/NLSF_stabilize.c",
- "opus/silk/ana_filt_bank_1.c",
- "opus/silk/check_control_input.c",
- "opus/silk/bwexpander.c",
- "opus/silk/A2NLSF.c",
- "opus/silk/LPC_inv_pred_gain.c",
- "opus/silk/log2lin.c",
- "opus/silk/process_NLSFs.c",
- "opus/silk/sigm_Q15.c",
- "opus/silk/VQ_WMat_EC.c",
- "opus/silk/quant_LTP_gains.c",
- "opus/silk/resampler_private_down_FIR.c",
- "opus/silk/NLSF_decode.c",
- "opus/silk/control_codec.c",
- "opus/silk/NLSF_VQ_weights_laroia.c",
- "opus/silk/decode_pitch.c",
- "opus/silk/stereo_decode_pred.c",
- "opus/silk/tables_pulses_per_block.c",
- "opus/silk/init_decoder.c",
- "opus/silk/table_LSF_cos.c",
- "opus/silk/decode_core.c",
- "opus/silk/code_signs.c",
- "opus/silk/enc_API.c",
- "opus/silk/tables_LTP.c",
- "opus/silk/pitch_est_tables.c",
- "opus/silk/biquad_alt.c",
- "opus/silk/encode_indices.c",
- "opus/silk/tables_NLSF_CB_WB.c",
- "opus/silk/debug.c",
- "opus/silk/decode_parameters.c",
- "opus/silk/tables_pitch_lag.c",
- "opus/silk/NLSF2A.c",
- "opus/silk/resampler.c",
- "opus/silk/decode_indices.c",
- "opus/silk/NLSF_VQ.c",
- "opus/silk/bwexpander_32.c",
- "opus/silk/tables_NLSF_CB_NB_MB.c",
- "opus/silk/encode_pulses.c",
- "opus/silk/NSQ_del_dec.c",
- "opus/silk/control_SNR.c",
- "opus/silk/shell_coder.c",
- "opus/silk/NLSF_encode.c",
- "opus/silk/stereo_MS_to_LR.c",
- "opus/silk/stereo_LR_to_MS.c",
- "opus/silk/HP_variable_cutoff.c",
- "opus/silk/LPC_analysis_filter.c",
- "opus/silk/CNG.c",
- "opus/silk/decoder_set_fs.c",
- "opus/silk/resampler_rom.c",
- "opus/silk/control_audio_bandwidth.c",
- "opus/silk/lin2log.c",
- "opus/silk/LP_variable_cutoff.c",
- "opus/silk/NSQ.c",
- "opus/silk/gain_quant.c",
- "opus/celt/laplace.c",
- "opus/celt/vq.c",
- "opus/celt/quant_bands.c",
- "opus/celt/kiss_fft.c",
- "opus/celt/entcode.c",
- "opus/celt/entenc.c",
- "opus/celt/celt_lpc.c",
- "opus/celt/pitch.c",
- "opus/celt/rate.c",
- "opus/celt/mathops.c",
- #"opus/celt/arm/armcpu.c",
- #"opus/celt/arm/celt_neon_intr.c",
- #"opus/celt/arm/celt_ne10_mdct.c",
- #"opus/celt/arm/celt_ne10_fft.c",
- #"opus/celt/arm/arm_celt_map.c",
- "opus/celt/celt_encoder.c",
- "opus/celt/celt.c",
- "opus/celt/bands.c",
- "opus/celt/cwrs.c",
- "opus/celt/entdec.c",
- "opus/celt/celt_decoder.c",
- "opus/celt/mdct.c",
- "opus/celt/modes.c",
- "opus/repacketizer.c",
- "opus/mlp_data.c",
- "opus/opus_multistream.c",
- "opus/opusfile.c",
- "opus/opus_encoder.c",
- "opus/analysis.c",
- "opus/mlp.c",
- "opus/info.c",
- "opus/stream.c",
- "opus/opus_decoder.c",
- "opus/internal.c",
- "opus/wincerts.c",
- "opus/opus.c",
- "opus/opus_multistream_encoder.c",
- "opus/http.c",
- "opus/opus_multistream_decoder.c"
-]
-
-if("opus_fixed_point" in env and env.opus_fixed_point=="yes"):
- env.Append(CFLAGS=["-DOPUS_FIXED_POINT"])
- opus_sources_silk = [
- "opus/silk/fixed/schur64_FIX.c",
- "opus/silk/fixed/residual_energy16_FIX.c",
- "opus/silk/fixed/encode_frame_FIX.c",
- "opus/silk/fixed/regularize_correlations_FIX.c",
- "opus/silk/fixed/apply_sine_window_FIX.c",
- "opus/silk/fixed/solve_LS_FIX.c",
- "opus/silk/fixed/schur_FIX.c",
- "opus/silk/fixed/pitch_analysis_core_FIX.c",
- "opus/silk/fixed/noise_shape_analysis_FIX.c",
- "opus/silk/fixed/find_LTP_FIX.c",
- "opus/silk/fixed/vector_ops_FIX.c",
- "opus/silk/fixed/autocorr_FIX.c",
- "opus/silk/fixed/warped_autocorrelation_FIX.c",
- "opus/silk/fixed/find_pitch_lags_FIX.c",
- "opus/silk/fixed/k2a_Q16_FIX.c",
- "opus/silk/fixed/LTP_scale_ctrl_FIX.c",
- "opus/silk/fixed/corrMatrix_FIX.c",
- "opus/silk/fixed/prefilter_FIX.c",
- "opus/silk/fixed/find_LPC_FIX.c",
- "opus/silk/fixed/residual_energy_FIX.c",
- "opus/silk/fixed/process_gains_FIX.c",
- "opus/silk/fixed/LTP_analysis_filter_FIX.c",
- "opus/silk/fixed/k2a_FIX.c",
- "opus/silk/fixed/burg_modified_FIX.c",
- "opus/silk/fixed/find_pred_coefs_FIX.c"
- ]
-else:
- opus_sources_silk = [
- "opus/silk/float/LTP_scale_ctrl_FLP.c",
- "opus/silk/float/regularize_correlations_FLP.c",
- "opus/silk/float/corrMatrix_FLP.c",
- "opus/silk/float/LPC_analysis_filter_FLP.c",
- "opus/silk/float/levinsondurbin_FLP.c",
- "opus/silk/float/schur_FLP.c",
- "opus/silk/float/scale_vector_FLP.c",
- "opus/silk/float/apply_sine_window_FLP.c",
- "opus/silk/float/pitch_analysis_core_FLP.c",
- "opus/silk/float/wrappers_FLP.c",
- "opus/silk/float/bwexpander_FLP.c",
- "opus/silk/float/warped_autocorrelation_FLP.c",
- "opus/silk/float/solve_LS_FLP.c",
- "opus/silk/float/find_LPC_FLP.c",
- "opus/silk/float/autocorrelation_FLP.c",
- "opus/silk/float/find_pred_coefs_FLP.c",
- "opus/silk/float/find_pitch_lags_FLP.c",
- "opus/silk/float/burg_modified_FLP.c",
- "opus/silk/float/find_LTP_FLP.c",
- "opus/silk/float/energy_FLP.c",
- "opus/silk/float/sort_FLP.c",
- "opus/silk/float/LPC_inv_pred_gain_FLP.c",
- "opus/silk/float/k2a_FLP.c",
- "opus/silk/float/noise_shape_analysis_FLP.c",
- "opus/silk/float/inner_product_FLP.c",
- "opus/silk/float/process_gains_FLP.c",
- "opus/silk/float/encode_frame_FLP.c",
- "opus/silk/float/scale_copy_vector_FLP.c",
- "opus/silk/float/residual_energy_FLP.c",
- "opus/silk/float/LTP_analysis_filter_FLP.c",
- "opus/silk/float/prefilter_FLP.c"
- ]
-
-
-env.drivers_sources+=opus_sources_silk
-env.drivers_sources+=opus_sources_lib
-env.drivers_sources+=opus_sources
-
-Export('env')
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index 96ef9fa5f..1e3f54a9c 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -1,42 +1,48 @@
Import('env')
-Import('env_drivers')
+env_png = env.Clone()
-png_sources = [
- "png/png.c",
- "png/pngerror.c",
- "png/pngget.c",
- "png/pngmem.c",
- "png/pngpread.c",
- "png/pngread.c",
- "png/pngrio.c",
- "png/pngrtran.c",
- "png/pngrutil.c",
- "png/pngset.c",
- "png/pngtrans.c",
- "png/pngwio.c",
- "png/pngwrite.c",
- "png/pngwtran.c",
- "png/pngwutil.c",
- "png/resource_saver_png.cpp",
- "png/image_loader_png.cpp"
-]
+# Thirdparty source files
+if (env["libpng"] == "builtin"):
+ thirdparty_dir = "#thirdparty/libpng/"
+ thirdparty_sources = [
+ "png.c",
+ "pngerror.c",
+ "pngget.c",
+ "pngmem.c",
+ "pngpread.c",
+ "pngread.c",
+ "pngrio.c",
+ "pngrtran.c",
+ "pngrutil.c",
+ "pngset.c",
+ "pngtrans.c",
+ "pngwio.c",
+ "pngwrite.c",
+ "pngwtran.c",
+ "pngwutil.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-# Currently .ASM filter_neon.S does not compile on NT.
-import os
-if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
- env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
- env_neon = env_drivers.Clone();
- if "S_compiler" in env:
- env_neon['CC'] = env['S_compiler']
- #env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"])
- png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c"))
- png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S"))
-else:
- env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
+ env_png.add_source_files(env.drivers_sources, thirdparty_sources)
+ env_png.Append(CPPPATH = [thirdparty_dir])
-env.drivers_sources+=png_sources
+ # Currently .ASM filter_neon.S does not compile on NT.
+ import os
+ if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
+ env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=2"])
+ env_neon = env_png.Clone();
+ if "S_compiler" in env:
+ env_neon['CC'] = env['S_compiler']
+ neon_sources = []
+ neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
+ neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
+ neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
+ env.drivers_sources += neon_sources
+ else:
+ env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=0"])
-#env.add_source_files(env.drivers_sources, png_sources)
+# Godot source files
+env_png.add_source_files(env.drivers_sources, "*.cpp")
Export('env')
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 4967b0f9d..ab3f3e78f 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -30,6 +30,7 @@
#include "print_string.h"
#include "os/os.h"
+
#include <string.h>
diff --git a/drivers/png/image_loader_png.h b/drivers/png/image_loader_png.h
index d87d67d89..c146e3f5a 100644
--- a/drivers/png/image_loader_png.h
+++ b/drivers/png/image_loader_png.h
@@ -30,7 +30,8 @@
#define IMAGE_LOADER_PNG_H
#include "io/image_loader.h"
-#include "drivers/png/png.h"
+
+#include <png.h>
/**
@author Juan Linietsky <reduzio@gmail.com>
diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp
index 2578fe9eb..e7987f27b 100644
--- a/drivers/png/resource_saver_png.cpp
+++ b/drivers/png/resource_saver_png.cpp
@@ -27,11 +27,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "resource_saver_png.h"
-#include "scene/resources/texture.h"
-#include "drivers/png/png.h"
-#include "os/file_access.h"
-#include "globals.h"
+
#include "core/image.h"
+#include "globals.h"
+#include "os/file_access.h"
+#include "scene/resources/texture.h"
+
+#include <png.h>
static void _write_png_data(png_structp png_ptr,png_bytep data, png_size_t p_length) {
diff --git a/drivers/pnm/SCsub b/drivers/pnm/SCsub
deleted file mode 100644
index 28b35773a..000000000
--- a/drivers/pnm/SCsub
+++ /dev/null
@@ -1,10 +0,0 @@
-Import('env')
-
-
-pnm_sources = [
- "pnm/bitmap_loader_pnm.cpp"
- ]
-
-env.drivers_sources+=pnm_sources
-
-#env.add_source_files(env.drivers_sources, pnm_sources)
diff --git a/drivers/pulseaudio/SCsub b/drivers/pulseaudio/SCsub
index 9fbb467ba..0582e0197 100644
--- a/drivers/pulseaudio/SCsub
+++ b/drivers/pulseaudio/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.drivers_sources,"*.cpp")
+env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')
diff --git a/drivers/pvr/SCsub b/drivers/pvr/SCsub
deleted file mode 100644
index 44b8c3d6b..000000000
--- a/drivers/pvr/SCsub
+++ /dev/null
@@ -1,15 +0,0 @@
-Import('env')
-
-
-pvr_sources = [
- "pvr/BitScale.cpp",
- "pvr/MortonTable.cpp",
- "pvr/PvrTcDecoder.cpp",
- "pvr/PvrTcEncoder.cpp",
- "pvr/PvrTcPacket.cpp",
- "pvr/texture_loader_pvr.cpp"
- ]
-
-env.drivers_sources+=pvr_sources
-
-#env.add_source_files(env.drivers_sources, pvr_sources)
diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp
index 8354de8c6..7486d4f21 100644
--- a/drivers/register_driver_types.cpp
+++ b/drivers/register_driver_types.cpp
@@ -28,21 +28,9 @@
/*************************************************************************/
#include "register_driver_types.h"
+#include "core/math/geometry.h"
#include "png/image_loader_png.h"
-#include "webp/image_loader_webp.h"
#include "png/resource_saver_png.h"
-#include "jpegd/image_loader_jpegd.h"
-#include "dds/texture_loader_dds.h"
-#include "etc1/texture_loader_pkm.h"
-#include "pvr/texture_loader_pvr.h"
-#include "etc1/image_etc.h"
-#include "chibi/event_stream_chibi.h"
-#include "pnm/bitmap_loader_pnm.h"
-
-
-#ifdef TOOLS_ENABLED
-#include "squish/image_compress_squish.h"
-#endif
#ifdef TOOLS_ENABLED
#include "convex_decomp/b2d_decompose.h"
@@ -52,276 +40,38 @@
#include "platform/windows/export/export.h"
#endif
-#ifdef TREMOR_ENABLED
-#include "teora/audio_stream_ogg.h"
-#endif
-
-#ifdef VORBIS_ENABLED
-#include "vorbis/audio_stream_ogg_vorbis.h"
-#endif
-
-#ifdef OPUS_ENABLED
-#include "opus/audio_stream_opus.h"
-#endif
-
-#ifdef SPEEX_ENABLED
-#include "speex/audio_stream_speex.h"
-#endif
-
-#ifdef THEORA_ENABLED
-#include "theora/video_stream_theora.h"
-#endif
-
-
#include "drivers/nrex/regex.h"
-#ifdef MUSEPACK_ENABLED
-#include "mpc/audio_stream_mpc.h"
-#endif
-
-#ifdef PNG_ENABLED
static ImageLoaderPNG *image_loader_png=NULL;
static ResourceSaverPNG *resource_saver_png=NULL;
-#endif
-
-#ifdef WEBP_ENABLED
-static ImageLoaderWEBP *image_loader_webp=NULL;
-//static ResourceSaverPNG *resource_saver_png=NULL;
-#endif
-
-#ifdef JPG_ENABLED
-static ImageLoaderJPG *image_loader_jpg=NULL;
-#endif
-
-#ifdef DDS_ENABLED
-static ResourceFormatDDS *resource_loader_dds=NULL;
-#endif
-
-#ifdef ETC1_ENABLED
-static ResourceFormatPKM *resource_loader_pkm=NULL;
-#endif
-
-
-#ifdef PVR_ENABLED
-static ResourceFormatPVR *resource_loader_pvr=NULL;
-#endif
-
-#ifdef TREMOR_ENABLED
-static ResourceFormatLoaderAudioStreamOGG *vorbis_stream_loader=NULL;
-#endif
-
-#ifdef VORBIS_ENABLED
-static ResourceFormatLoaderAudioStreamOGGVorbis *vorbis_stream_loader=NULL;
-#endif
-
-#ifdef OPUS_ENABLED
-static ResourceFormatLoaderAudioStreamOpus *opus_stream_loader=NULL;
-#endif
-
-#ifdef SPEEX_ENABLED
-static ResourceFormatLoaderAudioStreamSpeex *speex_stream_loader=NULL;
-#endif
-
-#ifdef THEORA_ENABLED
-static ResourceFormatLoaderVideoStreamTheora* theora_stream_loader = NULL;
-#endif
-
-#ifdef MUSEPACK_ENABLED
-static ResourceFormatLoaderAudioStreamMPC * mpc_stream_loader=NULL;
-#endif
-
-#ifdef OPENSSL_ENABLED
-#include "openssl/register_openssl.h"
-#endif
-
-
-static ResourceFormatPBM * pbm_loader=NULL;
void register_core_driver_types() {
-#ifdef PNG_ENABLED
image_loader_png = memnew( ImageLoaderPNG );
ImageLoader::add_image_format_loader( image_loader_png );
resource_saver_png = memnew( ResourceSaverPNG );
ResourceSaver::add_resource_format_saver(resource_saver_png);
-#endif
-
-#ifdef WEBP_ENABLED
- image_loader_webp = memnew( ImageLoaderWEBP );
- ImageLoader::add_image_format_loader( image_loader_webp );
-
-// resource_saver_png = memnew( ResourceSaverPNG );
-// ResourceSaver::add_resource_format_saver(resource_saver_png);
-
-#endif
-
-#ifdef JPG_ENABLED
-
- image_loader_jpg = memnew( ImageLoaderJPG );
- ImageLoader::add_image_format_loader( image_loader_jpg );
-#endif
-
-
- pbm_loader = memnew( ResourceFormatPBM );
- ResourceLoader::add_resource_format_loader(pbm_loader);
-
ObjectTypeDB::register_type<RegEx>();
}
void unregister_core_driver_types() {
-#ifdef PNG_ENABLED
if (image_loader_png)
memdelete( image_loader_png );
if (resource_saver_png)
memdelete( resource_saver_png );
-#endif
-
-#ifdef WEBP_ENABLED
- if (image_loader_webp)
- memdelete( image_loader_webp );
-// if (resource_saver_png)
-// memdelete( resource_saver_png );
-#endif
-
-#ifdef JPG_ENABLED
- if (image_loader_jpg)
- memdelete( image_loader_jpg );
-#endif
-
- memdelete( pbm_loader );
}
void register_driver_types() {
-#ifdef TREMOR_ENABLED
- vorbis_stream_loader=memnew( ResourceFormatLoaderAudioStreamOGG );
- ResourceLoader::add_resource_format_loader(vorbis_stream_loader );
- ObjectTypeDB::register_type<AudioStreamOGG>();
-#endif
-
-#ifdef VORBIS_ENABLED
- vorbis_stream_loader=memnew( ResourceFormatLoaderAudioStreamOGGVorbis );
- ResourceLoader::add_resource_format_loader(vorbis_stream_loader );
- ObjectTypeDB::register_type<AudioStreamOGGVorbis>();
-#endif
-
-#ifdef OPUS_ENABLED
- opus_stream_loader=memnew( ResourceFormatLoaderAudioStreamOpus );
- ResourceLoader::add_resource_format_loader( opus_stream_loader );
- ObjectTypeDB::register_type<AudioStreamOpus>();
-#endif
-
-#ifdef DDS_ENABLED
- resource_loader_dds = memnew( ResourceFormatDDS );
- ResourceLoader::add_resource_format_loader(resource_loader_dds );
-#endif
-
-#ifdef ETC1_ENABLED
- resource_loader_pkm = memnew( ResourceFormatPKM );
- ResourceLoader::add_resource_format_loader(resource_loader_pkm);
-#endif
-
-#ifdef PVR_ENABLED
- resource_loader_pvr = memnew( ResourceFormatPVR );
- ResourceLoader::add_resource_format_loader(resource_loader_pvr );
-#endif
-
#ifdef TOOLS_ENABLED
-
Geometry::_decompose_func=b2d_decompose;
#endif
-
-#ifdef SPEEX_ENABLED
- speex_stream_loader=memnew( ResourceFormatLoaderAudioStreamSpeex );
- ResourceLoader::add_resource_format_loader(speex_stream_loader);
- ObjectTypeDB::register_type<AudioStreamSpeex>();
-#endif
-
-#ifdef MUSEPACK_ENABLED
-
- mpc_stream_loader=memnew( ResourceFormatLoaderAudioStreamMPC );
- ResourceLoader::add_resource_format_loader(mpc_stream_loader);
- ObjectTypeDB::register_type<AudioStreamMPC>();
-
-#endif
-
-#ifdef OPENSSL_ENABLED
-
- register_openssl();
-#endif
-
-#ifdef THEORA_ENABLED
- theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
- ResourceLoader::add_resource_format_loader(theora_stream_loader);
- ObjectTypeDB::register_type<VideoStreamTheora>();
-#endif
-
-
-#ifdef TOOLS_ENABLED
-#ifdef SQUISH_ENABLED
-
- Image::set_compress_bc_func(image_compress_squish);
-
-#endif
-#endif
-
-#ifdef ETC1_ENABLED
- _register_etc1_compress_func();
-#endif
-
- initialize_chibi();
}
void unregister_driver_types() {
-
-
-#ifdef TREMOR_ENABLED
- memdelete( vorbis_stream_loader );
-#endif
-
-#ifdef VORBIS_ENABLED
- memdelete( vorbis_stream_loader );
-#endif
-
-#ifdef OPUS_ENABLED
- memdelete( opus_stream_loader );
-#endif
-
-#ifdef SPEEX_ENABLED
- memdelete( speex_stream_loader );
-#endif
-
-#ifdef THEORA_ENABLED
- memdelete (theora_stream_loader);
-#endif
-
-
-#ifdef MUSEPACK_ENABLED
-
- memdelete (mpc_stream_loader);
-#endif
-
-#ifdef DDS_ENABLED
- memdelete(resource_loader_dds);
-#endif
-
-#ifdef ETC1_ENABLED
- memdelete(resource_loader_pkm);
-#endif
-
-#ifdef PVR_ENABLED
- memdelete(resource_loader_pvr);
-#endif
-
-#ifdef OPENSSL_ENABLED
-
- unregister_openssl();
-#endif
-
- finalize_chibi();
}
diff --git a/drivers/rtaudio/SCsub b/drivers/rtaudio/SCsub
index 6699efef7..836c84c43 100644
--- a/drivers/rtaudio/SCsub
+++ b/drivers/rtaudio/SCsub
@@ -1,4 +1,18 @@
Import('env')
-Export('env');
-env.add_source_files(env.drivers_sources,"*.cpp")
+# Not cloning the env, the includes need to be accessible for platform/
+
+# Thirdparty source files
+thirdparty_dir = "#thirdparty/rtaudio/"
+thirdparty_sources = [
+ "RtAudio.cpp",
+]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+env.add_source_files(env.drivers_sources, thirdparty_sources)
+env.Append(CPPPATH = [thirdparty_dir])
+
+# Driver source files
+env.add_source_files(env.drivers_sources, "*.cpp")
+
+Export('env')
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index 1bea82868..fbe7ac68d 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -27,8 +27,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_driver_rtaudio.h"
+
#include "globals.h"
#include "os/os.h"
+
#ifdef RTAUDIO_ENABLED
const char* AudioDriverRtAudio::get_name() const {
diff --git a/drivers/rtaudio/audio_driver_rtaudio.h b/drivers/rtaudio/audio_driver_rtaudio.h
index ccb3d005c..82055f6d1 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.h
+++ b/drivers/rtaudio/audio_driver_rtaudio.h
@@ -32,7 +32,8 @@
#ifdef RTAUDIO_ENABLED
#include "servers/audio/audio_server_sw.h"
-#include "drivers/rtaudio/RtAudio.h"
+
+#include <RtAudio.h>
class AudioDriverRtAudio : public AudioDriverSW {
diff --git a/drivers/speex/SCsub b/drivers/speex/SCsub
deleted file mode 100644
index 5094b259a..000000000
--- a/drivers/speex/SCsub
+++ /dev/null
@@ -1,55 +0,0 @@
-Import('env')
-
-
-
-
-speex_sources = [\
-"speex/bits.c",\
-"speex/buffer.c",\
-"speex/cb_search.c",\
-"speex/exc_10_16_table.c",\
-"speex/exc_10_32_table.c",\
-"speex/exc_20_32_table.c",\
-"speex/exc_5_256_table.c",\
-"speex/exc_5_64_table.c",\
-"speex/exc_8_128_table.c",\
-"speex/fftwrap.c",\
-"speex/filterbank.c",\
-"speex/filters.c",\
-"speex/gain_table.c",\
-"speex/gain_table_lbr.c",\
-"speex/hexc_10_32_table.c",\
-"speex/hexc_table.c",\
-"speex/high_lsp_tables.c",\
-"speex/jitter.c",\
-"speex/kiss_fft.c",\
-"speex/kiss_fftr.c",\
-"speex/lpc.c",\
-"speex/lsp.c",\
-"speex/lsp_tables_nb.c",\
-"speex/ltp.c",\
-"speex/mdf.c",\
-"speex/modes.c",\
-"speex/modes_wb.c",\
-"speex/nb_celp.c",\
-"speex/preprocess.c",\
-"speex/quant_lsp.c",\
-"speex/resample.c",\
-"speex/sb_celp.c",\
-"speex/scal.c",\
-"speex/smallft.c",\
-"speex/speex.c",\
-"speex/speex_callbacks.c",\
-"speex/speex_header.c",\
-"speex/stereo.c",\
-"speex/vbr.c",\
-"speex/vq.c",\
-"speex/window.c",\
-"speex/audio_stream_speex.cpp",
-]
-
-env.drivers_sources+=speex_sources
-
-#env.add_source_files(env.drivers_sources, speex_sources)
-
-Export('env')
diff --git a/drivers/speex/_kiss_fft_guts.h b/drivers/speex/_kiss_fft_guts.h
deleted file mode 100644
index 6571e79c0..000000000
--- a/drivers/speex/_kiss_fft_guts.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define MIN(a,b) ((a)<(b) ? (a):(b))
-#define MAX(a,b) ((a)>(b) ? (a):(b))
-
-/* kiss_fft.h
- defines kiss_fft_scalar as either short or a float type
- and defines
- typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
-#include "kiss_fft.h"
-#include "math_approx.h"
-
-#define MAXFACTORS 32
-/* e.g. an fft of length 128 has 4 factors
- as far as kissfft is concerned
- 4*4*4*2
- */
-
-struct kiss_fft_state{
- int nfft;
- int inverse;
- int factors[2*MAXFACTORS];
- kiss_fft_cpx twiddles[1];
-};
-
-/*
- Explanation of macros dealing with complex math:
-
- C_MUL(m,a,b) : m = a*b
- C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
- C_SUB( res, a,b) : res = a - b
- C_SUBFROM( res , a) : res -= a
- C_ADDTO( res , a) : res += a
- * */
-#ifdef FIXED_POINT
-#include "arch.h"
-# define FRACBITS 15
-# define SAMPPROD spx_int32_t
-#define SAMP_MAX 32767
-
-#define SAMP_MIN -SAMP_MAX
-
-#if defined(CHECK_OVERFLOW)
-# define CHECK_OVERFLOW_OP(a,op,b) \
- if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
- fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); }
-#endif
-
-
-# define smul(a,b) ( (SAMPPROD)(a)*(b) )
-# define sround( x ) (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS )
-
-# define S_MUL(a,b) sround( smul(a,b) )
-
-# define C_MUL(m,a,b) \
- do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
- (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
-
-# define C_MUL4(m,a,b) \
- do{ (m).r = PSHR32( smul((a).r,(b).r) - smul((a).i,(b).i),17 ); \
- (m).i = PSHR32( smul((a).r,(b).i) + smul((a).i,(b).r),17 ); }while(0)
-
-# define DIVSCALAR(x,k) \
- (x) = sround( smul( x, SAMP_MAX/k ) )
-
-# define C_FIXDIV(c,div) \
- do { DIVSCALAR( (c).r , div); \
- DIVSCALAR( (c).i , div); }while (0)
-
-# define C_MULBYSCALAR( c, s ) \
- do{ (c).r = sround( smul( (c).r , s ) ) ;\
- (c).i = sround( smul( (c).i , s ) ) ; }while(0)
-
-#else /* not FIXED_POINT*/
-
-# define S_MUL(a,b) ( (a)*(b) )
-#define C_MUL(m,a,b) \
- do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
- (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
-
-#define C_MUL4(m,a,b) C_MUL(m,a,b)
-
-# define C_FIXDIV(c,div) /* NOOP */
-# define C_MULBYSCALAR( c, s ) \
- do{ (c).r *= (s);\
- (c).i *= (s); }while(0)
-#endif
-
-#ifndef CHECK_OVERFLOW_OP
-# define CHECK_OVERFLOW_OP(a,op,b) /* noop */
-#endif
-
-#define C_ADD( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,+,(b).r)\
- CHECK_OVERFLOW_OP((a).i,+,(b).i)\
- (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \
- }while(0)
-#define C_SUB( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,-,(b).r)\
- CHECK_OVERFLOW_OP((a).i,-,(b).i)\
- (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \
- }while(0)
-#define C_ADDTO( res , a)\
- do { \
- CHECK_OVERFLOW_OP((res).r,+,(a).r)\
- CHECK_OVERFLOW_OP((res).i,+,(a).i)\
- (res).r += (a).r; (res).i += (a).i;\
- }while(0)
-
-#define C_SUBFROM( res , a)\
- do {\
- CHECK_OVERFLOW_OP((res).r,-,(a).r)\
- CHECK_OVERFLOW_OP((res).i,-,(a).i)\
- (res).r -= (a).r; (res).i -= (a).i; \
- }while(0)
-
-
-#ifdef FIXED_POINT
-# define KISS_FFT_COS(phase) floor(MIN(32767,MAX(-32767,.5+32768 * cos (phase))))
-# define KISS_FFT_SIN(phase) floor(MIN(32767,MAX(-32767,.5+32768 * sin (phase))))
-# define HALF_OF(x) ((x)>>1)
-#elif defined(USE_SIMD)
-# define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) )
-# define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) )
-# define HALF_OF(x) ((x)*_mm_set1_ps(.5))
-#else
-# define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase)
-# define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase)
-# define HALF_OF(x) ((x)*.5)
-#endif
-
-#define kf_cexp(x,phase) \
- do{ \
- (x)->r = KISS_FFT_COS(phase);\
- (x)->i = KISS_FFT_SIN(phase);\
- }while(0)
-#define kf_cexp2(x,phase) \
- do{ \
- (x)->r = spx_cos_norm((phase));\
- (x)->i = spx_cos_norm((phase)-32768);\
-}while(0)
-
-
-/* a debugging function */
-#define pcpx(c)\
- fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
diff --git a/drivers/speex/arch.h b/drivers/speex/arch.h
deleted file mode 100644
index e2513dae4..000000000
--- a/drivers/speex/arch.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
- @file arch.h
- @brief Various architecture definitions Speex
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef ARCH_H
-#define ARCH_H
-
-#ifndef SPEEX_VERSION
-#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */
-#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */
-#define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */
-#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */
-#define SPEEX_VERSION "speex-1.2beta3" /**< Speex version string. */
-#endif
-
-#include "os_support.h"
-/* A couple test to catch stupid option combinations */
-
-//custom engine code
-#ifndef FIXED_POINT
-#define FLOATING_POINT
-#endif
-#define USE_SMALLFT
-#define EXPORT
-//end of custom engine code
-
-#ifdef FIXED_POINT
-
-#ifdef FLOATING_POINT
-#error You cannot compile as floating point and fixed point at the same time
-#endif
-#ifdef _USE_SSE
-#error SSE is only for floating-point
-#endif
-#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
-#error Make up your mind. What CPU do you have?
-#endif
-#ifdef VORBIS_PSYCHO
-#error Vorbis-psy model currently not implemented in fixed-point
-#endif
-
-#else
-
-#ifndef FLOATING_POINT
-#error You now need to define either FIXED_POINT or FLOATING_POINT
-#endif
-#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
-#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
-#endif
-#ifdef FIXED_POINT_DEBUG
-#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
-#endif
-
-
-#endif
-
-#ifndef OUTSIDE_SPEEX
-#include "speex/speex_types.h"
-#endif
-
-#define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */
-#define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */
-#define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */
-#define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */
-#define ABS32(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 32-bit value. */
-#define MIN32(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 32-bit value. */
-#define MAX32(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */
-
-#ifdef FIXED_POINT
-
-typedef spx_int16_t spx_word16_t;
-typedef spx_int32_t spx_word32_t;
-typedef spx_word32_t spx_mem_t;
-typedef spx_word16_t spx_coef_t;
-typedef spx_word16_t spx_lsp_t;
-typedef spx_word32_t spx_sig_t;
-
-#define Q15ONE 32767
-
-#define LPC_SCALING 8192
-#define SIG_SCALING 16384
-#define LSP_SCALING 8192.
-#define GAMMA_SCALING 32768.
-#define GAIN_SCALING 64
-#define GAIN_SCALING_1 0.015625
-
-#define LPC_SHIFT 13
-#define LSP_SHIFT 13
-#define SIG_SHIFT 14
-#define GAIN_SHIFT 6
-
-#define VERY_SMALL 0
-#define VERY_LARGE32 ((spx_word32_t)2147483647)
-#define VERY_LARGE16 ((spx_word16_t)32767)
-#define Q15_ONE ((spx_word16_t)32767)
-
-
-#ifdef FIXED_DEBUG
-#include "fixed_debug.h"
-#else
-
-#include "fixed_generic.h"
-
-#ifdef ARM5E_ASM
-#include "fixed_arm5e.h"
-#elif defined (ARM4_ASM)
-#include "fixed_arm4.h"
-#elif defined (BFIN_ASM)
-#include "fixed_bfin.h"
-#endif
-
-#endif
-
-
-#else
-
-typedef float spx_mem_t;
-typedef float spx_coef_t;
-typedef float spx_lsp_t;
-typedef float spx_sig_t;
-typedef float spx_word16_t;
-typedef float spx_word32_t;
-
-#define Q15ONE 1.0f
-#define LPC_SCALING 1.f
-#define SIG_SCALING 1.f
-#define LSP_SCALING 1.f
-#define GAMMA_SCALING 1.f
-#define GAIN_SCALING 1.f
-#define GAIN_SCALING_1 1.f
-
-
-#define VERY_SMALL 1e-15f
-#define VERY_LARGE32 1e15f
-#define VERY_LARGE16 1e15f
-#define Q15_ONE ((spx_word16_t)1.f)
-
-#define QCONST16(x,bits) (x)
-#define QCONST32(x,bits) (x)
-
-#define NEG16(x) (-(x))
-#define NEG32(x) (-(x))
-#define EXTRACT16(x) (x)
-#define EXTEND32(x) (x)
-#define SHR16(a,shift) (a)
-#define SHL16(a,shift) (a)
-#define SHR32(a,shift) (a)
-#define SHL32(a,shift) (a)
-#define PSHR16(a,shift) (a)
-#define PSHR32(a,shift) (a)
-#define VSHR32(a,shift) (a)
-#define SATURATE16(x,a) (x)
-#define SATURATE32(x,a) (x)
-
-#define PSHR(a,shift) (a)
-#define SHR(a,shift) (a)
-#define SHL(a,shift) (a)
-#define SATURATE(x,a) (x)
-
-#define ADD16(a,b) ((a)+(b))
-#define SUB16(a,b) ((a)-(b))
-#define ADD32(a,b) ((a)+(b))
-#define SUB32(a,b) ((a)-(b))
-#define MULT16_16_16(a,b) ((a)*(b))
-#define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b))
-#define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
-
-#define MULT16_32_Q11(a,b) ((a)*(b))
-#define MULT16_32_Q13(a,b) ((a)*(b))
-#define MULT16_32_Q14(a,b) ((a)*(b))
-#define MULT16_32_Q15(a,b) ((a)*(b))
-#define MULT16_32_P15(a,b) ((a)*(b))
-
-#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b))
-#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
-
-#define MAC16_16_Q11(c,a,b) ((c)+(a)*(b))
-#define MAC16_16_Q13(c,a,b) ((c)+(a)*(b))
-#define MAC16_16_P13(c,a,b) ((c)+(a)*(b))
-#define MULT16_16_Q11_32(a,b) ((a)*(b))
-#define MULT16_16_Q13(a,b) ((a)*(b))
-#define MULT16_16_Q14(a,b) ((a)*(b))
-#define MULT16_16_Q15(a,b) ((a)*(b))
-#define MULT16_16_P15(a,b) ((a)*(b))
-#define MULT16_16_P13(a,b) ((a)*(b))
-#define MULT16_16_P14(a,b) ((a)*(b))
-
-#define DIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
-#define PDIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
-#define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
-#define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
-
-
-#endif
-
-
-#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
-
-/* 2 on TI C5x DSP */
-#define BYTES_PER_CHAR 2
-#define BITS_PER_CHAR 16
-#define LOG2_BITS_PER_CHAR 4
-
-#else
-
-#define BYTES_PER_CHAR 1
-#define BITS_PER_CHAR 8
-#define LOG2_BITS_PER_CHAR 3
-
-#endif
-
-
-
-#ifdef FIXED_DEBUG
-extern long long spx_mips;
-#endif
-
-
-#endif
diff --git a/drivers/speex/audio_stream_speex.cpp b/drivers/speex/audio_stream_speex.cpp
deleted file mode 100644
index 3aa80fd0b..000000000
--- a/drivers/speex/audio_stream_speex.cpp
+++ /dev/null
@@ -1,581 +0,0 @@
-/*************************************************************************/
-/* audio_stream_speex.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "audio_stream_speex.h"
-
-#include "os_support.h"
-#include "os/os.h"
-#define READ_CHUNK 1024
-
-static _FORCE_INLINE_ uint16_t le_short(uint16_t s)
-{
- uint16_t ret=s;
-#if 0 //def BIG_ENDIAN_ENABLED
- ret = s>>8;
- ret += s<<8;
-#endif
- return ret;
-}
-
-
-int AudioStreamPlaybackSpeex::mix(int16_t* p_buffer,int p_frames) {
-
-
-
- //printf("update, loops %i, read ofs %i\n", (int)loops, read_ofs);
- //printf("playing %i, paused %i\n", (int)playing, (int)paused);
-
- if (!active || !playing || !data.size())
- return 0;
-
- /*
- if (read_ofs >= data.size()) {
- if (loops) {
- reload();
- ++loop_count;
- } else {
- return;
- };
- };
- */
-
- int todo = p_frames;
- if (todo < page_size) {
- return 0;
- };
-
- int eos = 0;
-
- while (todo > page_size) {
-
- int ret=0;
- while ((todo>page_size && packets_available && !eos) || (ret = ogg_sync_pageout(&oy, &og))==1) {
-
- if (!packets_available) {
- /*Add page to the bitstream*/
- ogg_stream_pagein(&os, &og);
- page_granule = ogg_page_granulepos(&og);
- page_nb_packets = ogg_page_packets(&og);
- packet_no=0;
- if (page_granule>0 && frame_size)
- {
- skip_samples = page_nb_packets*frame_size*nframes - (page_granule-last_granule);
- if (ogg_page_eos(&og))
- skip_samples = -skip_samples;
- /*else if (!ogg_page_bos(&og))
- skip_samples = 0;*/
- } else
- {
- skip_samples = 0;
- }
-
-
- last_granule = page_granule;
- packets_available=true;
- }
- /*Extract all available packets*/
- while (todo > page_size && !eos) {
-
- if (ogg_stream_packetout(&os, &op)!=1) {
- packets_available=false;
- break;
- }
-
- packet_no++;
-
-
- /*End of stream condition*/
- if (op.e_o_s)
- eos=1;
-
- /*Copy Ogg packet to Speex bitstream*/
- speex_bits_read_from(&bits, (char*)op.packet, op.bytes);
-
-
- for (int j=0;j!=nframes;j++)
- {
-
- int16_t* out = p_buffer;
-
- int ret;
- /*Decode frame*/
- ret = speex_decode_int(st, &bits, out);
-
- /*for (i=0;i<frame_size*channels;i++)
- printf ("%d\n", (int)output[i]);*/
-
- if (ret==-1) {
- printf("decode returned -1\n");
- break;
- };
- if (ret==-2)
- {
- OS::get_singleton()->printerr( "Decoding error: corrupted stream?\n");
- break;
- }
- if (speex_bits_remaining(&bits)<0)
- {
- OS::get_singleton()->printerr( "Decoding overflow: corrupted stream?\n");
- break;
- }
- //if (channels==2)
- // speex_decode_stereo_int(output, frame_size, &stereo);
-
-
- /*Convert to short and save to output file*/
- for (int i=0;i<frame_size*stream_channels;i++) {
- out[i]=le_short(out[i]);
- }
-
-
- {
-
- int new_frame_size = frame_size;
-
- /*printf ("packet %d %d\n", packet_no, skip_samples);*/
- if (packet_no == 1 && j==0 && skip_samples > 0)
- {
- /*printf ("chopping first packet\n");*/
- new_frame_size -= skip_samples;
- }
- if (packet_no == page_nb_packets && skip_samples < 0)
- {
- int packet_length = nframes*frame_size+skip_samples;
- new_frame_size = packet_length - j*frame_size;
- if (new_frame_size<0)
- new_frame_size = 0;
- if (new_frame_size>frame_size)
- new_frame_size = frame_size;
- /*printf ("chopping end: %d %d %d\n", new_frame_size, packet_length, packet_no);*/
- }
-
-
- p_buffer+=new_frame_size*stream_channels;
- todo-=new_frame_size;
- }
- }
-
- };
- };
- //todo = get_todo();
-
- //todo is still greater than page size, can write more
- if (todo > page_size || eos) {
- if (read_ofs < data.size()) {
-
- //char *buf;
- int nb_read = MIN(data.size() - read_ofs, READ_CHUNK);
-
- /*Get the ogg buffer for writing*/
- char* ogg_dst = ogg_sync_buffer(&oy, nb_read);
- /*Read bitstream from input file*/
- copymem(ogg_dst, &data[read_ofs], nb_read);
- read_ofs += nb_read;
- ogg_sync_wrote(&oy, nb_read);
- } else {
- if (loops) {
- reload();
- ++loop_count;
- //break;
- } else {
- playing=false;
- unload();
- break;
- };
- }
- };
- };
-
- return p_frames-todo;
-};
-
-
-void AudioStreamPlaybackSpeex::unload() {
-
-
-
- if (!active) return;
-
- speex_bits_destroy(&bits);
- if (st)
- speex_decoder_destroy(st);
-
- ogg_sync_clear(&oy);
- active = false;
- //data.resize(0);
- st = NULL;
-
- frame_size = 0;
- page_size = 0;
- loop_count = 0;
-}
-
-void *AudioStreamPlaybackSpeex::process_header(ogg_packet *op, int *frame_size, int *rate, int *nframes, int *channels, int *extra_headers) {
-
- SpeexHeader *header;
- int modeID;
-
- header = speex_packet_to_header((char*)op->packet, op->bytes);
- if (!header)
- {
- OS::get_singleton()->printerr( "Cannot read header\n");
- return NULL;
- }
- if (header->mode >= SPEEX_NB_MODES)
- {
- OS::get_singleton()->printerr( "Mode number %d does not (yet/any longer) exist in this version\n",
- header->mode);
- return NULL;
- }
-
- modeID = header->mode;
-
- const SpeexMode *mode = speex_lib_get_mode (modeID);
-
- if (header->speex_version_id > 1)
- {
- OS::get_singleton()->printerr( "This file was encoded with Speex bit-stream version %d, which I don't know how to decode\n", header->speex_version_id);
- return NULL;
- }
-
- if (mode->bitstream_version < header->mode_bitstream_version)
- {
- OS::get_singleton()->printerr( "The file was encoded with a newer version of Speex. You need to upgrade in order to play it.\n");
- return NULL;
- }
- if (mode->bitstream_version > header->mode_bitstream_version)
- {
- OS::get_singleton()->printerr( "The file was encoded with an older version of Speex. You would need to downgrade the version in order to play it.\n");
- return NULL;
- }
-
- void* state = speex_decoder_init(mode);
- if (!state)
- {
- OS::get_singleton()->printerr( "Decoder initialization failed.\n");
- return NULL;
- }
- //speex_decoder_ctl(state, SPEEX_SET_ENH, &enh_enabled);
- speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, frame_size);
-
- if (!*rate)
- *rate = header->rate;
-
- speex_decoder_ctl(state, SPEEX_SET_SAMPLING_RATE, rate);
-
- *nframes = header->frames_per_packet;
-
- *channels = header->nb_channels;
-
- if (*channels!=1) {
- OS::get_singleton()->printerr("Only MONO speex streams supported\n");
- return NULL;
- }
-
- *extra_headers = header->extra_headers;
-
- speex_free(header);
- return state;
-}
-
-
-
-void AudioStreamPlaybackSpeex::reload() {
-
-
-
- if (active)
- unload();
-
- if (!data.size())
- return;
-
- ogg_sync_init(&oy);
- speex_bits_init(&bits);
-
- read_ofs = 0;
-// char *buf;
-
- int packet_count = 0;
- int extra_headers = 0;
- int stream_init = 0;
-
- page_granule=0;
- last_granule=0;
- skip_samples=0;
- page_nb_packets=0;
- packets_available=false;
- packet_no=0;
-
- int eos = 0;
-
- do {
-
- /*Get the ogg buffer for writing*/
- int nb_read = MIN(data.size() - read_ofs, READ_CHUNK);
- char* ogg_dst = ogg_sync_buffer(&oy, nb_read);
- /*Read bitstream from input file*/
- copymem(ogg_dst, &data[read_ofs], nb_read);
- read_ofs += nb_read;
- ogg_sync_wrote(&oy, nb_read);
-
- /*Loop for all complete pages we got (most likely only one)*/
- while (ogg_sync_pageout(&oy, &og)==1) {
-
- if (stream_init == 0) {
- ogg_stream_init(&os, ogg_page_serialno(&og));
- stream_init = 1;
- }
- /*Add page to the bitstream*/
- ogg_stream_pagein(&os, &og);
- page_granule = ogg_page_granulepos(&og);
- page_nb_packets = ogg_page_packets(&og);
- if (page_granule>0 && frame_size)
- {
- skip_samples = page_nb_packets*frame_size*nframes - (page_granule-last_granule);
- if (ogg_page_eos(&og))
- skip_samples = -skip_samples;
- /*else if (!ogg_page_bos(&og))
- skip_samples = 0;*/
- } else
- {
- skip_samples = 0;
- }
-
-
- last_granule = page_granule;
- /*Extract all available packets*/
- while (!eos && ogg_stream_packetout(&os, &op)==1)
- {
- /*If first packet, process as Speex header*/
- if (packet_count==0)
- {
- int rate = 0;
- int channels;
- st = process_header(&op, &frame_size, &rate, &nframes, &channels, &extra_headers);
- if (!nframes)
- nframes=1;
- if (!st) {
- unload();
- return;
- };
-
- page_size = nframes * frame_size;
- stream_srate=rate;
- stream_channels=channels;
- stream_minbuff_size=page_size;
-
-
- } else if (packet_count==1)
- {
- } else if (packet_count<=1+extra_headers)
- {
- /* Ignore extra headers */
- };
- };
- ++packet_count;
- };
-
- } while (packet_count <= extra_headers);
-
- active=true;
-
-}
-
-void AudioStreamPlaybackSpeex::_bind_methods() {
-
- //ObjectTypeDB::bind_method(_MD("set_file","file"),&AudioStreamPlaybackSpeex::set_file);
-// ObjectTypeDB::bind_method(_MD("get_file"),&AudioStreamPlaybackSpeex::get_file);
-
- ObjectTypeDB::bind_method(_MD("_set_bundled"),&AudioStreamPlaybackSpeex::_set_bundled);
- ObjectTypeDB::bind_method(_MD("_get_bundled"),&AudioStreamPlaybackSpeex::_get_bundled);
-
- ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"_bundled",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_BUNDLE),_SCS("_set_bundled"),_SCS("_get_bundled"));
- //ADD_PROPERTY( PropertyInfo(Variant::STRING,"file",PROPERTY_HINT_FILE,"*.spx"),_SCS("set_file"),_SCS("get_file"));
-};
-
-void AudioStreamPlaybackSpeex::_set_bundled(const Dictionary& dict) {
-
- ERR_FAIL_COND( !dict.has("filename"));
- ERR_FAIL_COND( !dict.has("data"));
-
- filename = dict["filename"];
- data = dict["data"];
-};
-
-Dictionary AudioStreamPlaybackSpeex::_get_bundled() const {
-
- Dictionary d;
- d["filename"] = filename;
- d["data"] = data;
- return d;
-};
-
-
-
-void AudioStreamPlaybackSpeex::set_data(const Vector<uint8_t>& p_data) {
-
- data=p_data;
- reload();
-}
-
-
-void AudioStreamPlaybackSpeex::play(float p_from_pos) {
-
-
-
- reload();
- if (!active)
- return;
- playing = true;
-
-}
-void AudioStreamPlaybackSpeex::stop(){
-
-
- unload();
- playing = false;
-
-}
-bool AudioStreamPlaybackSpeex::is_playing() const{
-
- return playing;
-}
-
-
-void AudioStreamPlaybackSpeex::set_loop(bool p_enable){
-
- loops = p_enable;
-}
-bool AudioStreamPlaybackSpeex::has_loop() const{
-
- return loops;
-}
-
-float AudioStreamPlaybackSpeex::get_length() const{
-
- return 0;
-}
-
-String AudioStreamPlaybackSpeex::get_stream_name() const{
-
- return "";
-}
-
-int AudioStreamPlaybackSpeex::get_loop_count() const{
-
- return 0;
-}
-
-float AudioStreamPlaybackSpeex::get_pos() const{
-
- return 0;
-}
-void AudioStreamPlaybackSpeex::seek_pos(float p_time){
-
-
-};
-
-
-
-AudioStreamPlaybackSpeex::AudioStreamPlaybackSpeex() {
-
- active=false;
- st = NULL;
- stream_channels=1;
- stream_srate=1;
- stream_minbuff_size=1;
- playing=false;
-
-
-}
-
-AudioStreamPlaybackSpeex::~AudioStreamPlaybackSpeex() {
-
- unload();
-}
-
-
-
-
-
-////////////////////////////////////////
-
-
-
-void AudioStreamSpeex::set_file(const String& p_file) {
-
- if (this->file == p_file)
- return;
-
- this->file=p_file;
-
- if (p_file == "") {
- data.resize(0);
- return;
- };
-
- Error err;
- FileAccess* file = FileAccess::open(p_file, FileAccess::READ,&err);
- if (err != OK) {
- data.resize(0);
- };
- ERR_FAIL_COND(err != OK);
-
- this->file = p_file;
- data.resize(file->get_len());
- int read = file->get_buffer(&data[0], data.size());
- memdelete(file);
-
-}
-
-RES ResourceFormatLoaderAudioStreamSpeex::load(const String &p_path, const String& p_original_path, Error *r_error) {
-
- if (r_error)
- *r_error=OK;
-
- AudioStreamSpeex *stream = memnew(AudioStreamSpeex);
- stream->set_file(p_path);
- return Ref<AudioStreamSpeex>(stream);
-}
-
-void ResourceFormatLoaderAudioStreamSpeex::get_recognized_extensions(List<String> *p_extensions) const {
-
- p_extensions->push_back("spx");
-}
-bool ResourceFormatLoaderAudioStreamSpeex::handles_type(const String& p_type) const {
-
- return (p_type=="AudioStream" || p_type=="AudioStreamSpeex");
-}
-
-String ResourceFormatLoaderAudioStreamSpeex::get_resource_type(const String &p_path) const {
-
- if (p_path.extension().to_lower()=="spx")
- return "AudioStreamSpeex";
- return "";
-}
diff --git a/drivers/speex/audio_stream_speex.h b/drivers/speex/audio_stream_speex.h
deleted file mode 100644
index 491c593e4..000000000
--- a/drivers/speex/audio_stream_speex.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*************************************************************************/
-/* audio_stream_speex.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef AUDIO_STREAM_SPEEX_H
-#define AUDIO_STREAM_SPEEX_H
-
-#include "scene/resources/audio_stream.h"
-#include "speex/speex.h"
-#include "os/file_access.h"
-#include "io/resource_loader.h"
-#include "os/thread_safe.h"
-
-#include <speex/speex.h>
-#include <speex/speex_header.h>
-#include <speex/speex_stereo.h>
-#include <speex/speex_callbacks.h>
-
-#include <ogg/ogg.h>
-
-class AudioStreamPlaybackSpeex : public AudioStreamPlayback {
-
- OBJ_TYPE(AudioStreamPlaybackSpeex, AudioStreamPlayback);
-
-
- void *st;
- SpeexBits bits;
- Vector<uint8_t> data;
- int read_ofs;
- bool active;
- String filename;
- int loop_count;
- bool loops;
- int page_size;
- bool playing;
- bool packets_available;
-
- void unload();
- void reload();
-
- ogg_sync_state oy;
- ogg_page og;
- ogg_packet op;
- ogg_stream_state os;
- int nframes;
- int frame_size;
- int packet_no;
-
- ogg_int64_t page_granule, last_granule;
- int skip_samples, page_nb_packets;
- int stream_channels;
- int stream_srate;
- int stream_minbuff_size;
-
- void* process_header(ogg_packet *op, int *frame_size, int *rate, int *nframes, int *channels, int *extra_headers);
-
- static void _bind_methods();
-
-protected:
-
- //virtual bool _can_mix() const;
-
- Dictionary _get_bundled() const;
- void _set_bundled(const Dictionary& dict);
-
-public:
-
-
- void set_data(const Vector<uint8_t>& p_data);
-
- virtual void play(float p_from_pos=0);
- virtual void stop();
- virtual bool is_playing() const;
-
- virtual void set_loop(bool p_enable);
- virtual bool has_loop() const;
-
- virtual float get_length() const;
-
- virtual String get_stream_name() const;
-
- virtual int get_loop_count() const;
-
- virtual float get_pos() const;
- virtual void seek_pos(float p_time);
-
- virtual int get_channels() const { return stream_channels; }
- virtual int get_mix_rate() const { return stream_srate; }
-
- virtual int get_minimum_buffer_size() const { return stream_minbuff_size; }
- virtual int mix(int16_t* p_bufer,int p_frames);
-
- virtual void set_loop_restart_time(float p_time) { } //no loop restart, ignore
-
- AudioStreamPlaybackSpeex();
- ~AudioStreamPlaybackSpeex();
-};
-
-
-
-class AudioStreamSpeex : public AudioStream {
-
- OBJ_TYPE(AudioStreamSpeex,AudioStream);
-
- Vector<uint8_t> data;
- String file;
-public:
-
- Ref<AudioStreamPlayback> instance_playback() {
- Ref<AudioStreamPlaybackSpeex> pb = memnew( AudioStreamPlaybackSpeex );
- pb->set_data(data);
- return pb;
- }
-
- void set_file(const String& p_file);
-
-};
-
-
-class ResourceFormatLoaderAudioStreamSpeex : public ResourceFormatLoader {
-public:
- virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String& p_type) const;
- virtual String get_resource_type(const String &p_path) const;
-
-};
-
-#endif // AUDIO_STREAM_SPEEX_H
diff --git a/drivers/speex/bits.c b/drivers/speex/bits.c
deleted file mode 100644
index 66c688606..000000000
--- a/drivers/speex/bits.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: speex_bits.c
-
- Handles bit packing/unpacking
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#include "config.h"
-
-
-#include <speex/speex_bits.h>
-#include "arch.h"
-#include "os_support.h"
-
-/* Maximum size of the bit-stream (for fixed-size allocation) */
-#ifndef MAX_CHARS_PER_FRAME
-#define MAX_CHARS_PER_FRAME (2000/BYTES_PER_CHAR)
-#endif
-
-EXPORT void speex_bits_init(SpeexBits *bits)
-{
- bits->chars = (char*)speex_alloc(MAX_CHARS_PER_FRAME);
- if (!bits->chars)
- return;
-
- bits->buf_size = MAX_CHARS_PER_FRAME;
-
- bits->owner=1;
-
- speex_bits_reset(bits);
-}
-
-EXPORT void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
-{
- bits->chars = (char*)buff;
- bits->buf_size = buf_size;
-
- bits->owner=0;
-
- speex_bits_reset(bits);
-}
-
-EXPORT void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
-{
- bits->chars = (char*)buff;
- bits->buf_size = buf_size;
-
- bits->owner=0;
-
- bits->nbBits=buf_size<<LOG2_BITS_PER_CHAR;
- bits->charPtr=0;
- bits->bitPtr=0;
- bits->overflow=0;
-
-}
-
-EXPORT void speex_bits_destroy(SpeexBits *bits)
-{
- if (bits->owner)
- speex_free(bits->chars);
- /* Will do something once the allocation is dynamic */
-}
-
-EXPORT void speex_bits_reset(SpeexBits *bits)
-{
- /* We only need to clear the first byte now */
- bits->chars[0]=0;
- bits->nbBits=0;
- bits->charPtr=0;
- bits->bitPtr=0;
- bits->overflow=0;
-}
-
-EXPORT void speex_bits_rewind(SpeexBits *bits)
-{
- bits->charPtr=0;
- bits->bitPtr=0;
- bits->overflow=0;
-}
-
-EXPORT void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
-{
- int i;
- int nchars = len / BYTES_PER_CHAR;
- if (nchars > bits->buf_size)
- {
- speex_notify("Packet is larger than allocated buffer");
- if (bits->owner)
- {
- char *tmp = (char*)speex_realloc(bits->chars, nchars);
- if (tmp)
- {
- bits->buf_size=nchars;
- bits->chars=tmp;
- } else {
- nchars=bits->buf_size;
- speex_warning("Could not resize input buffer: truncating input");
- }
- } else {
- speex_warning("Do not own input buffer: truncating oversize input");
- nchars=bits->buf_size;
- }
- }
-#if (BYTES_PER_CHAR==2)
-/* Swap bytes to proper endian order (could be done externally) */
-#define HTOLS(A) ((((A) >> 8)&0xff)|(((A) & 0xff)<<8))
-#else
-#define HTOLS(A) (A)
-#endif
- for (i=0;i<nchars;i++)
- bits->chars[i]=HTOLS(chars[i]);
-
- bits->nbBits=nchars<<LOG2_BITS_PER_CHAR;
- bits->charPtr=0;
- bits->bitPtr=0;
- bits->overflow=0;
-}
-
-static void speex_bits_flush(SpeexBits *bits)
-{
- int nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
- if (bits->charPtr>0)
- SPEEX_MOVE(bits->chars, &bits->chars[bits->charPtr], nchars-bits->charPtr);
- bits->nbBits -= bits->charPtr<<LOG2_BITS_PER_CHAR;
- bits->charPtr=0;
-}
-
-EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
-{
- int i,pos;
- int nchars = nbytes/BYTES_PER_CHAR;
-
- if (((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR)+nchars > bits->buf_size)
- {
- /* Packet is larger than allocated buffer */
- if (bits->owner)
- {
- char *tmp = (char*)speex_realloc(bits->chars, (bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1);
- if (tmp)
- {
- bits->buf_size=(bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1;
- bits->chars=tmp;
- } else {
- nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1;
- speex_warning("Could not resize input buffer: truncating oversize input");
- }
- } else {
- speex_warning("Do not own input buffer: truncating oversize input");
- nchars=bits->buf_size;
- }
- }
-
- speex_bits_flush(bits);
- pos=bits->nbBits>>LOG2_BITS_PER_CHAR;
- for (i=0;i<nchars;i++)
- bits->chars[pos+i]=HTOLS(chars[i]);
- bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR;
-}
-
-EXPORT int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
-{
- int i;
- int max_nchars = max_nbytes/BYTES_PER_CHAR;
- int charPtr, bitPtr, nbBits;
-
- /* Insert terminator, but save the data so we can put it back after */
- bitPtr=bits->bitPtr;
- charPtr=bits->charPtr;
- nbBits=bits->nbBits;
- speex_bits_insert_terminator(bits);
- bits->bitPtr=bitPtr;
- bits->charPtr=charPtr;
- bits->nbBits=nbBits;
-
- if (max_nchars > ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR))
- max_nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
-
- for (i=0;i<max_nchars;i++)
- chars[i]=HTOLS(bits->chars[i]);
- return max_nchars*BYTES_PER_CHAR;
-}
-
-EXPORT int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes)
-{
- int max_nchars = max_nbytes/BYTES_PER_CHAR;
- int i;
- if (max_nchars > ((bits->nbBits)>>LOG2_BITS_PER_CHAR))
- max_nchars = ((bits->nbBits)>>LOG2_BITS_PER_CHAR);
- for (i=0;i<max_nchars;i++)
- chars[i]=HTOLS(bits->chars[i]);
-
- if (bits->bitPtr>0)
- bits->chars[0]=bits->chars[max_nchars];
- else
- bits->chars[0]=0;
- bits->charPtr=0;
- bits->nbBits &= (BITS_PER_CHAR-1);
- return max_nchars*BYTES_PER_CHAR;
-}
-
-EXPORT void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
-{
- unsigned int d=data;
-
- if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)
- {
- speex_notify("Buffer too small to pack bits");
- if (bits->owner)
- {
- int new_nchars = ((bits->buf_size+5)*3)>>1;
- char *tmp = (char*)speex_realloc(bits->chars, new_nchars);
- if (tmp)
- {
- bits->buf_size=new_nchars;
- bits->chars=tmp;
- } else {
- speex_warning("Could not resize input buffer: not packing");
- return;
- }
- } else {
- speex_warning("Do not own input buffer: not packing");
- return;
- }
- }
-
- while(nbBits)
- {
- int bit;
- bit = (d>>(nbBits-1))&1;
- bits->chars[bits->charPtr] |= bit<<(BITS_PER_CHAR-1-bits->bitPtr);
- bits->bitPtr++;
-
- if (bits->bitPtr==BITS_PER_CHAR)
- {
- bits->bitPtr=0;
- bits->charPtr++;
- bits->chars[bits->charPtr] = 0;
- }
- bits->nbBits++;
- nbBits--;
- }
-}
-
-EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
-{
- unsigned int d=speex_bits_unpack_unsigned(bits,nbBits);
- /* If number is negative */
- if (d>>(nbBits-1))
- {
- d |= (-1)<<nbBits;
- }
- return d;
-}
-
-EXPORT unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
-{
- unsigned int d=0;
- if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
- bits->overflow=1;
- if (bits->overflow)
- return 0;
- while(nbBits)
- {
- d<<=1;
- d |= (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1;
- bits->bitPtr++;
- if (bits->bitPtr==BITS_PER_CHAR)
- {
- bits->bitPtr=0;
- bits->charPtr++;
- }
- nbBits--;
- }
- return d;
-}
-
-EXPORT unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
-{
- unsigned int d=0;
- int bitPtr, charPtr;
- char *chars;
-
- if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
- bits->overflow=1;
- if (bits->overflow)
- return 0;
-
- bitPtr=bits->bitPtr;
- charPtr=bits->charPtr;
- chars = bits->chars;
- while(nbBits)
- {
- d<<=1;
- d |= (chars[charPtr]>>(BITS_PER_CHAR-1 - bitPtr))&1;
- bitPtr++;
- if (bitPtr==BITS_PER_CHAR)
- {
- bitPtr=0;
- charPtr++;
- }
- nbBits--;
- }
- return d;
-}
-
-EXPORT int speex_bits_peek(SpeexBits *bits)
-{
- if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+1>bits->nbBits)
- bits->overflow=1;
- if (bits->overflow)
- return 0;
- return (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1;
-}
-
-EXPORT void speex_bits_advance(SpeexBits *bits, int n)
-{
- if (((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+n>bits->nbBits) || bits->overflow){
- bits->overflow=1;
- return;
- }
- bits->charPtr += (bits->bitPtr+n) >> LOG2_BITS_PER_CHAR; /* divide by BITS_PER_CHAR */
- bits->bitPtr = (bits->bitPtr+n) & (BITS_PER_CHAR-1); /* modulo by BITS_PER_CHAR */
-}
-
-EXPORT int speex_bits_remaining(SpeexBits *bits)
-{
- if (bits->overflow)
- return -1;
- else
- return bits->nbBits-((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr);
-}
-
-EXPORT int speex_bits_nbytes(SpeexBits *bits)
-{
- return ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
-}
-
-EXPORT void speex_bits_insert_terminator(SpeexBits *bits)
-{
- if (bits->bitPtr)
- speex_bits_pack(bits, 0, 1);
- while (bits->bitPtr)
- speex_bits_pack(bits, 1, 1);
-}
diff --git a/drivers/speex/buffer.c b/drivers/speex/buffer.c
deleted file mode 100644
index 848840e8a..000000000
--- a/drivers/speex/buffer.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-
- File: buffer.c
- This is a very simple ring buffer implementation. It is not thread-safe
- so you need to do your own locking.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-
-#include "os_support.h"
-#include "arch.h"
-#include <speex/speex_buffer.h>
-
-struct SpeexBuffer_ {
- char *data;
- int size;
- int read_ptr;
- int write_ptr;
- int available;
-};
-
-EXPORT SpeexBuffer *speex_buffer_init(int size)
-{
- SpeexBuffer *st = speex_alloc(sizeof(SpeexBuffer));
- st->data = speex_alloc(size);
- st->size = size;
- st->read_ptr = 0;
- st->write_ptr = 0;
- st->available = 0;
- return st;
-}
-
-EXPORT void speex_buffer_destroy(SpeexBuffer *st)
-{
- speex_free(st->data);
- speex_free(st);
-}
-
-EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len)
-{
- int end;
- int end1;
- char *data = _data;
- if (len > st->size)
- {
- data += len-st->size;
- len = st->size;
- }
- end = st->write_ptr + len;
- end1 = end;
- if (end1 > st->size)
- end1 = st->size;
- SPEEX_COPY(st->data + st->write_ptr, data, end1 - st->write_ptr);
- if (end > st->size)
- {
- end -= st->size;
- SPEEX_COPY(st->data, data+end1 - st->write_ptr, end);
- }
- st->available += len;
- if (st->available > st->size)
- {
- st->available = st->size;
- st->read_ptr = st->write_ptr;
- }
- st->write_ptr += len;
- if (st->write_ptr > st->size)
- st->write_ptr -= st->size;
- return len;
-}
-
-EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len)
-{
- /* This is almost the same as for speex_buffer_write() but using
- SPEEX_MEMSET() instead of SPEEX_COPY(). Update accordingly. */
- int end;
- int end1;
- if (len > st->size)
- {
- len = st->size;
- }
- end = st->write_ptr + len;
- end1 = end;
- if (end1 > st->size)
- end1 = st->size;
- SPEEX_MEMSET(st->data + st->write_ptr, 0, end1 - st->write_ptr);
- if (end > st->size)
- {
- end -= st->size;
- SPEEX_MEMSET(st->data, 0, end);
- }
- st->available += len;
- if (st->available > st->size)
- {
- st->available = st->size;
- st->read_ptr = st->write_ptr;
- }
- st->write_ptr += len;
- if (st->write_ptr > st->size)
- st->write_ptr -= st->size;
- return len;
-}
-
-EXPORT int speex_buffer_read(SpeexBuffer *st, void *_data, int len)
-{
- int end, end1;
- char *data = _data;
- if (len > st->available)
- {
- SPEEX_MEMSET(data+st->available, 0, st->size-st->available);
- len = st->available;
- }
- end = st->read_ptr + len;
- end1 = end;
- if (end1 > st->size)
- end1 = st->size;
- SPEEX_COPY(data, st->data + st->read_ptr, end1 - st->read_ptr);
-
- if (end > st->size)
- {
- end -= st->size;
- SPEEX_COPY(data+end1 - st->read_ptr, st->data, end);
- }
- st->available -= len;
- st->read_ptr += len;
- if (st->read_ptr > st->size)
- st->read_ptr -= st->size;
- return len;
-}
-
-EXPORT int speex_buffer_get_available(SpeexBuffer *st)
-{
- return st->available;
-}
-
-EXPORT int speex_buffer_resize(SpeexBuffer *st, int len)
-{
- int old_len = st->size;
- if (len > old_len)
- {
- st->data = speex_realloc(st->data, len);
- /* FIXME: move data/pointers properly for growing the buffer */
- } else {
- /* FIXME: move data/pointers properly for shrinking the buffer */
- st->data = speex_realloc(st->data, len);
- }
- return len;
-}
diff --git a/drivers/speex/cb_search.c b/drivers/speex/cb_search.c
deleted file mode 100644
index 7fbfe1a2f..000000000
--- a/drivers/speex/cb_search.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
- File: cb_search.c
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include "cb_search.h"
-#include "filters.h"
-#include "stack_alloc.h"
-#include "vq.h"
-#include "arch.h"
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifdef _USE_SSE
-#include "cb_search_sse.h"
-#elif defined(ARM4_ASM) || defined(ARM5E_ASM)
-#include "cb_search_arm4.h"
-#elif defined(BFIN_ASM)
-#include "cb_search_bfin.h"
-#endif
-
-#ifndef OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
-static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
-{
- int i, j, k;
- VARDECL(spx_word16_t *shape);
- ALLOC(shape, subvect_size, spx_word16_t);
- for (i=0;i<shape_cb_size;i++)
- {
- spx_word16_t *res;
-
- res = resp+i*subvect_size;
- for (k=0;k<subvect_size;k++)
- shape[k] = (spx_word16_t)shape_cb[i*subvect_size+k];
- E[i]=0;
-
- /* Compute codeword response using convolution with impulse response */
- for(j=0;j<subvect_size;j++)
- {
- spx_word32_t resj=0;
- spx_word16_t res16;
- for (k=0;k<=j;k++)
- resj = MAC16_16(resj,shape[k],r[j-k]);
-#ifdef FIXED_POINT
- res16 = EXTRACT16(SHR32(resj, 13));
-#else
- res16 = 0.03125f*resj;
-#endif
- /* Compute codeword energy */
- E[i]=MAC16_16(E[i],res16,res16);
- res[j] = res16;
- /*printf ("%d\n", (int)res[j]);*/
- }
- }
-
-}
-#endif
-
-#ifndef OVERRIDE_TARGET_UPDATE
-static SPEEX_INLINE void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
-{
- int n;
- for (n=0;n<len;n++)
- t[n] = SUB16(t[n],PSHR32(MULT16_16(g,r[n]),13));
-}
-#endif
-
-
-
-static void split_cb_search_shape_sign_N1(
-spx_word16_t target[], /* target vector */
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs for this subframe */
-const void *par, /* Codebook/search parameters*/
-int p, /* number of LPC coeffs */
-int nsf, /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int update_target
-)
-{
- int i,j,m,q;
- VARDECL(spx_word16_t *resp);
-#ifdef _USE_SSE
- VARDECL(__m128 *resp2);
- VARDECL(__m128 *E);
-#else
- spx_word16_t *resp2;
- VARDECL(spx_word32_t *E);
-#endif
- VARDECL(spx_word16_t *t);
- VARDECL(spx_sig_t *e);
- const signed char *shape_cb;
- int shape_cb_size, subvect_size, nb_subvect;
- const split_cb_params *params;
- int best_index;
- spx_word32_t best_dist;
- int have_sign;
-
- params = (const split_cb_params *) par;
- subvect_size = params->subvect_size;
- nb_subvect = params->nb_subvect;
- shape_cb_size = 1<<params->shape_bits;
- shape_cb = params->shape_cb;
- have_sign = params->have_sign;
- ALLOC(resp, shape_cb_size*subvect_size, spx_word16_t);
-#ifdef _USE_SSE
- ALLOC(resp2, (shape_cb_size*subvect_size)>>2, __m128);
- ALLOC(E, shape_cb_size>>2, __m128);
-#else
- resp2 = resp;
- ALLOC(E, shape_cb_size, spx_word32_t);
-#endif
- ALLOC(t, nsf, spx_word16_t);
- ALLOC(e, nsf, spx_sig_t);
-
- /* FIXME: Do we still need to copy the target? */
- SPEEX_COPY(t, target, nsf);
-
- compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
-
- for (i=0;i<nb_subvect;i++)
- {
- spx_word16_t *x=t+subvect_size*i;
- /*Find new n-best based on previous n-best j*/
- if (have_sign)
- vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack);
- else
- vq_nbest(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack);
-
- speex_bits_pack(bits,best_index,params->shape_bits+have_sign);
-
- {
- int rind;
- spx_word16_t *res;
- spx_word16_t sign=1;
- rind = best_index;
- if (rind>=shape_cb_size)
- {
- sign=-1;
- rind-=shape_cb_size;
- }
- res = resp+rind*subvect_size;
- if (sign>0)
- for (m=0;m<subvect_size;m++)
- t[subvect_size*i+m] = SUB16(t[subvect_size*i+m], res[m]);
- else
- for (m=0;m<subvect_size;m++)
- t[subvect_size*i+m] = ADD16(t[subvect_size*i+m], res[m]);
-
-#ifdef FIXED_POINT
- if (sign==1)
- {
- for (j=0;j<subvect_size;j++)
- e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5);
- } else {
- for (j=0;j<subvect_size;j++)
- e[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5));
- }
-#else
- for (j=0;j<subvect_size;j++)
- e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];
-#endif
-
- }
-
- for (m=0;m<subvect_size;m++)
- {
- spx_word16_t g;
- int rind;
- spx_word16_t sign=1;
- rind = best_index;
- if (rind>=shape_cb_size)
- {
- sign=-1;
- rind-=shape_cb_size;
- }
-
- q=subvect_size-m;
-#ifdef FIXED_POINT
- g=sign*shape_cb[rind*subvect_size+m];
-#else
- g=sign*0.03125*shape_cb[rind*subvect_size+m];
-#endif
- target_update(t+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1));
- }
- }
-
- /* Update excitation */
- /* FIXME: We could update the excitation directly above */
- for (j=0;j<nsf;j++)
- exc[j]=ADD32(exc[j],e[j]);
-
- /* Update target: only update target if necessary */
- if (update_target)
- {
- VARDECL(spx_word16_t *r2);
- ALLOC(r2, nsf, spx_word16_t);
- for (j=0;j<nsf;j++)
- r2[j] = EXTRACT16(PSHR32(e[j] ,6));
- syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack);
- for (j=0;j<nsf;j++)
- target[j]=SUB16(target[j],PSHR16(r2[j],2));
- }
-}
-
-
-
-void split_cb_search_shape_sign(
-spx_word16_t target[], /* target vector */
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs for this subframe */
-const void *par, /* Codebook/search parameters*/
-int p, /* number of LPC coeffs */
-int nsf, /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int complexity,
-int update_target
-)
-{
- int i,j,k,m,n,q;
- VARDECL(spx_word16_t *resp);
-#ifdef _USE_SSE
- VARDECL(__m128 *resp2);
- VARDECL(__m128 *E);
-#else
- spx_word16_t *resp2;
- VARDECL(spx_word32_t *E);
-#endif
- VARDECL(spx_word16_t *t);
- VARDECL(spx_sig_t *e);
- VARDECL(spx_word16_t *tmp);
- VARDECL(spx_word32_t *ndist);
- VARDECL(spx_word32_t *odist);
- VARDECL(int *itmp);
- VARDECL(spx_word16_t **ot2);
- VARDECL(spx_word16_t **nt2);
- spx_word16_t **ot, **nt;
- VARDECL(int **nind);
- VARDECL(int **oind);
- VARDECL(int *ind);
- const signed char *shape_cb;
- int shape_cb_size, subvect_size, nb_subvect;
- const split_cb_params *params;
- int N=2;
- VARDECL(int *best_index);
- VARDECL(spx_word32_t *best_dist);
- VARDECL(int *best_nind);
- VARDECL(int *best_ntarget);
- int have_sign;
- N=complexity;
- if (N>10)
- N=10;
- /* Complexity isn't as important for the codebooks as it is for the pitch */
- N=(2*N)/3;
- if (N<1)
- N=1;
- if (N==1)
- {
- split_cb_search_shape_sign_N1(target,ak,awk1,awk2,par,p,nsf,exc,r,bits,stack,update_target);
- return;
- }
- ALLOC(ot2, N, spx_word16_t*);
- ALLOC(nt2, N, spx_word16_t*);
- ALLOC(oind, N, int*);
- ALLOC(nind, N, int*);
-
- params = (const split_cb_params *) par;
- subvect_size = params->subvect_size;
- nb_subvect = params->nb_subvect;
- shape_cb_size = 1<<params->shape_bits;
- shape_cb = params->shape_cb;
- have_sign = params->have_sign;
- ALLOC(resp, shape_cb_size*subvect_size, spx_word16_t);
-#ifdef _USE_SSE
- ALLOC(resp2, (shape_cb_size*subvect_size)>>2, __m128);
- ALLOC(E, shape_cb_size>>2, __m128);
-#else
- resp2 = resp;
- ALLOC(E, shape_cb_size, spx_word32_t);
-#endif
- ALLOC(t, nsf, spx_word16_t);
- ALLOC(e, nsf, spx_sig_t);
- ALLOC(ind, nb_subvect, int);
-
- ALLOC(tmp, 2*N*nsf, spx_word16_t);
- for (i=0;i<N;i++)
- {
- ot2[i]=tmp+2*i*nsf;
- nt2[i]=tmp+(2*i+1)*nsf;
- }
- ot=ot2;
- nt=nt2;
- ALLOC(best_index, N, int);
- ALLOC(best_dist, N, spx_word32_t);
- ALLOC(best_nind, N, int);
- ALLOC(best_ntarget, N, int);
- ALLOC(ndist, N, spx_word32_t);
- ALLOC(odist, N, spx_word32_t);
-
- ALLOC(itmp, 2*N*nb_subvect, int);
- for (i=0;i<N;i++)
- {
- nind[i]=itmp+2*i*nb_subvect;
- oind[i]=itmp+(2*i+1)*nb_subvect;
- }
-
- SPEEX_COPY(t, target, nsf);
-
- for (j=0;j<N;j++)
- SPEEX_COPY(&ot[j][0], t, nsf);
-
- /* Pre-compute codewords response and energy */
- compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
-
- for (j=0;j<N;j++)
- odist[j]=0;
-
- /*For all subvectors*/
- for (i=0;i<nb_subvect;i++)
- {
- /*"erase" nbest list*/
- for (j=0;j<N;j++)
- ndist[j]=VERY_LARGE32;
- /* This is not strictly necessary, but it provides an additonal safety
- to prevent crashes in case something goes wrong in the previous
- steps (e.g. NaNs) */
- for (j=0;j<N;j++)
- best_nind[j] = best_ntarget[j] = 0;
- /*For all n-bests of previous subvector*/
- for (j=0;j<N;j++)
- {
- spx_word16_t *x=ot[j]+subvect_size*i;
- spx_word32_t tener = 0;
- for (m=0;m<subvect_size;m++)
- tener = MAC16_16(tener, x[m],x[m]);
-#ifdef FIXED_POINT
- tener = SHR32(tener,1);
-#else
- tener *= .5;
-#endif
- /*Find new n-best based on previous n-best j*/
- if (have_sign)
- vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, N, best_index, best_dist, stack);
- else
- vq_nbest(x, resp2, subvect_size, shape_cb_size, E, N, best_index, best_dist, stack);
-
- /*For all new n-bests*/
- for (k=0;k<N;k++)
- {
- /* Compute total distance (including previous sub-vectors */
- spx_word32_t err = ADD32(ADD32(odist[j],best_dist[k]),tener);
-
- /*update n-best list*/
- if (err<ndist[N-1])
- {
- for (m=0;m<N;m++)
- {
- if (err < ndist[m])
- {
- for (n=N-1;n>m;n--)
- {
- ndist[n] = ndist[n-1];
- best_nind[n] = best_nind[n-1];
- best_ntarget[n] = best_ntarget[n-1];
- }
- /* n is equal to m here, so they're interchangeable */
- ndist[m] = err;
- best_nind[n] = best_index[k];
- best_ntarget[n] = j;
- break;
- }
- }
- }
- }
- if (i==0)
- break;
- }
- for (j=0;j<N;j++)
- {
- /*previous target (we don't care what happened before*/
- for (m=(i+1)*subvect_size;m<nsf;m++)
- nt[j][m]=ot[best_ntarget[j]][m];
-
- /* New code: update the rest of the target only if it's worth it */
- for (m=0;m<subvect_size;m++)
- {
- spx_word16_t g;
- int rind;
- spx_word16_t sign=1;
- rind = best_nind[j];
- if (rind>=shape_cb_size)
- {
- sign=-1;
- rind-=shape_cb_size;
- }
-
- q=subvect_size-m;
-#ifdef FIXED_POINT
- g=sign*shape_cb[rind*subvect_size+m];
-#else
- g=sign*0.03125*shape_cb[rind*subvect_size+m];
-#endif
- target_update(nt[j]+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1));
- }
-
- for (q=0;q<nb_subvect;q++)
- nind[j][q]=oind[best_ntarget[j]][q];
- nind[j][i]=best_nind[j];
- }
-
- /*update old-new data*/
- /* just swap pointers instead of a long copy */
- {
- spx_word16_t **tmp2;
- tmp2=ot;
- ot=nt;
- nt=tmp2;
- }
- for (j=0;j<N;j++)
- for (m=0;m<nb_subvect;m++)
- oind[j][m]=nind[j][m];
- for (j=0;j<N;j++)
- odist[j]=ndist[j];
- }
-
- /*save indices*/
- for (i=0;i<nb_subvect;i++)
- {
- ind[i]=nind[0][i];
- speex_bits_pack(bits,ind[i],params->shape_bits+have_sign);
- }
-
- /* Put everything back together */
- for (i=0;i<nb_subvect;i++)
- {
- int rind;
- spx_word16_t sign=1;
- rind = ind[i];
- if (rind>=shape_cb_size)
- {
- sign=-1;
- rind-=shape_cb_size;
- }
-#ifdef FIXED_POINT
- if (sign==1)
- {
- for (j=0;j<subvect_size;j++)
- e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5);
- } else {
- for (j=0;j<subvect_size;j++)
- e[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5));
- }
-#else
- for (j=0;j<subvect_size;j++)
- e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];
-#endif
- }
- /* Update excitation */
- for (j=0;j<nsf;j++)
- exc[j]=ADD32(exc[j],e[j]);
-
- /* Update target: only update target if necessary */
- if (update_target)
- {
- VARDECL(spx_word16_t *r2);
- ALLOC(r2, nsf, spx_word16_t);
- for (j=0;j<nsf;j++)
- r2[j] = EXTRACT16(PSHR32(e[j] ,6));
- syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack);
- for (j=0;j<nsf;j++)
- target[j]=SUB16(target[j],PSHR16(r2[j],2));
- }
-}
-
-
-void split_cb_shape_sign_unquant(
-spx_sig_t *exc,
-const void *par, /* non-overlapping codebook */
-int nsf, /* number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_int32_t *seed
-)
-{
- int i,j;
- VARDECL(int *ind);
- VARDECL(int *signs);
- const signed char *shape_cb;
- int shape_cb_size, subvect_size, nb_subvect;
- const split_cb_params *params;
- int have_sign;
-
- params = (const split_cb_params *) par;
- subvect_size = params->subvect_size;
- nb_subvect = params->nb_subvect;
- shape_cb_size = 1<<params->shape_bits;
- shape_cb = params->shape_cb;
- have_sign = params->have_sign;
-
- ALLOC(ind, nb_subvect, int);
- ALLOC(signs, nb_subvect, int);
-
- /* Decode codewords and gains */
- for (i=0;i<nb_subvect;i++)
- {
- if (have_sign)
- signs[i] = speex_bits_unpack_unsigned(bits, 1);
- else
- signs[i] = 0;
- ind[i] = speex_bits_unpack_unsigned(bits, params->shape_bits);
- }
- /* Compute decoded excitation */
- for (i=0;i<nb_subvect;i++)
- {
- spx_word16_t s=1;
- if (signs[i])
- s=-1;
-#ifdef FIXED_POINT
- if (s==1)
- {
- for (j=0;j<subvect_size;j++)
- exc[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[ind[i]*subvect_size+j]),SIG_SHIFT-5);
- } else {
- for (j=0;j<subvect_size;j++)
- exc[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[ind[i]*subvect_size+j]),SIG_SHIFT-5));
- }
-#else
- for (j=0;j<subvect_size;j++)
- exc[subvect_size*i+j]+=s*0.03125*shape_cb[ind[i]*subvect_size+j];
-#endif
- }
-}
-
-void noise_codebook_quant(
-spx_word16_t target[], /* target vector */
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs for this subframe */
-const void *par, /* Codebook/search parameters*/
-int p, /* number of LPC coeffs */
-int nsf, /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int complexity,
-int update_target
-)
-{
- int i;
- VARDECL(spx_word16_t *tmp);
- ALLOC(tmp, nsf, spx_word16_t);
- residue_percep_zero16(target, ak, awk1, awk2, tmp, nsf, p, stack);
-
- for (i=0;i<nsf;i++)
- exc[i]+=SHL32(EXTEND32(tmp[i]),8);
- SPEEX_MEMSET(target, 0, nsf);
-}
-
-
-void noise_codebook_unquant(
-spx_sig_t *exc,
-const void *par, /* non-overlapping codebook */
-int nsf, /* number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_int32_t *seed
-)
-{
- int i;
- /* FIXME: This is bad, but I don't think the function ever gets called anyway */
- for (i=0;i<nsf;i++)
- exc[i]=SHL32(EXTEND32(speex_rand(1, seed)),SIG_SHIFT);
-}
diff --git a/drivers/speex/cb_search.h b/drivers/speex/cb_search.h
deleted file mode 100644
index 7687b453f..000000000
--- a/drivers/speex/cb_search.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin & David Rowe */
-/**
- @file cb_search.h
- @brief Overlapped codebook search
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef CB_SEARCH_H
-#define CB_SEARCH_H
-
-#include <speex/speex_bits.h>
-#include "arch.h"
-
-/** Split codebook parameters. */
-typedef struct split_cb_params {
- int subvect_size;
- int nb_subvect;
- const signed char *shape_cb;
- int shape_bits;
- int have_sign;
-} split_cb_params;
-
-
-void split_cb_search_shape_sign(
-spx_word16_t target[], /* target vector */
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs for this subframe */
-const void *par, /* Codebook/search parameters */
-int p, /* number of LPC coeffs */
-int nsf, /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int complexity,
-int update_target
-);
-
-void split_cb_shape_sign_unquant(
-spx_sig_t *exc,
-const void *par, /* non-overlapping codebook */
-int nsf, /* number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_int32_t *seed
-);
-
-
-void noise_codebook_quant(
-spx_word16_t target[], /* target vector */
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs for this subframe */
-const void *par, /* Codebook/search parameters */
-int p, /* number of LPC coeffs */
-int nsf, /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int complexity,
-int update_target
-);
-
-
-void noise_codebook_unquant(
-spx_sig_t *exc,
-const void *par, /* non-overlapping codebook */
-int nsf, /* number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_int32_t *seed
-);
-
-#endif
diff --git a/drivers/speex/cb_search_arm4.h b/drivers/speex/cb_search_arm4.h
deleted file mode 100644
index 19b752a4b..000000000
--- a/drivers/speex/cb_search_arm4.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Copyright (C) 2004 Jean-Marc Valin */
-/**
- @file cb_search_arm4.h
- @brief Fixed codebook functions (ARM4 version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* This optimization is temporaly disabled until it is fixed to account for the fact
- that "r" is now a 16-bit array */
-#if 0
-#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
-static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
-{
- int i, j, k;
- //const signed char *shape;
- for (i=0;i<shape_cb_size;i+=4)
- {
-
- //shape = shape_cb;
- E[0]=0;
- E[1]=0;
- E[2]=0;
- E[3]=0;
-
- /* Compute codeword response using convolution with impulse response */
- for(j=0;j<subvect_size;j++)
- {
-#if 1
- spx_word16_t *res;
- res = resp+j;
- spx_word32_t resj0,resj1,resj2,resj3;
- spx_word32_t dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8;
- __asm__ __volatile__ (
- "mov %0, #0 \n\t"
- "mov %1, #0 \n\t"
- "mov %2, #0 \n\t"
- "mov %3, #0 \n\t"
- ".weighted%=: \n\t"
- "ldrsb %8, [%6] \n\t"
- "ldr %10, [%5], #-4 \n\t"
- "mov %9, %6 \n\t"
- "ldrsb %11, [%9, %7]! \n\t"
- "mla %0, %10, %8, %0 \n\t"
- "ldrsb %8, [%9, %7]! \n\t"
- "mla %1, %10, %11, %1 \n\t"
- "ldrsb %11, [%9, %7]! \n\t"
- "mla %2, %10, %8, %2 \n\t"
- "subs %4, %4, #1 \n\t"
- "mla %3, %10, %11, %3 \n\t"
- "add %6, %6, #1 \n\t"
- "bne .weighted%= \n\t"
- : "=r" (resj0), "=r" (resj1), "=r" (resj2), "=r" (resj3),
- "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
- "=r" (dead5), "=r" (dead6), "=r" (dead7), "=r" (dead8)
- : "4" (j+1), "5" (r+j), "6" (shape_cb), "7" (subvect_size)
- : "cc", "memory");
-#else
- spx_word16_t *res;
- res = resp+j;
- spx_word32_t resj0=0;
- spx_word32_t resj1=0;
- spx_word32_t resj2=0;
- spx_word32_t resj3=0;
- for (k=0;k<=j;k++)
- {
- const signed char *shape=shape_cb+k;
- resj0 = MAC16_16(resj0,*shape,r[j-k]);
- shape += subvect_size;
- resj1 = MAC16_16(resj1,*shape,r[j-k]);
- shape += subvect_size;
- resj2 = MAC16_16(resj2,*shape,r[j-k]);
- shape += subvect_size;
- resj3 = MAC16_16(resj3,*shape,r[j-k]);
- shape += subvect_size;
- }
-#endif
-
-#ifdef FIXED_POINT
- resj0 = SHR(resj0, 11);
- resj1 = SHR(resj1, 11);
- resj2 = SHR(resj2, 11);
- resj3 = SHR(resj3, 11);
-#else
- resj0 *= 0.03125;
- resj1 *= 0.03125;
- resj2 *= 0.03125;
- resj3 *= 0.03125;
-#endif
-
- /* Compute codeword energy */
- E[0]=ADD32(E[0],MULT16_16(resj0,resj0));
- E[1]=ADD32(E[1],MULT16_16(resj1,resj1));
- E[2]=ADD32(E[2],MULT16_16(resj2,resj2));
- E[3]=ADD32(E[3],MULT16_16(resj3,resj3));
- *res = resj0;
- res += subvect_size;
- *res = resj1;
- res += subvect_size;
- *res = resj2;
- res += subvect_size;
- *res = resj3;
- res += subvect_size;
- }
- resp += subvect_size<<2;
- shape_cb += subvect_size<<2;
- E+=4;
- }
-
-}
-#endif
diff --git a/drivers/speex/cb_search_bfin.h b/drivers/speex/cb_search_bfin.h
deleted file mode 100644
index ae9cf8343..000000000
--- a/drivers/speex/cb_search_bfin.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copyright (C) 2005 Analog Devices */
-/**
- @author Jean-Marc Valin
- @file cb_search_bfin.h
- @brief Fixed codebook functions (Blackfin version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
-void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
-{
- int i;
- for (i=0;i<shape_cb_size;i++)
- {
- __asm__ __volatile__ (
- "P0 = %0;\n\t"
- "LC0 = P0;\n\t"
- "P1 = %1;\n\t"
- "P2 = %2;\n\t"
- "P3 = %3;\n\t"
- "P0 = 1;\n\t"
- "L0 = 0;\n\t"
- "L1 = 0;\n\t"
- "R2 = 0;\n\t"
- "A1 = 0;\n\t"
- "LOOP outter%= LC0;\n\t"
- "LOOP_BEGIN outter%=;\n\t"
- "A0 = 0;\n\t"
- "P4 = P1;\n\t"
- "I1 = P2;\n\t"
- "R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
- "LOOP inner%= LC1 = P0;\n\t"
- "LOOP_BEGIN inner%=;\n\t"
- "A0 += R0.L*R1.L (IS) || R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
- "LOOP_END inner%=;\n\t"
- "R0 = A0;\n\t"
- "R0 >>>= 13;\n\t"
- "A1 += R0.L*R0.L (IS);\n\t"
- "W[P3++] = R0;\n\t"
- "P0 += 1;\n\t"
- "P2 += 2;\n\t"
- "LOOP_END outter%=;\n\t"
- "P4 = %4;\n\t"
- "R1 = A1;\n\t"
- "[P4] = R1;\n\t"
- :
- : "m" (subvect_size), "m" (shape_cb), "m" (r), "m" (resp), "m" (E)
- : "A0", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "I0", "I1", "L0",
- "L1", "A0", "A1", "memory"
-#if !(__GNUC__ == 3)
- , "LC0", "LC1" /* gcc 3.4 doesn't know about LC registers */
-#endif
- );
- shape_cb += subvect_size;
- resp += subvect_size;
- E++;
- }
-}
-
-#define OVERRIDE_TARGET_UPDATE
-static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
-{
- if (!len)
- return;
- __asm__ __volatile__
- (
- "I0 = %0;\n\t"
- "I1 = %1;\n\t"
- "L0 = 0;\n\t"
- "L1 = 0;\n\t"
- "R2 = 4096;\n\t"
- "LOOP tupdate%= LC0 = %3;\n\t"
- "LOOP_BEGIN tupdate%=;\n\t"
- "R0.L = W[I0] || R1.L = W[I1++];\n\t"
- "R1 = (A1 = R1.L*%2.L) (IS);\n\t"
- "R1 = R1 + R2;\n\t"
- "R1 >>>= 13;\n\t"
- "R0.L = R0.L - R1.L;\n\t"
- "W[I0++] = R0.L;\n\t"
- "LOOP_END tupdate%=;\n\t"
- :
- : "a" (t), "a" (r), "d" (g), "a" (len)
- : "R0", "R1", "R2", "A1", "I0", "I1", "L0", "L1"
- );
-}
diff --git a/drivers/speex/cb_search_sse.h b/drivers/speex/cb_search_sse.h
deleted file mode 100644
index 8b039686f..000000000
--- a/drivers/speex/cb_search_sse.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright (C) 2004 Jean-Marc Valin */
-/**
- @file cb_search_sse.h
- @brief Fixed codebook functions (SSE version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <xmmintrin.h>
-
-static inline void _spx_mm_getr_ps (__m128 U, float *__Z, float *__Y, float *__X, float *__W)
-{
- union {
- float __a[4];
- __m128 __v;
- } __u;
-
- __u.__v = U;
-
- *__Z = __u.__a[0];
- *__Y = __u.__a[1];
- *__X = __u.__a[2];
- *__W = __u.__a[3];
-
-}
-
-#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
-static void compute_weighted_codebook(const signed char *shape_cb, const spx_sig_t *_r, float *resp, __m128 *resp2, __m128 *E, int shape_cb_size, int subvect_size, char *stack)
-{
- int i, j, k;
- __m128 resj, EE;
- VARDECL(__m128 *r);
- VARDECL(__m128 *shape);
- ALLOC(r, subvect_size, __m128);
- ALLOC(shape, subvect_size, __m128);
- for(j=0;j<subvect_size;j++)
- r[j] = _mm_load_ps1(_r+j);
- for (i=0;i<shape_cb_size;i+=4)
- {
- float *_res = resp+i*subvect_size;
- const signed char *_shape = shape_cb+i*subvect_size;
- EE = _mm_setzero_ps();
- for(j=0;j<subvect_size;j++)
- {
- shape[j] = _mm_setr_ps(0.03125*_shape[j], 0.03125*_shape[subvect_size+j], 0.03125*_shape[2*subvect_size+j], 0.03125*_shape[3*subvect_size+j]);
- }
- for(j=0;j<subvect_size;j++)
- {
- resj = _mm_setzero_ps();
- for (k=0;k<=j;k++)
- resj = _mm_add_ps(resj, _mm_mul_ps(shape[k],r[j-k]));
- _spx_mm_getr_ps(resj, _res+j, _res+subvect_size+j, _res+2*subvect_size+j, _res+3*subvect_size+j);
- *resp2++ = resj;
- EE = _mm_add_ps(EE, _mm_mul_ps(resj, resj));
- }
- E[i>>2] = EE;
- }
-}
diff --git a/drivers/speex/echo_diagnostic.m b/drivers/speex/echo_diagnostic.m
deleted file mode 100644
index aebf39067..000000000
--- a/drivers/speex/echo_diagnostic.m
+++ /dev/null
@@ -1,72 +0,0 @@
-% Attempts to diagnose AEC problems from recorded samples
-%
-% out = echo_diagnostic(rec_file, play_file, out_file, tail_length)
-%
-% Computes the full matrix inversion to cancel echo from the
-% recording 'rec_file' using the far end signal 'play_file' using
-% a filter length of 'tail_length'. The output is saved to 'out_file'.
-function out = echo_diagnostic(rec_file, play_file, out_file, tail_length)
-
-F=fopen(rec_file,'rb');
-rec=fread(F,Inf,'short');
-fclose (F);
-F=fopen(play_file,'rb');
-play=fread(F,Inf,'short');
-fclose (F);
-
-rec = [rec; zeros(1024,1)];
-play = [play; zeros(1024,1)];
-
-N = length(rec);
-corr = real(ifft(fft(rec).*conj(fft(play))));
-acorr = real(ifft(fft(play).*conj(fft(play))));
-
-[a,b] = max(corr);
-
-if b > N/2
- b = b-N;
-end
-printf ("Far end to near end delay is %d samples\n", b);
-if (b > .3*tail_length)
- printf ('This is too much delay, try delaying the far-end signal a bit\n');
-else if (b < 0)
- printf ('You have a negative delay, the echo canceller has no chance to cancel anything!\n');
- else
- printf ('Delay looks OK.\n');
- end
- end
-end
-N2 = round(N/2);
-corr1 = real(ifft(fft(rec(1:N2)).*conj(fft(play(1:N2)))));
-corr2 = real(ifft(fft(rec(N2+1:end)).*conj(fft(play(N2+1:end)))));
-
-[a,b1] = max(corr1);
-if b1 > N2/2
- b1 = b1-N2;
-end
-[a,b2] = max(corr2);
-if b2 > N2/2
- b2 = b2-N2;
-end
-drift = (b1-b2)/N2;
-printf ('Drift estimate is %f%% (%d samples)\n', 100*drift, b1-b2);
-if abs(b1-b2) < 10
- printf ('A drift of a few (+-10) samples is normal.\n');
-else
- if abs(b1-b2) < 30
- printf ('There may be (not sure) excessive clock drift. Is the capture and playback done on the same soundcard?\n');
- else
- printf ('Your clock is drifting! No way the AEC will be able to do anything with that. Most likely, you''re doing capture and playback from two different cards.\n');
- end
- end
-end
-acorr(1) = .001+1.00001*acorr(1);
-AtA = toeplitz(acorr(1:tail_length));
-bb = corr(1:tail_length);
-h = AtA\bb;
-
-out = (rec - filter(h, 1, play));
-
-F=fopen(out_file,'w');
-fwrite(F,out,'short');
-fclose (F);
diff --git a/drivers/speex/exc_10_16_table.c b/drivers/speex/exc_10_16_table.c
deleted file mode 100644
index 98ae357d8..000000000
--- a/drivers/speex/exc_10_16_table.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: exc_10_16_table.c
- Codebook for excitation in narrowband CELP mode (3200 bps)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-const signed char exc_10_16_table[160] = {
-22,39,14,44,11,35,-2,23,-4,6,
-46,-28,13,-27,-23,12,4,20,-5,9,
-37,-18,-23,23,0,9,-6,-20,4,-1,
--17,-5,-4,17,0,1,9,-2,1,2,
-2,-12,8,-25,39,15,9,16,-55,-11,
-9,11,5,10,-2,-60,8,13,-6,11,
--16,27,-47,-12,11,1,16,-7,9,-3,
--29,9,-14,25,-19,34,36,12,40,-10,
--3,-24,-14,-37,-21,-35,-2,-36,3,-6,
-67,28,6,-17,-3,-12,-16,-15,-17,-7,
--59,-36,-13,1,7,1,2,10,2,11,
-13,10,8,-2,7,3,5,4,2,2,
--3,-8,4,-5,6,7,-42,15,35,-2,
--46,38,28,-20,-9,1,7,-3,0,-2,
-0,0,0,0,0,0,0,0,0,0,
--15,-28,52,32,5,-5,-17,-20,-10,-1};
diff --git a/drivers/speex/exc_10_32_table.c b/drivers/speex/exc_10_32_table.c
deleted file mode 100644
index 1ee56a259..000000000
--- a/drivers/speex/exc_10_32_table.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: exc_10_32_table.c
- Codebook for excitation in narrowband CELP mode (4000 bps)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-const signed char exc_10_32_table[320] = {
-7,17,17,27,25,22,12,4,-3,0,
-28,-36,39,-24,-15,3,-9,15,-5,10,
-31,-28,11,31,-21,9,-11,-11,-2,-7,
--25,14,-22,31,4,-14,19,-12,14,-5,
-4,-7,4,-5,9,0,-2,42,-47,-16,
-1,8,0,9,23,-57,0,28,-11,6,
--31,55,-45,3,-5,4,2,-2,4,-7,
--3,6,-2,7,-3,12,5,8,54,-10,
-8,-7,-8,-24,-25,-27,-14,-5,8,5,
-44,23,5,-9,-11,-11,-13,-9,-12,-8,
--29,-8,-22,6,-15,3,-12,-1,-5,-3,
-34,-1,29,-16,17,-4,12,2,1,4,
--2,-4,2,-1,11,-3,-52,28,30,-9,
--32,25,44,-20,-24,4,6,-1,0,0,
-0,0,0,0,0,0,0,0,0,0,
--25,-10,22,29,13,-13,-22,-13,-4,0,
--4,-16,10,15,-36,-24,28,25,-1,-3,
-66,-33,-11,-15,6,0,3,4,-2,5,
-24,-20,-47,29,19,-2,-4,-1,0,-1,
--2,3,1,8,-11,5,5,-57,28,28,
-0,-16,4,-4,12,-6,-1,2,-20,61,
--9,24,-22,-42,29,6,17,8,4,2,
--65,15,8,10,5,6,5,3,2,-2,
--3,5,-9,4,-5,23,13,23,-3,-63,
-3,-5,-4,-6,0,-3,23,-36,-46,9,
-5,5,8,4,9,-5,1,-3,10,1,
--6,10,-11,24,-47,31,22,-12,14,-10,
-6,11,-7,-7,7,-31,51,-12,-6,7,
-6,-17,9,-11,-20,52,-19,3,-6,-6,
--8,-5,23,-41,37,1,-21,10,-14,8,
-7,5,-15,-15,23,39,-26,-33,7,2,
--32,-30,-21,-8,4,12,17,15,14,11};
diff --git a/drivers/speex/exc_20_32_table.c b/drivers/speex/exc_20_32_table.c
deleted file mode 100644
index e4098b8d1..000000000
--- a/drivers/speex/exc_20_32_table.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: exc_20_32_table.c
- Codebook for excitation in narrowband CELP mode (2000 bps)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-const signed char exc_20_32_table[640] = {
-12,32,25,46,36,33,9,14,-3,6,1,-8,0,-10,-5,-7,-7,-7,-5,-5,
-31,-27,24,-32,-4,10,-11,21,-3,19,23,-9,22,24,-10,-1,-10,-13,-7,-11,
-42,-33,31,19,-8,0,-10,-16,1,-21,-17,10,-8,14,8,4,11,-2,5,-2,
--33,11,-16,33,11,-4,9,-4,11,2,6,-5,8,-5,11,-4,-6,26,-36,-16,
-0,4,-2,-8,12,6,-1,34,-46,-22,9,9,21,9,5,-66,-5,26,2,10,
-13,2,19,9,12,-81,3,13,13,0,-14,22,-35,6,-7,-4,6,-6,10,-6,
--31,38,-33,0,-10,-11,5,-12,12,-17,5,0,-6,13,-9,10,8,25,33,2,
--12,8,-6,10,-2,21,7,17,43,5,11,-7,-9,-20,-36,-20,-23,-4,-4,-3,
-27,-9,-9,-49,-39,-38,-11,-9,6,5,23,25,5,3,3,4,1,2,-3,-1,
-87,39,17,-21,-9,-19,-9,-15,-13,-14,-17,-11,-10,-11,-8,-6,-1,-3,-3,-1,
--54,-34,-27,-8,-11,-4,-5,0,0,4,8,6,9,7,9,7,6,5,5,5,
-48,10,19,-10,12,-1,9,-3,2,5,-3,2,-2,-2,0,-2,-26,6,9,-7,
--16,-9,2,7,7,-5,-43,11,22,-11,-9,34,37,-15,-13,-6,1,-1,1,1,
--64,56,52,-11,-27,5,4,3,1,2,1,3,-1,-4,-4,-10,-7,-4,-4,2,
--1,-7,-7,-12,-10,-15,-9,-5,-5,-11,-16,-13,6,16,4,-13,-16,-10,-4,2,
--47,-13,25,47,19,-14,-20,-8,-17,0,-3,-13,1,6,-17,-14,15,1,10,6,
--24,0,-10,19,-69,-8,14,49,17,-5,33,-29,3,-4,0,2,-8,5,-6,2,
-120,-56,-12,-47,23,-9,6,-5,1,2,-5,1,-10,4,-1,-1,4,-1,0,-3,
-30,-52,-67,30,22,11,-1,-4,3,0,7,2,0,1,-10,-4,-8,-13,5,1,
-1,-1,5,13,-9,-3,-10,-62,22,48,-4,-6,2,3,5,1,1,4,1,13,
-3,-20,10,-9,13,-2,-4,9,-20,44,-1,20,-32,-67,19,0,28,11,8,2,
--11,15,-19,-53,31,2,34,10,6,-4,-58,8,10,13,14,1,12,2,0,0,
--128,37,-8,44,-9,26,-3,18,2,6,11,-1,9,1,5,3,0,1,1,2,
-12,3,-2,-3,7,25,9,18,-6,-37,3,-8,-16,3,-10,-7,17,-34,-44,11,
-17,-15,-3,-16,-1,-13,11,-46,-65,-2,8,13,2,4,4,5,15,5,9,6,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
--9,19,-12,12,-28,38,29,-1,12,2,5,23,-10,3,4,-15,21,-4,3,3,
-6,17,-9,-4,-8,-20,26,5,-10,6,1,-19,18,-15,-12,47,-6,-2,-7,-9,
--1,-17,-2,-2,-14,30,-14,2,-7,-4,-1,-12,11,-25,16,-3,-12,11,-7,7,
--17,1,19,-28,31,-7,-10,7,-10,3,12,5,-16,6,24,41,-29,-54,0,1,
-7,-1,5,-6,13,10,-4,-8,8,-9,-27,-53,-38,-1,10,19,17,16,12,12,
-0,3,-7,-4,13,12,-31,-14,6,-5,3,5,17,43,50,25,10,1,-6,-2};
diff --git a/drivers/speex/exc_5_256_table.c b/drivers/speex/exc_5_256_table.c
deleted file mode 100644
index 4137996d4..000000000
--- a/drivers/speex/exc_5_256_table.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: exc_5_256_table.c
- Codebook for excitation in narrowband CELP mode (12800 bps)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-const signed char exc_5_256_table[1280] = {
--8,-37,5,-43,5,
-73,61,39,12,-3,
--61,-32,2,42,30,
--3,17,-27,9,34,
-20,-1,-5,2,23,
--7,-46,26,53,-47,
-20,-2,-33,-89,-51,
--64,27,11,15,-34,
--5,-56,25,-9,-1,
--29,1,40,67,-23,
--16,16,33,19,7,
-14,85,22,-10,-10,
--12,-7,-1,52,89,
-29,11,-20,-37,-46,
--15,17,-24,-28,24,
-2,1,0,23,-101,
-23,14,-1,-23,-18,
-9,5,-13,38,1,
--28,-28,4,27,51,
--26,34,-40,35,47,
-54,38,-54,-26,-6,
-42,-25,13,-30,-36,
-18,41,-4,-33,23,
--32,-7,-4,51,-3,
-17,-52,56,-47,36,
--2,-21,36,10,8,
--33,31,19,9,-5,
--40,10,-9,-21,19,
-18,-78,-18,-5,0,
--26,-36,-47,-51,-44,
-18,40,27,-2,29,
-49,-26,2,32,-54,
-30,-73,54,3,-5,
-36,22,53,10,-1,
--84,-53,-29,-5,3,
--44,53,-51,4,22,
-71,-35,-1,33,-5,
--27,-7,36,17,-23,
--39,16,-9,-55,-15,
--20,39,-35,6,-39,
--14,18,48,-64,-17,
--15,9,39,81,37,
--68,37,47,-21,-6,
--104,13,6,9,-2,
-35,8,-23,18,42,
-45,21,33,-5,-49,
-9,-6,-43,-56,39,
-2,-16,-25,87,1,
--3,-9,17,-25,-11,
--9,-1,10,2,-14,
--14,4,-1,-10,28,
--23,40,-32,26,-9,
-26,4,-27,-23,3,
-42,-60,1,49,-3,
-27,10,-52,-40,-2,
-18,45,-23,17,-44,
-3,-3,17,-46,52,
--40,-47,25,75,31,
--49,53,30,-30,-32,
--36,38,-6,-15,-16,
-54,-27,-48,3,38,
--29,-32,-22,-14,-4,
--23,-13,32,-39,9,
-8,-45,-13,34,-16,
-49,40,32,31,28,
-23,23,32,47,59,
--68,8,62,44,25,
--14,-24,-65,-16,36,
-67,-25,-38,-21,4,
--33,-2,42,5,-63,
-40,11,26,-42,-23,
--61,79,-31,23,-20,
-10,-32,53,-25,-36,
-10,-26,-5,3,0,
--71,5,-10,-37,1,
--24,21,-54,-17,1,
--29,-25,-15,-27,32,
-68,45,-16,-37,-18,
--5,1,0,-77,71,
--6,3,-20,71,-67,
-29,-35,10,-30,19,
-4,16,17,5,0,
--14,19,2,28,26,
-59,3,2,24,39,
-55,-50,-45,-18,-17,
-33,-35,14,-1,1,
-8,87,-35,-29,0,
--27,13,-7,23,-13,
-37,-40,50,-35,14,
-19,-7,-14,49,54,
--5,22,-2,-29,-8,
--27,38,13,27,48,
-12,-41,-21,-15,28,
-7,-16,-24,-19,-20,
-11,-20,9,2,13,
-23,-20,11,27,-27,
-71,-69,8,2,-6,
-22,12,16,16,9,
--16,-8,-17,1,25,
-1,40,-37,-33,66,
-94,53,4,-22,-25,
--41,-42,25,35,-16,
--15,57,31,-29,-32,
-21,16,-60,45,15,
--1,7,57,-26,-47,
--29,11,8,15,19,
--105,-8,54,27,10,
--17,6,-12,-1,-10,
-4,0,23,-10,31,
-13,11,10,12,-64,
-23,-3,-8,-19,16,
-52,24,-40,16,10,
-40,5,9,0,-13,
--7,-21,-8,-6,-7,
--21,59,16,-53,18,
--60,11,-47,14,-18,
-25,-13,-24,4,-39,
-16,-28,54,26,-67,
-30,27,-20,-52,20,
--12,55,12,18,-16,
-39,-14,-6,-26,56,
--88,-55,12,25,26,
--37,6,75,0,-34,
--81,54,-30,1,-7,
-49,-23,-14,21,10,
--62,-58,-57,-47,-34,
-15,-4,34,-78,31,
-25,-11,7,50,-10,
-42,-63,14,-36,-4,
-57,55,57,53,42,
--42,-1,15,40,37,
-15,25,-11,6,1,
-31,-2,-6,-1,-7,
--64,34,28,30,-1,
-3,21,0,-88,-12,
--56,25,-28,40,8,
--28,-14,9,12,2,
--6,-17,22,49,-6,
--26,14,28,-20,4,
--12,50,35,40,13,
--38,-58,-29,17,30,
-22,60,26,-54,-39,
--12,58,-28,-63,10,
--21,-8,-12,26,-62,
-6,-10,-11,-22,-6,
--7,4,1,18,2,
--70,11,14,4,13,
-19,-24,-34,24,67,
-17,51,-21,13,23,
-54,-30,48,1,-13,
-80,26,-16,-2,13,
--4,6,-30,29,-24,
-73,-58,30,-27,20,
--2,-21,41,45,30,
--27,-3,-5,-18,-20,
--49,-3,-35,10,42,
--19,-67,-53,-11,9,
-13,-15,-33,-51,-30,
-15,7,25,-30,4,
-28,-22,-34,54,-29,
-39,-46,20,16,34,
--4,47,75,1,-44,
--55,-24,7,-1,9,
--42,50,-8,-36,41,
-68,0,-4,-10,-23,
--15,-50,64,36,-9,
--27,12,25,-38,-47,
--37,32,-49,51,-36,
-2,-4,69,-26,19,
-7,45,67,46,13,
--63,46,15,-47,4,
--41,13,-6,5,-21,
-37,26,-55,-7,33,
--1,-28,10,-17,-64,
--14,0,-36,-17,93,
--3,-9,-66,44,-21,
-3,-12,38,-6,-13,
--12,19,13,43,-43,
--10,-12,6,-5,9,
--49,32,-5,2,4,
-5,15,-16,10,-21,
-8,-62,-8,64,8,
-79,-1,-66,-49,-18,
-5,40,-5,-30,-45,
-1,-6,21,-32,93,
--18,-30,-21,32,21,
--18,22,8,5,-41,
--54,80,22,-10,-7,
--8,-23,-64,66,56,
--14,-30,-41,-46,-14,
--29,-37,27,-14,42,
--2,-9,-29,34,14,
-33,-14,22,4,10,
-26,26,28,32,23,
--72,-32,3,0,-14,
-35,-42,-78,-32,6,
-29,-18,-45,-5,7,
--33,-45,-3,-22,-34,
-8,-8,4,-51,-25,
--9,59,-78,21,-5,
--25,-48,66,-15,-17,
--24,-49,-13,25,-23,
--64,-6,40,-24,-19,
--11,57,-33,-8,1,
-10,-52,-54,28,39,
-49,34,-11,-61,-41,
--43,10,15,-15,51,
-30,15,-51,32,-34,
--2,-34,14,18,16,
-1,1,-3,-3,1,
-1,-18,6,16,48,
-12,-5,-42,7,36,
-48,7,-20,-10,7,
-12,2,54,39,-38,
-37,54,4,-11,-8,
--46,-10,5,-10,-34,
-46,-12,29,-37,39,
-36,-11,24,56,17,
-14,20,25,0,-25,
--28,55,-7,-5,27,
-3,9,-26,-8,6,
--24,-10,-30,-31,-34,
-18,4,22,21,40,
--1,-29,-37,-8,-21,
-92,-29,11,-3,11,
-73,23,22,7,4,
--44,-9,-11,21,-13,
-11,9,-78,-1,47,
-114,-12,-37,-19,-5,
--11,-22,19,12,-30,
-7,38,45,-21,-8,
--9,55,-45,56,-21,
-7,17,46,-57,-87,
--6,27,31,31,7,
--56,-12,46,21,-5,
--12,36,3,3,-21,
-43,19,12,-7,9,
--14,0,-9,-33,-91,
-7,26,3,-11,64,
-83,-31,-46,25,2,
-9,5,2,2,-1,
-20,-17,10,-5,-27,
--8,20,8,-19,16,
--21,-13,-31,5,5,
-42,24,9,34,-20,
-28,-61,22,11,-39,
-64,-20,-1,-30,-9,
--20,24,-25,-24,-29,
-22,-60,6,-5,41,
--9,-87,14,34,15,
--57,52,69,15,-3,
--102,58,16,3,6,
-60,-75,-32,26,7,
--57,-27,-32,-24,-21,
--29,-16,62,-46,31,
-30,-27,-15,7,15};
diff --git a/drivers/speex/exc_5_64_table.c b/drivers/speex/exc_5_64_table.c
deleted file mode 100644
index 2c66d5189..000000000
--- a/drivers/speex/exc_5_64_table.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: exc_5_64_table.c
- Codebook for excitation in narrowband CELP mode (9600 bps)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-const signed char exc_5_64_table[320]={
-1,5,-15,49,-66,
--48,-4,50,-44,7,
-37,16,-18,25,-26,
--26,-15,19,19,-27,
--47,28,57,5,-17,
--32,-41,68,21,-2,
-64,56,8,-16,-13,
--26,-9,-16,11,6,
--39,25,-19,22,-31,
-20,-45,55,-43,10,
--16,47,-40,40,-20,
--51,3,-17,-14,-15,
--24,53,-20,-46,46,
-27,-68,32,3,-18,
--5,9,-31,16,-9,
--10,-1,-23,48,95,
-47,25,-41,-32,-3,
-15,-25,-55,36,41,
--27,20,5,13,14,
--22,5,2,-23,18,
-46,-15,17,-18,-34,
--5,-8,27,-55,73,
-16,2,-1,-17,40,
--78,33,0,2,19,
-4,53,-16,-15,-16,
--28,-3,-13,49,8,
--7,-29,27,-13,32,
-20,32,-61,16,14,
-41,44,40,24,20,
-7,4,48,-60,-77,
-17,-6,-48,65,-15,
-32,-30,-71,-10,-3,
--6,10,-2,-7,-29,
--56,67,-30,7,-5,
-86,-6,-10,0,5,
--31,60,34,-38,-3,
-24,10,-2,30,23,
-24,-41,12,70,-43,
-15,-17,6,13,16,
--13,8,30,-15,-8,
-5,23,-34,-98,-4,
--13,13,-48,-31,70,
-12,31,25,24,-24,
-26,-7,33,-16,8,
-5,-11,-14,-8,-65,
-13,10,-2,-9,0,
--3,-68,5,35,7,
-0,-31,-1,-17,-9,
--9,16,-37,-18,-1,
-69,-48,-28,22,-21,
--11,5,49,55,23,
--86,-36,16,2,13,
-63,-51,30,-11,13,
-24,-18,-6,14,-19,
-1,41,9,-5,27,
--36,-44,-34,-37,-21,
--26,31,-39,15,43,
-5,-8,29,20,-8,
--20,-52,-28,-1,13,
-26,-34,-10,-9,27,
--8,8,27,-66,4,
-12,-22,49,10,-77,
-32,-18,3,-38,12,
--3,-1,2,2,0};
diff --git a/drivers/speex/exc_8_128_table.c b/drivers/speex/exc_8_128_table.c
deleted file mode 100644
index 17ee64b92..000000000
--- a/drivers/speex/exc_8_128_table.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: exc_8_128_table.c
- Codebook for excitation in narrowband CELP mode (7000 bps)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-const signed char exc_8_128_table[1024] = {
--14,9,13,-32,2,-10,31,-10,
--8,-8,6,-4,-1,10,-64,23,
-6,20,13,6,8,-22,16,34,
-7,42,-49,-28,5,26,4,-15,
-41,34,41,32,33,24,23,14,
-8,40,34,4,-24,-41,-19,-15,
-13,-13,33,-54,24,27,-44,33,
-27,-15,-15,24,-19,14,-36,14,
--9,24,-12,-4,37,-5,16,-34,
-5,10,33,-15,-54,-16,12,25,
-12,1,2,0,3,-1,-4,-4,
-11,2,-56,54,27,-20,13,-6,
--46,-41,-33,-11,-5,7,12,14,
--14,-5,8,20,6,3,4,-8,
--5,-42,11,8,-14,25,-2,2,
-13,11,-22,39,-9,9,5,-45,
--9,7,-9,12,-7,34,-17,-102,
-7,2,-42,18,35,-9,-34,11,
--5,-2,3,22,46,-52,-25,-9,
--94,8,11,-5,-5,-5,4,-7,
--35,-7,54,5,-32,3,24,-9,
--22,8,65,37,-1,-12,-23,-6,
--9,-28,55,-33,14,-3,2,18,
--60,41,-17,8,-16,17,-11,0,
--11,29,-28,37,9,-53,33,-14,
--9,7,-25,-7,-11,26,-32,-8,
-24,-21,22,-19,19,-10,29,-14,
-0,0,0,0,0,0,0,0,
--5,-52,10,41,6,-30,-4,16,
-32,22,-27,-22,32,-3,-28,-3,
-3,-35,6,17,23,21,8,2,
-4,-45,-17,14,23,-4,-31,-11,
--3,14,1,19,-11,2,61,-8,
-9,-12,7,-10,12,-3,-24,99,
--48,23,50,-37,-5,-23,0,8,
--14,35,-64,-5,46,-25,13,-1,
--49,-19,-15,9,34,50,25,11,
--6,-9,-16,-20,-32,-33,-32,-27,
-10,-8,12,-15,56,-14,-32,33,
-3,-9,1,65,-9,-9,-10,-2,
--6,-23,9,17,3,-28,13,-32,
-4,-2,-10,4,-16,76,12,-52,
-6,13,33,-6,4,-14,-9,-3,
-1,-15,-16,28,1,-15,11,16,
-9,4,-21,-37,-40,-6,22,12,
--15,-23,-14,-17,-16,-9,-10,-9,
-13,-39,41,5,-9,16,-38,25,
-46,-47,4,49,-14,17,-2,6,
-18,5,-6,-33,-22,44,50,-2,
-1,3,-6,7,7,-3,-21,38,
--18,34,-14,-41,60,-13,6,16,
--24,35,19,-13,-36,24,3,-17,
--14,-10,36,44,-44,-29,-3,3,
--54,-8,12,55,26,4,-2,-5,
-2,-11,22,-23,2,22,1,-25,
--39,66,-49,21,-8,-2,10,-14,
--60,25,6,10,27,-25,16,5,
--2,-9,26,-13,-20,58,-2,7,
-52,-9,2,5,-4,-15,23,-1,
--38,23,8,27,-6,0,-27,-7,
-39,-10,-14,26,11,-45,-12,9,
--5,34,4,-35,10,43,-22,-11,
-56,-7,20,1,10,1,-26,9,
-94,11,-27,-14,-13,1,-11,0,
-14,-5,-6,-10,-4,-15,-8,-41,
-21,-5,1,-28,-8,22,-9,33,
--23,-4,-4,-12,39,4,-7,3,
--60,80,8,-17,2,-6,12,-5,
-1,9,15,27,31,30,27,23,
-61,47,26,10,-5,-8,-12,-13,
-5,-18,25,-15,-4,-15,-11,12,
--2,-2,-16,-2,-6,24,12,11,
--4,9,1,-9,14,-45,57,12,
-20,-35,26,11,-64,32,-10,-10,
-42,-4,-9,-16,32,24,7,10,
-52,-11,-57,29,0,8,0,-6,
-17,-17,-56,-40,7,20,18,12,
--6,16,5,7,-1,9,1,10,
-29,12,16,13,-2,23,7,9,
--3,-4,-5,18,-64,13,55,-25,
-9,-9,24,14,-25,15,-11,-40,
--30,37,1,-19,22,-5,-31,13,
--2,0,7,-4,16,-67,12,66,
--36,24,-8,18,-15,-23,19,0,
--45,-7,4,3,-13,13,35,5,
-13,33,10,27,23,0,-7,-11,
-43,-74,36,-12,2,5,-8,6,
--33,11,-16,-14,-5,-7,-3,17,
--34,27,-16,11,-9,15,33,-31,
-8,-16,7,-6,-7,63,-55,-17,
-11,-1,20,-46,34,-30,6,9,
-19,28,-9,5,-24,-8,-23,-2,
-31,-19,-16,-5,-15,-18,0,26,
-18,37,-5,-15,-2,17,5,-27,
-21,-33,44,12,-27,-9,17,11,
-25,-21,-31,-7,13,33,-8,-25,
--7,7,-10,4,-6,-9,48,-82,
--23,-8,6,11,-23,3,-3,49,
--29,25,31,4,14,16,9,-4,
--18,10,-26,3,5,-44,-9,9,
--47,-55,15,9,28,1,4,-3,
-46,6,-6,-38,-29,-31,-15,-6,
-3,0,14,-6,8,-54,-50,33,
--5,1,-14,33,-48,26,-4,-5,
--3,-5,-3,-5,-28,-22,77,55,
--1,2,10,10,-9,-14,-66,-49,
-11,-36,-6,-20,10,-10,16,12,
-4,-1,-16,45,-44,-50,31,-2,
-25,42,23,-32,-22,0,11,20,
--40,-35,-40,-36,-32,-26,-21,-13,
-52,-22,6,-24,-20,17,-5,-8,
-36,-25,-11,21,-26,6,34,-8,
-7,20,-3,5,-25,-8,18,-5,
--9,-4,1,-9,20,20,39,48,
--24,9,5,-65,22,29,4,3,
--43,-11,32,-6,9,19,-27,-10,
--47,-14,24,10,-7,-36,-7,-1,
--4,-5,-5,16,53,25,-26,-29,
--4,-12,45,-58,-34,33,-5,2,
--1,27,-48,31,-15,22,-5,4,
-7,7,-25,-3,11,-22,16,-12,
-8,-3,7,-11,45,14,-73,-19,
-56,-46,24,-20,28,-12,-2,-1,
--36,-3,-33,19,-6,7,2,-15,
-5,-31,-45,8,35,13,20,0,
--9,48,-13,-43,-3,-13,2,-5,
-72,-68,-27,2,1,-2,-7,5,
-36,33,-40,-12,-4,-5,23,19};
diff --git a/drivers/speex/fftwrap.c b/drivers/speex/fftwrap.c
deleted file mode 100644
index ac71bbfcb..000000000
--- a/drivers/speex/fftwrap.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/* Copyright (C) 2005-2006 Jean-Marc Valin
- File: fftwrap.c
-
- Wrapper for various FFTs
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#include "config.h"
-
-
-#include "arch.h"
-#include "os_support.h"
-
-#define MAX_FFT_SIZE 2048
-
-#ifdef FIXED_POINT
-static int maximize_range(spx_word16_t *in, spx_word16_t *out, spx_word16_t bound, int len)
-{
- int i, shift;
- spx_word16_t max_val = 0;
- for (i=0;i<len;i++)
- {
- if (in[i]>max_val)
- max_val = in[i];
- if (-in[i]>max_val)
- max_val = -in[i];
- }
- shift=0;
- while (max_val <= (bound>>1) && max_val != 0)
- {
- max_val <<= 1;
- shift++;
- }
- for (i=0;i<len;i++)
- {
- out[i] = SHL16(in[i], shift);
- }
- return shift;
-}
-
-static void renorm_range(spx_word16_t *in, spx_word16_t *out, int shift, int len)
-{
- int i;
- for (i=0;i<len;i++)
- {
- out[i] = PSHR16(in[i], shift);
- }
-}
-#endif
-
-#ifdef USE_SMALLFT
-
-#include "smallft.h"
-#include <math.h>
-
-void *spx_fft_init(int size)
-{
- struct drft_lookup *table;
- table = speex_alloc(sizeof(struct drft_lookup));
- spx_drft_init((struct drft_lookup *)table, size);
- return (void*)table;
-}
-
-void spx_fft_destroy(void *table)
-{
- spx_drft_clear(table);
- speex_free(table);
-}
-
-void spx_fft(void *table, float *in, float *out)
-{
- if (in==out)
- {
- int i;
- float scale = 1./((struct drft_lookup *)table)->n;
- speex_warning("FFT should not be done in-place");
- for (i=0;i<((struct drft_lookup *)table)->n;i++)
- out[i] = scale*in[i];
- } else {
- int i;
- float scale = 1./((struct drft_lookup *)table)->n;
- for (i=0;i<((struct drft_lookup *)table)->n;i++)
- out[i] = scale*in[i];
- }
- spx_drft_forward((struct drft_lookup *)table, out);
-}
-
-void spx_ifft(void *table, float *in, float *out)
-{
- if (in==out)
- {
- speex_warning("FFT should not be done in-place");
- } else {
- int i;
- for (i=0;i<((struct drft_lookup *)table)->n;i++)
- out[i] = in[i];
- }
- spx_drft_backward((struct drft_lookup *)table, out);
-}
-
-#elif defined(USE_INTEL_MKL)
-#include <mkl.h>
-
-struct mkl_config {
- DFTI_DESCRIPTOR_HANDLE desc;
- int N;
-};
-
-void *spx_fft_init(int size)
-{
- struct mkl_config *table = (struct mkl_config *) speex_alloc(sizeof(struct mkl_config));
- table->N = size;
- DftiCreateDescriptor(&table->desc, DFTI_SINGLE, DFTI_REAL, 1, size);
- DftiSetValue(table->desc, DFTI_PACKED_FORMAT, DFTI_PACK_FORMAT);
- DftiSetValue(table->desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
- DftiSetValue(table->desc, DFTI_FORWARD_SCALE, 1.0f / size);
- DftiCommitDescriptor(table->desc);
- return table;
-}
-
-void spx_fft_destroy(void *table)
-{
- struct mkl_config *t = (struct mkl_config *) table;
- DftiFreeDescriptor(t->desc);
- speex_free(table);
-}
-
-void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
-{
- struct mkl_config *t = (struct mkl_config *) table;
- DftiComputeForward(t->desc, in, out);
-}
-
-void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
-{
- struct mkl_config *t = (struct mkl_config *) table;
- DftiComputeBackward(t->desc, in, out);
-}
-
-#elif defined(USE_GPL_FFTW3)
-
-#include <fftw3.h>
-
-struct fftw_config {
- float *in;
- float *out;
- fftwf_plan fft;
- fftwf_plan ifft;
- int N;
-};
-
-void *spx_fft_init(int size)
-{
- struct fftw_config *table = (struct fftw_config *) speex_alloc(sizeof(struct fftw_config));
- table->in = fftwf_malloc(sizeof(float) * (size+2));
- table->out = fftwf_malloc(sizeof(float) * (size+2));
-
- table->fft = fftwf_plan_dft_r2c_1d(size, table->in, (fftwf_complex *) table->out, FFTW_PATIENT);
- table->ifft = fftwf_plan_dft_c2r_1d(size, (fftwf_complex *) table->in, table->out, FFTW_PATIENT);
-
- table->N = size;
- return table;
-}
-
-void spx_fft_destroy(void *table)
-{
- struct fftw_config *t = (struct fftw_config *) table;
- fftwf_destroy_plan(t->fft);
- fftwf_destroy_plan(t->ifft);
- fftwf_free(t->in);
- fftwf_free(t->out);
- speex_free(table);
-}
-
-
-void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
-{
- int i;
- struct fftw_config *t = (struct fftw_config *) table;
- const int N = t->N;
- float *iptr = t->in;
- float *optr = t->out;
- const float m = 1.0 / N;
- for(i=0;i<N;++i)
- iptr[i]=in[i] * m;
-
- fftwf_execute(t->fft);
-
- out[0] = optr[0];
- for(i=1;i<N;++i)
- out[i] = optr[i+1];
-}
-
-void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
-{
- int i;
- struct fftw_config *t = (struct fftw_config *) table;
- const int N = t->N;
- float *iptr = t->in;
- float *optr = t->out;
-
- iptr[0] = in[0];
- iptr[1] = 0.0f;
- for(i=1;i<N;++i)
- iptr[i+1] = in[i];
- iptr[N+1] = 0.0f;
-
- fftwf_execute(t->ifft);
-
- for(i=0;i<N;++i)
- out[i] = optr[i];
-}
-
-#elif defined(USE_KISS_FFT)
-
-#include "kiss_fftr.h"
-#include "kiss_fft.h"
-
-struct kiss_config {
- kiss_fftr_cfg forward;
- kiss_fftr_cfg backward;
- int N;
-};
-
-void *spx_fft_init(int size)
-{
- struct kiss_config *table;
- table = (struct kiss_config*)speex_alloc(sizeof(struct kiss_config));
- table->forward = kiss_fftr_alloc(size,0,NULL,NULL);
- table->backward = kiss_fftr_alloc(size,1,NULL,NULL);
- table->N = size;
- return table;
-}
-
-void spx_fft_destroy(void *table)
-{
- struct kiss_config *t = (struct kiss_config *)table;
- kiss_fftr_free(t->forward);
- kiss_fftr_free(t->backward);
- speex_free(table);
-}
-
-#ifdef FIXED_POINT
-
-void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
-{
- int shift;
- struct kiss_config *t = (struct kiss_config *)table;
- shift = maximize_range(in, in, 32000, t->N);
- kiss_fftr2(t->forward, in, out);
- renorm_range(in, in, shift, t->N);
- renorm_range(out, out, shift, t->N);
-}
-
-#else
-
-void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
-{
- int i;
- float scale;
- struct kiss_config *t = (struct kiss_config *)table;
- scale = 1./t->N;
- kiss_fftr2(t->forward, in, out);
- for (i=0;i<t->N;i++)
- out[i] *= scale;
-}
-#endif
-
-void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
-{
- struct kiss_config *t = (struct kiss_config *)table;
- kiss_fftri2(t->backward, in, out);
-}
-
-
-#else
-
-#error No other FFT implemented
-
-#endif
-
-
-#ifdef FIXED_POINT
-/*#include "smallft.h"*/
-
-
-void spx_fft_float(void *table, float *in, float *out)
-{
- int i;
-#ifdef USE_SMALLFT
- int N = ((struct drft_lookup *)table)->n;
-#elif defined(USE_KISS_FFT)
- int N = ((struct kiss_config *)table)->N;
-#else
-#endif
-#ifdef VAR_ARRAYS
- spx_word16_t _in[N];
- spx_word16_t _out[N];
-#else
- spx_word16_t _in[MAX_FFT_SIZE];
- spx_word16_t _out[MAX_FFT_SIZE];
-#endif
- for (i=0;i<N;i++)
- _in[i] = (int)floor(.5+in[i]);
- spx_fft(table, _in, _out);
- for (i=0;i<N;i++)
- out[i] = _out[i];
-#if 0
- if (!fixed_point)
- {
- float scale;
- struct drft_lookup t;
- spx_drft_init(&t, ((struct kiss_config *)table)->N);
- scale = 1./((struct kiss_config *)table)->N;
- for (i=0;i<((struct kiss_config *)table)->N;i++)
- out[i] = scale*in[i];
- spx_drft_forward(&t, out);
- spx_drft_clear(&t);
- }
-#endif
-}
-
-void spx_ifft_float(void *table, float *in, float *out)
-{
- int i;
-#ifdef USE_SMALLFT
- int N = ((struct drft_lookup *)table)->n;
-#elif defined(USE_KISS_FFT)
- int N = ((struct kiss_config *)table)->N;
-#else
-#endif
-#ifdef VAR_ARRAYS
- spx_word16_t _in[N];
- spx_word16_t _out[N];
-#else
- spx_word16_t _in[MAX_FFT_SIZE];
- spx_word16_t _out[MAX_FFT_SIZE];
-#endif
- for (i=0;i<N;i++)
- _in[i] = (int)floor(.5+in[i]);
- spx_ifft(table, _in, _out);
- for (i=0;i<N;i++)
- out[i] = _out[i];
-#if 0
- if (!fixed_point)
- {
- int i;
- struct drft_lookup t;
- spx_drft_init(&t, ((struct kiss_config *)table)->N);
- for (i=0;i<((struct kiss_config *)table)->N;i++)
- out[i] = in[i];
- spx_drft_backward(&t, out);
- spx_drft_clear(&t);
- }
-#endif
-}
-
-#else
-
-void spx_fft_float(void *table, float *in, float *out)
-{
- spx_fft(table, in, out);
-}
-void spx_ifft_float(void *table, float *in, float *out)
-{
- spx_ifft(table, in, out);
-}
-
-#endif
diff --git a/drivers/speex/fftwrap.h b/drivers/speex/fftwrap.h
deleted file mode 100644
index dfaf48944..000000000
--- a/drivers/speex/fftwrap.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 2005 Jean-Marc Valin
- File: fftwrap.h
-
- Wrapper for various FFTs
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef FFTWRAP_H
-#define FFTWRAP_H
-
-#include "arch.h"
-
-/** Compute tables for an FFT */
-void *spx_fft_init(int size);
-
-/** Destroy tables for an FFT */
-void spx_fft_destroy(void *table);
-
-/** Forward (real to half-complex) transform */
-void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out);
-
-/** Backward (half-complex to real) transform */
-void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out);
-
-/** Forward (real to half-complex) transform of float data */
-void spx_fft_float(void *table, float *in, float *out);
-
-/** Backward (half-complex to real) transform of float data */
-void spx_ifft_float(void *table, float *in, float *out);
-
-#endif
diff --git a/drivers/speex/filterbank.c b/drivers/speex/filterbank.c
deleted file mode 100644
index 8874ed482..000000000
--- a/drivers/speex/filterbank.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Copyright (C) 2006 Jean-Marc Valin */
-/**
- @file filterbank.c
- @brief Converting between psd and filterbank
- */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include "filterbank.h"
-#include "arch.h"
-#include <math.h>
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifdef FIXED_POINT
-
-#define toBARK(n) (MULT16_16(26829,spx_atan(SHR32(MULT16_16(97,n),2))) + MULT16_16(4588,spx_atan(MULT16_32_Q15(20,MULT16_16(n,n)))) + MULT16_16(3355,n))
-
-#else
-#define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
-#endif
-
-#define toMEL(n) (2595.f*log10(1.f+(n)/700.f))
-
-FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type)
-{
- FilterBank *bank;
- spx_word32_t df;
- spx_word32_t max_mel, mel_interval;
- int i;
- int id1;
- int id2;
- df = DIV32(SHL32(sampling,15),MULT16_16(2,len));
- max_mel = toBARK(EXTRACT16(sampling/2));
- mel_interval = PDIV32(max_mel,banks-1);
-
- bank = (FilterBank*)speex_alloc(sizeof(FilterBank));
- bank->nb_banks = banks;
- bank->len = len;
- bank->bank_left = (int*)speex_alloc(len*sizeof(int));
- bank->bank_right = (int*)speex_alloc(len*sizeof(int));
- bank->filter_left = (spx_word16_t*)speex_alloc(len*sizeof(spx_word16_t));
- bank->filter_right = (spx_word16_t*)speex_alloc(len*sizeof(spx_word16_t));
- /* Think I can safely disable normalisation that for fixed-point (and probably float as well) */
-#ifndef FIXED_POINT
- bank->scaling = (float*)speex_alloc(banks*sizeof(float));
-#endif
- for (i=0;i<len;i++)
- {
- spx_word16_t curr_freq;
- spx_word32_t mel;
- spx_word16_t val;
- curr_freq = EXTRACT16(MULT16_32_P15(i,df));
- mel = toBARK(curr_freq);
- if (mel > max_mel)
- break;
-#ifdef FIXED_POINT
- id1 = DIV32(mel,mel_interval);
-#else
- id1 = (int)(floor(mel/mel_interval));
-#endif
- if (id1>banks-2)
- {
- id1 = banks-2;
- val = Q15_ONE;
- } else {
- val = DIV32_16(mel - id1*mel_interval,EXTRACT16(PSHR32(mel_interval,15)));
- }
- id2 = id1+1;
- bank->bank_left[i] = id1;
- bank->filter_left[i] = SUB16(Q15_ONE,val);
- bank->bank_right[i] = id2;
- bank->filter_right[i] = val;
- }
-
- /* Think I can safely disable normalisation for fixed-point (and probably float as well) */
-#ifndef FIXED_POINT
- for (i=0;i<bank->nb_banks;i++)
- bank->scaling[i] = 0;
- for (i=0;i<bank->len;i++)
- {
- int id = bank->bank_left[i];
- bank->scaling[id] += bank->filter_left[i];
- id = bank->bank_right[i];
- bank->scaling[id] += bank->filter_right[i];
- }
- for (i=0;i<bank->nb_banks;i++)
- bank->scaling[i] = Q15_ONE/(bank->scaling[i]);
-#endif
- return bank;
-}
-
-void filterbank_destroy(FilterBank *bank)
-{
- speex_free(bank->bank_left);
- speex_free(bank->bank_right);
- speex_free(bank->filter_left);
- speex_free(bank->filter_right);
-#ifndef FIXED_POINT
- speex_free(bank->scaling);
-#endif
- speex_free(bank);
-}
-
-void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel)
-{
- int i;
- for (i=0;i<bank->nb_banks;i++)
- mel[i] = 0;
-
- for (i=0;i<bank->len;i++)
- {
- int id;
- id = bank->bank_left[i];
- mel[id] += MULT16_32_P15(bank->filter_left[i],ps[i]);
- id = bank->bank_right[i];
- mel[id] += MULT16_32_P15(bank->filter_right[i],ps[i]);
- }
- /* Think I can safely disable normalisation that for fixed-point (and probably float as well) */
-#ifndef FIXED_POINT
- /*for (i=0;i<bank->nb_banks;i++)
- mel[i] = MULT16_32_P15(Q15(bank->scaling[i]),mel[i]);
- */
-#endif
-}
-
-void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *ps)
-{
- int i;
- for (i=0;i<bank->len;i++)
- {
- spx_word32_t tmp;
- int id1, id2;
- id1 = bank->bank_left[i];
- id2 = bank->bank_right[i];
- tmp = MULT16_16(mel[id1],bank->filter_left[i]);
- tmp += MULT16_16(mel[id2],bank->filter_right[i]);
- ps[i] = EXTRACT16(PSHR32(tmp,15));
- }
-}
-
-
-#ifndef FIXED_POINT
-void filterbank_compute_bank(FilterBank *bank, float *ps, float *mel)
-{
- int i;
- for (i=0;i<bank->nb_banks;i++)
- mel[i] = 0;
-
- for (i=0;i<bank->len;i++)
- {
- int id = bank->bank_left[i];
- mel[id] += bank->filter_left[i]*ps[i];
- id = bank->bank_right[i];
- mel[id] += bank->filter_right[i]*ps[i];
- }
- for (i=0;i<bank->nb_banks;i++)
- mel[i] *= bank->scaling[i];
-}
-
-void filterbank_compute_psd(FilterBank *bank, float *mel, float *ps)
-{
- int i;
- for (i=0;i<bank->len;i++)
- {
- int id = bank->bank_left[i];
- ps[i] = mel[id]*bank->filter_left[i];
- id = bank->bank_right[i];
- ps[i] += mel[id]*bank->filter_right[i];
- }
-}
-
-void filterbank_psy_smooth(FilterBank *bank, float *ps, float *mask)
-{
- /* Low freq slope: 14 dB/Bark*/
- /* High freq slope: 9 dB/Bark*/
- /* Noise vs tone: 5 dB difference */
- /* FIXME: Temporary kludge */
- float bark[100];
- int i;
- /* Assumes 1/3 Bark resolution */
- float decay_low = 0.34145f;
- float decay_high = 0.50119f;
- filterbank_compute_bank(bank, ps, bark);
- for (i=1;i<bank->nb_banks;i++)
- {
- /*float decay_high = 13-1.6*log10(bark[i-1]);
- decay_high = pow(10,(-decay_high/30.f));*/
- bark[i] = bark[i] + decay_high*bark[i-1];
- }
- for (i=bank->nb_banks-2;i>=0;i--)
- {
- bark[i] = bark[i] + decay_low*bark[i+1];
- }
- filterbank_compute_psd(bank, bark, mask);
-}
-
-#endif
diff --git a/drivers/speex/filterbank.h b/drivers/speex/filterbank.h
deleted file mode 100644
index 3e889a22f..000000000
--- a/drivers/speex/filterbank.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2006 Jean-Marc Valin */
-/**
- @file filterbank.h
- @brief Converting between psd and filterbank
- */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef FILTERBANK_H
-#define FILTERBANK_H
-
-#include "arch.h"
-
-typedef struct {
- int *bank_left;
- int *bank_right;
- spx_word16_t *filter_left;
- spx_word16_t *filter_right;
-#ifndef FIXED_POINT
- float *scaling;
-#endif
- int nb_banks;
- int len;
-} FilterBank;
-
-
-FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type);
-
-void filterbank_destroy(FilterBank *bank);
-
-void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel);
-
-void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *psd);
-
-#ifndef FIXED_POINT
-void filterbank_compute_bank(FilterBank *bank, float *psd, float *mel);
-void filterbank_compute_psd(FilterBank *bank, float *mel, float *psd);
-#endif
-
-
-#endif
diff --git a/drivers/speex/filters.c b/drivers/speex/filters.c
deleted file mode 100644
index 2cfac6d67..000000000
--- a/drivers/speex/filters.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
- File: filters.c
- Various analysis/synthesis filters
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include "filters.h"
-#include "stack_alloc.h"
-#include "arch.h"
-#include "math_approx.h"
-#include "ltp.h"
-#include <math.h>
-
-#ifdef _USE_SSE
-#include "filters_sse.h"
-#elif defined (ARM4_ASM) || defined(ARM5E_ASM)
-#include "filters_arm4.h"
-#elif defined (BFIN_ASM)
-#include "filters_bfin.h"
-#endif
-
-
-
-void bw_lpc(spx_word16_t gamma, const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order)
-{
- int i;
- spx_word16_t tmp=gamma;
- for (i=0;i<order;i++)
- {
- lpc_out[i] = MULT16_16_P15(tmp,lpc_in[i]);
- tmp = MULT16_16_P15(tmp, gamma);
- }
-}
-
-void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len)
-{
- int i;
- for (i=0;i<len;i++)
- {
- /* It's important we do the test that way so we can catch NaNs, which are neither greater nor smaller */
- if (!(vec[i]>=min_val && vec[i] <= max_val))
- {
- if (vec[i] < min_val)
- vec[i] = min_val;
- else if (vec[i] > max_val)
- vec[i] = max_val;
- else /* Has to be NaN */
- vec[i] = 0;
- }
- }
-}
-
-void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem)
-{
- int i;
-#ifdef FIXED_POINT
- const spx_word16_t Pcoef[5][3] = {{16384, -31313, 14991}, {16384, -31569, 15249}, {16384, -31677, 15328}, {16384, -32313, 15947}, {16384, -22446, 6537}};
- const spx_word16_t Zcoef[5][3] = {{15672, -31344, 15672}, {15802, -31601, 15802}, {15847, -31694, 15847}, {16162, -32322, 16162}, {14418, -28836, 14418}};
-#else
- const spx_word16_t Pcoef[5][3] = {{1.00000f, -1.91120f, 0.91498f}, {1.00000f, -1.92683f, 0.93071f}, {1.00000f, -1.93338f, 0.93553f}, {1.00000f, -1.97226f, 0.97332f}, {1.00000f, -1.37000f, 0.39900f}};
- const spx_word16_t Zcoef[5][3] = {{0.95654f, -1.91309f, 0.95654f}, {0.96446f, -1.92879f, 0.96446f}, {0.96723f, -1.93445f, 0.96723f}, {0.98645f, -1.97277f, 0.98645f}, {0.88000f, -1.76000f, 0.88000f}};
-#endif
- const spx_word16_t *den, *num;
- if (filtID>4)
- filtID=4;
-
- den = Pcoef[filtID]; num = Zcoef[filtID];
- /*return;*/
- for (i=0;i<len;i++)
- {
- spx_word16_t yi;
- spx_word32_t vout = ADD32(MULT16_16(num[0], x[i]),mem[0]);
- yi = EXTRACT16(SATURATE(PSHR32(vout,14),32767));
- mem[0] = ADD32(MAC16_16(mem[1], num[1],x[i]), SHL32(MULT16_32_Q15(-den[1],vout),1));
- mem[1] = ADD32(MULT16_16(num[2],x[i]), SHL32(MULT16_32_Q15(-den[2],vout),1));
- y[i] = yi;
- }
-}
-
-#ifdef FIXED_POINT
-
-/* FIXME: These functions are ugly and probably introduce too much error */
-void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len)
-{
- int i;
- for (i=0;i<len;i++)
- {
- y[i] = SHL32(MULT16_32_Q14(EXTRACT16(SHR32(x[i],7)),scale),7);
- }
-}
-
-void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len)
-{
- int i;
- if (scale > SHL32(EXTEND32(SIG_SCALING), 8))
- {
- spx_word16_t scale_1;
- scale = PSHR32(scale, SIG_SHIFT);
- scale_1 = EXTRACT16(PDIV32_16(SHL32(EXTEND32(SIG_SCALING),7),scale));
- for (i=0;i<len;i++)
- {
- y[i] = MULT16_16_P15(scale_1, x[i]);
- }
- } else if (scale > SHR32(EXTEND32(SIG_SCALING), 2)) {
- spx_word16_t scale_1;
- scale = PSHR32(scale, SIG_SHIFT-5);
- scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),3),scale);
- for (i=0;i<len;i++)
- {
- y[i] = PSHR32(MULT16_16(scale_1, SHL16(x[i],2)),8);
- }
- } else {
- spx_word16_t scale_1;
- scale = PSHR32(scale, SIG_SHIFT-7);
- if (scale < 5)
- scale = 5;
- scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),3),scale);
- for (i=0;i<len;i++)
- {
- y[i] = PSHR32(MULT16_16(scale_1, SHL16(x[i],2)),6);
- }
- }
-}
-
-#else
-
-void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len)
-{
- int i;
- for (i=0;i<len;i++)
- y[i] = scale*x[i];
-}
-
-void signal_div(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len)
-{
- int i;
- float scale_1 = 1/scale;
- for (i=0;i<len;i++)
- y[i] = scale_1*x[i];
-}
-#endif
-
-
-
-#ifdef FIXED_POINT
-
-
-
-spx_word16_t compute_rms(const spx_sig_t *x, int len)
-{
- int i;
- spx_word32_t sum=0;
- spx_sig_t max_val=1;
- int sig_shift;
-
- for (i=0;i<len;i++)
- {
- spx_sig_t tmp = x[i];
- if (tmp<0)
- tmp = -tmp;
- if (tmp > max_val)
- max_val = tmp;
- }
-
- sig_shift=0;
- while (max_val>16383)
- {
- sig_shift++;
- max_val >>= 1;
- }
-
- for (i=0;i<len;i+=4)
- {
- spx_word32_t sum2=0;
- spx_word16_t tmp;
- tmp = EXTRACT16(SHR32(x[i],sig_shift));
- sum2 = MAC16_16(sum2,tmp,tmp);
- tmp = EXTRACT16(SHR32(x[i+1],sig_shift));
- sum2 = MAC16_16(sum2,tmp,tmp);
- tmp = EXTRACT16(SHR32(x[i+2],sig_shift));
- sum2 = MAC16_16(sum2,tmp,tmp);
- tmp = EXTRACT16(SHR32(x[i+3],sig_shift));
- sum2 = MAC16_16(sum2,tmp,tmp);
- sum = ADD32(sum,SHR32(sum2,6));
- }
-
- return EXTRACT16(PSHR32(SHL32(EXTEND32(spx_sqrt(DIV32(sum,len))),(sig_shift+3)),SIG_SHIFT));
-}
-
-spx_word16_t compute_rms16(const spx_word16_t *x, int len)
-{
- int i;
- spx_word16_t max_val=10;
-
- for (i=0;i<len;i++)
- {
- spx_sig_t tmp = x[i];
- if (tmp<0)
- tmp = -tmp;
- if (tmp > max_val)
- max_val = tmp;
- }
- if (max_val>16383)
- {
- spx_word32_t sum=0;
- for (i=0;i<len;i+=4)
- {
- spx_word32_t sum2=0;
- sum2 = MAC16_16(sum2,SHR16(x[i],1),SHR16(x[i],1));
- sum2 = MAC16_16(sum2,SHR16(x[i+1],1),SHR16(x[i+1],1));
- sum2 = MAC16_16(sum2,SHR16(x[i+2],1),SHR16(x[i+2],1));
- sum2 = MAC16_16(sum2,SHR16(x[i+3],1),SHR16(x[i+3],1));
- sum = ADD32(sum,SHR32(sum2,6));
- }
- return SHL16(spx_sqrt(DIV32(sum,len)),4);
- } else {
- spx_word32_t sum=0;
- int sig_shift=0;
- if (max_val < 8192)
- sig_shift=1;
- if (max_val < 4096)
- sig_shift=2;
- if (max_val < 2048)
- sig_shift=3;
- for (i=0;i<len;i+=4)
- {
- spx_word32_t sum2=0;
- sum2 = MAC16_16(sum2,SHL16(x[i],sig_shift),SHL16(x[i],sig_shift));
- sum2 = MAC16_16(sum2,SHL16(x[i+1],sig_shift),SHL16(x[i+1],sig_shift));
- sum2 = MAC16_16(sum2,SHL16(x[i+2],sig_shift),SHL16(x[i+2],sig_shift));
- sum2 = MAC16_16(sum2,SHL16(x[i+3],sig_shift),SHL16(x[i+3],sig_shift));
- sum = ADD32(sum,SHR32(sum2,6));
- }
- return SHL16(spx_sqrt(DIV32(sum,len)),3-sig_shift);
- }
-}
-
-#ifndef OVERRIDE_NORMALIZE16
-int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
-{
- int i;
- spx_sig_t max_val=1;
- int sig_shift;
-
- for (i=0;i<len;i++)
- {
- spx_sig_t tmp = x[i];
- if (tmp<0)
- tmp = NEG32(tmp);
- if (tmp >= max_val)
- max_val = tmp;
- }
-
- sig_shift=0;
- while (max_val>max_scale)
- {
- sig_shift++;
- max_val >>= 1;
- }
-
- for (i=0;i<len;i++)
- y[i] = EXTRACT16(SHR32(x[i], sig_shift));
-
- return sig_shift;
-}
-#endif
-
-#else
-
-spx_word16_t compute_rms(const spx_sig_t *x, int len)
-{
- int i;
- float sum=0;
- for (i=0;i<len;i++)
- {
- sum += x[i]*x[i];
- }
- return sqrt(.1+sum/len);
-}
-spx_word16_t compute_rms16(const spx_word16_t *x, int len)
-{
- return compute_rms(x, len);
-}
-#endif
-
-
-
-#ifndef OVERRIDE_FILTER_MEM16
-void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- int i,j;
- spx_word16_t xi,yi,nyi;
- for (i=0;i<N;i++)
- {
- xi= x[i];
- yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767));
- nyi = NEG16(yi);
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_16(MAC16_16(mem[j+1], num[j],xi), den[j],nyi);
- }
- mem[ord-1] = ADD32(MULT16_16(num[ord-1],xi), MULT16_16(den[ord-1],nyi));
- y[i] = yi;
- }
-}
-#endif
-
-#ifndef OVERRIDE_IIR_MEM16
-void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- int i,j;
- spx_word16_t yi,nyi;
-
- for (i=0;i<N;i++)
- {
- yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767));
- nyi = NEG16(yi);
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_16(mem[j+1],den[j],nyi);
- }
- mem[ord-1] = MULT16_16(den[ord-1],nyi);
- y[i] = yi;
- }
-}
-#endif
-
-#ifndef OVERRIDE_FIR_MEM16
-void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- int i,j;
- spx_word16_t xi,yi;
-
- for (i=0;i<N;i++)
- {
- xi=x[i];
- yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767));
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_16(mem[j+1], num[j],xi);
- }
- mem[ord-1] = MULT16_16(num[ord-1],xi);
- y[i] = yi;
- }
-}
-#endif
-
-
-void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
-{
- int i;
- VARDECL(spx_mem_t *mem);
- ALLOC(mem, ord, spx_mem_t);
- for (i=0;i<ord;i++)
- mem[i]=0;
- iir_mem16(xx, ak, y, N, ord, mem, stack);
- for (i=0;i<ord;i++)
- mem[i]=0;
- filter_mem16(y, awk1, awk2, y, N, ord, mem, stack);
-}
-void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
-{
- int i;
- VARDECL(spx_mem_t *mem);
- ALLOC(mem, ord, spx_mem_t);
- for (i=0;i<ord;i++)
- mem[i]=0;
- filter_mem16(xx, ak, awk1, y, N, ord, mem, stack);
- for (i=0;i<ord;i++)
- mem[i]=0;
- fir_mem16(y, awk2, y, N, ord, mem, stack);
-}
-
-
-#ifndef OVERRIDE_COMPUTE_IMPULSE_RESPONSE
-void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
-{
- int i,j;
- spx_word16_t y1, ny1i, ny2i;
- VARDECL(spx_mem_t *mem1);
- VARDECL(spx_mem_t *mem2);
- ALLOC(mem1, ord, spx_mem_t);
- ALLOC(mem2, ord, spx_mem_t);
-
- y[0] = LPC_SCALING;
- for (i=0;i<ord;i++)
- y[i+1] = awk1[i];
- i++;
- for (;i<N;i++)
- y[i] = VERY_SMALL;
- for (i=0;i<ord;i++)
- mem1[i] = mem2[i] = 0;
- for (i=0;i<N;i++)
- {
- y1 = ADD16(y[i], EXTRACT16(PSHR32(mem1[0],LPC_SHIFT)));
- ny1i = NEG16(y1);
- y[i] = PSHR32(ADD32(SHL32(EXTEND32(y1),LPC_SHIFT+1),mem2[0]),LPC_SHIFT);
- ny2i = NEG16(y[i]);
- for (j=0;j<ord-1;j++)
- {
- mem1[j] = MAC16_16(mem1[j+1], awk2[j],ny1i);
- mem2[j] = MAC16_16(mem2[j+1], ak[j],ny2i);
- }
- mem1[ord-1] = MULT16_16(awk2[ord-1],ny1i);
- mem2[ord-1] = MULT16_16(ak[ord-1],ny2i);
- }
-}
-#endif
-
-/* Decomposes a signal into low-band and high-band using a QMF */
-void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *y1, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack)
-{
- int i,j,k,M2;
- VARDECL(spx_word16_t *a);
- VARDECL(spx_word16_t *x);
- spx_word16_t *x2;
-
- ALLOC(a, M, spx_word16_t);
- ALLOC(x, N+M-1, spx_word16_t);
- x2=x+M-1;
- M2=M>>1;
- for (i=0;i<M;i++)
- a[M-i-1]= aa[i];
- for (i=0;i<M-1;i++)
- x[i]=mem[M-i-2];
- for (i=0;i<N;i++)
- x[i+M-1]=SHR16(xx[i],1);
- for (i=0;i<M-1;i++)
- mem[i]=SHR16(xx[N-i-1],1);
- for (i=0,k=0;i<N;i+=2,k++)
- {
- spx_word32_t y1k=0, y2k=0;
- for (j=0;j<M2;j++)
- {
- y1k=ADD32(y1k,MULT16_16(a[j],ADD16(x[i+j],x2[i-j])));
- y2k=SUB32(y2k,MULT16_16(a[j],SUB16(x[i+j],x2[i-j])));
- j++;
- y1k=ADD32(y1k,MULT16_16(a[j],ADD16(x[i+j],x2[i-j])));
- y2k=ADD32(y2k,MULT16_16(a[j],SUB16(x[i+j],x2[i-j])));
- }
- y1[k] = EXTRACT16(SATURATE(PSHR32(y1k,15),32767));
- y2[k] = EXTRACT16(SATURATE(PSHR32(y2k,15),32767));
- }
-}
-
-/* Re-synthesised a signal from the QMF low-band and high-band signals */
-void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack)
- /* assumptions:
- all odd x[i] are zero -- well, actually they are left out of the array now
- N and M are multiples of 4 */
-{
- int i, j;
- int M2, N2;
- VARDECL(spx_word16_t *xx1);
- VARDECL(spx_word16_t *xx2);
-
- M2 = M>>1;
- N2 = N>>1;
- ALLOC(xx1, M2+N2, spx_word16_t);
- ALLOC(xx2, M2+N2, spx_word16_t);
-
- for (i = 0; i < N2; i++)
- xx1[i] = x1[N2-1-i];
- for (i = 0; i < M2; i++)
- xx1[N2+i] = mem1[2*i+1];
- for (i = 0; i < N2; i++)
- xx2[i] = x2[N2-1-i];
- for (i = 0; i < M2; i++)
- xx2[N2+i] = mem2[2*i+1];
-
- for (i = 0; i < N2; i += 2) {
- spx_sig_t y0, y1, y2, y3;
- spx_word16_t x10, x20;
-
- y0 = y1 = y2 = y3 = 0;
- x10 = xx1[N2-2-i];
- x20 = xx2[N2-2-i];
-
- for (j = 0; j < M2; j += 2) {
- spx_word16_t x11, x21;
- spx_word16_t a0, a1;
-
- a0 = a[2*j];
- a1 = a[2*j+1];
- x11 = xx1[N2-1+j-i];
- x21 = xx2[N2-1+j-i];
-
-#ifdef FIXED_POINT
- /* We multiply twice by the same coef to avoid overflows */
- y0 = MAC16_16(MAC16_16(y0, a0, x11), NEG16(a0), x21);
- y1 = MAC16_16(MAC16_16(y1, a1, x11), a1, x21);
- y2 = MAC16_16(MAC16_16(y2, a0, x10), NEG16(a0), x20);
- y3 = MAC16_16(MAC16_16(y3, a1, x10), a1, x20);
-#else
- y0 = ADD32(y0,MULT16_16(a0, x11-x21));
- y1 = ADD32(y1,MULT16_16(a1, x11+x21));
- y2 = ADD32(y2,MULT16_16(a0, x10-x20));
- y3 = ADD32(y3,MULT16_16(a1, x10+x20));
-#endif
- a0 = a[2*j+2];
- a1 = a[2*j+3];
- x10 = xx1[N2+j-i];
- x20 = xx2[N2+j-i];
-
-#ifdef FIXED_POINT
- /* We multiply twice by the same coef to avoid overflows */
- y0 = MAC16_16(MAC16_16(y0, a0, x10), NEG16(a0), x20);
- y1 = MAC16_16(MAC16_16(y1, a1, x10), a1, x20);
- y2 = MAC16_16(MAC16_16(y2, a0, x11), NEG16(a0), x21);
- y3 = MAC16_16(MAC16_16(y3, a1, x11), a1, x21);
-#else
- y0 = ADD32(y0,MULT16_16(a0, x10-x20));
- y1 = ADD32(y1,MULT16_16(a1, x10+x20));
- y2 = ADD32(y2,MULT16_16(a0, x11-x21));
- y3 = ADD32(y3,MULT16_16(a1, x11+x21));
-#endif
- }
-#ifdef FIXED_POINT
- y[2*i] = EXTRACT16(SATURATE32(PSHR32(y0,15),32767));
- y[2*i+1] = EXTRACT16(SATURATE32(PSHR32(y1,15),32767));
- y[2*i+2] = EXTRACT16(SATURATE32(PSHR32(y2,15),32767));
- y[2*i+3] = EXTRACT16(SATURATE32(PSHR32(y3,15),32767));
-#else
- /* Normalize up explicitly if we're in float */
- y[2*i] = 2.f*y0;
- y[2*i+1] = 2.f*y1;
- y[2*i+2] = 2.f*y2;
- y[2*i+3] = 2.f*y3;
-#endif
- }
-
- for (i = 0; i < M2; i++)
- mem1[2*i+1] = xx1[i];
- for (i = 0; i < M2; i++)
- mem2[2*i+1] = xx2[i];
-}
-
-#ifdef FIXED_POINT
-#if 0
-const spx_word16_t shift_filt[3][7] = {{-33, 1043, -4551, 19959, 19959, -4551, 1043},
- {-98, 1133, -4425, 29179, 8895, -2328, 444},
- {444, -2328, 8895, 29179, -4425, 1133, -98}};
-#else
-const spx_word16_t shift_filt[3][7] = {{-390, 1540, -4993, 20123, 20123, -4993, 1540},
- {-1064, 2817, -6694, 31589, 6837, -990, -209},
- {-209, -990, 6837, 31589, -6694, 2817, -1064}};
-#endif
-#else
-#if 0
-const float shift_filt[3][7] = {{-9.9369e-04, 3.1831e-02, -1.3889e-01, 6.0910e-01, 6.0910e-01, -1.3889e-01, 3.1831e-02},
- {-0.0029937, 0.0345613, -0.1350474, 0.8904793, 0.2714479, -0.0710304, 0.0135403},
- {0.0135403, -0.0710304, 0.2714479, 0.8904793, -0.1350474, 0.0345613, -0.0029937}};
-#else
-const float shift_filt[3][7] = {{-0.011915f, 0.046995f, -0.152373f, 0.614108f, 0.614108f, -0.152373f, 0.046995f},
- {-0.0324855f, 0.0859768f, -0.2042986f, 0.9640297f, 0.2086420f, -0.0302054f, -0.0063646f},
- {-0.0063646f, -0.0302054f, 0.2086420f, 0.9640297f, -0.2042986f, 0.0859768f, -0.0324855f}};
-#endif
-#endif
-
-int interp_pitch(
-spx_word16_t *exc, /*decoded excitation*/
-spx_word16_t *interp, /*decoded excitation*/
-int pitch, /*pitch period*/
-int len
-)
-{
- int i,j,k;
- spx_word32_t corr[4][7];
- spx_word32_t maxcorr;
- int maxi, maxj;
- for (i=0;i<7;i++)
- {
- corr[0][i] = inner_prod(exc, exc-pitch-3+i, len);
- }
- for (i=0;i<3;i++)
- {
- for (j=0;j<7;j++)
- {
- int i1, i2;
- spx_word32_t tmp=0;
- i1 = 3-j;
- if (i1<0)
- i1 = 0;
- i2 = 10-j;
- if (i2>7)
- i2 = 7;
- for (k=i1;k<i2;k++)
- tmp += MULT16_32_Q15(shift_filt[i][k],corr[0][j+k-3]);
- corr[i+1][j] = tmp;
- }
- }
- maxi=maxj=0;
- maxcorr = corr[0][0];
- for (i=0;i<4;i++)
- {
- for (j=0;j<7;j++)
- {
- if (corr[i][j] > maxcorr)
- {
- maxcorr = corr[i][j];
- maxi=i;
- maxj=j;
- }
- }
- }
- for (i=0;i<len;i++)
- {
- spx_word32_t tmp = 0;
- if (maxi>0)
- {
- for (k=0;k<7;k++)
- {
- tmp += MULT16_16(exc[i-(pitch-maxj+3)+k-3],shift_filt[maxi-1][k]);
- }
- } else {
- tmp = SHL32(exc[i-(pitch-maxj+3)],15);
- }
- interp[i] = PSHR32(tmp,15);
- }
- return pitch-maxj+3;
-}
-
-void multicomb(
-spx_word16_t *exc, /*decoded excitation*/
-spx_word16_t *new_exc, /*enhanced excitation*/
-spx_coef_t *ak, /*LPC filter coefs*/
-int p, /*LPC order*/
-int nsf, /*sub-frame size*/
-int pitch, /*pitch period*/
-int max_pitch,
-spx_word16_t comb_gain, /*gain of comb filter*/
-char *stack
-)
-{
- int i;
- VARDECL(spx_word16_t *iexc);
- spx_word16_t old_ener, new_ener;
- int corr_pitch;
-
- spx_word16_t iexc0_mag, iexc1_mag, exc_mag;
- spx_word32_t corr0, corr1;
- spx_word16_t gain0, gain1;
- spx_word16_t pgain1, pgain2;
- spx_word16_t c1, c2;
- spx_word16_t g1, g2;
- spx_word16_t ngain;
- spx_word16_t gg1, gg2;
-#ifdef FIXED_POINT
- int scaledown=0;
-#endif
-#if 0 /* Set to 1 to enable full pitch search */
- int nol_pitch[6];
- spx_word16_t nol_pitch_coef[6];
- spx_word16_t ol_pitch_coef;
- open_loop_nbest_pitch(exc, 20, 120, nsf,
- nol_pitch, nol_pitch_coef, 6, stack);
- corr_pitch=nol_pitch[0];
- ol_pitch_coef = nol_pitch_coef[0];
- /*Try to remove pitch multiples*/
- for (i=1;i<6;i++)
- {
-#ifdef FIXED_POINT
- if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],19661)) &&
-#else
- if ((nol_pitch_coef[i]>.6*nol_pitch_coef[0]) &&
-#endif
- (ABS(2*nol_pitch[i]-corr_pitch)<=2 || ABS(3*nol_pitch[i]-corr_pitch)<=3 ||
- ABS(4*nol_pitch[i]-corr_pitch)<=4 || ABS(5*nol_pitch[i]-corr_pitch)<=5))
- {
- corr_pitch = nol_pitch[i];
- }
- }
-#else
- corr_pitch = pitch;
-#endif
-
- ALLOC(iexc, 2*nsf, spx_word16_t);
-
- interp_pitch(exc, iexc, corr_pitch, 80);
- if (corr_pitch>max_pitch)
- interp_pitch(exc, iexc+nsf, 2*corr_pitch, 80);
- else
- interp_pitch(exc, iexc+nsf, -corr_pitch, 80);
-
-#ifdef FIXED_POINT
- for (i=0;i<nsf;i++)
- {
- if (ABS16(exc[i])>16383)
- {
- scaledown = 1;
- break;
- }
- }
- if (scaledown)
- {
- for (i=0;i<nsf;i++)
- exc[i] = SHR16(exc[i],1);
- for (i=0;i<2*nsf;i++)
- iexc[i] = SHR16(iexc[i],1);
- }
-#endif
- /*interp_pitch(exc, iexc+2*nsf, 2*corr_pitch, 80);*/
-
- /*printf ("%d %d %f\n", pitch, corr_pitch, max_corr*ener_1);*/
- iexc0_mag = spx_sqrt(1000+inner_prod(iexc,iexc,nsf));
- iexc1_mag = spx_sqrt(1000+inner_prod(iexc+nsf,iexc+nsf,nsf));
- exc_mag = spx_sqrt(1+inner_prod(exc,exc,nsf));
- corr0 = inner_prod(iexc,exc,nsf);
- if (corr0<0)
- corr0=0;
- corr1 = inner_prod(iexc+nsf,exc,nsf);
- if (corr1<0)
- corr1=0;
-#ifdef FIXED_POINT
- /* Doesn't cost much to limit the ratio and it makes the rest easier */
- if (SHL32(EXTEND32(iexc0_mag),6) < EXTEND32(exc_mag))
- iexc0_mag = ADD16(1,PSHR16(exc_mag,6));
- if (SHL32(EXTEND32(iexc1_mag),6) < EXTEND32(exc_mag))
- iexc1_mag = ADD16(1,PSHR16(exc_mag,6));
-#endif
- if (corr0 > MULT16_16(iexc0_mag,exc_mag))
- pgain1 = QCONST16(1., 14);
- else
- pgain1 = PDIV32_16(SHL32(PDIV32(corr0, exc_mag),14),iexc0_mag);
- if (corr1 > MULT16_16(iexc1_mag,exc_mag))
- pgain2 = QCONST16(1., 14);
- else
- pgain2 = PDIV32_16(SHL32(PDIV32(corr1, exc_mag),14),iexc1_mag);
- gg1 = PDIV32_16(SHL32(EXTEND32(exc_mag),8), iexc0_mag);
- gg2 = PDIV32_16(SHL32(EXTEND32(exc_mag),8), iexc1_mag);
- if (comb_gain>0)
- {
-#ifdef FIXED_POINT
- c1 = (MULT16_16_Q15(QCONST16(.4,15),comb_gain)+QCONST16(.07,15));
- c2 = QCONST16(.5,15)+MULT16_16_Q14(QCONST16(1.72,14),(c1-QCONST16(.07,15)));
-#else
- c1 = .4*comb_gain+.07;
- c2 = .5+1.72*(c1-.07);
-#endif
- } else
- {
- c1=c2=0;
- }
-#ifdef FIXED_POINT
- g1 = 32767 - MULT16_16_Q13(MULT16_16_Q15(c2, pgain1),pgain1);
- g2 = 32767 - MULT16_16_Q13(MULT16_16_Q15(c2, pgain2),pgain2);
-#else
- g1 = 1-c2*pgain1*pgain1;
- g2 = 1-c2*pgain2*pgain2;
-#endif
- if (g1<c1)
- g1 = c1;
- if (g2<c1)
- g2 = c1;
- g1 = (spx_word16_t)PDIV32_16(SHL32(EXTEND32(c1),14),(spx_word16_t)g1);
- g2 = (spx_word16_t)PDIV32_16(SHL32(EXTEND32(c1),14),(spx_word16_t)g2);
- if (corr_pitch>max_pitch)
- {
- gain0 = MULT16_16_Q15(QCONST16(.7,15),MULT16_16_Q14(g1,gg1));
- gain1 = MULT16_16_Q15(QCONST16(.3,15),MULT16_16_Q14(g2,gg2));
- } else {
- gain0 = MULT16_16_Q15(QCONST16(.6,15),MULT16_16_Q14(g1,gg1));
- gain1 = MULT16_16_Q15(QCONST16(.6,15),MULT16_16_Q14(g2,gg2));
- }
- for (i=0;i<nsf;i++)
- new_exc[i] = ADD16(exc[i], EXTRACT16(PSHR32(ADD32(MULT16_16(gain0,iexc[i]), MULT16_16(gain1,iexc[i+nsf])),8)));
- /* FIXME: compute_rms16 is currently not quite accurate enough (but close) */
- new_ener = compute_rms16(new_exc, nsf);
- old_ener = compute_rms16(exc, nsf);
-
- if (old_ener < 1)
- old_ener = 1;
- if (new_ener < 1)
- new_ener = 1;
- if (old_ener > new_ener)
- old_ener = new_ener;
- ngain = PDIV32_16(SHL32(EXTEND32(old_ener),14),new_ener);
-
- for (i=0;i<nsf;i++)
- new_exc[i] = MULT16_16_Q14(ngain, new_exc[i]);
-#ifdef FIXED_POINT
- if (scaledown)
- {
- for (i=0;i<nsf;i++)
- exc[i] = SHL16(exc[i],1);
- for (i=0;i<nsf;i++)
- new_exc[i] = SHL16(SATURATE16(new_exc[i],16383),1);
- }
-#endif
-}
-
diff --git a/drivers/speex/filters.h b/drivers/speex/filters.h
deleted file mode 100644
index e3a5980e7..000000000
--- a/drivers/speex/filters.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file filters.h
- @brief Various analysis/synthesis filters
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef FILTERS_H
-#define FILTERS_H
-
-#include "arch.h"
-
-spx_word16_t compute_rms(const spx_sig_t *x, int len);
-spx_word16_t compute_rms16(const spx_word16_t *x, int len);
-void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len);
-void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len);
-
-#ifdef FIXED_POINT
-
-int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len);
-
-#endif
-
-
-#define HIGHPASS_NARROWBAND 0
-#define HIGHPASS_WIDEBAND 2
-#define HIGHPASS_INPUT 0
-#define HIGHPASS_OUTPUT 1
-#define HIGHPASS_IRS 4
-
-void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem);
-
-
-void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack);
-void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack);
-
-void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
-void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
-void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
-
-/* Apply bandwidth expansion on LPC coef */
-void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order);
-void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len);
-
-
-void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
-void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
-
-void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
-
-void multicomb(
-spx_word16_t *exc, /*decoded excitation*/
-spx_word16_t *new_exc, /*enhanced excitation*/
-spx_coef_t *ak, /*LPC filter coefs*/
-int p, /*LPC order*/
-int nsf, /*sub-frame size*/
-int pitch, /*pitch period*/
-int max_pitch, /*pitch gain (3-tap)*/
-spx_word16_t comb_gain, /*gain of comb filter*/
-char *stack
-);
-
-#endif
diff --git a/drivers/speex/filters_arm4.h b/drivers/speex/filters_arm4.h
deleted file mode 100644
index 7a7404246..000000000
--- a/drivers/speex/filters_arm4.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Copyright (C) 2004 Jean-Marc Valin */
-/**
- @file filters_arm4.h
- @brief Various analysis/synthesis filters (ARM4 version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_NORMALIZE16
-int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
-{
- spx_sig_t max_val=1;
- int sig_shift;
- int dead1, dead2, dead3, dead4, dead5, dead6;
-
- __asm__ __volatile__ (
- "\tmov %1, #1 \n"
- "\tmov %3, #0 \n"
-
- ".normalize16loop1%=: \n"
-
- "\tldr %4, [%0], #4 \n"
- "\tcmps %4, %1 \n"
- "\tmovgt %1, %4 \n"
- "\tcmps %4, %3 \n"
- "\tmovlt %3, %4 \n"
-
- "\tsubs %2, %2, #1 \n"
- "\tbne .normalize16loop1%=\n"
-
- "\trsb %3, %3, #0 \n"
- "\tcmp %1, %3 \n"
- "\tmovlt %1, %3 \n"
- : "=r" (dead1), "=r" (max_val), "=r" (dead3), "=r" (dead4),
- "=r" (dead5), "=r" (dead6)
- : "0" (x), "2" (len)
- : "cc");
-
- sig_shift=0;
- while (max_val>max_scale)
- {
- sig_shift++;
- max_val >>= 1;
- }
-
- __asm__ __volatile__ (
- ".normalize16loop%=: \n"
-
- "\tldr %4, [%0], #4 \n"
- "\tldr %5, [%0], #4 \n"
- "\tmov %4, %4, asr %3 \n"
- "\tstrh %4, [%1], #2 \n"
- "\tldr %4, [%0], #4 \n"
- "\tmov %5, %5, asr %3 \n"
- "\tstrh %5, [%1], #2 \n"
- "\tldr %5, [%0], #4 \n"
- "\tmov %4, %4, asr %3 \n"
- "\tstrh %4, [%1], #2 \n"
- "\tsubs %2, %2, #1 \n"
- "\tmov %5, %5, asr %3 \n"
- "\tstrh %5, [%1], #2 \n"
-
- "\tbgt .normalize16loop%=\n"
- : "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
- "=r" (dead5), "=r" (dead6)
- : "0" (x), "1" (y), "2" (len>>2), "3" (sig_shift)
- : "cc", "memory");
- return sig_shift;
-}
-
diff --git a/drivers/speex/filters_bfin.h b/drivers/speex/filters_bfin.h
deleted file mode 100644
index 1e433ee16..000000000
--- a/drivers/speex/filters_bfin.h
+++ /dev/null
@@ -1,515 +0,0 @@
-/* Copyright (C) 2005 Analog Devices */
-/**
- @file filters_bfin.h
- @brief Various analysis/synthesis filters (Blackfin version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_NORMALIZE16
-int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
-{
- spx_sig_t max_val=1;
- int sig_shift;
- __asm__
- (
- "%0 = 0;\n\t"
- "I0 = %1;\n\t"
- "L0 = 0;\n\t"
- "R1 = [I0++];\n\t"
- "LOOP norm_max%= LC0 = %2;\n\t"
- "LOOP_BEGIN norm_max%=;\n\t"
- "R2 = ABS R1 || R1 = [I0++];\n\t"
- "%0 = MAX(%0, R2);\n\t"
- "LOOP_END norm_max%=;\n\t"
- : "=&d" (max_val)
- : "a" (x), "a" (len)
- : "R1", "R2"
- );
-
- sig_shift=0;
- while (max_val>max_scale)
- {
- sig_shift++;
- max_val >>= 1;
- }
-
- __asm__ __volatile__
- (
- "I0 = %0;\n\t"
- "L0 = 0;\n\t"
- "P1 = %1;\n\t"
- "R0 = [I0++];\n\t"
- "LOOP norm_shift%= LC0 = %3;\n\t"
- "LOOP_BEGIN norm_shift%=;\n\t"
- "R1 = ASHIFT R0 by %2.L || R0 = [I0++];\n\t"
- "W[P1++] = R1;\n\t"
- "LOOP_END norm_shift%=;\n\t"
- "R1 = ASHIFT R0 by %2.L;\n\t"
- "W[P1++] = R1;\n\t"
- : : "a" (x), "a" (y), "d" (-sig_shift), "a" (len-1)
- : "I0", "L0", "P1", "R0", "R1", "memory"
- );
- return sig_shift;
-}
-
-
-
-#define OVERRIDE_FILTER_MEM16
-void filter_mem16(const spx_word16_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- VARDECL(spx_word32_t *xy2);
- VARDECL(spx_word32_t *numden_a);
- spx_word32_t *xy;
- spx_word16_t *numden;
- int i;
-
- ALLOC(xy2, (N+1), spx_word32_t);
- ALLOC(numden_a, (2*ord+2), spx_word32_t);
- xy = xy2+1;
- numden = (spx_word16_t*) numden_a;
-
- for (i=0;i<ord;i++)
- {
- numden[2*i] = num[i];
- numden[2*i+1] = den[i];
- }
- __asm__ __volatile__
- (
- /* Register setup */
- "R0 = %5;\n\t" /*ord */
-
- "P0 = %3;\n\t"
- "I0 = P0;\n\t"
- "B0 = P0;\n\t" /* numden */
- "L0 = 0;\n\t"
-
- "P2 = %0;\n\t" /* Fused xy */
- "I2 = P2;\n\t"
- "L2 = 0;\n\t"
-
- "P4 = %6;\n\t" /* mem */
- "P0 = %1;\n\t" /* _x */
- "P1 = %2;\n\t" /* _y */
-
- /* First sample */
- "R1 = [P4++];\n\t"
- "R1 <<= 3;\n\t" /* shift mem */
- "R1.L = R1 (RND);\n\t"
- "R2 = W[P0++];\n\t" /* load x[0] */
- "R1.L = R1.L + R2.L;\n\t"
- "W[P1++] = R1;\n\t" /* store y[0] */
- "R2 = PACK(R1.L, R2.L);\n\t" /* pack x16 and y16 */
- "[P2] = R2;\n\t"
-
- /* Samples 1 to ord-1 (using memory) */
- "R0 += -1;\n\t"
- "R3 = 0;\n\t"
- "LC0 = R0;\n\t"
- "LOOP filter_start%= LC0;\n\t"
- "LOOP_BEGIN filter_start%=;\n\t"
- "R3 += 1;\n\t"
- "LC1 = R3;\n\t"
-
- "R1 = [P4++];\n\t"
- "A1 = R1;\n\t"
- "A0 = 0;\n\t"
- "I0 = B0;\n\t"
- "I2 = P2;\n\t"
- "P2 += 4;\n\t"
- "R4 = [I0++] || R5 = [I2--];\n\t"
- "LOOP filter_start_inner%= LC1;\n\t"
- "LOOP_BEGIN filter_start_inner%=;\n\t"
- "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
- "LOOP_END filter_start_inner%=;\n\t"
- "A0 += A1;\n\t"
- "R4 = A0;\n\t"
- "R4 <<= 3;\n\t" /* shift mem */
- "R4.L = R4 (RND);\n\t"
- "R2 = W[P0++];\n\t" /* load x */
- "R4.L = R4.L + R2.L;\n\t"
- "W[P1++] = R4;\n\t" /* store y */
- //"R4 <<= 2;\n\t"
- //"R2 <<= 2;\n\t"
- "R2 = PACK(R4.L, R2.L);\n\t" /* pack x16 and y16 */
- "[P2] = R2;\n\t"
-
- "LOOP_END filter_start%=;\n\t"
-
- /* Samples ord to N*/
- "R0 = %5;\n\t"
- "R0 <<= 1;\n\t"
- "I0 = B0;\n\t" /* numden */
- "R0 <<= 1;\n\t"
- "L0 = R0;\n\t"
-
- "R0 = %5;\n\t" /* org */
- "R2 = %4;\n\t" /* N */
- "R2 = R2 - R0;\n\t"
- "R4 = [I0++];\n\t" /* numden */
- "LC0 = R2;\n\t"
- "P3 = R0;\n\t"
- "R0 <<= 2;\n\t"
- "R0 += 8;\n\t"
- "I2 = P2;\n\t"
- "M0 = R0;\n\t"
- "A1 = A0 = 0;\n\t"
- "R5 = [I2--];\n\t" /* load xy */
- "LOOP filter_mid%= LC0;\n\t"
- "LOOP_BEGIN filter_mid%=;\n\t"
- "LOOP filter_mid_inner%= LC1=P3;\n\t"
- "LOOP_BEGIN filter_mid_inner%=;\n\t"
- "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
- "LOOP_END filter_mid_inner%=;\n\t"
- "R0 = (A0 += A1) || I2 += M0;\n\t"
- "R0 = R0 << 3 || R5 = W[P0++];\n\t" /* load x */
- "R0.L = R0 (RND);\n\t"
- "R0.L = R0.L + R5.L;\n\t"
- "R5 = PACK(R0.L, R5.L) || W[P1++] = R0;\n\t" /* shift y | store y */
- "A1 = A0 = 0 || [I2--] = R5\n\t"
- "LOOP_END filter_mid%=;\n\t"
- "I2 += 4;\n\t"
- "P2 = I2;\n\t"
- /* Update memory */
- "P4 = %6;\n\t"
- "R0 = %5;\n\t"
- "LC0 = R0;\n\t"
- "P0 = B0;\n\t"
- "A1 = A0 = 0;\n\t"
- "LOOP mem_update%= LC0;\n\t"
- "LOOP_BEGIN mem_update%=;\n\t"
- "I2 = P2;\n\t"
- "I0 = P0;\n\t"
- "P0 += 4;\n\t"
- "R0 = LC0;\n\t"
- "LC1 = R0;\n\t"
- "R5 = [I2--] || R4 = [I0++];\n\t"
- "LOOP mem_accum%= LC1;\n\t"
- "LOOP_BEGIN mem_accum%=;\n\t"
- "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
- "LOOP_END mem_accum%=;\n\t"
- "R0 = (A0 += A1);\n\t"
- "A1 = A0 = 0 || [P4++] = R0;\n\t"
- "LOOP_END mem_update%=;\n\t"
- "L0 = 0;\n\t"
- : : "m" (xy), "m" (_x), "m" (_y), "m" (numden), "m" (N), "m" (ord), "m" (mem)
- : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B0", "I0", "I2", "L0", "L2", "M0", "memory"
- );
-
-}
-
-
-
-#define OVERRIDE_IIR_MEM16
-void iir_mem16(const spx_word16_t *_x, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- VARDECL(spx_word16_t *y);
- spx_word16_t *yy;
-
- ALLOC(y, (N+2), spx_word16_t);
- yy = y+2;
-
- __asm__ __volatile__
- (
- /* Register setup */
- "R0 = %5;\n\t" /*ord */
-
- "P1 = %3;\n\t"
- "I1 = P1;\n\t"
- "B1 = P1;\n\t"
- "L1 = 0;\n\t"
-
- "P3 = %0;\n\t"
- "I3 = P3;\n\t"
- "L3 = 0;\n\t"
-
- "P4 = %6;\n\t"
- "P0 = %1;\n\t"
- "P1 = %2;\n\t"
-
- /* First sample */
- "R1 = [P4++];\n\t"
- "R1 = R1 << 3 (S);\n\t"
- "R1.L = R1 (RND);\n\t"
- "R2 = W[P0++];\n\t"
- "R1 = R1 + R2;\n\t"
- "W[P1++] = R1;\n\t"
- "W[P3] = R1;\n\t"
-
- /* Samples 1 to ord-1 (using memory) */
- "R0 += -1;\n\t"
- "R3 = 0;\n\t"
- "LC0 = R0;\n\t"
- "LOOP filter_start%= LC0;\n\t"
- "LOOP_BEGIN filter_start%=;\n\t"
- "R3 += 1;\n\t"
- "LC1 = R3;\n\t"
-
- "R1 = [P4++];\n\t"
- "A1 = R1;\n\t"
- "I1 = B1;\n\t"
- "I3 = P3;\n\t"
- "P3 += 2;\n\t"
- "LOOP filter_start_inner%= LC1;\n\t"
- "LOOP_BEGIN filter_start_inner%=;\n\t"
- "R4.L = W[I1++];\n\t"
- "R5.L = W[I3--];\n\t"
- "A1 -= R4.L*R5.L (IS);\n\t"
- "LOOP_END filter_start_inner%=;\n\t"
-
- "R1 = A1;\n\t"
- "R1 <<= 3;\n\t"
- "R1.L = R1 (RND);\n\t"
- "R2 = W[P0++];\n\t"
- "R1 = R1 + R2;\n\t"
- "W[P1++] = R1;\n\t"
- "W[P3] = R1;\n\t"
- "LOOP_END filter_start%=;\n\t"
-
- /* Samples ord to N*/
- "R0 = %5;\n\t"
- "R0 <<= 1;\n\t"
- "I1 = B1;\n\t"
- "L1 = R0;\n\t"
-
- "R0 = %5;\n\t"
- "R2 = %4;\n\t"
- "R2 = R2 - R0;\n\t"
- "R4.L = W[I1++];\n\t"
- "LC0 = R2;\n\t"
- "LOOP filter_mid%= LC0;\n\t"
- "LOOP_BEGIN filter_mid%=;\n\t"
- "LC1 = R0;\n\t"
- "A1 = 0;\n\t"
- "I3 = P3;\n\t"
- "P3 += 2;\n\t"
- "R5.L = W[I3--];\n\t"
- "LOOP filter_mid_inner%= LC1;\n\t"
- "LOOP_BEGIN filter_mid_inner%=;\n\t"
- "A1 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
- "LOOP_END filter_mid_inner%=;\n\t"
- "R1 = A1;\n\t"
- "R1 = R1 << 3 || R2 = W[P0++];\n\t"
- "R1.L = R1 (RND);\n\t"
- "R1 = R1 + R2;\n\t"
- "W[P1++] = R1;\n\t"
- "W[P3] = R1;\n\t"
- "LOOP_END filter_mid%=;\n\t"
-
- /* Update memory */
- "P4 = %6;\n\t"
- "R0 = %5;\n\t"
- "LC0 = R0;\n\t"
- "P1 = B1;\n\t"
- "LOOP mem_update%= LC0;\n\t"
- "LOOP_BEGIN mem_update%=;\n\t"
- "A0 = 0;\n\t"
- "I3 = P3;\n\t"
- "I1 = P1;\n\t"
- "P1 += 2;\n\t"
- "R0 = LC0;\n\t"
- "LC1=R0;\n\t"
- "R5.L = W[I3--] || R4.L = W[I1++];\n\t"
- "LOOP mem_accum%= LC1;\n\t"
- "LOOP_BEGIN mem_accum%=;\n\t"
- "A0 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
- "LOOP_END mem_accum%=;\n\t"
- "R0 = A0;\n\t"
- "[P4++] = R0;\n\t"
- "LOOP_END mem_update%=;\n\t"
- "L1 = 0;\n\t"
- : : "m" (yy), "m" (_x), "m" (_y), "m" (den), "m" (N), "m" (ord), "m" (mem)
- : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B1", "I1", "I3", "L1", "L3", "memory"
- );
-
-}
-
-
-#define OVERRIDE_FIR_MEM16
-void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- int i;
- spx_coef_t den2[12];
- spx_coef_t *den;
- den = (spx_coef_t*)((((int)den2)+4)&0xfffffffc);
- for (i=0;i<10;i++)
- den[i] = 0;
- filter_mem16(x, num, den, y, N, ord, mem, stack);
-}
-
-
-#define OVERRIDE_COMPUTE_IMPULSE_RESPONSE
-void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
-{
- int i;
- VARDECL(spx_word16_t *ytmp);
- ALLOC(ytmp, N, spx_word16_t);
- spx_word16_t *ytmp2 = ytmp;
- y[0] = LPC_SCALING;
- for (i=0;i<ord;i++)
- y[i+1] = awk1[i];
- i++;
- for (;i<N;i++)
- y[i] = 0;
-
- N-=1;
- __asm__ __volatile__
- (
- "I0 = %0;\n\t"
- "I1 = %1;\n\t"
- "L0 = 0;\n\t"
- "L1 = 0;\n\t"
- "L2 = 0;\n\t"
- "L3 = 0;\n\t"
- "R0 = 1;\n\t"
- "R0 <<= 13;\n\t"
- "W[I0] = R0.L;\n\t"
- "R0 <<= 1;\n\t"
- "W[I1] = R0.L;\n\t"
- "R0 = %5;\n\t"
- "LC0 = R0;\n\t"
- "R2 = 0;\n\t"
- "LOOP samples%= LC0;\n\t"
- "LOOP_BEGIN samples%=;\n\t"
- "R2 += 1;\n\t"
- "R2 = MIN(R2, %4);\n\t"
- "I0 = %0;\n\t"
- "I1 = %1;\n\t"
- "I2 = %2;\n\t"
- "I3 = %3;\n\t"
- "%0 += 2;\n\t"
- "%1 += 2;\n\t"
- "A1 = A0 = 0;\n\t"
- "R0.L = W[I0--] || R1.L = W[I2++];\n\t"
- "LC1 = R2;\n\t"
- "LOOP filter%= LC1;\n\t"
- "LOOP_BEGIN filter%=;\n\t"
- "A0 -= R0.L*R1.L (IS) || R0.L = W[I1--] || R1.L = W[I3++];\n\t"
- "A1 -= R0.L*R1.L (IS) || R0.L = W[I0--] || R1.L = W[I2++];\n\t"
- "LOOP_END filter%=;\n\t"
- "R0 = A0, R1 = A1;\n\t"
- "R3 = W[%1] (X);\n\t"
- "R3 <<= 13;\n\t"
- "R0 = R0 + R3;\n\t"
- "R3 = R0 >>> 13;\n\t"
- "W[%0] = R3.L;\n\t"
- "R0 <<= 1;\n\t"
- "R1 = R1 + R0;\n\t"
- "R1 >>>= 13;\n\t"
- "W[%1] = R1.L;\n\t"
- "LOOP_END samples%=;\n\t"
- : "=a" (ytmp2), "=a" (y)
- : "a" (awk2), "a" (ak), "d" (ord), "m" (N), "0" (ytmp2), "1" (y)
- : "A0", "A1", "R0", "R1", "R2", "R3", "I0", "I1", "I2", "I3", "L0", "L1", "L2", "L3", "A0", "A1"
- );
-}
-
-
-
-#if 0 /* Equivalent C function for filter_mem2 and compute_impulse_response */
-#define min(a,b) ((a)<(b) ? (a):(b))
-
-void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
-{
- int i,j;
- VARDECL(spx_word16_t *ytmp);
- ALLOC(ytmp, N, spx_word16_t);
-
- y[0] = LPC_SCALING;
- for (i=0;i<ord;i++)
- y[i+1] = awk1[i];
- i++;
- for (;i<N;i++)
- y[i] = 0;
-
- for (i=0;i<N;i++)
- {
- spx_word32_t yi = SHL32(EXTEND32(y[i]),LPC_SHIFT);
- spx_word32_t yi2 = 0;
- for (j=0;j<min(i,ord);j++)
- {
- yi = MAC16_16(yi, awk2[j], -ytmp[i-j-1]);
- yi2 = MAC16_16(yi2, ak[j], -y[i-j-1]);
- }
- ytmp[i] = EXTRACT16(SHR32(yi,LPC_SHIFT));
- yi2 = ADD32(yi2,SHL32(yi,1));
- y[i] = EXTRACT16(SHR32(yi2,LPC_SHIFT));
- }
-
-}
-
-
-void filter_mem2(const spx_sig_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *_y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_word16_t xi,yi,nyi;
- spx_word16_t x[N],y[N];
- spx_word16_t *xx, *yy;
- xx = x;
- yy = y;
- for (i=0;i<N;i++)
- {
- x[i] = EXTRACT16(SHR32(_x[i],SIG_SHIFT));
- }
-
- for (i=0;i<ord;i++)
- {
- spx_word32_t yi = mem[i];
- for (j=0;j<i;j++)
- {
- yi = MAC16_16(yi, num[j], x[i-j-1]);
- yi = MAC16_16(yi, den[j], -y[i-j-1]);
- }
- _y[i] = ADD32(_x[i],SHL32(yi,1));
- y[i] = EXTRACT16(SHR32(_y[i],SIG_SHIFT));
- }
- for (i=ord;i<N;i++)
- {
- spx_word32_t yi = 0;
- for (j=0;j<ord;j++)
- {
- yi = MAC16_16(yi, num[j], x[i-j-1]);
- yi = MAC16_16(yi, den[j], -y[i-j-1]);
- }
- _y[i] = ADD32(_x[i],SHL32(yi,1));
- y[i] = EXTRACT16(SHR32(_y[i],SIG_SHIFT));
- }
-
- for (i=0;i<ord;i++)
- {
- spx_mem_t m = 0;
- for (j=0;j<ord-i;j++)
- {
- m = MAC16_16(m, x[N-1-j], num[j+i]);
- m = MAC16_16(m, -y[N-1-j], den[j+i]);
- }
- mem[i] = m;
- }
-}
-#endif
diff --git a/drivers/speex/filters_sse.h b/drivers/speex/filters_sse.h
deleted file mode 100644
index 4bb333daf..000000000
--- a/drivers/speex/filters_sse.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file filters_sse.h
- @brief Various analysis/synthesis filters (SSE version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <xmmintrin.h>
-
-void filter_mem16_10(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
-{
- __m128 num[3], den[3], mem[3];
-
- int i;
-
- /* Copy numerator, denominator and memory to aligned xmm */
- for (i=0;i<2;i++)
- {
- mem[i] = _mm_loadu_ps(_mem+4*i);
- num[i] = _mm_loadu_ps(_num+4*i);
- den[i] = _mm_loadu_ps(_den+4*i);
- }
- mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
- num[2] = _mm_setr_ps(_num[8], _num[9], 0, 0);
- den[2] = _mm_setr_ps(_den[8], _den[9], 0, 0);
-
- for (i=0;i<N;i++)
- {
- __m128 xx;
- __m128 yy;
- /* Compute next filter result */
- xx = _mm_load_ps1(x+i);
- yy = _mm_add_ss(xx, mem[0]);
- _mm_store_ss(y+i, yy);
- yy = _mm_shuffle_ps(yy, yy, 0);
-
- /* Update memory */
- mem[0] = _mm_move_ss(mem[0], mem[1]);
- mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
-
- mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
- mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
-
- mem[1] = _mm_move_ss(mem[1], mem[2]);
- mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
-
- mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
- mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
-
- mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
-
- mem[2] = _mm_add_ps(mem[2], _mm_mul_ps(xx, num[2]));
- mem[2] = _mm_sub_ps(mem[2], _mm_mul_ps(yy, den[2]));
- }
- /* Put memory back in its place */
- _mm_storeu_ps(_mem, mem[0]);
- _mm_storeu_ps(_mem+4, mem[1]);
- _mm_store_ss(_mem+8, mem[2]);
- mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
- _mm_store_ss(_mem+9, mem[2]);
-}
-
-void filter_mem16_8(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
-{
- __m128 num[2], den[2], mem[2];
-
- int i;
-
- /* Copy numerator, denominator and memory to aligned xmm */
- for (i=0;i<2;i++)
- {
- mem[i] = _mm_loadu_ps(_mem+4*i);
- num[i] = _mm_loadu_ps(_num+4*i);
- den[i] = _mm_loadu_ps(_den+4*i);
- }
-
- for (i=0;i<N;i++)
- {
- __m128 xx;
- __m128 yy;
- /* Compute next filter result */
- xx = _mm_load_ps1(x+i);
- yy = _mm_add_ss(xx, mem[0]);
- _mm_store_ss(y+i, yy);
- yy = _mm_shuffle_ps(yy, yy, 0);
-
- /* Update memory */
- mem[0] = _mm_move_ss(mem[0], mem[1]);
- mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
-
- mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
- mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
-
- mem[1] = _mm_sub_ss(mem[1], mem[1]);
- mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
-
- mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
- mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
- }
- /* Put memory back in its place */
- _mm_storeu_ps(_mem, mem[0]);
- _mm_storeu_ps(_mem+4, mem[1]);
-}
-
-
-#define OVERRIDE_FILTER_MEM16
-void filter_mem16(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
-{
- if(ord==10)
- filter_mem16_10(x, _num, _den, y, N, ord, _mem);
- else if (ord==8)
- filter_mem16_8(x, _num, _den, y, N, ord, _mem);
-}
-
-
-
-void iir_mem16_10(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
-{
- __m128 den[3], mem[3];
-
- int i;
-
- /* Copy numerator, denominator and memory to aligned xmm */
- for (i=0;i<2;i++)
- {
- mem[i] = _mm_loadu_ps(_mem+4*i);
- den[i] = _mm_loadu_ps(_den+4*i);
- }
- mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
- den[2] = _mm_setr_ps(_den[8], _den[9], 0, 0);
-
- for (i=0;i<N;i++)
- {
- __m128 xx;
- __m128 yy;
- /* Compute next filter result */
- xx = _mm_load_ps1(x+i);
- yy = _mm_add_ss(xx, mem[0]);
- _mm_store_ss(y+i, yy);
- yy = _mm_shuffle_ps(yy, yy, 0);
-
- /* Update memory */
- mem[0] = _mm_move_ss(mem[0], mem[1]);
- mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
-
- mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
-
- mem[1] = _mm_move_ss(mem[1], mem[2]);
- mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
-
- mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
-
- mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
-
- mem[2] = _mm_sub_ps(mem[2], _mm_mul_ps(yy, den[2]));
- }
- /* Put memory back in its place */
- _mm_storeu_ps(_mem, mem[0]);
- _mm_storeu_ps(_mem+4, mem[1]);
- _mm_store_ss(_mem+8, mem[2]);
- mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
- _mm_store_ss(_mem+9, mem[2]);
-}
-
-
-void iir_mem16_8(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
-{
- __m128 den[2], mem[2];
-
- int i;
-
- /* Copy numerator, denominator and memory to aligned xmm */
- for (i=0;i<2;i++)
- {
- mem[i] = _mm_loadu_ps(_mem+4*i);
- den[i] = _mm_loadu_ps(_den+4*i);
- }
-
- for (i=0;i<N;i++)
- {
- __m128 xx;
- __m128 yy;
- /* Compute next filter result */
- xx = _mm_load_ps1(x+i);
- yy = _mm_add_ss(xx, mem[0]);
- _mm_store_ss(y+i, yy);
- yy = _mm_shuffle_ps(yy, yy, 0);
-
- /* Update memory */
- mem[0] = _mm_move_ss(mem[0], mem[1]);
- mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
-
- mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
-
- mem[1] = _mm_sub_ss(mem[1], mem[1]);
- mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
-
- mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
- }
- /* Put memory back in its place */
- _mm_storeu_ps(_mem, mem[0]);
- _mm_storeu_ps(_mem+4, mem[1]);
-}
-
-#define OVERRIDE_IIR_MEM16
-void iir_mem16(const float *x, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
-{
- if(ord==10)
- iir_mem16_10(x, _den, y, N, ord, _mem);
- else if (ord==8)
- iir_mem16_8(x, _den, y, N, ord, _mem);
-}
-
-
-void fir_mem16_10(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
-{
- __m128 num[3], mem[3];
-
- int i;
-
- /* Copy numerator, denominator and memory to aligned xmm */
- for (i=0;i<2;i++)
- {
- mem[i] = _mm_loadu_ps(_mem+4*i);
- num[i] = _mm_loadu_ps(_num+4*i);
- }
- mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
- num[2] = _mm_setr_ps(_num[8], _num[9], 0, 0);
-
- for (i=0;i<N;i++)
- {
- __m128 xx;
- __m128 yy;
- /* Compute next filter result */
- xx = _mm_load_ps1(x+i);
- yy = _mm_add_ss(xx, mem[0]);
- _mm_store_ss(y+i, yy);
- yy = _mm_shuffle_ps(yy, yy, 0);
-
- /* Update memory */
- mem[0] = _mm_move_ss(mem[0], mem[1]);
- mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
-
- mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
-
- mem[1] = _mm_move_ss(mem[1], mem[2]);
- mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
-
- mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
-
- mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
-
- mem[2] = _mm_add_ps(mem[2], _mm_mul_ps(xx, num[2]));
- }
- /* Put memory back in its place */
- _mm_storeu_ps(_mem, mem[0]);
- _mm_storeu_ps(_mem+4, mem[1]);
- _mm_store_ss(_mem+8, mem[2]);
- mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
- _mm_store_ss(_mem+9, mem[2]);
-}
-
-void fir_mem16_8(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
-{
- __m128 num[2], mem[2];
-
- int i;
-
- /* Copy numerator, denominator and memory to aligned xmm */
- for (i=0;i<2;i++)
- {
- mem[i] = _mm_loadu_ps(_mem+4*i);
- num[i] = _mm_loadu_ps(_num+4*i);
- }
-
- for (i=0;i<N;i++)
- {
- __m128 xx;
- __m128 yy;
- /* Compute next filter result */
- xx = _mm_load_ps1(x+i);
- yy = _mm_add_ss(xx, mem[0]);
- _mm_store_ss(y+i, yy);
- yy = _mm_shuffle_ps(yy, yy, 0);
-
- /* Update memory */
- mem[0] = _mm_move_ss(mem[0], mem[1]);
- mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
-
- mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
-
- mem[1] = _mm_sub_ss(mem[1], mem[1]);
- mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
-
- mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
- }
- /* Put memory back in its place */
- _mm_storeu_ps(_mem, mem[0]);
- _mm_storeu_ps(_mem+4, mem[1]);
-}
-
-#define OVERRIDE_FIR_MEM16
-void fir_mem16(const float *x, const float *_num, float *y, int N, int ord, float *_mem, char *stack)
-{
- if(ord==10)
- fir_mem16_10(x, _num, y, N, ord, _mem);
- else if (ord==8)
- fir_mem16_8(x, _num, y, N, ord, _mem);
-}
diff --git a/drivers/speex/fixed_arm4.h b/drivers/speex/fixed_arm4.h
deleted file mode 100644
index b6981cae7..000000000
--- a/drivers/speex/fixed_arm4.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* Copyright (C) 2004 Jean-Marc Valin */
-/**
- @file fixed_arm4.h
- @brief ARM4 fixed-point operations
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef FIXED_ARM4_H
-#define FIXED_ARM4_H
-
-#undef MULT16_32_Q14
-static inline spx_word32_t MULT16_32_Q14(spx_word16_t x, spx_word32_t y) {
- int res;
- int dummy;
- asm (
- "smull %0,%1,%2,%3 \n\t"
- "mov %0, %0, lsr #14 \n\t"
- "add %0, %0, %1, lsl #18 \n\t"
- : "=&r"(res), "=&r" (dummy)
- : "r"(y),"r"((int)x));
- return(res);
-}
-
-#undef MULT16_32_Q15
-static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) {
- int res;
- int dummy;
- asm (
- "smull %0,%1,%2,%3 \n\t"
- "mov %0, %0, lsr #15 \n\t"
- "add %0, %0, %1, lsl #17 \n\t"
- : "=&r"(res), "=&r" (dummy)
- : "r"(y),"r"((int)x));
- return(res);
-}
-
-#undef DIV32_16
-static inline short DIV32_16(int a, int b)
-{
- int res=0;
- int dead1, dead2, dead3, dead4, dead5;
- __asm__ __volatile__ (
- "\teor %5, %0, %1\n"
- "\tmovs %4, %0\n"
- "\trsbmi %0, %0, #0 \n"
- "\tmovs %4, %1\n"
- "\trsbmi %1, %1, #0 \n"
- "\tmov %4, #1\n"
-
- "\tsubs %3, %0, %1, asl #14 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #14 \n"
-
- "\tsubs %3, %0, %1, asl #13 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #13 \n"
-
- "\tsubs %3, %0, %1, asl #12 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #12 \n"
-
- "\tsubs %3, %0, %1, asl #11 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #11 \n"
-
- "\tsubs %3, %0, %1, asl #10 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #10 \n"
-
- "\tsubs %3, %0, %1, asl #9 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #9 \n"
-
- "\tsubs %3, %0, %1, asl #8 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #8 \n"
-
- "\tsubs %3, %0, %1, asl #7 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #7 \n"
-
- "\tsubs %3, %0, %1, asl #6 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #6 \n"
-
- "\tsubs %3, %0, %1, asl #5 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #5 \n"
-
- "\tsubs %3, %0, %1, asl #4 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #4 \n"
-
- "\tsubs %3, %0, %1, asl #3 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #3 \n"
-
- "\tsubs %3, %0, %1, asl #2 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #2 \n"
-
- "\tsubs %3, %0, %1, asl #1 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #1 \n"
-
- "\tsubs %3, %0, %1 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4 \n"
-
- "\tmovs %5, %5, lsr #31 \n"
- "\trsbne %2, %2, #0 \n"
- : "=r" (dead1), "=r" (dead2), "=r" (res),
- "=r" (dead3), "=r" (dead4), "=r" (dead5)
- : "0" (a), "1" (b), "2" (res)
- : "cc"
- );
- return res;
-}
-
-
-#endif
diff --git a/drivers/speex/fixed_arm5e.h b/drivers/speex/fixed_arm5e.h
deleted file mode 100644
index 9b4861c9a..000000000
--- a/drivers/speex/fixed_arm5e.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
- @file fixed_arm5e.h
- @brief ARM-tuned fixed-point operations
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef FIXED_ARM5E_H
-#define FIXED_ARM5E_H
-
-#undef MULT16_16
-static inline spx_word32_t MULT16_16(spx_word16_t x, spx_word16_t y) {
- int res;
- asm ("smulbb %0,%1,%2;\n"
- : "=&r"(res)
- : "%r"(x),"r"(y));
- return(res);
-}
-
-#undef MAC16_16
-static inline spx_word32_t MAC16_16(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smlabb %0,%1,%2,%3;\n"
- : "=&r"(res)
- : "%r"(x),"r"(y),"r"(a));
- return(res);
-}
-
-#undef MULT16_32_Q15
-static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smulwb %0,%1,%2;\n"
- : "=&r"(res)
- : "%r"(y<<1),"r"(x));
- return(res);
-}
-
-#undef MAC16_32_Q15
-static inline spx_word32_t MAC16_32_Q15(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smlawb %0,%1,%2,%3;\n"
- : "=&r"(res)
- : "%r"(y<<1),"r"(x),"r"(a));
- return(res);
-}
-
-#undef MULT16_32_Q11
-static inline spx_word32_t MULT16_32_Q11(spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smulwb %0,%1,%2;\n"
- : "=&r"(res)
- : "%r"(y<<5),"r"(x));
- return(res);
-}
-
-#undef MAC16_32_Q11
-static inline spx_word32_t MAC16_32_Q11(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smlawb %0,%1,%2,%3;\n"
- : "=&r"(res)
- : "%r"(y<<5),"r"(x),"r"(a));
- return(res);
-}
-
-#undef DIV32_16
-static inline short DIV32_16(int a, int b)
-{
- int res=0;
- int dead1, dead2, dead3, dead4, dead5;
- __asm__ __volatile__ (
- "\teor %5, %0, %1\n"
- "\tmovs %4, %0\n"
- "\trsbmi %0, %0, #0 \n"
- "\tmovs %4, %1\n"
- "\trsbmi %1, %1, #0 \n"
- "\tmov %4, #1\n"
-
- "\tsubs %3, %0, %1, asl #14 \n"
- "\torrpl %2, %2, %4, asl #14 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #13 \n"
- "\torrpl %2, %2, %4, asl #13 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #12 \n"
- "\torrpl %2, %2, %4, asl #12 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #11 \n"
- "\torrpl %2, %2, %4, asl #11 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #10 \n"
- "\torrpl %2, %2, %4, asl #10 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #9 \n"
- "\torrpl %2, %2, %4, asl #9 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #8 \n"
- "\torrpl %2, %2, %4, asl #8 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #7 \n"
- "\torrpl %2, %2, %4, asl #7 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #6 \n"
- "\torrpl %2, %2, %4, asl #6 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #5 \n"
- "\torrpl %2, %2, %4, asl #5 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #4 \n"
- "\torrpl %2, %2, %4, asl #4 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #3 \n"
- "\torrpl %2, %2, %4, asl #3 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #2 \n"
- "\torrpl %2, %2, %4, asl #2 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #1 \n"
- "\torrpl %2, %2, %4, asl #1 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1 \n"
- "\torrpl %2, %2, %4 \n"
- "\tmovpl %0, %3 \n"
-
- "\tmovs %5, %5, lsr #31 \n"
- "\trsbne %2, %2, #0 \n"
- : "=r" (dead1), "=r" (dead2), "=r" (res),
- "=r" (dead3), "=r" (dead4), "=r" (dead5)
- : "0" (a), "1" (b), "2" (res)
- : "memory", "cc"
- );
- return res;
-}
-
-
-
-
-#endif
diff --git a/drivers/speex/fixed_bfin.h b/drivers/speex/fixed_bfin.h
deleted file mode 100644
index aa26f6a87..000000000
--- a/drivers/speex/fixed_bfin.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Copyright (C) 2005 Analog Devices
- Author: Jean-Marc Valin */
-/**
- @file fixed_bfin.h
- @brief Blackfin fixed-point operations
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef FIXED_BFIN_H
-#define FIXED_BFIN_H
-
-#undef PDIV32_16
-static inline spx_word16_t PDIV32_16(spx_word32_t a, spx_word16_t b)
-{
- spx_word32_t res, bb;
- bb = b;
- a += b>>1;
- __asm__ (
- "P0 = 15;\n\t"
- "R0 = %1;\n\t"
- "R1 = %2;\n\t"
- //"R0 = R0 + R1;\n\t"
- "R0 <<= 1;\n\t"
- "DIVS (R0, R1);\n\t"
- "LOOP divide%= LC0 = P0;\n\t"
- "LOOP_BEGIN divide%=;\n\t"
- "DIVQ (R0, R1);\n\t"
- "LOOP_END divide%=;\n\t"
- "R0 = R0.L;\n\t"
- "%0 = R0;\n\t"
- : "=m" (res)
- : "m" (a), "m" (bb)
- : "P0", "R0", "R1", "cc");
- return res;
-}
-
-#undef DIV32_16
-static inline spx_word16_t DIV32_16(spx_word32_t a, spx_word16_t b)
-{
- spx_word32_t res, bb;
- bb = b;
- /* Make the roundinf consistent with the C version
- (do we need to do that?)*/
- if (a<0)
- a += (b-1);
- __asm__ (
- "P0 = 15;\n\t"
- "R0 = %1;\n\t"
- "R1 = %2;\n\t"
- "R0 <<= 1;\n\t"
- "DIVS (R0, R1);\n\t"
- "LOOP divide%= LC0 = P0;\n\t"
- "LOOP_BEGIN divide%=;\n\t"
- "DIVQ (R0, R1);\n\t"
- "LOOP_END divide%=;\n\t"
- "R0 = R0.L;\n\t"
- "%0 = R0;\n\t"
- : "=m" (res)
- : "m" (a), "m" (bb)
- : "P0", "R0", "R1", "cc");
- return res;
-}
-
-#undef MAX16
-static inline spx_word16_t MAX16(spx_word16_t a, spx_word16_t b)
-{
- spx_word32_t res;
- __asm__ (
- "%1 = %1.L (X);\n\t"
- "%2 = %2.L (X);\n\t"
- "%0 = MAX(%1,%2);"
- : "=d" (res)
- : "%d" (a), "d" (b)
- );
- return res;
-}
-
-#undef MULT16_32_Q15
-static inline spx_word32_t MULT16_32_Q15(spx_word16_t a, spx_word32_t b)
-{
- spx_word32_t res;
- __asm__
- (
- "A1 = %2.L*%1.L (M);\n\t"
- "A1 = A1 >>> 15;\n\t"
- "%0 = (A1 += %2.L*%1.H) ;\n\t"
- : "=&W" (res), "=&d" (b)
- : "d" (a), "1" (b)
- : "A1"
- );
- return res;
-}
-
-#undef MAC16_32_Q15
-static inline spx_word32_t MAC16_32_Q15(spx_word32_t c, spx_word16_t a, spx_word32_t b)
-{
- spx_word32_t res;
- __asm__
- (
- "A1 = %2.L*%1.L (M);\n\t"
- "A1 = A1 >>> 15;\n\t"
- "%0 = (A1 += %2.L*%1.H);\n\t"
- "%0 = %0 + %4;\n\t"
- : "=&W" (res), "=&d" (b)
- : "d" (a), "1" (b), "d" (c)
- : "A1"
- );
- return res;
-}
-
-#undef MULT16_32_Q14
-static inline spx_word32_t MULT16_32_Q14(spx_word16_t a, spx_word32_t b)
-{
- spx_word32_t res;
- __asm__
- (
- "%2 <<= 1;\n\t"
- "A1 = %1.L*%2.L (M);\n\t"
- "A1 = A1 >>> 15;\n\t"
- "%0 = (A1 += %1.L*%2.H);\n\t"
- : "=W" (res), "=d" (a), "=d" (b)
- : "1" (a), "2" (b)
- : "A1"
- );
- return res;
-}
-
-#undef MAC16_32_Q14
-static inline spx_word32_t MAC16_32_Q14(spx_word32_t c, spx_word16_t a, spx_word32_t b)
-{
- spx_word32_t res;
- __asm__
- (
- "%1 <<= 1;\n\t"
- "A1 = %2.L*%1.L (M);\n\t"
- "A1 = A1 >>> 15;\n\t"
- "%0 = (A1 += %2.L*%1.H);\n\t"
- "%0 = %0 + %4;\n\t"
- : "=&W" (res), "=&d" (b)
- : "d" (a), "1" (b), "d" (c)
- : "A1"
- );
- return res;
-}
-
-#endif
diff --git a/drivers/speex/fixed_debug.h b/drivers/speex/fixed_debug.h
deleted file mode 100644
index 54f3866e8..000000000
--- a/drivers/speex/fixed_debug.h
+++ /dev/null
@@ -1,487 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
- @file fixed_debug.h
- @brief Fixed-point operations with debugging
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef FIXED_DEBUG_H
-#define FIXED_DEBUG_H
-
-#include <stdio.h>
-
-extern long long spx_mips;
-#define MIPS_INC spx_mips++,
-
-#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
-#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
-
-
-#define VERIFY_SHORT(x) ((x)<=32767&&(x)>=-32768)
-#define VERIFY_INT(x) ((x)<=2147483647LL&&(x)>=-2147483648LL)
-
-static inline short NEG16(int x)
-{
- int res;
- if (!VERIFY_SHORT(x))
- {
- fprintf (stderr, "NEG16: input is not short: %d\n", (int)x);
- }
- res = -x;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "NEG16: output is not short: %d\n", (int)res);
- spx_mips++;
- return res;
-}
-static inline int NEG32(long long x)
-{
- long long res;
- if (!VERIFY_INT(x))
- {
- fprintf (stderr, "NEG16: input is not int: %d\n", (int)x);
- }
- res = -x;
- if (!VERIFY_INT(res))
- fprintf (stderr, "NEG16: output is not int: %d\n", (int)res);
- spx_mips++;
- return res;
-}
-
-#define EXTRACT16(x) _EXTRACT16(x, __FILE__, __LINE__)
-static inline short _EXTRACT16(int x, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(x))
- {
- fprintf (stderr, "EXTRACT16: input is not short: %d in %s: line %d\n", x, file, line);
- }
- res = x;
- spx_mips++;
- return res;
-}
-
-#define EXTEND32(x) _EXTEND32(x, __FILE__, __LINE__)
-static inline int _EXTEND32(int x, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(x))
- {
- fprintf (stderr, "EXTEND32: input is not short: %d in %s: line %d\n", x, file, line);
- }
- res = x;
- spx_mips++;
- return res;
-}
-
-#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__)
-static inline short _SHR16(int a, int shift, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
- {
- fprintf (stderr, "SHR16: inputs are not short: %d >> %d in %s: line %d\n", a, shift, file, line);
- }
- res = a>>shift;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "SHR16: output is not short: %d in %s: line %d\n", res, file, line);
- spx_mips++;
- return res;
-}
-#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__)
-static inline short _SHL16(int a, int shift, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
- {
- fprintf (stderr, "SHL16: inputs are not short: %d %d in %s: line %d\n", a, shift, file, line);
- }
- res = a<<shift;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "SHL16: output is not short: %d in %s: line %d\n", res, file, line);
- spx_mips++;
- return res;
-}
-
-static inline int SHR32(long long a, int shift)
-{
- long long res;
- if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
- {
- fprintf (stderr, "SHR32: inputs are not int: %d %d\n", (int)a, shift);
- }
- res = a>>shift;
- if (!VERIFY_INT(res))
- {
- fprintf (stderr, "SHR32: output is not int: %d\n", (int)res);
- }
- spx_mips++;
- return res;
-}
-static inline int SHL32(long long a, int shift)
-{
- long long res;
- if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
- {
- fprintf (stderr, "SHL32: inputs are not int: %d %d\n", (int)a, shift);
- }
- res = a<<shift;
- if (!VERIFY_INT(res))
- {
- fprintf (stderr, "SHL32: output is not int: %d\n", (int)res);
- }
- spx_mips++;
- return res;
-}
-
-#define PSHR16(a,shift) (SHR16(ADD16((a),((1<<((shift))>>1))),shift))
-#define PSHR32(a,shift) (SHR32(ADD32((a),((EXTEND32(1)<<((shift))>>1))),shift))
-#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
-
-#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-
-//#define SHR(a,shift) ((a) >> (shift))
-//#define SHL(a,shift) ((a) << (shift))
-
-#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__)
-static inline short _ADD16(int a, int b, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "ADD16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
- }
- res = a+b;
- if (!VERIFY_SHORT(res))
- {
- fprintf (stderr, "ADD16: output is not short: %d+%d=%d in %s: line %d\n", a,b,res, file, line);
- }
- spx_mips++;
- return res;
-}
-
-#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__)
-static inline short _SUB16(int a, int b, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "SUB16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
- }
- res = a-b;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "SUB16: output is not short: %d in %s: line %d\n", res, file, line);
- spx_mips++;
- return res;
-}
-
-#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__)
-static inline int _ADD32(long long a, long long b, char *file, int line)
-{
- long long res;
- if (!VERIFY_INT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "ADD32: inputs are not int: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
- }
- res = a+b;
- if (!VERIFY_INT(res))
- {
- fprintf (stderr, "ADD32: output is not int: %d in %s: line %d\n", (int)res, file, line);
- }
- spx_mips++;
- return res;
-}
-
-static inline int SUB32(long long a, long long b)
-{
- long long res;
- if (!VERIFY_INT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "SUB32: inputs are not int: %d %d\n", (int)a, (int)b);
- }
- res = a-b;
- if (!VERIFY_INT(res))
- fprintf (stderr, "SUB32: output is not int: %d\n", (int)res);
- spx_mips++;
- return res;
-}
-
-#define ADD64(a,b) (MIPS_INC(a)+(b))
-
-/* result fits in 16 bits */
-static inline short MULT16_16_16(int a, int b)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_16: inputs are not short: %d %d\n", a, b);
- }
- res = a*b;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_16: output is not short: %d\n", res);
- spx_mips++;
- return res;
-}
-
-#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__)
-static inline int _MULT16_16(int a, int b, char *file, int line)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
- }
- res = ((long long)a)*b;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16: output is not int: %d in %s: line %d\n", (int)res, file, line);
- spx_mips++;
- return res;
-}
-
-#define MAC16_16(c,a,b) (spx_mips--,ADD32((c),MULT16_16((a),(b))))
-#define MAC16_16_Q11(c,a,b) (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),11)))))
-#define MAC16_16_Q13(c,a,b) (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),13)))))
-#define MAC16_16_P13(c,a,b) (EXTRACT16(ADD32((c),SHR32(ADD32(4096,MULT16_16((a),(b))),13))))
-
-
-#define MULT16_32_QX(a, b, Q) _MULT16_32_QX(a, b, Q, __FILE__, __LINE__)
-static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
- }
- if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
- fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
- res = (((long long)a)*(long long)b) >> Q;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line);
- spx_mips+=5;
- return res;
-}
-
-static inline int MULT16_32_PX(int a, long long b, int Q)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
- }
- if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
- fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
- res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<<Q)>>1))>> Q;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
- spx_mips+=5;
- return res;
-}
-
-
-#define MULT16_32_Q11(a,b) MULT16_32_QX(a,b,11)
-#define MAC16_32_Q11(c,a,b) ADD32((c),MULT16_32_Q11((a),(b)))
-#define MULT16_32_Q12(a,b) MULT16_32_QX(a,b,12)
-#define MULT16_32_Q13(a,b) MULT16_32_QX(a,b,13)
-#define MULT16_32_Q14(a,b) MULT16_32_QX(a,b,14)
-#define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15)
-#define MULT16_32_P15(a,b) MULT16_32_PX(a,b,15)
-#define MAC16_32_Q15(c,a,b) ADD32((c),MULT16_32_Q15((a),(b)))
-
-static inline int SATURATE(int a, int b)
-{
- if (a>b)
- a=b;
- if (a<-b)
- a = -b;
- return a;
-}
-
-static inline int MULT16_16_Q11_32(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_Q11: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res >>= 11;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16_Q11: output is not short: %d*%d=%d\n", (int)a, (int)b, (int)res);
- spx_mips+=3;
- return res;
-}
-static inline short MULT16_16_Q13(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_Q13: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res >>= 13;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_Q13: output is not short: %d*%d=%d\n", a, b, (int)res);
- spx_mips+=3;
- return res;
-}
-static inline short MULT16_16_Q14(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_Q14: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res >>= 14;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_Q14: output is not short: %d\n", (int)res);
- spx_mips+=3;
- return res;
-}
-static inline short MULT16_16_Q15(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_Q15: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res >>= 15;
- if (!VERIFY_SHORT(res))
- {
- fprintf (stderr, "MULT16_16_Q15: output is not short: %d\n", (int)res);
- }
- spx_mips+=3;
- return res;
-}
-
-static inline short MULT16_16_P13(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_P13: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res += 4096;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16_P13: overflow: %d*%d=%d\n", a, b, (int)res);
- res >>= 13;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_P13: output is not short: %d*%d=%d\n", a, b, (int)res);
- spx_mips+=4;
- return res;
-}
-static inline short MULT16_16_P14(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_P14: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res += 8192;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16_P14: overflow: %d*%d=%d\n", a, b, (int)res);
- res >>= 14;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_P14: output is not short: %d*%d=%d\n", a, b, (int)res);
- spx_mips+=4;
- return res;
-}
-static inline short MULT16_16_P15(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_P15: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res += 16384;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16_P15: overflow: %d*%d=%d\n", a, b, (int)res);
- res >>= 15;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_P15: output is not short: %d*%d=%d\n", a, b, (int)res);
- spx_mips+=4;
- return res;
-}
-
-#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__)
-
-static inline int _DIV32_16(long long a, long long b, char *file, int line)
-{
- long long res;
- if (b==0)
- {
- fprintf(stderr, "DIV32_16: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
- return 0;
- }
- if (!VERIFY_INT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "DIV32_16: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
- }
- res = a/b;
- if (!VERIFY_SHORT(res))
- {
- fprintf (stderr, "DIV32_16: output is not short: %d / %d = %d in %s: line %d\n", (int)a,(int)b,(int)res, file, line);
- if (res>32767)
- res = 32767;
- if (res<-32768)
- res = -32768;
- }
- spx_mips+=20;
- return res;
-}
-
-#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__)
-static inline int _DIV32(long long a, long long b, char *file, int line)
-{
- long long res;
- if (b==0)
- {
- fprintf(stderr, "DIV32: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
- return 0;
- }
-
- if (!VERIFY_INT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "DIV32: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
- }
- res = a/b;
- if (!VERIFY_INT(res))
- fprintf (stderr, "DIV32: output is not int: %d in %s: line %d\n", (int)res, file, line);
- spx_mips+=36;
- return res;
-}
-#define PDIV32(a,b) DIV32(ADD32((a),(b)>>1),b)
-#define PDIV32_16(a,b) DIV32_16(ADD32((a),(b)>>1),b)
-
-#endif
diff --git a/drivers/speex/fixed_generic.h b/drivers/speex/fixed_generic.h
deleted file mode 100644
index 3fb096ed9..000000000
--- a/drivers/speex/fixed_generic.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
- @file fixed_generic.h
- @brief Generic fixed-point operations
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef FIXED_GENERIC_H
-#define FIXED_GENERIC_H
-
-#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
-#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
-
-#define NEG16(x) (-(x))
-#define NEG32(x) (-(x))
-#define EXTRACT16(x) ((spx_word16_t)(x))
-#define EXTEND32(x) ((spx_word32_t)(x))
-#define SHR16(a,shift) ((a) >> (shift))
-#define SHL16(a,shift) ((a) << (shift))
-#define SHR32(a,shift) ((a) >> (shift))
-#define SHL32(a,shift) ((a) << (shift))
-#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift))
-#define PSHR32(a,shift) (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift))
-#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
-#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-
-#define SHR(a,shift) ((a) >> (shift))
-#define SHL(a,shift) ((spx_word32_t)(a) << (shift))
-#define PSHR(a,shift) (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift))
-#define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-
-
-#define ADD16(a,b) ((spx_word16_t)((spx_word16_t)(a)+(spx_word16_t)(b)))
-#define SUB16(a,b) ((spx_word16_t)(a)-(spx_word16_t)(b))
-#define ADD32(a,b) ((spx_word32_t)(a)+(spx_word32_t)(b))
-#define SUB32(a,b) ((spx_word32_t)(a)-(spx_word32_t)(b))
-
-
-/* result fits in 16 bits */
-#define MULT16_16_16(a,b) ((((spx_word16_t)(a))*((spx_word16_t)(b))))
-
-/* (spx_word32_t)(spx_word16_t) gives TI compiler a hint that it's 16x16->32 multiply */
-#define MULT16_16(a,b) (((spx_word32_t)(spx_word16_t)(a))*((spx_word32_t)(spx_word16_t)(b)))
-
-#define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b))))
-#define MULT16_32_Q12(a,b) ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12))
-#define MULT16_32_Q13(a,b) ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13))
-#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))
-
-#define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))
-#define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))
-
-#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15))
-#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))
-#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
-
-
-#define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11)))
-#define MAC16_16_Q13(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),13)))
-#define MAC16_16_P13(c,a,b) (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
-
-#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
-#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
-#define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14))
-#define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15))
-
-#define MULT16_16_P13(a,b) (SHR(ADD32(4096,MULT16_16((a),(b))),13))
-#define MULT16_16_P14(a,b) (SHR(ADD32(8192,MULT16_16((a),(b))),14))
-#define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15))
-
-#define MUL_16_32_R15(a,bh,bl) ADD32(MULT16_16((a),(bh)), SHR(MULT16_16((a),(bl)),15))
-
-#define DIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b))))
-#define PDIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b))))
-#define DIV32(a,b) (((spx_word32_t)(a))/((spx_word32_t)(b)))
-#define PDIV32(a,b) (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b)))
-
-#endif
diff --git a/drivers/speex/gain_table.c b/drivers/speex/gain_table.c
deleted file mode 100644
index 00b824425..000000000
--- a/drivers/speex/gain_table.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: gain_table.c
- Codebook for 3-tap pitch prediction gain (128 entries)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-const signed char gain_cdbk_nb[512] = {
--32, -32, -32, 0,
--28, -67, -5, 33,
--42, -6, -32, 18,
--57, -10, -54, 35,
--16, 27, -41, 42,
-19, -19, -40, 36,
--45, 24, -21, 40,
--8, -14, -18, 28,
-1, 14, -58, 53,
--18, -88, -39, 39,
--38, 21, -18, 37,
--19, 20, -43, 38,
-10, 17, -48, 54,
--52, -58, -13, 33,
--44, -1, -11, 32,
--12, -11, -34, 22,
-14, 0, -46, 46,
--37, -35, -34, 5,
--25, 44, -30, 43,
-6, -4, -63, 49,
--31, 43, -41, 43,
--23, 30, -43, 41,
--43, 26, -14, 44,
--33, 1, -13, 27,
--13, 18, -37, 37,
--46, -73, -45, 34,
--36, 24, -25, 34,
--36, -11, -20, 19,
--25, 12, -18, 33,
--36, -69, -59, 34,
--45, 6, 8, 46,
--22, -14, -24, 18,
--1, 13, -44, 44,
--39, -48, -26, 15,
--32, 31, -37, 34,
--33, 15, -46, 31,
--24, 30, -36, 37,
--41, 31, -23, 41,
--50, 22, -4, 50,
--22, 2, -21, 28,
--17, 30, -34, 40,
--7, -60, -28, 29,
--38, 42, -28, 42,
--44, -11, 21, 43,
--16, 8, -44, 34,
--39, -55, -43, 21,
--11, -35, 26, 41,
--9, 0, -34, 29,
--8, 121, -81, 113,
-7, -16, -22, 33,
--37, 33, -31, 36,
--27, -7, -36, 17,
--34, 70, -57, 65,
--37, -11, -48, 21,
--40, 17, -1, 44,
--33, 6, -6, 33,
--9, 0, -20, 34,
--21, 69, -33, 57,
--29, 33, -31, 35,
--55, 12, -1, 49,
--33, 27, -22, 35,
--50, -33, -47, 17,
--50, 54, 51, 94,
--1, -5, -44, 35,
--4, 22, -40, 45,
--39, -66, -25, 24,
--33, 1, -26, 20,
--24, -23, -25, 12,
--11, 21, -45, 44,
--25, -45, -19, 17,
--43, 105, -16, 82,
-5, -21, 1, 41,
--16, 11, -33, 30,
--13, -99, -4, 57,
--37, 33, -15, 44,
--25, 37, -63, 54,
--36, 24, -31, 31,
--53, -56, -38, 26,
--41, -4, 4, 37,
--33, 13, -30, 24,
-49, 52, -94, 114,
--5, -30, -15, 23,
-1, 38, -40, 56,
--23, 12, -36, 29,
--17, 40, -47, 51,
--37, -41, -39, 11,
--49, 34, 0, 58,
--18, -7, -4, 34,
--16, 17, -27, 35,
-30, 5, -62, 65,
-4, 48, -68, 76,
--43, 11, -11, 38,
--18, 19, -15, 41,
--23, -62, -39, 23,
--42, 10, -2, 41,
--21, -13, -13, 25,
--9, 13, -47, 42,
--23, -62, -24, 24,
--44, 60, -21, 58,
--18, -3, -52, 32,
--22, 22, -36, 34,
--75, 57, 16, 90,
--19, 3, 10, 45,
--29, 23, -38, 32,
--5, -62, -51, 38,
--51, 40, -18, 53,
--42, 13, -24, 32,
--34, 14, -20, 30,
--56, -75, -26, 37,
--26, 32, 15, 59,
--26, 17, -29, 29,
--7, 28, -52, 53,
--12, -30, 5, 30,
--5, -48, -5, 35,
-2, 2, -43, 40,
-21, 16, 16, 75,
--25, -45, -32, 10,
--43, 18, -10, 42,
-9, 0, -1, 52,
--1, 7, -30, 36,
-19, -48, -4, 48,
--28, 25, -29, 32,
--22, 0, -31, 22,
--32, 17, -10, 36,
--64, -41, -62, 36,
--52, 15, 16, 58,
--30, -22, -32, 6,
--7, 9, -38, 36};
diff --git a/drivers/speex/gain_table_lbr.c b/drivers/speex/gain_table_lbr.c
deleted file mode 100644
index 3c1c3dba9..000000000
--- a/drivers/speex/gain_table_lbr.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: gain_table_lbr.c
- Codebook for 3-tap pitch prediction gain (32 entries)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-const signed char gain_cdbk_lbr[128] = {
--32, -32, -32, 0,
--31, -58, -16, 22,
--41, -24, -43, 14,
--56, -22, -55, 29,
--13, 33, -41, 47,
--4, -39, -9, 29,
--41, 15, -12, 38,
--8, -15, -12, 31,
-1, 2, -44, 40,
--22, -66, -42, 27,
--38, 28, -23, 38,
--21, 14, -37, 31,
-0, 21, -50, 52,
--53, -71, -27, 33,
--37, -1, -19, 25,
--19, -5, -28, 22,
-6, 65, -44, 74,
--33, -48, -33, 9,
--40, 57, -14, 58,
--17, 4, -45, 32,
--31, 38, -33, 36,
--23, 28, -40, 39,
--43, 29, -12, 46,
--34, 13, -23, 28,
--16, 15, -27, 34,
--14, -82, -15, 43,
--31, 25, -32, 29,
--21, 5, -5, 38,
--47, -63, -51, 33,
--46, 12, 3, 47,
--28, -17, -29, 11,
--10, 14, -40, 38};
diff --git a/drivers/speex/hexc_10_32_table.c b/drivers/speex/hexc_10_32_table.c
deleted file mode 100644
index 8dd408f2c..000000000
--- a/drivers/speex/hexc_10_32_table.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: hexc_10_32_table.c
- Codebook for high-band excitation in SB-CELP mode (4000 bps)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-const signed char hexc_10_32_table[320] = {
--3, -2, -1, 0, -4, 5, 35, -40, -9, 13,
--44, 5, -27, -1, -7, 6, -11, 7, -8, 7,
-19, -14, 15, -4, 9, -10, 10, -8, 10, -9,
--1, 1, 0, 0, 2, 5, -18, 22, -53, 50,
-1, -23, 50, -36, 15, 3, -13, 14, -10, 6,
-1, 5, -3, 4, -2, 5, -32, 25, 5, -2,
--1, -4, 1, 11, -29, 26, -6, -15, 30, -18,
-0, 15, -17, 40, -41, 3, 9, -2, -2, 3,
--3, -1, -5, 2, 21, -6, -16, -21, 23, 2,
-60, 15, 16, -16, -9, 14, 9, -1, 7, -9,
-0, 1, 1, 0, -1, -6, 17, -28, 54, -45,
--1, 1, -1, -6, -6, 2, 11, 26, -29, -2,
-46, -21, 34, 12, -23, 32, -23, 16, -10, 3,
-66, 19, -20, 24, 7, 11, -3, 0, -3, -1,
--50, -46, 2, -18, -3, 4, -1, -2, 3, -3,
--19, 41, -36, 9, 11, -24, 21, -16, 9, -3,
--25, -3, 10, 18, -9, -2, -5, -1, -5, 6,
--4, -3, 2, -26, 21, -19, 35, -15, 7, -13,
-17, -19, 39, -43, 48, -31, 16, -9, 7, -2,
--5, 3, -4, 9, -19, 27, -55, 63, -35, 10,
-26, -44, -2, 9, 4, 1, -6, 8, -9, 5,
--8, -1, -3, -16, 45, -42, 5, 15, -16, 10,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
--16, 24, -55, 47, -38, 27, -19, 7, -3, 1,
-16, 27, 20, -19, 18, 5, -7, 1, -5, 2,
--6, 8, -22, 0, -3, -3, 8, -1, 7, -8,
-1, -3, 5, 0, 17, -48, 58, -52, 29, -7,
--2, 3, -10, 6, -26, 58, -31, 1, -6, 3,
-93, -29, 39, 3, 17, 5, 6, -1, -1, -1,
-27, 13, 10, 19, -7, -34, 12, 10, -4, 9,
--76, 9, 8, -28, -2, -11, 2, -1, 3, 1,
--83, 38, -39, 4, -16, -6, -2, -5, 5, -2,
-};
diff --git a/drivers/speex/hexc_table.c b/drivers/speex/hexc_table.c
deleted file mode 100644
index 268408a8d..000000000
--- a/drivers/speex/hexc_table.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: hexc_table.c
- Codebook for high-band excitation in SB-CELP mode (8000 bps with sign)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-const signed char hexc_table[1024] = {
--24, 21, -20, 5, -5, -7, 14, -10,
-2, -27, 16, -20, 0, -32, 26, 19,
-8, -11, -41, 31, 28, -27, -32, 34,
-42, 34, -17, 22, -10, 13, -29, 18,
--12, -26, -24, 11, 22, 5, -5, -5,
-54, -68, -43, 57, -25, 24, 4, 4,
-26, -8, -12, -17, 54, 30, -45, 1,
-10, -15, 18, -41, 11, 68, -67, 37,
--16, -24, -16, 38, -22, 6, -29, 30,
-66, -27, 5, 7, -16, 13, 2, -12,
--7, -3, -20, 36, 4, -28, 9, 3,
-32, 48, 26, 39, 3, 0, 7, -21,
--13, 5, -82, -7, 73, -20, 34, -9,
--5, 1, -1, 10, -5, -10, -1, 9,
-1, -9, 10, 0, -14, 11, -1, -2,
--1, 11, 20, 96, -81, -22, -12, -9,
--58, 9, 24, -30, 26, -35, 27, -12,
-13, -18, 56, -59, 15, -7, 23, -15,
--1, 6, -25, 14, -22, -20, 47, -11,
-16, 2, 38, -23, -19, -30, -9, 40,
--11, 5, 4, -6, 8, 26, -21, -11,
-127, 4, 1, 6, -9, 2, -7, -2,
--3, 7, -5, 10, -19, 7, -106, 91,
--3, 9, -4, 21, -8, 26, -80, 8,
-1, -2, -10, -17, -17, -27, 32, 71,
-6, -29, 11, -23, 54, -38, 29, -22,
-39, 87, -31, -12, -20, 3, -2, -2,
-2, 20, 0, -1, -35, 27, 9, -6,
--12, 3, -12, -6, 13, 1, 14, -22,
--59, -15, -17, -25, 13, -7, 7, 3,
-0, 1, -7, 6, -3, 61, -37, -23,
--23, -29, 38, -31, 27, 1, -8, 2,
--27, 23, -26, 36, -34, 5, 24, -24,
--6, 7, 3, -59, 78, -62, 44, -16,
-1, 6, 0, 17, 8, 45, 0, -110,
-6, 14, -2, 32, -77, -56, 62, -3,
-3, -13, 4, -16, 102, -15, -36, -1,
-9, -113, 6, 23, 0, 9, 9, 5,
--8, -1, -14, 5, -12, 121, -53, -27,
--8, -9, 22, -13, 3, 2, -3, 1,
--2, -71, 95, 38, -19, 15, -16, -5,
-71, 10, 2, -32, -13, -5, 15, -1,
--2, -14, -85, 30, 29, 6, 3, 2,
-0, 0, 0, 0, 0, 0, 0, 0,
-2, -65, -56, -9, 18, 18, 23, -14,
--2, 0, 12, -29, 26, -12, 1, 2,
--12, -64, 90, -6, 4, 1, 5, -5,
--110, -3, -31, 22, -29, 9, 0, 8,
--40, -5, 21, -5, -5, 13, 10, -18,
-40, 1, 35, -20, 30, -28, 11, -6,
-19, 7, 14, 18, -64, 9, -6, 16,
-51, 68, 8, 16, 12, -8, 0, -9,
-20, -22, 25, 7, -4, -13, 41, -35,
-93, -18, -54, 11, -1, 1, -9, 4,
--66, 66, -31, 20, -22, 25, -23, 11,
-10, 9, 19, 15, 11, -5, -31, -10,
--23, -28, -6, -6, -3, -4, 5, 3,
--28, 22, -11, -42, 25, -25, -16, 41,
-34, 47, -6, 2, 42, -19, -22, 5,
--39, 32, 6, -35, 22, 17, -30, 8,
--26, -11, -11, 3, -12, 33, 33, -37,
-21, -1, 6, -4, 3, 0, -5, 5,
-12, -12, 57, 27, -61, -3, 20, -17,
-2, 0, 4, 0, -2, -33, -58, 81,
--23, 39, -10, -5, 2, 6, -7, 5,
-4, -3, -2, -13, -23, -72, 107, 15,
--5, 0, -7, -3, -6, 5, -4, 15,
-47, 12, -31, 25, -16, 8, 22, -25,
--62, -56, -18, 14, 28, 12, 2, -11,
-74, -66, 41, -20, -7, 16, -20, 16,
--8, 0, -16, 4, -19, 92, 12, -59,
--14, -39, 49, -25, -16, 23, -27, 19,
--3, -33, 19, 85, -29, 6, -7, -10,
-16, -7, -12, 1, -6, 2, 4, -2,
-64, 10, -25, 41, -2, -31, 15, 0,
-110, 50, 69, 35, 28, 19, -10, 2,
--43, -49, -56, -15, -16, 10, 3, 12,
--1, -8, 1, 26, -12, -1, 7, -11,
--27, 41, 25, 1, -11, -18, 22, -7,
--1, -47, -8, 23, -3, -17, -7, 18,
--125, 59, -5, 3, 18, 1, 2, 3,
-27, -35, 65, -53, 50, -46, 37, -21,
--28, 7, 14, -37, -5, -5, 12, 5,
--8, 78, -19, 21, -6, -16, 8, -7,
-5, 2, 7, 2, 10, -6, 12, -60,
-44, 11, -36, -32, 31, 0, 2, -2,
-2, 1, -3, 7, -10, 17, -21, 10,
-6, -2, 19, -2, 59, -38, -86, 38,
-8, -41, -30, -45, -33, 7, 15, 28,
-29, -7, 24, -40, 7, 7, 5, -2,
-9, 24, -23, -18, 6, -29, 30, 2,
-28, 49, -11, -46, 10, 43, -13, -9,
--1, -3, -7, -7, -17, -6, 97, -33,
--21, 3, 5, 1, 12, -43, -8, 28,
-7, -43, -7, 17, -20, 19, -1, 2,
--13, 9, 54, 34, 9, -28, -11, -9,
--17, 110, -59, 44, -26, 0, 3, -12,
--47, 73, -34, -43, 38, -33, 16, -5,
--46, -4, -6, -2, -25, 19, -29, 28,
--13, 5, 14, 27, -40, -43, 4, 32,
--13, -2, -35, -4, 112, -42, 9, -12,
-37, -28, 17, 14, -19, 35, -39, 23,
-3, -14, -1, -57, -5, 94, -9, 3,
--39, 5, 30, -10, -32, 42, -13, -14,
--97, -63, 30, -9, 1, -7, 12, 5,
-20, 17, -9, -36, -30, 25, 47, -9,
--15, 12, -22, 98, -8, -50, 15, -27,
-21, -16, -11, 2, 12, -10, 10, -3,
-33, 36, -96, 0, -17, 31, -9, 9,
-3, -20, 13, -11, 8, -4, 10, -10,
-9, 1, 112, -70, -27, 5, -21, 2,
--57, -3, -29, 10, 19, -21, 21, -10,
--66, -3, 91, -35, 30, -12, 0, -7,
-59, -28, 26, 2, 14, -18, 1, 1,
-11, 17, 20, -54, -59, 27, 4, 29,
-32, 5, 19, 12, -4, 1, 7, -10,
-5, -2, 10, 0, 23, -5, 28, -104,
-46, 11, 16, 3, 29, 1, -8, -14,
-1, 7, -50, 88, -62, 26, 8, -17,
--14, 50, 0, 32, -12, -3, -27, 18,
--8, -5, 8, 3, -20, -11, 37, -12,
-9, 33, 46, -101, -1, -4, 1, 6,
--1, 28, -42, -15, 16, 5, -1, -2,
--55, 85, 38, -9, -4, 11, -2, -9,
--6, 3, -20, -10, -77, 89, 24, -3,
--104, -57, -26, -31, -20, -6, -9, 14,
-20, -23, 46, -15, -31, 28, 1, -15,
--2, 6, -2, 31, 45, -76, 23, -25,
-};
diff --git a/drivers/speex/high_lsp_tables.c b/drivers/speex/high_lsp_tables.c
deleted file mode 100644
index e82e87550..000000000
--- a/drivers/speex/high_lsp_tables.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: high_lsp_tables.c
- Codebooks for high-band LSPs in SB-CELP mode
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-const signed char high_lsp_cdbk[512]={
-39,12,-14,-20,-29,-61,-67,-76,
--32,-71,-67,68,77,46,34,5,
--13,-48,-46,-72,-81,-84,-60,-58,
--40,-28,82,93,68,45,29,3,
--19,-47,-28,-43,-35,-30,-8,-13,
--39,-91,-91,-123,-96,10,10,-6,
--18,-55,-60,-91,-56,-36,-27,-16,
--48,-75,40,28,-10,-28,35,9,
-37,19,1,-20,-31,-41,-18,-25,
--35,-68,-80,45,27,-1,47,13,
-0,-29,-35,-57,-50,-79,-73,-38,
--19,5,35,14,-10,-23,16,-8,
-5,-24,-40,-62,-23,-27,-22,-16,
--18,-46,-72,-77,43,21,33,1,
--80,-70,-70,-64,-56,-52,-39,-33,
--31,-38,-19,-19,-15,32,33,-2,
-7,-15,-15,-24,-23,-33,-41,-56,
--24,-57,5,89,64,41,27,5,
--9,-47,-60,-97,-97,-124,-20,-9,
--44,-73,31,29,-4,64,48,7,
--35,-57,0,-3,-26,-47,-3,-6,
--40,-76,-79,-48,12,81,55,10,
-9,-24,-43,-73,-57,-69,16,5,
--28,-53,18,29,20,0,-4,-11,
-6,-13,23,7,-17,-35,-37,-37,
--30,-68,-63,6,24,-9,-14,3,
-21,-13,-27,-57,-49,-80,-24,-41,
--5,-16,-5,1,45,25,12,-7,
-3,-15,-6,-16,-15,-8,6,-13,
--42,-81,-80,-87,14,1,-10,-3,
--43,-69,-46,-24,-28,-29,36,6,
--43,-56,-12,12,54,79,43,9,
-54,22,2,8,-12,-43,-46,-52,
--38,-69,-89,-5,75,38,33,5,
--13,-53,-62,-87,-89,-113,-99,-55,
--34,-37,62,55,33,16,21,-2,
--17,-46,-29,-38,-38,-48,-39,-42,
--36,-75,-72,-88,-48,-30,21,2,
--15,-57,-64,-98,-84,-76,25,1,
--46,-80,-12,18,-7,3,34,6,
-38,31,23,4,-1,20,14,-15,
--43,-78,-91,-24,14,-3,54,16,
-0,-27,-28,-44,-56,-83,-92,-89,
--3,34,56,41,36,22,20,-8,
--7,-35,-42,-62,-49,3,12,-10,
--50,-87,-96,-66,92,70,38,9,
--70,-71,-62,-42,-39,-43,-11,-7,
--50,-79,-58,-50,-31,32,31,-6,
--4,-25,7,-17,-38,-70,-58,-27,
--43,-83,-28,59,36,20,31,2,
--27,-71,-80,-109,-98,-75,-33,-32,
--31,-2,33,15,-6,43,33,-5,
-0,-22,-10,-27,-34,-49,-11,-20,
--41,-91,-100,-121,-39,57,41,10,
--19,-50,-38,-59,-60,-70,-18,-20,
--8,-31,-8,-15,1,-14,-26,-25,
-33,21,32,17,1,-19,-19,-26,
--58,-81,-35,-22,45,30,11,-11,
-3,-26,-48,-87,-67,-83,-58,3,
--1,-26,-20,44,10,25,39,5,
--9,-35,-27,-38,7,10,4,-9,
--42,-85,-102,-127,52,44,28,10,
--47,-61,-40,-39,-17,-1,-10,-33,
--42,-74,-48,21,-4,70,52,10};
-
-
-const signed char high_lsp_cdbk2[512]={
--36,-62,6,-9,-10,-14,-56,23,
-1,-26,23,-48,-17,12,8,-7,
-23,29,-36,-28,-6,-29,-17,-5,
-40,23,10,10,-46,-13,36,6,
-4,-30,-29,62,32,-32,-1,22,
--14,1,-4,-22,-45,2,54,4,
--30,-57,-59,-12,27,-3,-31,8,
--9,5,10,-14,32,66,19,9,
-2,-25,-37,23,-15,18,-38,-31,
-5,-9,-21,15,0,22,62,30,
-15,-12,-14,-46,77,21,33,3,
-34,29,-19,50,2,11,9,-38,
--12,-37,62,1,-15,54,32,6,
-2,-24,20,35,-21,2,19,24,
--13,55,4,9,39,-19,30,-1,
--21,73,54,33,8,18,3,15,
-6,-19,-47,6,-3,-48,-50,1,
-26,20,8,-23,-50,65,-14,-55,
--17,-31,-37,-28,53,-1,-17,-53,
-1,57,11,-8,-25,-30,-37,64,
-5,-52,-45,15,23,31,15,14,
--25,24,33,-2,-44,-56,-18,6,
--21,-43,4,-12,17,-37,20,-10,
-34,15,2,15,55,21,-11,-31,
--6,46,25,16,-9,-25,-8,-62,
-28,17,20,-32,-29,26,30,25,
--19,2,-16,-17,26,-51,2,50,
-42,19,-66,23,29,-2,3,19,
--19,-37,32,15,6,30,-34,13,
-11,-5,40,31,10,-42,4,-9,
-26,-9,-70,17,-2,-23,20,-22,
--55,51,-24,-31,22,-22,15,-13,
-3,-10,-28,-16,56,4,-63,11,
--18,-15,-18,-38,-35,16,-7,34,
--1,-21,-49,-47,9,-37,7,8,
-69,55,20,6,-33,-45,-10,-9,
-6,-9,12,71,15,-3,-42,-7,
--24,32,-35,-2,-42,-17,-5,0,
--2,-33,-54,13,-12,-34,47,23,
-19,55,7,-8,74,31,14,16,
--23,-26,19,12,-18,-49,-28,-31,
--20,2,-14,-20,-47,78,40,13,
--23,-11,21,-6,18,1,47,5,
-38,35,32,46,22,8,13,16,
--14,18,51,19,40,39,11,-26,
--1,-17,47,2,-53,-15,31,-22,
-38,21,-15,-16,5,-33,53,15,
--38,86,11,-3,-24,49,13,-4,
--11,-18,28,20,-12,-27,-26,35,
--25,-35,-3,-20,-61,30,10,-55,
--12,-22,-52,-54,-14,19,-32,-12,
-45,15,-8,-48,-9,11,-32,8,
--16,-34,-13,51,18,38,-2,-32,
--17,22,-2,-18,-28,-70,59,27,
--28,-19,-10,-20,-9,-9,-8,-21,
-21,-8,35,-2,45,-3,-9,12,
-0,30,7,-39,43,27,-38,-91,
-30,26,19,-55,-4,63,14,-17,
-13,9,13,2,7,4,6,61,
-72,-1,-17,29,-1,-22,-17,8,
--28,-37,63,44,41,3,2,14,
-9,-6,75,-8,-7,-12,-15,-12,
-13,9,-4,30,-22,-65,15,0,
--45,4,-4,1,5,22,11,23};
diff --git a/drivers/speex/jitter.c b/drivers/speex/jitter.c
deleted file mode 100644
index 05a125e3d..000000000
--- a/drivers/speex/jitter.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: speex_jitter.h
-
- Adaptive jitter buffer for Speex
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-/*
-TODO:
-- Add short-term estimate
-- Defensive programming
- + warn when last returned < last desired (begative buffering)
- + warn if update_delay not called between get() and tick() or is called twice in a row
-- Linked list structure for holding the packets instead of the current fixed-size array
- + return memory to a pool
- + allow pre-allocation of the pool
- + optional max number of elements
-- Statistics
- + drift
- + loss
- + late
- + jitter
- + buffering delay
-*/
-
-#include "config.h"
-
-
-
-#include "arch.h"
-#include <speex/speex.h>
-#include <speex/speex_bits.h>
-#include <speex/speex_jitter.h>
-#include "os_support.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define SPEEX_JITTER_MAX_BUFFER_SIZE 200 /**< Maximum number of packets in jitter buffer */
-
-#define TSUB(a,b) ((spx_int32_t)((a)-(b)))
-
-#define GT32(a,b) (((spx_int32_t)((a)-(b)))>0)
-#define GE32(a,b) (((spx_int32_t)((a)-(b)))>=0)
-#define LT32(a,b) (((spx_int32_t)((a)-(b)))<0)
-#define LE32(a,b) (((spx_int32_t)((a)-(b)))<=0)
-
-#define ROUND_DOWN(x, step) ((x)<0 ? ((x)-(step)+1)/(step)*(step) : (x)/(step)*(step))
-
-#define MAX_TIMINGS 40
-#define MAX_BUFFERS 3
-#define TOP_DELAY 40
-
-/** Buffer that keeps the time of arrival of the latest packets */
-struct TimingBuffer {
- int filled; /**< Number of entries occupied in "timing" and "counts"*/
- int curr_count; /**< Number of packet timings we got (including those we discarded) */
- spx_int32_t timing[MAX_TIMINGS]; /**< Sorted list of all timings ("latest" packets first) */
- spx_int16_t counts[MAX_TIMINGS]; /**< Order the packets were put in (will be used for short-term estimate) */
-};
-
-static void tb_init(struct TimingBuffer *tb)
-{
- tb->filled = 0;
- tb->curr_count = 0;
-}
-
-/* Add the timing of a new packet to the TimingBuffer */
-static void tb_add(struct TimingBuffer *tb, spx_int16_t timing)
-{
- int pos;
- /* Discard packet that won't make it into the list because they're too early */
- if (tb->filled >= MAX_TIMINGS && timing >= tb->timing[tb->filled-1])
- {
- tb->curr_count++;
- return;
- }
-
- /* Find where the timing info goes in the sorted list */
- pos = 0;
- /* FIXME: Do bisection instead of linear search */
- while (pos<tb->filled && timing >= tb->timing[pos])
- {
- pos++;
- }
-
- speex_assert(pos <= tb->filled && pos < MAX_TIMINGS);
-
- /* Shift everything so we can perform the insertion */
- if (pos < tb->filled)
- {
- int move_size = tb->filled-pos;
- if (tb->filled == MAX_TIMINGS)
- move_size -= 1;
- SPEEX_MOVE(&tb->timing[pos+1], &tb->timing[pos], move_size);
- SPEEX_MOVE(&tb->counts[pos+1], &tb->counts[pos], move_size);
- }
- /* Insert */
- tb->timing[pos] = timing;
- tb->counts[pos] = tb->curr_count;
-
- tb->curr_count++;
- if (tb->filled<MAX_TIMINGS)
- tb->filled++;
-}
-
-
-
-/** Jitter buffer structure */
-struct JitterBuffer_ {
- spx_uint32_t pointer_timestamp; /**< Timestamp of what we will *get* next */
- spx_uint32_t last_returned_timestamp; /**< Useful for getting the next packet with the same timestamp (for fragmented media) */
- spx_uint32_t next_stop; /**< Estimated time the next get() will be called */
-
- spx_int32_t buffered; /**< Amount of data we think is still buffered by the application (timestamp units)*/
-
- JitterBufferPacket packets[SPEEX_JITTER_MAX_BUFFER_SIZE]; /**< Packets stored in the buffer */
- spx_uint32_t arrival[SPEEX_JITTER_MAX_BUFFER_SIZE]; /**< Packet arrival time (0 means it was late, even though it's a valid timestamp) */
-
- void (*destroy) (void *); /**< Callback for destroying a packet */
-
- spx_int32_t delay_step; /**< Size of the steps when adjusting buffering (timestamp units) */
- spx_int32_t concealment_size; /**< Size of the packet loss concealment "units" */
- int reset_state; /**< True if state was just reset */
- int buffer_margin; /**< How many frames we want to keep in the buffer (lower bound) */
- int late_cutoff; /**< How late must a packet be for it not to be considered at all */
- int interp_requested; /**< An interpolation is requested by speex_jitter_update_delay() */
- int auto_adjust; /**< Whether to automatically adjust the delay at any time */
-
- struct TimingBuffer _tb[MAX_BUFFERS]; /**< Don't use those directly */
- struct TimingBuffer *timeBuffers[MAX_BUFFERS]; /**< Storing arrival time of latest frames so we can compute some stats */
- int window_size; /**< Total window over which the late frames are counted */
- int subwindow_size; /**< Sub-window size for faster computation */
- int max_late_rate; /**< Absolute maximum amount of late packets tolerable (in percent) */
- int latency_tradeoff; /**< Latency equivalent of losing one percent of packets */
- int auto_tradeoff; /**< Latency equivalent of losing one percent of packets (automatic default) */
-
- int lost_count; /**< Number of consecutive lost packets */
-};
-
-/** Based on available data, this computes the optimal delay for the jitter buffer.
- The optimised function is in timestamp units and is:
- cost = delay + late_factor*[number of frames that would be late if we used that delay]
- @param tb Array of buffers
- @param late_factor Equivalent cost of a late frame (in timestamp units)
- */
-static spx_int16_t compute_opt_delay(JitterBuffer *jitter)
-{
- int i;
- spx_int16_t opt=0;
- spx_int32_t best_cost=0x7fffffff;
- int late = 0;
- int pos[MAX_BUFFERS];
- int tot_count;
- float late_factor;
- int penalty_taken = 0;
- int best = 0;
- int worst = 0;
- spx_int32_t deltaT;
- struct TimingBuffer *tb;
-
- tb = jitter->_tb;
-
- /* Number of packet timings we have received (including those we didn't keep) */
- tot_count = 0;
- for (i=0;i<MAX_BUFFERS;i++)
- tot_count += tb[i].curr_count;
- if (tot_count==0)
- return 0;
-
- /* Compute cost for one lost packet */
- if (jitter->latency_tradeoff != 0)
- late_factor = jitter->latency_tradeoff * 100.0f / tot_count;
- else
- late_factor = jitter->auto_tradeoff * jitter->window_size/tot_count;
-
- /*fprintf(stderr, "late_factor = %f\n", late_factor);*/
- for (i=0;i<MAX_BUFFERS;i++)
- pos[i] = 0;
-
- /* Pick the TOP_DELAY "latest" packets (doesn't need to actually be late
- for the current settings) */
- for (i=0;i<TOP_DELAY;i++)
- {
- int j;
- int next=-1;
- int latest = 32767;
- /* Pick latest amoung all sub-windows */
- for (j=0;j<MAX_BUFFERS;j++)
- {
- if (pos[j] < tb[j].filled && tb[j].timing[pos[j]] < latest)
- {
- next = j;
- latest = tb[j].timing[pos[j]];
- }
- }
- if (next != -1)
- {
- spx_int32_t cost;
-
- if (i==0)
- worst = latest;
- best = latest;
- latest = ROUND_DOWN(latest, jitter->delay_step);
- pos[next]++;
-
- /* Actual cost function that tells us how bad using this delay would be */
- cost = -latest + late_factor*late;
- /*fprintf(stderr, "cost %d = %d + %f * %d\n", cost, -latest, late_factor, late);*/
- if (cost < best_cost)
- {
- best_cost = cost;
- opt = latest;
- }
- } else {
- break;
- }
-
- /* For the next timing we will consider, there will be one more late packet to count */
- late++;
- /* Two-frame penalty if we're going to increase the amount of late frames (hysteresis) */
- if (latest >= 0 && !penalty_taken)
- {
- penalty_taken = 1;
- late+=4;
- }
- }
-
- deltaT = best-worst;
- /* This is a default "automatic latency tradeoff" when none is provided */
- jitter->auto_tradeoff = 1 + deltaT/TOP_DELAY;
- /*fprintf(stderr, "auto_tradeoff = %d (%d %d %d)\n", jitter->auto_tradeoff, best, worst, i);*/
-
- /* FIXME: Compute a short-term estimate too and combine with the long-term one */
-
- /* Prevents reducing the buffer size when we haven't really had much data */
- if (tot_count < TOP_DELAY && opt > 0)
- return 0;
- return opt;
-}
-
-
-/** Initialise jitter buffer */
-EXPORT JitterBuffer *jitter_buffer_init(int step_size)
-{
- JitterBuffer *jitter = (JitterBuffer*)speex_alloc(sizeof(JitterBuffer));
- if (jitter)
- {
- int i;
- spx_int32_t tmp;
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- jitter->packets[i].data=NULL;
- jitter->delay_step = step_size;
- jitter->concealment_size = step_size;
- /*FIXME: Should this be 0 or 1?*/
- jitter->buffer_margin = 0;
- jitter->late_cutoff = 50;
- jitter->destroy = NULL;
- jitter->latency_tradeoff = 0;
- jitter->auto_adjust = 1;
- tmp = 4;
- jitter_buffer_ctl(jitter, JITTER_BUFFER_SET_MAX_LATE_RATE, &tmp);
- jitter_buffer_reset(jitter);
- }
- return jitter;
-}
-
-/** Reset jitter buffer */
-EXPORT void jitter_buffer_reset(JitterBuffer *jitter)
-{
- int i;
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- if (jitter->packets[i].data)
- {
- if (jitter->destroy)
- jitter->destroy(jitter->packets[i].data);
- else
- speex_free(jitter->packets[i].data);
- jitter->packets[i].data = NULL;
- }
- }
- /* Timestamp is actually undefined at this point */
- jitter->pointer_timestamp = 0;
- jitter->next_stop = 0;
- jitter->reset_state = 1;
- jitter->lost_count = 0;
- jitter->buffered = 0;
- jitter->auto_tradeoff = 32000;
-
- for (i=0;i<MAX_BUFFERS;i++)
- {
- tb_init(&jitter->_tb[i]);
- jitter->timeBuffers[i] = &jitter->_tb[i];
- }
- /*fprintf (stderr, "reset\n");*/
-}
-
-/** Destroy jitter buffer */
-EXPORT void jitter_buffer_destroy(JitterBuffer *jitter)
-{
- jitter_buffer_reset(jitter);
- speex_free(jitter);
-}
-
-/** Take the following timing into consideration for future calculations */
-static void update_timings(JitterBuffer *jitter, spx_int32_t timing)
-{
- if (timing < -32767)
- timing = -32767;
- if (timing > 32767)
- timing = 32767;
- /* If the current sub-window is full, perform a rotation and discard oldest sub-widow */
- if (jitter->timeBuffers[0]->curr_count >= jitter->subwindow_size)
- {
- int i;
- /*fprintf(stderr, "Rotate buffer\n");*/
- struct TimingBuffer *tmp = jitter->timeBuffers[MAX_BUFFERS-1];
- for (i=MAX_BUFFERS-1;i>=1;i--)
- jitter->timeBuffers[i] = jitter->timeBuffers[i-1];
- jitter->timeBuffers[0] = tmp;
- tb_init(jitter->timeBuffers[0]);
- }
- tb_add(jitter->timeBuffers[0], timing);
-}
-
-/** Compensate all timings when we do an adjustment of the buffering */
-static void shift_timings(JitterBuffer *jitter, spx_int16_t amount)
-{
- int i, j;
- for (i=0;i<MAX_BUFFERS;i++)
- {
- for (j=0;j<jitter->timeBuffers[i]->filled;j++)
- jitter->timeBuffers[i]->timing[j] += amount;
- }
-}
-
-
-/** Put one packet into the jitter buffer */
-EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
-{
- int i,j;
- int late;
- /*fprintf (stderr, "put packet %d %d\n", timestamp, span);*/
-
- /* Cleanup buffer (remove old packets that weren't played) */
- if (!jitter->reset_state)
- {
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- /* Make sure we don't discard a "just-late" packet in case we want to play it next (if we interpolate). */
- if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp + jitter->packets[i].span, jitter->pointer_timestamp))
- {
- /*fprintf (stderr, "cleaned (not played)\n");*/
- if (jitter->destroy)
- jitter->destroy(jitter->packets[i].data);
- else
- speex_free(jitter->packets[i].data);
- jitter->packets[i].data = NULL;
- }
- }
- }
-
- /*fprintf(stderr, "arrival: %d %d %d\n", packet->timestamp, jitter->next_stop, jitter->pointer_timestamp);*/
- /* Check if packet is late (could still be useful though) */
- if (!jitter->reset_state && LT32(packet->timestamp, jitter->next_stop))
- {
- update_timings(jitter, ((spx_int32_t)packet->timestamp) - ((spx_int32_t)jitter->next_stop) - jitter->buffer_margin);
- late = 1;
- } else {
- late = 0;
- }
-
- /* For some reason, the consumer has failed the last 20 fetches. Make sure this packet is
- * used to resync. */
- if (jitter->lost_count>20)
- {
- jitter_buffer_reset(jitter);
- }
-
- /* Only insert the packet if it's not hopelessly late (i.e. totally useless) */
- if (jitter->reset_state || GE32(packet->timestamp+packet->span+jitter->delay_step, jitter->pointer_timestamp))
- {
-
- /*Find an empty slot in the buffer*/
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- if (jitter->packets[i].data==NULL)
- break;
- }
-
- /*No place left in the buffer, need to make room for it by discarding the oldest packet */
- if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
- {
- int earliest=jitter->packets[0].timestamp;
- i=0;
- for (j=1;j<SPEEX_JITTER_MAX_BUFFER_SIZE;j++)
- {
- if (!jitter->packets[i].data || LT32(jitter->packets[j].timestamp,earliest))
- {
- earliest = jitter->packets[j].timestamp;
- i=j;
- }
- }
- if (jitter->destroy)
- jitter->destroy(jitter->packets[i].data);
- else
- speex_free(jitter->packets[i].data);
- jitter->packets[i].data=NULL;
- /*fprintf (stderr, "Buffer is full, discarding earliest frame %d (currently at %d)\n", timestamp, jitter->pointer_timestamp);*/
- }
-
- /* Copy packet in buffer */
- if (jitter->destroy)
- {
- jitter->packets[i].data = packet->data;
- } else {
- jitter->packets[i].data=(char*)speex_alloc(packet->len);
- for (j=0;j<packet->len;j++)
- jitter->packets[i].data[j]=packet->data[j];
- }
- jitter->packets[i].timestamp=packet->timestamp;
- jitter->packets[i].span=packet->span;
- jitter->packets[i].len=packet->len;
- jitter->packets[i].sequence=packet->sequence;
- jitter->packets[i].user_data=packet->user_data;
- if (jitter->reset_state || late)
- jitter->arrival[i] = 0;
- else
- jitter->arrival[i] = jitter->next_stop;
- }
-
-
-}
-
-/** Get one packet from the jitter buffer */
-EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset)
-{
- int i;
- unsigned int j;
- int incomplete = 0;
- spx_int16_t opt;
-
- if (start_offset != NULL)
- *start_offset = 0;
-
- /* Syncing on the first call */
- if (jitter->reset_state)
- {
- int found = 0;
- /* Find the oldest packet */
- spx_uint32_t oldest=0;
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- if (jitter->packets[i].data && (!found || LT32(jitter->packets[i].timestamp,oldest)))
- {
- oldest = jitter->packets[i].timestamp;
- found = 1;
- }
- }
- if (found)
- {
- jitter->reset_state=0;
- jitter->pointer_timestamp = oldest;
- jitter->next_stop = oldest;
- } else {
- packet->timestamp = 0;
- packet->span = jitter->interp_requested;
- return JITTER_BUFFER_MISSING;
- }
- }
-
-
- jitter->last_returned_timestamp = jitter->pointer_timestamp;
-
- if (jitter->interp_requested != 0)
- {
- packet->timestamp = jitter->pointer_timestamp;
- packet->span = jitter->interp_requested;
-
- /* Increment the pointer because it got decremented in the delay update */
- jitter->pointer_timestamp += jitter->interp_requested;
- packet->len = 0;
- /*fprintf (stderr, "Deferred interpolate\n");*/
-
- jitter->interp_requested = 0;
-
- jitter->buffered = packet->span - desired_span;
-
- return JITTER_BUFFER_INSERTION;
- }
-
- /* Searching for the packet that fits best */
-
- /* Search the buffer for a packet with the right timestamp and spanning the whole current chunk */
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- if (jitter->packets[i].data && jitter->packets[i].timestamp==jitter->pointer_timestamp && GE32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp+desired_span))
- break;
- }
-
- /* If no match, try for an "older" packet that still spans (fully) the current chunk */
- if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
- {
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp, jitter->pointer_timestamp) && GE32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp+desired_span))
- break;
- }
- }
-
- /* If still no match, try for an "older" packet that spans part of the current chunk */
- if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
- {
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp, jitter->pointer_timestamp) && GT32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp))
- break;
- }
- }
-
- /* If still no match, try for earliest packet possible */
- if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
- {
- int found = 0;
- spx_uint32_t best_time=0;
- int best_span=0;
- int besti=0;
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- /* check if packet starts within current chunk */
- if (jitter->packets[i].data && LT32(jitter->packets[i].timestamp,jitter->pointer_timestamp+desired_span) && GE32(jitter->packets[i].timestamp,jitter->pointer_timestamp))
- {
- if (!found || LT32(jitter->packets[i].timestamp,best_time) || (jitter->packets[i].timestamp==best_time && GT32(jitter->packets[i].span,best_span)))
- {
- best_time = jitter->packets[i].timestamp;
- best_span = jitter->packets[i].span;
- besti = i;
- found = 1;
- }
- }
- }
- if (found)
- {
- i=besti;
- incomplete = 1;
- /*fprintf (stderr, "incomplete: %d %d %d %d\n", jitter->packets[i].timestamp, jitter->pointer_timestamp, chunk_size, jitter->packets[i].span);*/
- }
- }
-
- /* If we find something */
- if (i!=SPEEX_JITTER_MAX_BUFFER_SIZE)
- {
- spx_int32_t offset;
-
- /* We (obviously) haven't lost this packet */
- jitter->lost_count = 0;
-
- /* In this case, 0 isn't as a valid timestamp */
- if (jitter->arrival[i] != 0)
- {
- update_timings(jitter, ((spx_int32_t)jitter->packets[i].timestamp) - ((spx_int32_t)jitter->arrival[i]) - jitter->buffer_margin);
- }
-
-
- /* Copy packet */
- if (jitter->destroy)
- {
- packet->data = jitter->packets[i].data;
- packet->len = jitter->packets[i].len;
- } else {
- if (jitter->packets[i].len > packet->len)
- {
- speex_warning_int("jitter_buffer_get(): packet too large to fit. Size is", jitter->packets[i].len);
- } else {
- packet->len = jitter->packets[i].len;
- }
- for (j=0;j<packet->len;j++)
- packet->data[j] = jitter->packets[i].data[j];
- /* Remove packet */
- speex_free(jitter->packets[i].data);
- }
- jitter->packets[i].data = NULL;
- /* Set timestamp and span (if requested) */
- offset = (spx_int32_t)jitter->packets[i].timestamp-(spx_int32_t)jitter->pointer_timestamp;
- if (start_offset != NULL)
- *start_offset = offset;
- else if (offset != 0)
- speex_warning_int("jitter_buffer_get() discarding non-zero start_offset", offset);
-
- packet->timestamp = jitter->packets[i].timestamp;
- jitter->last_returned_timestamp = packet->timestamp;
-
- packet->span = jitter->packets[i].span;
- packet->sequence = jitter->packets[i].sequence;
- packet->user_data = jitter->packets[i].user_data;
- /* Point to the end of the current packet */
- jitter->pointer_timestamp = jitter->packets[i].timestamp+jitter->packets[i].span;
-
- jitter->buffered = packet->span - desired_span;
-
- if (start_offset != NULL)
- jitter->buffered += *start_offset;
-
- return JITTER_BUFFER_OK;
- }
-
-
- /* If we haven't found anything worth returning */
-
- /*fprintf (stderr, "not found\n");*/
- jitter->lost_count++;
- /*fprintf (stderr, "m");*/
- /*fprintf (stderr, "lost_count = %d\n", jitter->lost_count);*/
-
- opt = compute_opt_delay(jitter);
-
- /* Should we force an increase in the buffer or just do normal interpolation? */
- if (opt < 0)
- {
- /* Need to increase buffering */
-
- /* Shift histogram to compensate */
- shift_timings(jitter, -opt);
-
- packet->timestamp = jitter->pointer_timestamp;
- packet->span = -opt;
- /* Don't move the pointer_timestamp forward */
- packet->len = 0;
-
- jitter->buffered = packet->span - desired_span;
- return JITTER_BUFFER_INSERTION;
- /*jitter->pointer_timestamp -= jitter->delay_step;*/
- /*fprintf (stderr, "Forced to interpolate\n");*/
- } else {
- /* Normal packet loss */
- packet->timestamp = jitter->pointer_timestamp;
-
- desired_span = ROUND_DOWN(desired_span, jitter->concealment_size);
- packet->span = desired_span;
- jitter->pointer_timestamp += desired_span;
- packet->len = 0;
-
- jitter->buffered = packet->span - desired_span;
- return JITTER_BUFFER_MISSING;
- /*fprintf (stderr, "Normal loss\n");*/
- }
-
-
-}
-
-EXPORT int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet)
-{
- int i, j;
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- if (jitter->packets[i].data && jitter->packets[i].timestamp==jitter->last_returned_timestamp)
- break;
- }
- if (i!=SPEEX_JITTER_MAX_BUFFER_SIZE)
- {
- /* Copy packet */
- packet->len = jitter->packets[i].len;
- if (jitter->destroy)
- {
- packet->data = jitter->packets[i].data;
- } else {
- for (j=0;j<packet->len;j++)
- packet->data[j] = jitter->packets[i].data[j];
- /* Remove packet */
- speex_free(jitter->packets[i].data);
- }
- jitter->packets[i].data = NULL;
- packet->timestamp = jitter->packets[i].timestamp;
- packet->span = jitter->packets[i].span;
- packet->sequence = jitter->packets[i].sequence;
- packet->user_data = jitter->packets[i].user_data;
- return JITTER_BUFFER_OK;
- } else {
- packet->data = NULL;
- packet->len = 0;
- packet->span = 0;
- return JITTER_BUFFER_MISSING;
- }
-}
-
-/* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */
-static int _jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
-{
- spx_int16_t opt = compute_opt_delay(jitter);
- /*fprintf(stderr, "opt adjustment is %d ", opt);*/
-
- if (opt < 0)
- {
- shift_timings(jitter, -opt);
-
- jitter->pointer_timestamp += opt;
- jitter->interp_requested = -opt;
- /*fprintf (stderr, "Decision to interpolate %d samples\n", -opt);*/
- } else if (opt > 0)
- {
- shift_timings(jitter, -opt);
- jitter->pointer_timestamp += opt;
- /*fprintf (stderr, "Decision to drop %d samples\n", opt);*/
- }
-
- return opt;
-}
-
-/* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */
-EXPORT int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
-{
- /* If the programmer calls jitter_buffer_update_delay() directly,
- automatically disable auto-adjustment */
- jitter->auto_adjust = 0;
-
- return _jitter_buffer_update_delay(jitter, packet, start_offset);
-}
-
-/** Get pointer timestamp of jitter buffer */
-EXPORT int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter)
-{
- return jitter->pointer_timestamp;
-}
-
-EXPORT void jitter_buffer_tick(JitterBuffer *jitter)
-{
- /* Automatically-adjust the buffering delay if requested */
- if (jitter->auto_adjust)
- _jitter_buffer_update_delay(jitter, NULL, NULL);
-
- if (jitter->buffered >= 0)
- {
- jitter->next_stop = jitter->pointer_timestamp - jitter->buffered;
- } else {
- jitter->next_stop = jitter->pointer_timestamp;
- speex_warning_int("jitter buffer sees negative buffering, your code might be broken. Value is ", jitter->buffered);
- }
- jitter->buffered = 0;
-}
-
-EXPORT void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem)
-{
- /* Automatically-adjust the buffering delay if requested */
- if (jitter->auto_adjust)
- _jitter_buffer_update_delay(jitter, NULL, NULL);
-
- if (jitter->buffered < 0)
- speex_warning_int("jitter buffer sees negative buffering, your code might be broken. Value is ", jitter->buffered);
- jitter->next_stop = jitter->pointer_timestamp - rem;
-}
-
-
-/* Used like the ioctl function to control the jitter buffer parameters */
-EXPORT int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
-{
- int count, i;
- switch(request)
- {
- case JITTER_BUFFER_SET_MARGIN:
- jitter->buffer_margin = *(spx_int32_t*)ptr;
- break;
- case JITTER_BUFFER_GET_MARGIN:
- *(spx_int32_t*)ptr = jitter->buffer_margin;
- break;
- case JITTER_BUFFER_GET_AVALIABLE_COUNT:
- count = 0;
- for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
- {
- if (jitter->packets[i].data && LE32(jitter->pointer_timestamp, jitter->packets[i].timestamp))
- {
- count++;
- }
- }
- *(spx_int32_t*)ptr = count;
- break;
- case JITTER_BUFFER_SET_DESTROY_CALLBACK:
- jitter->destroy = (void (*) (void *))ptr;
- break;
- case JITTER_BUFFER_GET_DESTROY_CALLBACK:
- *(void (**) (void *))ptr = jitter->destroy;
- break;
- case JITTER_BUFFER_SET_DELAY_STEP:
- jitter->delay_step = *(spx_int32_t*)ptr;
- break;
- case JITTER_BUFFER_GET_DELAY_STEP:
- *(spx_int32_t*)ptr = jitter->delay_step;
- break;
- case JITTER_BUFFER_SET_CONCEALMENT_SIZE:
- jitter->concealment_size = *(spx_int32_t*)ptr;
- break;
- case JITTER_BUFFER_GET_CONCEALMENT_SIZE:
- *(spx_int32_t*)ptr = jitter->concealment_size;
- break;
- case JITTER_BUFFER_SET_MAX_LATE_RATE:
- jitter->max_late_rate = *(spx_int32_t*)ptr;
- jitter->window_size = 100*TOP_DELAY/jitter->max_late_rate;
- jitter->subwindow_size = jitter->window_size/MAX_BUFFERS;
- break;
- case JITTER_BUFFER_GET_MAX_LATE_RATE:
- *(spx_int32_t*)ptr = jitter->max_late_rate;
- break;
- case JITTER_BUFFER_SET_LATE_COST:
- jitter->latency_tradeoff = *(spx_int32_t*)ptr;
- break;
- case JITTER_BUFFER_GET_LATE_COST:
- *(spx_int32_t*)ptr = jitter->latency_tradeoff;
- break;
- default:
- speex_warning_int("Unknown jitter_buffer_ctl request: ", request);
- return -1;
- }
- return 0;
-}
-
diff --git a/drivers/speex/kiss_fft.c b/drivers/speex/kiss_fft.c
deleted file mode 100644
index b85f018de..000000000
--- a/drivers/speex/kiss_fft.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-Copyright (c) 2005-2007, Jean-Marc Valin
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-
-#include "config.h"
-
-
-#include "_kiss_fft_guts.h"
-#include "arch.h"
-#include "os_support.h"
-
-/* The guts header contains all the multiplication and addition macros that are defined for
- fixed or floating point complex numbers. It also delares the kf_ internal functions.
- */
-
-static void kf_bfly2(
- kiss_fft_cpx * Fout,
- const size_t fstride,
- const kiss_fft_cfg st,
- int m,
- int N,
- int mm
- )
-{
- kiss_fft_cpx * Fout2;
- kiss_fft_cpx * tw1;
- kiss_fft_cpx t;
- if (!st->inverse) {
- int i,j;
- kiss_fft_cpx * Fout_beg = Fout;
- for (i=0;i<N;i++)
- {
- Fout = Fout_beg + i*mm;
- Fout2 = Fout + m;
- tw1 = st->twiddles;
- for(j=0;j<m;j++)
- {
- /* Almost the same as the code path below, except that we divide the input by two
- (while keeping the best accuracy possible) */
- spx_word32_t tr, ti;
- tr = SHR32(SUB32(MULT16_16(Fout2->r , tw1->r),MULT16_16(Fout2->i , tw1->i)), 1);
- ti = SHR32(ADD32(MULT16_16(Fout2->i , tw1->r),MULT16_16(Fout2->r , tw1->i)), 1);
- tw1 += fstride;
- Fout2->r = PSHR32(SUB32(SHL32(EXTEND32(Fout->r), 14), tr), 15);
- Fout2->i = PSHR32(SUB32(SHL32(EXTEND32(Fout->i), 14), ti), 15);
- Fout->r = PSHR32(ADD32(SHL32(EXTEND32(Fout->r), 14), tr), 15);
- Fout->i = PSHR32(ADD32(SHL32(EXTEND32(Fout->i), 14), ti), 15);
- ++Fout2;
- ++Fout;
- }
- }
- } else {
- int i,j;
- kiss_fft_cpx * Fout_beg = Fout;
- for (i=0;i<N;i++)
- {
- Fout = Fout_beg + i*mm;
- Fout2 = Fout + m;
- tw1 = st->twiddles;
- for(j=0;j<m;j++)
- {
- C_MUL (t, *Fout2 , *tw1);
- tw1 += fstride;
- C_SUB( *Fout2 , *Fout , t );
- C_ADDTO( *Fout , t );
- ++Fout2;
- ++Fout;
- }
- }
- }
-}
-
-static void kf_bfly4(
- kiss_fft_cpx * Fout,
- const size_t fstride,
- const kiss_fft_cfg st,
- int m,
- int N,
- int mm
- )
-{
- kiss_fft_cpx *tw1,*tw2,*tw3;
- kiss_fft_cpx scratch[6];
- const size_t m2=2*m;
- const size_t m3=3*m;
- int i, j;
-
- if (st->inverse)
- {
- kiss_fft_cpx * Fout_beg = Fout;
- for (i=0;i<N;i++)
- {
- Fout = Fout_beg + i*mm;
- tw3 = tw2 = tw1 = st->twiddles;
- for (j=0;j<m;j++)
- {
- C_MUL(scratch[0],Fout[m] , *tw1 );
- C_MUL(scratch[1],Fout[m2] , *tw2 );
- C_MUL(scratch[2],Fout[m3] , *tw3 );
-
- C_SUB( scratch[5] , *Fout, scratch[1] );
- C_ADDTO(*Fout, scratch[1]);
- C_ADD( scratch[3] , scratch[0] , scratch[2] );
- C_SUB( scratch[4] , scratch[0] , scratch[2] );
- C_SUB( Fout[m2], *Fout, scratch[3] );
- tw1 += fstride;
- tw2 += fstride*2;
- tw3 += fstride*3;
- C_ADDTO( *Fout , scratch[3] );
-
- Fout[m].r = scratch[5].r - scratch[4].i;
- Fout[m].i = scratch[5].i + scratch[4].r;
- Fout[m3].r = scratch[5].r + scratch[4].i;
- Fout[m3].i = scratch[5].i - scratch[4].r;
- ++Fout;
- }
- }
- } else
- {
- kiss_fft_cpx * Fout_beg = Fout;
- for (i=0;i<N;i++)
- {
- Fout = Fout_beg + i*mm;
- tw3 = tw2 = tw1 = st->twiddles;
- for (j=0;j<m;j++)
- {
- C_MUL4(scratch[0],Fout[m] , *tw1 );
- C_MUL4(scratch[1],Fout[m2] , *tw2 );
- C_MUL4(scratch[2],Fout[m3] , *tw3 );
-
- Fout->r = PSHR16(Fout->r, 2);
- Fout->i = PSHR16(Fout->i, 2);
- C_SUB( scratch[5] , *Fout, scratch[1] );
- C_ADDTO(*Fout, scratch[1]);
- C_ADD( scratch[3] , scratch[0] , scratch[2] );
- C_SUB( scratch[4] , scratch[0] , scratch[2] );
- Fout[m2].r = PSHR16(Fout[m2].r, 2);
- Fout[m2].i = PSHR16(Fout[m2].i, 2);
- C_SUB( Fout[m2], *Fout, scratch[3] );
- tw1 += fstride;
- tw2 += fstride*2;
- tw3 += fstride*3;
- C_ADDTO( *Fout , scratch[3] );
-
- Fout[m].r = scratch[5].r + scratch[4].i;
- Fout[m].i = scratch[5].i - scratch[4].r;
- Fout[m3].r = scratch[5].r - scratch[4].i;
- Fout[m3].i = scratch[5].i + scratch[4].r;
- ++Fout;
- }
- }
- }
-}
-
-static void kf_bfly3(
- kiss_fft_cpx * Fout,
- const size_t fstride,
- const kiss_fft_cfg st,
- size_t m
- )
-{
- size_t k=m;
- const size_t m2 = 2*m;
- kiss_fft_cpx *tw1,*tw2;
- kiss_fft_cpx scratch[5];
- kiss_fft_cpx epi3;
- epi3 = st->twiddles[fstride*m];
-
- tw1=tw2=st->twiddles;
-
- do{
- if (!st->inverse) {
- C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
- }
-
- C_MUL(scratch[1],Fout[m] , *tw1);
- C_MUL(scratch[2],Fout[m2] , *tw2);
-
- C_ADD(scratch[3],scratch[1],scratch[2]);
- C_SUB(scratch[0],scratch[1],scratch[2]);
- tw1 += fstride;
- tw2 += fstride*2;
-
- Fout[m].r = Fout->r - HALF_OF(scratch[3].r);
- Fout[m].i = Fout->i - HALF_OF(scratch[3].i);
-
- C_MULBYSCALAR( scratch[0] , epi3.i );
-
- C_ADDTO(*Fout,scratch[3]);
-
- Fout[m2].r = Fout[m].r + scratch[0].i;
- Fout[m2].i = Fout[m].i - scratch[0].r;
-
- Fout[m].r -= scratch[0].i;
- Fout[m].i += scratch[0].r;
-
- ++Fout;
- }while(--k);
-}
-
-static void kf_bfly5(
- kiss_fft_cpx * Fout,
- const size_t fstride,
- const kiss_fft_cfg st,
- int m
- )
-{
- kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4;
- int u;
- kiss_fft_cpx scratch[13];
- kiss_fft_cpx * twiddles = st->twiddles;
- kiss_fft_cpx *tw;
- kiss_fft_cpx ya,yb;
- ya = twiddles[fstride*m];
- yb = twiddles[fstride*2*m];
-
- Fout0=Fout;
- Fout1=Fout0+m;
- Fout2=Fout0+2*m;
- Fout3=Fout0+3*m;
- Fout4=Fout0+4*m;
-
- tw=st->twiddles;
- for ( u=0; u<m; ++u ) {
- if (!st->inverse) {
- C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5);
- }
- scratch[0] = *Fout0;
-
- C_MUL(scratch[1] ,*Fout1, tw[u*fstride]);
- C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]);
- C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]);
- C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]);
-
- C_ADD( scratch[7],scratch[1],scratch[4]);
- C_SUB( scratch[10],scratch[1],scratch[4]);
- C_ADD( scratch[8],scratch[2],scratch[3]);
- C_SUB( scratch[9],scratch[2],scratch[3]);
-
- Fout0->r += scratch[7].r + scratch[8].r;
- Fout0->i += scratch[7].i + scratch[8].i;
-
- scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r);
- scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r);
-
- scratch[6].r = S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i);
- scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i);
-
- C_SUB(*Fout1,scratch[5],scratch[6]);
- C_ADD(*Fout4,scratch[5],scratch[6]);
-
- scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r);
- scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r);
- scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i);
- scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i);
-
- C_ADD(*Fout2,scratch[11],scratch[12]);
- C_SUB(*Fout3,scratch[11],scratch[12]);
-
- ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4;
- }
-}
-
-/* perform the butterfly for one stage of a mixed radix FFT */
-static void kf_bfly_generic(
- kiss_fft_cpx * Fout,
- const size_t fstride,
- const kiss_fft_cfg st,
- int m,
- int p
- )
-{
- int u,k,q1,q;
- kiss_fft_cpx * twiddles = st->twiddles;
- kiss_fft_cpx t;
- kiss_fft_cpx scratchbuf[17];
- int Norig = st->nfft;
-
- /*CHECKBUF(scratchbuf,nscratchbuf,p);*/
- if (p>17)
- speex_fatal("KissFFT: max radix supported is 17");
-
- for ( u=0; u<m; ++u ) {
- k=u;
- for ( q1=0 ; q1<p ; ++q1 ) {
- scratchbuf[q1] = Fout[ k ];
- if (!st->inverse) {
- C_FIXDIV(scratchbuf[q1],p);
- }
- k += m;
- }
-
- k=u;
- for ( q1=0 ; q1<p ; ++q1 ) {
- int twidx=0;
- Fout[ k ] = scratchbuf[0];
- for (q=1;q<p;++q ) {
- twidx += fstride * k;
- if (twidx>=Norig) twidx-=Norig;
- C_MUL(t,scratchbuf[q] , twiddles[twidx] );
- C_ADDTO( Fout[ k ] ,t);
- }
- k += m;
- }
- }
-}
-
-static
-void kf_shuffle(
- kiss_fft_cpx * Fout,
- const kiss_fft_cpx * f,
- const size_t fstride,
- int in_stride,
- int * factors,
- const kiss_fft_cfg st
- )
-{
- const int p=*factors++; /* the radix */
- const int m=*factors++; /* stage's fft length/p */
-
- /*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/
- if (m==1)
- {
- int j;
- for (j=0;j<p;j++)
- {
- Fout[j] = *f;
- f += fstride*in_stride;
- }
- } else {
- int j;
- for (j=0;j<p;j++)
- {
- kf_shuffle( Fout , f, fstride*p, in_stride, factors,st);
- f += fstride*in_stride;
- Fout += m;
- }
- }
-}
-
-static
-void kf_work(
- kiss_fft_cpx * Fout,
- const kiss_fft_cpx * f,
- const size_t fstride,
- int in_stride,
- int * factors,
- const kiss_fft_cfg st,
- int N,
- int s2,
- int m2
- )
-{
- int i;
- kiss_fft_cpx * Fout_beg=Fout;
- const int p=*factors++; /* the radix */
- const int m=*factors++; /* stage's fft length/p */
-#if 0
- /*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/
- if (m==1)
- {
- /* int j;
- for (j=0;j<p;j++)
- {
- Fout[j] = *f;
- f += fstride*in_stride;
- }*/
- } else {
- int j;
- for (j=0;j<p;j++)
- {
- kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m);
- f += fstride*in_stride;
- Fout += m;
- }
- }
-
- Fout=Fout_beg;
-
- switch (p) {
- case 2: kf_bfly2(Fout,fstride,st,m); break;
- case 3: kf_bfly3(Fout,fstride,st,m); break;
- case 4: kf_bfly4(Fout,fstride,st,m); break;
- case 5: kf_bfly5(Fout,fstride,st,m); break;
- default: kf_bfly_generic(Fout,fstride,st,m,p); break;
- }
-#else
- /*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/
- if (m==1)
- {
- /*for (i=0;i<N;i++)
- {
- int j;
- Fout = Fout_beg+i*m2;
- const kiss_fft_cpx * f2 = f+i*s2;
- for (j=0;j<p;j++)
- {
- *Fout++ = *f2;
- f2 += fstride*in_stride;
- }
- }*/
- }else{
- kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m);
- }
-
-
-
-
- switch (p) {
- case 2: kf_bfly2(Fout,fstride,st,m, N, m2); break;
- case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break;
- case 4: kf_bfly4(Fout,fstride,st,m, N, m2); break;
- case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly5(Fout,fstride,st,m);} break;
- default: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly_generic(Fout,fstride,st,m,p);} break;
- }
-#endif
-}
-
-/* facbuf is populated by p1,m1,p2,m2, ...
- where
- p[i] * m[i] = m[i-1]
- m0 = n */
-static
-void kf_factor(int n,int * facbuf)
-{
- int p=4;
-
- /*factor out powers of 4, powers of 2, then any remaining primes */
- do {
- while (n % p) {
- switch (p) {
- case 4: p = 2; break;
- case 2: p = 3; break;
- default: p += 2; break;
- }
- if (p>32000 || (spx_int32_t)p*(spx_int32_t)p > n)
- p = n; /* no more factors, skip to end */
- }
- n /= p;
- *facbuf++ = p;
- *facbuf++ = n;
- } while (n > 1);
-}
-/*
- *
- * User-callable function to allocate all necessary storage space for the fft.
- *
- * The return value is a contiguous block of memory, allocated with malloc. As such,
- * It can be freed with free(), rather than a kiss_fft-specific function.
- * */
-kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem )
-{
- kiss_fft_cfg st=NULL;
- size_t memneeded = sizeof(struct kiss_fft_state)
- + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/
-
- if ( lenmem==NULL ) {
- st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded );
- }else{
- if (mem != NULL && *lenmem >= memneeded)
- st = (kiss_fft_cfg)mem;
- *lenmem = memneeded;
- }
- if (st) {
- int i;
- st->nfft=nfft;
- st->inverse = inverse_fft;
-#ifdef FIXED_POINT
- for (i=0;i<nfft;++i) {
- spx_word32_t phase = i;
- if (!st->inverse)
- phase = -phase;
- kf_cexp2(st->twiddles+i, DIV32(SHL32(phase,17),nfft));
- }
-#else
- for (i=0;i<nfft;++i) {
- const double pi=3.14159265358979323846264338327;
- double phase = ( -2*pi /nfft ) * i;
- if (st->inverse)
- phase *= -1;
- kf_cexp(st->twiddles+i, phase );
- }
-#endif
- kf_factor(nfft,st->factors);
- }
- return st;
-}
-
-
-
-
-void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride)
-{
- if (fin == fout)
- {
- speex_fatal("In-place FFT not supported");
- /*CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
- kf_work(tmpbuf,fin,1,in_stride, st->factors,st);
- SPEEX_MOVE(fout,tmpbuf,st->nfft);*/
- } else {
- kf_shuffle( fout, fin, 1,in_stride, st->factors,st);
- kf_work( fout, fin, 1,in_stride, st->factors,st, 1, in_stride, 1);
- }
-}
-
-void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout)
-{
- kiss_fft_stride(cfg,fin,fout,1);
-}
-
diff --git a/drivers/speex/kiss_fft.h b/drivers/speex/kiss_fft.h
deleted file mode 100644
index fa3f2c604..000000000
--- a/drivers/speex/kiss_fft.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef KISS_FFT_H
-#define KISS_FFT_H
-
-#include <stdlib.h>
-#include <math.h>
-#include "arch.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- ATTENTION!
- If you would like a :
- -- a utility that will handle the caching of fft objects
- -- real-only (no imaginary time component ) FFT
- -- a multi-dimensional FFT
- -- a command-line utility to perform ffts
- -- a command-line utility to perform fast-convolution filtering
-
- Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
- in the tools/ directory.
-*/
-
-#ifdef USE_SIMD
-# include <xmmintrin.h>
-# define kiss_fft_scalar __m128
-#define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes)
-#else
-#define KISS_FFT_MALLOC speex_alloc
-#endif
-
-
-#ifdef FIXED_POINT
-#include "arch.h"
-# define kiss_fft_scalar spx_int16_t
-#else
-# ifndef kiss_fft_scalar
-/* default is float */
-# define kiss_fft_scalar float
-# endif
-#endif
-
-typedef struct {
- kiss_fft_scalar r;
- kiss_fft_scalar i;
-}kiss_fft_cpx;
-
-typedef struct kiss_fft_state* kiss_fft_cfg;
-
-/*
- * kiss_fft_alloc
- *
- * Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
- *
- * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
- *
- * The return value from fft_alloc is a cfg buffer used internally
- * by the fft routine or NULL.
- *
- * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
- * The returned value should be free()d when done to avoid memory leaks.
- *
- * The state can be placed in a user supplied buffer 'mem':
- * If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
- * then the function places the cfg in mem and the size used in *lenmem
- * and returns mem.
- *
- * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
- * then the function returns NULL and places the minimum cfg
- * buffer size in *lenmem.
- * */
-
-kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
-
-/*
- * kiss_fft(cfg,in_out_buf)
- *
- * Perform an FFT on a complex input buffer.
- * for a forward FFT,
- * fin should be f[0] , f[1] , ... ,f[nfft-1]
- * fout will be F[0] , F[1] , ... ,F[nfft-1]
- * Note that each element is complex and can be accessed like
- f[k].r and f[k].i
- * */
-void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
-
-/*
- A more generic version of the above function. It reads its input from every Nth sample.
- * */
-void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
-
-/* If kiss_fft_alloc allocated a buffer, it is one contiguous
- buffer and can be simply free()d when no longer needed*/
-#define kiss_fft_free speex_free
-
-/*
- Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
- your compiler output to call this before you exit.
-*/
-void kiss_fft_cleanup(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/drivers/speex/kiss_fftr.c b/drivers/speex/kiss_fftr.c
deleted file mode 100644
index 819bc6f10..000000000
--- a/drivers/speex/kiss_fftr.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include "os_support.h"
-#include "kiss_fftr.h"
-#include "_kiss_fft_guts.h"
-
-struct kiss_fftr_state{
- kiss_fft_cfg substate;
- kiss_fft_cpx * tmpbuf;
- kiss_fft_cpx * super_twiddles;
-#ifdef USE_SIMD
- long pad;
-#endif
-};
-
-kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem)
-{
- int i;
- kiss_fftr_cfg st = NULL;
- size_t subsize, memneeded;
-
- if (nfft & 1) {
- speex_warning("Real FFT optimization must be even.\n");
- return NULL;
- }
- nfft >>= 1;
-
- kiss_fft_alloc (nfft, inverse_fft, NULL, &subsize);
- memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_fft_cpx) * ( nfft * 2);
-
- if (lenmem == NULL) {
- st = (kiss_fftr_cfg) KISS_FFT_MALLOC (memneeded);
- } else {
- if (*lenmem >= memneeded)
- st = (kiss_fftr_cfg) mem;
- *lenmem = memneeded;
- }
- if (!st)
- return NULL;
-
- st->substate = (kiss_fft_cfg) (st + 1); /*just beyond kiss_fftr_state struct */
- st->tmpbuf = (kiss_fft_cpx *) (((char *) st->substate) + subsize);
- st->super_twiddles = st->tmpbuf + nfft;
- kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize);
-
-#ifdef FIXED_POINT
- for (i=0;i<nfft;++i) {
- spx_word32_t phase = i+(nfft>>1);
- if (!inverse_fft)
- phase = -phase;
- kf_cexp2(st->super_twiddles+i, DIV32(SHL32(phase,16),nfft));
- }
-#else
- for (i=0;i<nfft;++i) {
- const double pi=3.14159265358979323846264338327;
- double phase = pi*(((double)i) /nfft + .5);
- if (!inverse_fft)
- phase = -phase;
- kf_cexp(st->super_twiddles+i, phase );
- }
-#endif
- return st;
-}
-
-void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata)
-{
- /* input buffer timedata is stored row-wise */
- int k,ncfft;
- kiss_fft_cpx fpnk,fpk,f1k,f2k,tw,tdc;
-
- if ( st->substate->inverse) {
- speex_fatal("kiss fft usage error: improper alloc\n");
- }
-
- ncfft = st->substate->nfft;
-
- /*perform the parallel fft of two real signals packed in real,imag*/
- kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf );
- /* The real part of the DC element of the frequency spectrum in st->tmpbuf
- * contains the sum of the even-numbered elements of the input time sequence
- * The imag part is the sum of the odd-numbered elements
- *
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
- * yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
- * yielding Nyquist bin of input time sequence
- */
-
- tdc.r = st->tmpbuf[0].r;
- tdc.i = st->tmpbuf[0].i;
- C_FIXDIV(tdc,2);
- CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
- CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
- freqdata[0].r = tdc.r + tdc.i;
- freqdata[ncfft].r = tdc.r - tdc.i;
-#ifdef USE_SIMD
- freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0);
-#else
- freqdata[ncfft].i = freqdata[0].i = 0;
-#endif
-
- for ( k=1;k <= ncfft/2 ; ++k ) {
- fpk = st->tmpbuf[k];
- fpnk.r = st->tmpbuf[ncfft-k].r;
- fpnk.i = - st->tmpbuf[ncfft-k].i;
- C_FIXDIV(fpk,2);
- C_FIXDIV(fpnk,2);
-
- C_ADD( f1k, fpk , fpnk );
- C_SUB( f2k, fpk , fpnk );
- C_MUL( tw , f2k , st->super_twiddles[k]);
-
- freqdata[k].r = HALF_OF(f1k.r + tw.r);
- freqdata[k].i = HALF_OF(f1k.i + tw.i);
- freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r);
- freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i);
- }
-}
-
-void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata, kiss_fft_scalar *timedata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
-
- if (st->substate->inverse == 0) {
- speex_fatal("kiss fft usage error: improper alloc\n");
- }
-
- ncfft = st->substate->nfft;
-
- st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
- st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
- /*C_FIXDIV(st->tmpbuf[0],2);*/
-
- for (k = 1; k <= ncfft / 2; ++k) {
- kiss_fft_cpx fk, fnkc, fek, fok, tmp;
- fk = freqdata[k];
- fnkc.r = freqdata[ncfft - k].r;
- fnkc.i = -freqdata[ncfft - k].i;
- /*C_FIXDIV( fk , 2 );
- C_FIXDIV( fnkc , 2 );*/
-
- C_ADD (fek, fk, fnkc);
- C_SUB (tmp, fk, fnkc);
- C_MUL (fok, tmp, st->super_twiddles[k]);
- C_ADD (st->tmpbuf[k], fek, fok);
- C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
- st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
-#else
- st->tmpbuf[ncfft - k].i *= -1;
-#endif
- }
- kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata);
-}
-
-void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata)
-{
- /* input buffer timedata is stored row-wise */
- int k,ncfft;
- kiss_fft_cpx f2k,tdc;
- spx_word32_t f1kr, f1ki, twr, twi;
-
- if ( st->substate->inverse) {
- speex_fatal("kiss fft usage error: improper alloc\n");
- }
-
- ncfft = st->substate->nfft;
-
- /*perform the parallel fft of two real signals packed in real,imag*/
- kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf );
- /* The real part of the DC element of the frequency spectrum in st->tmpbuf
- * contains the sum of the even-numbered elements of the input time sequence
- * The imag part is the sum of the odd-numbered elements
- *
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
- * yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
- * yielding Nyquist bin of input time sequence
- */
-
- tdc.r = st->tmpbuf[0].r;
- tdc.i = st->tmpbuf[0].i;
- C_FIXDIV(tdc,2);
- CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
- CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
- freqdata[0] = tdc.r + tdc.i;
- freqdata[2*ncfft-1] = tdc.r - tdc.i;
-
- for ( k=1;k <= ncfft/2 ; ++k )
- {
- /*fpk = st->tmpbuf[k];
- fpnk.r = st->tmpbuf[ncfft-k].r;
- fpnk.i = - st->tmpbuf[ncfft-k].i;
- C_FIXDIV(fpk,2);
- C_FIXDIV(fpnk,2);
-
- C_ADD( f1k, fpk , fpnk );
- C_SUB( f2k, fpk , fpnk );
-
- C_MUL( tw , f2k , st->super_twiddles[k]);
-
- freqdata[2*k-1] = HALF_OF(f1k.r + tw.r);
- freqdata[2*k] = HALF_OF(f1k.i + tw.i);
- freqdata[2*(ncfft-k)-1] = HALF_OF(f1k.r - tw.r);
- freqdata[2*(ncfft-k)] = HALF_OF(tw.i - f1k.i);
- */
-
- /*f1k.r = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
- f1k.i = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
- f2k.r = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
- f2k.i = SHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
-
- C_MUL( tw , f2k , st->super_twiddles[k]);
-
- freqdata[2*k-1] = HALF_OF(f1k.r + tw.r);
- freqdata[2*k] = HALF_OF(f1k.i + tw.i);
- freqdata[2*(ncfft-k)-1] = HALF_OF(f1k.r - tw.r);
- freqdata[2*(ncfft-k)] = HALF_OF(tw.i - f1k.i);
- */
- f2k.r = SHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
- f2k.i = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
-
- f1kr = SHL32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),13);
- f1ki = SHL32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),13);
-
- twr = SHR32(SUB32(MULT16_16(f2k.r,st->super_twiddles[k].r),MULT16_16(f2k.i,st->super_twiddles[k].i)), 1);
- twi = SHR32(ADD32(MULT16_16(f2k.i,st->super_twiddles[k].r),MULT16_16(f2k.r,st->super_twiddles[k].i)), 1);
-
-#ifdef FIXED_POINT
- freqdata[2*k-1] = PSHR32(f1kr + twr, 15);
- freqdata[2*k] = PSHR32(f1ki + twi, 15);
- freqdata[2*(ncfft-k)-1] = PSHR32(f1kr - twr, 15);
- freqdata[2*(ncfft-k)] = PSHR32(twi - f1ki, 15);
-#else
- freqdata[2*k-1] = .5f*(f1kr + twr);
- freqdata[2*k] = .5f*(f1ki + twi);
- freqdata[2*(ncfft-k)-1] = .5f*(f1kr - twr);
- freqdata[2*(ncfft-k)] = .5f*(twi - f1ki);
-
-#endif
- }
-}
-
-void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata,kiss_fft_scalar *timedata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
-
- if (st->substate->inverse == 0) {
- speex_fatal ("kiss fft usage error: improper alloc\n");
- }
-
- ncfft = st->substate->nfft;
-
- st->tmpbuf[0].r = freqdata[0] + freqdata[2*ncfft-1];
- st->tmpbuf[0].i = freqdata[0] - freqdata[2*ncfft-1];
- /*C_FIXDIV(st->tmpbuf[0],2);*/
-
- for (k = 1; k <= ncfft / 2; ++k) {
- kiss_fft_cpx fk, fnkc, fek, fok, tmp;
- fk.r = freqdata[2*k-1];
- fk.i = freqdata[2*k];
- fnkc.r = freqdata[2*(ncfft - k)-1];
- fnkc.i = -freqdata[2*(ncfft - k)];
- /*C_FIXDIV( fk , 2 );
- C_FIXDIV( fnkc , 2 );*/
-
- C_ADD (fek, fk, fnkc);
- C_SUB (tmp, fk, fnkc);
- C_MUL (fok, tmp, st->super_twiddles[k]);
- C_ADD (st->tmpbuf[k], fek, fok);
- C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
- st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
-#else
- st->tmpbuf[ncfft - k].i *= -1;
-#endif
- }
- kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata);
-}
diff --git a/drivers/speex/kiss_fftr.h b/drivers/speex/kiss_fftr.h
deleted file mode 100644
index 7bfb42334..000000000
--- a/drivers/speex/kiss_fftr.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef KISS_FTR_H
-#define KISS_FTR_H
-
-#include "kiss_fft.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-
- Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
-
-
-
- */
-
-typedef struct kiss_fftr_state *kiss_fftr_cfg;
-
-
-kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
-/*
- nfft must be even
-
- If you don't care to allocate space, use mem = lenmem = NULL
-*/
-
-
-void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata);
-/*
- input timedata has nfft scalar points
- output freqdata has nfft/2+1 complex points
-*/
-
-void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata);
-
-void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata);
-
-void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata, kiss_fft_scalar *timedata);
-
-/*
- input freqdata has nfft/2+1 complex points
- output timedata has nfft scalar points
-*/
-
-#define kiss_fftr_free speex_free
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/drivers/speex/lpc.c b/drivers/speex/lpc.c
deleted file mode 100644
index 6304efaa5..000000000
--- a/drivers/speex/lpc.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
- Technische Universitaet Berlin
-
- Any use of this software is permitted provided that this notice is not
- removed and that neither the authors nor the Technische Universitaet Berlin
- are deemed to have made any representations as to the suitability of this
- software for any purpose nor are held responsible for any defects of
- this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
-
- As a matter of courtesy, the authors request to be informed about uses
- this software has found, about bugs in this software, and about any
- improvements that may be of general interest.
-
- Berlin, 28.11.1994
- Jutta Degener
- Carsten Bormann
-
-
- Code modified by Jean-Marc Valin
-
- Speex License:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include "lpc.h"
-
-#ifdef BFIN_ASM
-#include "lpc_bfin.h"
-#endif
-
-/* LPC analysis
- *
- * The next two functions calculate linear prediction coefficients
- * and/or the related reflection coefficients from the first P_MAX+1
- * values of the autocorrelation function.
- */
-
-/* Invented by N. Levinson in 1947, modified by J. Durbin in 1959.
- */
-
-/* returns minimum mean square error */
-spx_word32_t _spx_lpc(
-spx_coef_t *lpc, /* out: [0...p-1] LPC coefficients */
-const spx_word16_t *ac, /* in: [0...p] autocorrelation values */
-int p
-)
-{
- int i, j;
- spx_word16_t r;
- spx_word16_t error = ac[0];
-
- if (ac[0] == 0)
- {
- for (i = 0; i < p; i++)
- lpc[i] = 0;
- return 0;
- }
-
- for (i = 0; i < p; i++) {
-
- /* Sum up this iteration's reflection coefficient */
- spx_word32_t rr = NEG32(SHL32(EXTEND32(ac[i + 1]),13));
- for (j = 0; j < i; j++)
- rr = SUB32(rr,MULT16_16(lpc[j],ac[i - j]));
-#ifdef FIXED_POINT
- r = DIV32_16(rr+PSHR32(error,1),ADD16(error,8));
-#else
- r = rr/(error+.003*ac[0]);
-#endif
- /* Update LPC coefficients and total error */
- lpc[i] = r;
- for (j = 0; j < i>>1; j++)
- {
- spx_word16_t tmp = lpc[j];
- lpc[j] = MAC16_16_P13(lpc[j],r,lpc[i-1-j]);
- lpc[i-1-j] = MAC16_16_P13(lpc[i-1-j],r,tmp);
- }
- if (i & 1)
- lpc[j] = MAC16_16_P13(lpc[j],lpc[j],r);
-
- error = SUB16(error,MULT16_16_Q13(r,MULT16_16_Q13(error,r)));
- }
- return error;
-}
-
-
-#ifdef FIXED_POINT
-
-/* Compute the autocorrelation
- * ,--,
- * ac(i) = > x(n) * x(n-i) for all n
- * `--'
- * for lags between 0 and lag-1, and x == 0 outside 0...n-1
- */
-
-#ifndef OVERRIDE_SPEEX_AUTOCORR
-void _spx_autocorr(
-const spx_word16_t *x, /* in: [0...n-1] samples x */
-spx_word16_t *ac, /* out: [0...lag-1] ac values */
-int lag,
-int n
-)
-{
- spx_word32_t d;
- int i, j;
- spx_word32_t ac0=1;
- int shift, ac_shift;
-
- for (j=0;j<n;j++)
- ac0 = ADD32(ac0,SHR32(MULT16_16(x[j],x[j]),8));
- ac0 = ADD32(ac0,n);
- shift = 8;
- while (shift && ac0<0x40000000)
- {
- shift--;
- ac0 <<= 1;
- }
- ac_shift = 18;
- while (ac_shift && ac0<0x40000000)
- {
- ac_shift--;
- ac0 <<= 1;
- }
-
-
- for (i=0;i<lag;i++)
- {
- d=0;
- for (j=i;j<n;j++)
- {
- d = ADD32(d,SHR32(MULT16_16(x[j],x[j-i]), shift));
- }
-
- ac[i] = SHR32(d, ac_shift);
- }
-}
-#endif
-
-
-#else
-
-
-
-/* Compute the autocorrelation
- * ,--,
- * ac(i) = > x(n) * x(n-i) for all n
- * `--'
- * for lags between 0 and lag-1, and x == 0 outside 0...n-1
- */
-void _spx_autocorr(
-const spx_word16_t *x, /* in: [0...n-1] samples x */
-float *ac, /* out: [0...lag-1] ac values */
-int lag,
-int n
-)
-{
- float d;
- int i;
- while (lag--)
- {
- for (i = lag, d = 0; i < n; i++)
- d += x[i] * x[i-lag];
- ac[lag] = d;
- }
- ac[0] += 10;
-}
-
-#endif
-
-
diff --git a/drivers/speex/lpc_bfin.h b/drivers/speex/lpc_bfin.h
deleted file mode 100644
index 7310ffba5..000000000
--- a/drivers/speex/lpc_bfin.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Copyright (C) 2005 Analog Devices */
-/**
- @file lpc_bfin.h
- @author Jean-Marc Valin
- @brief Functions for LPC (Linear Prediction Coefficients) analysis (Blackfin version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_SPEEX_AUTOCORR
-void _spx_autocorr(
-const spx_word16_t *x, /* in: [0...n-1] samples x */
-spx_word16_t *ac, /* out: [0...lag-1] ac values */
-int lag,
-int n
- )
-{
- spx_word32_t d;
- const spx_word16_t *xs;
- int i, j;
- spx_word32_t ac0=1;
- spx_word32_t ac32[11], *ac32top;
- int shift, ac_shift;
- ac32top = ac32+lag-1;
- int lag_1, N_lag;
- int nshift;
- lag_1 = lag-1;
- N_lag = n-lag_1;
- for (j=0;j<n;j++)
- ac0 = ADD32(ac0,SHR32(MULT16_16(x[j],x[j]),8));
- ac0 = ADD32(ac0,n);
- shift = 8;
- while (shift && ac0<0x40000000)
- {
- shift--;
- ac0 <<= 1;
- }
- ac_shift = 18;
- while (ac_shift && ac0<0x40000000)
- {
- ac_shift--;
- ac0 <<= 1;
- }
-
- xs = x+lag-1;
- nshift = -shift;
- __asm__ __volatile__
- (
- "P2 = %0;\n\t"
- "I0 = P2;\n\t" /* x in I0 */
- "B0 = P2;\n\t" /* x in B0 */
- "R0 = %3;\n\t" /* len in R0 */
- "P3 = %3;\n\t" /* len in R0 */
- "P4 = %4;\n\t" /* nb_pitch in R0 */
- "R1 = R0 << 1;\n\t" /* number of bytes in x */
- "L0 = R1;\n\t"
- "P0 = %1;\n\t"
- "P1 = %2;\n\t"
- "B1 = P1;\n\t"
- "R4 = %5;\n\t"
- "L1 = 0;\n\t" /*Disable looping on I1*/
-
- "r0 = [I0++];\n\t"
- "R2 = 0;R3=0;"
- "LOOP pitch%= LC0 = P4 >> 1;\n\t"
- "LOOP_BEGIN pitch%=;\n\t"
- "I1 = P0;\n\t"
- "A1 = A0 = 0;\n\t"
- "R1 = [I1++];\n\t"
- "LOOP inner_prod%= LC1 = P3 >> 1;\n\t"
- "LOOP_BEGIN inner_prod%=;\n\t"
- "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t"
- "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R1.H = W[I1++] || R0 = [I0++];\n\t"
- "LOOP_END inner_prod%=;\n\t"
- "A0 = ASHIFT A0 by R4.L;\n\t"
- "A1 = ASHIFT A1 by R4.L;\n\t"
-
- "R2 = A0, R3 = A1;\n\t"
- "[P1--] = R2;\n\t"
- "[P1--] = R3;\n\t"
- "P0 += 4;\n\t"
- "LOOP_END pitch%=;\n\t"
- : : "m" (xs), "m" (x), "m" (ac32top), "m" (N_lag), "m" (lag_1), "m" (nshift)
- : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "R3", "R4", "I0", "I1", "L0", "L1", "B0", "B1", "memory"
- );
- d=0;
- for (j=0;j<n;j++)
- {
- d = ADD32(d,SHR32(MULT16_16(x[j],x[j]), shift));
- }
- ac32[0] = d;
-
- for (i=0;i<lag;i++)
- {
- d=0;
- for (j=i;j<lag_1;j++)
- {
- d = ADD32(d,SHR32(MULT16_16(x[j],x[j-i]), shift));
- }
- if (i)
- ac32[i] += d;
- ac[i] = SHR32(ac32[i], ac_shift);
- }
-}
-
diff --git a/drivers/speex/lsp.c b/drivers/speex/lsp.c
deleted file mode 100644
index f62323a59..000000000
--- a/drivers/speex/lsp.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*---------------------------------------------------------------------------*\
-Original copyright
- FILE........: lsp.c
- AUTHOR......: David Rowe
- DATE CREATED: 24/2/93
-
-Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point,
- optimizations, additional functions, ...)
-
- This file contains functions for converting Linear Prediction
- Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the
- LSP coefficients are not in radians format but in the x domain of the
- unit circle.
-
- Speex License:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*---------------------------------------------------------------------------*\
-
- Introduction to Line Spectrum Pairs (LSPs)
- ------------------------------------------
-
- LSPs are used to encode the LPC filter coefficients {ak} for
- transmission over the channel. LSPs have several properties (like
- less sensitivity to quantisation noise) that make them superior to
- direct quantisation of {ak}.
-
- A(z) is a polynomial of order lpcrdr with {ak} as the coefficients.
-
- A(z) is transformed to P(z) and Q(z) (using a substitution and some
- algebra), to obtain something like:
-
- A(z) = 0.5[P(z)(z+z^-1) + Q(z)(z-z^-1)] (1)
-
- As you can imagine A(z) has complex zeros all over the z-plane. P(z)
- and Q(z) have the very neat property of only having zeros _on_ the
- unit circle. So to find them we take a test point z=exp(jw) and
- evaluate P (exp(jw)) and Q(exp(jw)) using a grid of points between 0
- and pi.
-
- The zeros (roots) of P(z) also happen to alternate, which is why we
- swap coefficients as we find roots. So the process of finding the
- LSP frequencies is basically finding the roots of 5th order
- polynomials.
-
- The root so P(z) and Q(z) occur in symmetrical pairs at +/-w, hence
- the name Line Spectrum Pairs (LSPs).
-
- To convert back to ak we just evaluate (1), "clocking" an impulse
- thru it lpcrdr times gives us the impulse response of A(z) which is
- {ak}.
-
-\*---------------------------------------------------------------------------*/
-
-
-#include "config.h"
-
-
-#include <math.h>
-#include "lsp.h"
-#include "stack_alloc.h"
-#include "math_approx.h"
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef FIXED_POINT
-
-#define FREQ_SCALE 16384
-
-/*#define ANGLE2X(a) (32768*cos(((a)/8192.)))*/
-#define ANGLE2X(a) (SHL16(spx_cos(a),2))
-
-/*#define X2ANGLE(x) (acos(.00006103515625*(x))*LSP_SCALING)*/
-#define X2ANGLE(x) (spx_acos(x))
-
-#ifdef BFIN_ASM
-#include "lsp_bfin.h"
-#endif
-
-#else
-
-/*#define C1 0.99940307
-#define C2 -0.49558072
-#define C3 0.03679168*/
-
-#define FREQ_SCALE 1.
-#define ANGLE2X(a) (spx_cos(a))
-#define X2ANGLE(x) (acos(x))
-
-#endif
-
-
-/*---------------------------------------------------------------------------*\
-
- FUNCTION....: cheb_poly_eva()
-
- AUTHOR......: David Rowe
- DATE CREATED: 24/2/93
-
- This function evaluates a series of Chebyshev polynomials
-
-\*---------------------------------------------------------------------------*/
-
-#ifdef FIXED_POINT
-
-#ifndef OVERRIDE_CHEB_POLY_EVA
-static inline spx_word32_t cheb_poly_eva(
- spx_word16_t *coef, /* P or Q coefs in Q13 format */
- spx_word16_t x, /* cos of freq (-1.0 to 1.0) in Q14 format */
- int m, /* LPC order/2 */
- char *stack
-)
-{
- int i;
- spx_word16_t b0, b1;
- spx_word32_t sum;
-
- /*Prevents overflows*/
- if (x>16383)
- x = 16383;
- if (x<-16383)
- x = -16383;
-
- /* Initialise values */
- b1=16384;
- b0=x;
-
- /* Evaluate Chebyshev series formulation usin g iterative approach */
- sum = ADD32(EXTEND32(coef[m]), EXTEND32(MULT16_16_P14(coef[m-1],x)));
- for(i=2;i<=m;i++)
- {
- spx_word16_t tmp=b0;
- b0 = SUB16(MULT16_16_Q13(x,b0), b1);
- b1 = tmp;
- sum = ADD32(sum, EXTEND32(MULT16_16_P14(coef[m-i],b0)));
- }
-
- return sum;
-}
-#endif
-
-#else
-
-static float cheb_poly_eva(spx_word32_t *coef, spx_word16_t x, int m, char *stack)
-{
- int k;
- float b0, b1, tmp;
-
- /* Initial conditions */
- b0=0; /* b_(m+1) */
- b1=0; /* b_(m+2) */
-
- x*=2;
-
- /* Calculate the b_(k) */
- for(k=m;k>0;k--)
- {
- tmp=b0; /* tmp holds the previous value of b0 */
- b0=x*b0-b1+coef[m-k]; /* b0 holds its new value based on b0 and b1 */
- b1=tmp; /* b1 holds the previous value of b0 */
- }
-
- return(-b1+.5*x*b0+coef[m]);
-}
-#endif
-
-/*---------------------------------------------------------------------------*\
-
- FUNCTION....: lpc_to_lsp()
-
- AUTHOR......: David Rowe
- DATE CREATED: 24/2/93
-
- This function converts LPC coefficients to LSP
- coefficients.
-
-\*---------------------------------------------------------------------------*/
-
-#ifdef FIXED_POINT
-#define SIGN_CHANGE(a,b) (((a)&0x70000000)^((b)&0x70000000)||(b==0))
-#else
-#define SIGN_CHANGE(a,b) (((a)*(b))<0.0)
-#endif
-
-
-int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t delta, char *stack)
-/* float *a lpc coefficients */
-/* int lpcrdr order of LPC coefficients (10) */
-/* float *freq LSP frequencies in the x domain */
-/* int nb number of sub-intervals (4) */
-/* float delta grid spacing interval (0.02) */
-
-
-{
- spx_word16_t temp_xr,xl,xr,xm=0;
- spx_word32_t psuml,psumr,psumm,temp_psumr/*,temp_qsumr*/;
- int i,j,m,flag,k;
- VARDECL(spx_word32_t *Q); /* ptrs for memory allocation */
- VARDECL(spx_word32_t *P);
- VARDECL(spx_word16_t *Q16); /* ptrs for memory allocation */
- VARDECL(spx_word16_t *P16);
- spx_word32_t *px; /* ptrs of respective P'(z) & Q'(z) */
- spx_word32_t *qx;
- spx_word32_t *p;
- spx_word32_t *q;
- spx_word16_t *pt; /* ptr used for cheb_poly_eval()
- whether P' or Q' */
- int roots=0; /* DR 8/2/94: number of roots found */
- flag = 1; /* program is searching for a root when,
- 1 else has found one */
- m = lpcrdr/2; /* order of P'(z) & Q'(z) polynomials */
-
- /* Allocate memory space for polynomials */
- ALLOC(Q, (m+1), spx_word32_t);
- ALLOC(P, (m+1), spx_word32_t);
-
- /* determine P'(z)'s and Q'(z)'s coefficients where
- P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */
-
- px = P; /* initialise ptrs */
- qx = Q;
- p = px;
- q = qx;
-
-#ifdef FIXED_POINT
- *px++ = LPC_SCALING;
- *qx++ = LPC_SCALING;
- for(i=0;i<m;i++){
- *px++ = SUB32(ADD32(EXTEND32(a[i]),EXTEND32(a[lpcrdr-i-1])), *p++);
- *qx++ = ADD32(SUB32(EXTEND32(a[i]),EXTEND32(a[lpcrdr-i-1])), *q++);
- }
- px = P;
- qx = Q;
- for(i=0;i<m;i++)
- {
- /*if (fabs(*px)>=32768)
- speex_warning_int("px", *px);
- if (fabs(*qx)>=32768)
- speex_warning_int("qx", *qx);*/
- *px = PSHR32(*px,2);
- *qx = PSHR32(*qx,2);
- px++;
- qx++;
- }
- /* The reason for this lies in the way cheb_poly_eva() is implemented for fixed-point */
- P[m] = PSHR32(P[m],3);
- Q[m] = PSHR32(Q[m],3);
-#else
- *px++ = LPC_SCALING;
- *qx++ = LPC_SCALING;
- for(i=0;i<m;i++){
- *px++ = (a[i]+a[lpcrdr-1-i]) - *p++;
- *qx++ = (a[i]-a[lpcrdr-1-i]) + *q++;
- }
- px = P;
- qx = Q;
- for(i=0;i<m;i++){
- *px = 2**px;
- *qx = 2**qx;
- px++;
- qx++;
- }
-#endif
-
- px = P; /* re-initialise ptrs */
- qx = Q;
-
- /* now that we have computed P and Q convert to 16 bits to
- speed up cheb_poly_eval */
-
- ALLOC(P16, m+1, spx_word16_t);
- ALLOC(Q16, m+1, spx_word16_t);
-
- for (i=0;i<m+1;i++)
- {
- P16[i] = P[i];
- Q16[i] = Q[i];
- }
-
- /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z).
- Keep alternating between the two polynomials as each zero is found */
-
- xr = 0; /* initialise xr to zero */
- xl = FREQ_SCALE; /* start at point xl = 1 */
-
- for(j=0;j<lpcrdr;j++){
- if(j&1) /* determines whether P' or Q' is eval. */
- pt = Q16;
- else
- pt = P16;
-
- psuml = cheb_poly_eva(pt,xl,m,stack); /* evals poly. at xl */
- flag = 1;
- while(flag && (xr >= -FREQ_SCALE)){
- spx_word16_t dd;
- /* Modified by JMV to provide smaller steps around x=+-1 */
-#ifdef FIXED_POINT
- dd = MULT16_16_Q15(delta,SUB16(FREQ_SCALE, MULT16_16_Q14(MULT16_16_Q14(xl,xl),14000)));
- if (psuml<512 && psuml>-512)
- dd = PSHR16(dd,1);
-#else
- dd=delta*(1-.9*xl*xl);
- if (fabs(psuml)<.2)
- dd *= .5;
-#endif
- xr = SUB16(xl, dd); /* interval spacing */
- psumr = cheb_poly_eva(pt,xr,m,stack);/* poly(xl-delta_x) */
- temp_psumr = psumr;
- temp_xr = xr;
-
- /* if no sign change increment xr and re-evaluate poly(xr). Repeat til
- sign change.
- if a sign change has occurred the interval is bisected and then
- checked again for a sign change which determines in which
- interval the zero lies in.
- If there is no sign change between poly(xm) and poly(xl) set interval
- between xm and xr else set interval between xl and xr and repeat till
- root is located within the specified limits */
-
- if(SIGN_CHANGE(psumr,psuml))
- {
- roots++;
-
- psumm=psuml;
- for(k=0;k<=nb;k++){
-#ifdef FIXED_POINT
- xm = ADD16(PSHR16(xl,1),PSHR16(xr,1)); /* bisect the interval */
-#else
- xm = .5*(xl+xr); /* bisect the interval */
-#endif
- psumm=cheb_poly_eva(pt,xm,m,stack);
- /*if(psumm*psuml>0.)*/
- if(!SIGN_CHANGE(psumm,psuml))
- {
- psuml=psumm;
- xl=xm;
- } else {
- psumr=psumm;
- xr=xm;
- }
- }
-
- /* once zero is found, reset initial interval to xr */
- freq[j] = X2ANGLE(xm);
- xl = xm;
- flag = 0; /* reset flag for next search */
- }
- else{
- psuml=temp_psumr;
- xl=temp_xr;
- }
- }
- }
- return(roots);
-}
-
-/*---------------------------------------------------------------------------*\
-
- FUNCTION....: lsp_to_lpc()
-
- AUTHOR......: David Rowe
- DATE CREATED: 24/2/93
-
- Converts LSP coefficients to LPC coefficients.
-
-\*---------------------------------------------------------------------------*/
-
-#ifdef FIXED_POINT
-
-void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
-/* float *freq array of LSP frequencies in the x domain */
-/* float *ak array of LPC coefficients */
-/* int lpcrdr order of LPC coefficients */
-{
- int i,j;
- spx_word32_t xout1,xout2,xin;
- spx_word32_t mult, a;
- VARDECL(spx_word16_t *freqn);
- VARDECL(spx_word32_t **xp);
- VARDECL(spx_word32_t *xpmem);
- VARDECL(spx_word32_t **xq);
- VARDECL(spx_word32_t *xqmem);
- int m = lpcrdr>>1;
-
- /*
-
- Reconstruct P(z) and Q(z) by cascading second order polynomials
- in form 1 - 2cos(w)z(-1) + z(-2), where w is the LSP frequency.
- In the time domain this is:
-
- y(n) = x(n) - 2cos(w)x(n-1) + x(n-2)
-
- This is what the ALLOCS below are trying to do:
-
- int xp[m+1][lpcrdr+1+2]; // P matrix in QIMP
- int xq[m+1][lpcrdr+1+2]; // Q matrix in QIMP
-
- These matrices store the output of each stage on each row. The
- final (m-th) row has the output of the final (m-th) cascaded
- 2nd order filter. The first row is the impulse input to the
- system (not written as it is known).
-
- The version below takes advantage of the fact that a lot of the
- outputs are zero or known, for example if we put an inpulse
- into the first section the "clock" it 10 times only the first 3
- outputs samples are non-zero (it's an FIR filter).
- */
-
- ALLOC(xp, (m+1), spx_word32_t*);
- ALLOC(xpmem, (m+1)*(lpcrdr+1+2), spx_word32_t);
-
- ALLOC(xq, (m+1), spx_word32_t*);
- ALLOC(xqmem, (m+1)*(lpcrdr+1+2), spx_word32_t);
-
- for(i=0; i<=m; i++) {
- xp[i] = xpmem + i*(lpcrdr+1+2);
- xq[i] = xqmem + i*(lpcrdr+1+2);
- }
-
- /* work out 2cos terms in Q14 */
-
- ALLOC(freqn, lpcrdr, spx_word16_t);
- for (i=0;i<lpcrdr;i++)
- freqn[i] = ANGLE2X(freq[i]);
-
- #define QIMP 21 /* scaling for impulse */
-
- xin = SHL32(EXTEND32(1), (QIMP-1)); /* 0.5 in QIMP format */
-
- /* first col and last non-zero values of each row are trivial */
-
- for(i=0;i<=m;i++) {
- xp[i][1] = 0;
- xp[i][2] = xin;
- xp[i][2+2*i] = xin;
- xq[i][1] = 0;
- xq[i][2] = xin;
- xq[i][2+2*i] = xin;
- }
-
- /* 2nd row (first output row) is trivial */
-
- xp[1][3] = -MULT16_32_Q14(freqn[0],xp[0][2]);
- xq[1][3] = -MULT16_32_Q14(freqn[1],xq[0][2]);
-
- xout1 = xout2 = 0;
-
- /* now generate remaining rows */
-
- for(i=1;i<m;i++) {
-
- for(j=1;j<2*(i+1)-1;j++) {
- mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]);
- xp[i+1][j+2] = ADD32(SUB32(xp[i][j+2], mult), xp[i][j]);
- mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]);
- xq[i+1][j+2] = ADD32(SUB32(xq[i][j+2], mult), xq[i][j]);
- }
-
- /* for last col xp[i][j+2] = xq[i][j+2] = 0 */
-
- mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]);
- xp[i+1][j+2] = SUB32(xp[i][j], mult);
- mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]);
- xq[i+1][j+2] = SUB32(xq[i][j], mult);
- }
-
- /* process last row to extra a{k} */
-
- for(j=1;j<=lpcrdr;j++) {
- int shift = QIMP-13;
-
- /* final filter sections */
- a = PSHR32(xp[m][j+2] + xout1 + xq[m][j+2] - xout2, shift);
- xout1 = xp[m][j+2];
- xout2 = xq[m][j+2];
-
- /* hard limit ak's to +/- 32767 */
-
- if (a < -32767) a = -32767;
- if (a > 32767) a = 32767;
- ak[j-1] = (short)a;
-
- }
-
-}
-
-#else
-
-void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
-/* float *freq array of LSP frequencies in the x domain */
-/* float *ak array of LPC coefficients */
-/* int lpcrdr order of LPC coefficients */
-
-
-{
- int i,j;
- float xout1,xout2,xin1,xin2;
- VARDECL(float *Wp);
- float *pw,*n1,*n2,*n3,*n4=NULL;
- VARDECL(float *x_freq);
- int m = lpcrdr>>1;
-
- ALLOC(Wp, 4*m+2, float);
- pw = Wp;
-
- /* initialise contents of array */
-
- for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */
- *pw++ = 0.0;
- }
-
- /* Set pointers up */
-
- pw = Wp;
- xin1 = 1.0;
- xin2 = 1.0;
-
- ALLOC(x_freq, lpcrdr, float);
- for (i=0;i<lpcrdr;i++)
- x_freq[i] = ANGLE2X(freq[i]);
-
- /* reconstruct P(z) and Q(z) by cascading second order
- polynomials in form 1 - 2xz(-1) +z(-2), where x is the
- LSP coefficient */
-
- for(j=0;j<=lpcrdr;j++){
- int i2=0;
- for(i=0;i<m;i++,i2+=2){
- n1 = pw+(i*4);
- n2 = n1 + 1;
- n3 = n2 + 1;
- n4 = n3 + 1;
- xout1 = xin1 - 2.f*x_freq[i2] * *n1 + *n2;
- xout2 = xin2 - 2.f*x_freq[i2+1] * *n3 + *n4;
- *n2 = *n1;
- *n4 = *n3;
- *n1 = xin1;
- *n3 = xin2;
- xin1 = xout1;
- xin2 = xout2;
- }
- xout1 = xin1 + *(n4+1);
- xout2 = xin2 - *(n4+2);
- if (j>0)
- ak[j-1] = (xout1 + xout2)*0.5f;
- *(n4+1) = xin1;
- *(n4+2) = xin2;
-
- xin1 = 0.0;
- xin2 = 0.0;
- }
-
-}
-#endif
-
-
-#ifdef FIXED_POINT
-
-/*Makes sure the LSPs are stable*/
-void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin)
-{
- int i;
- spx_word16_t m = margin;
- spx_word16_t m2 = 25736-margin;
-
- if (lsp[0]<m)
- lsp[0]=m;
- if (lsp[len-1]>m2)
- lsp[len-1]=m2;
- for (i=1;i<len-1;i++)
- {
- if (lsp[i]<lsp[i-1]+m)
- lsp[i]=lsp[i-1]+m;
-
- if (lsp[i]>lsp[i+1]-m)
- lsp[i]= SHR16(lsp[i],1) + SHR16(lsp[i+1]-m,1);
- }
-}
-
-
-void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes)
-{
- int i;
- spx_word16_t tmp = DIV32_16(SHL32(EXTEND32(1 + subframe),14),nb_subframes);
- spx_word16_t tmp2 = 16384-tmp;
- for (i=0;i<len;i++)
- {
- interp_lsp[i] = MULT16_16_P14(tmp2,old_lsp[i]) + MULT16_16_P14(tmp,new_lsp[i]);
- }
-}
-
-#else
-
-/*Makes sure the LSPs are stable*/
-void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin)
-{
- int i;
- if (lsp[0]<LSP_SCALING*margin)
- lsp[0]=LSP_SCALING*margin;
- if (lsp[len-1]>LSP_SCALING*(M_PI-margin))
- lsp[len-1]=LSP_SCALING*(M_PI-margin);
- for (i=1;i<len-1;i++)
- {
- if (lsp[i]<lsp[i-1]+LSP_SCALING*margin)
- lsp[i]=lsp[i-1]+LSP_SCALING*margin;
-
- if (lsp[i]>lsp[i+1]-LSP_SCALING*margin)
- lsp[i]= .5f* (lsp[i] + lsp[i+1]-LSP_SCALING*margin);
- }
-}
-
-
-void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes)
-{
- int i;
- float tmp = (1.0f + subframe)/nb_subframes;
- for (i=0;i<len;i++)
- {
- interp_lsp[i] = (1-tmp)*old_lsp[i] + tmp*new_lsp[i];
- }
-}
-
-#endif
diff --git a/drivers/speex/lsp.h b/drivers/speex/lsp.h
deleted file mode 100644
index b55bd42f2..000000000
--- a/drivers/speex/lsp.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*---------------------------------------------------------------------------*\
-Original Copyright
- FILE........: AK2LSPD.H
- TYPE........: Turbo C header file
- COMPANY.....: Voicetronix
- AUTHOR......: James Whitehall
- DATE CREATED: 21/11/95
-
-Modified by Jean-Marc Valin
-
- This file contains functions for converting Linear Prediction
- Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the
- LSP coefficients are not in radians format but in the x domain of the
- unit circle.
-
-\*---------------------------------------------------------------------------*/
-/**
- @file lsp.h
- @brief Line Spectral Pair (LSP) functions.
-*/
-/* Speex License:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __AK2LSPD__
-#define __AK2LSPD__
-
-#include "arch.h"
-
-int lpc_to_lsp (spx_coef_t *a, int lpcrdr, spx_lsp_t *freq, int nb, spx_word16_t delta, char *stack);
-void lsp_to_lpc(spx_lsp_t *freq, spx_coef_t *ak, int lpcrdr, char *stack);
-
-/*Added by JMV*/
-void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin);
-
-void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes);
-
-#endif /* __AK2LSPD__ */
diff --git a/drivers/speex/lsp_bfin.h b/drivers/speex/lsp_bfin.h
deleted file mode 100644
index 20e505287..000000000
--- a/drivers/speex/lsp_bfin.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (C) 2006 David Rowe */
-/**
- @file lsp_bfin.h
- @author David Rowe
- @brief LSP routines optimised for the Blackfin
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_CHEB_POLY_EVA
-#ifdef OVERRIDE_CHEB_POLY_EVA
-static inline spx_word32_t cheb_poly_eva(
- spx_word16_t *coef, /* P or Q coefs in Q13 format */
- spx_word16_t x, /* cos of freq (-1.0 to 1.0) in Q14 format */
- int m, /* LPC order/2 */
- char *stack
-)
-{
- spx_word32_t sum;
-
- __asm__ __volatile__
- (
- "P0 = %2;\n\t" /* P0: coef[m], coef[m-1],..., coef[0] */
- "R4 = 8192;\n\t" /* R4: rounding constant */
- "R2 = %1;\n\t" /* R2: x */
-
- "R5 = -16383;\n\t"
- "R2 = MAX(R2,R5);\n\t"
- "R5 = 16383;\n\t"
- "R2 = MIN(R2,R5);\n\t"
-
- "R3 = W[P0--] (X);\n\t" /* R3: sum */
- "R5 = W[P0--] (X);\n\t"
- "R5 = R5.L * R2.L (IS);\n\t"
- "R5 = R5 + R4;\n\t"
- "R5 >>>= 14;\n\t"
- "R3 = R3 + R5;\n\t"
-
- "R0 = R2;\n\t" /* R0: b0 */
- "R1 = 16384;\n\t" /* R1: b1 */
- "LOOP cpe%= LC0 = %3;\n\t"
- "LOOP_BEGIN cpe%=;\n\t"
- "P1 = R0;\n\t"
- "R0 = R2.L * R0.L (IS) || R5 = W[P0--] (X);\n\t"
- "R0 >>>= 13;\n\t"
- "R0 = R0 - R1;\n\t"
- "R1 = P1;\n\t"
- "R5 = R5.L * R0.L (IS);\n\t"
- "R5 = R5 + R4;\n\t"
- "R5 >>>= 14;\n\t"
- "R3 = R3 + R5;\n\t"
- "LOOP_END cpe%=;\n\t"
- "%0 = R3;\n\t"
- : "=&d" (sum)
- : "a" (x), "a" (&coef[m]), "a" (m-1)
- : "R0", "R1", "R3", "R2", "R4", "R5", "P0", "P1"
- );
- return sum;
-}
-#endif
-
-
-
diff --git a/drivers/speex/lsp_tables_nb.c b/drivers/speex/lsp_tables_nb.c
deleted file mode 100644
index 16f2e1b64..000000000
--- a/drivers/speex/lsp_tables_nb.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: lsp_tables_nb.c
- Codebooks for LSPs in narrowband CELP mode
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-const signed char cdbk_nb[640]={
-30,19,38,34,40,32,46,43,58,43,
-5,-18,-25,-40,-33,-55,-52,20,34,28,
--20,-63,-97,-92,61,53,47,49,53,75,
--14,-53,-77,-79,0,-3,-5,19,22,26,
--9,-53,-55,66,90,72,85,68,74,52,
--4,-41,-58,-31,-18,-31,27,32,30,18,
-24,3,8,5,-12,-3,26,28,74,63,
--2,-39,-67,-77,-106,-74,59,59,73,65,
-44,40,71,72,82,83,98,88,89,60,
--6,-31,-47,-48,-13,-39,-9,7,2,79,
--1,-39,-60,-17,87,81,65,50,45,19,
--21,-67,-91,-87,-41,-50,7,18,39,74,
-10,-31,-28,39,24,13,23,5,56,45,
-29,10,-5,-13,-11,-35,-18,-8,-10,-8,
--25,-71,-77,-21,2,16,50,63,87,87,
-5,-32,-40,-51,-68,0,12,6,54,34,
-5,-12,32,52,68,64,69,59,65,45,
-14,-16,-31,-40,-65,-67,41,49,47,37,
--11,-52,-75,-84,-4,57,48,42,42,33,
--11,-51,-68,-6,13,0,8,-8,26,32,
--23,-53,0,36,56,76,97,105,111,97,
--1,-28,-39,-40,-43,-54,-44,-40,-18,35,
-16,-20,-19,-28,-42,29,47,38,74,45,
-3,-29,-48,-62,-80,-104,-33,56,59,59,
-10,17,46,72,84,101,117,123,123,106,
--7,-33,-49,-51,-70,-67,-27,-31,70,67,
--16,-62,-85,-20,82,71,86,80,85,74,
--19,-58,-75,-45,-29,-33,-18,-25,45,57,
--12,-42,-5,12,28,36,52,64,81,82,
-13,-9,-27,-28,22,3,2,22,26,6,
--6,-44,-51,2,15,10,48,43,49,34,
--19,-62,-84,-89,-102,-24,8,17,61,68,
-39,24,23,19,16,-5,12,15,27,15,
--8,-44,-49,-60,-18,-32,-28,52,54,62,
--8,-48,-77,-70,66,101,83,63,61,37,
--12,-50,-75,-64,33,17,13,25,15,77,
-1,-42,-29,72,64,46,49,31,61,44,
--8,-47,-54,-46,-30,19,20,-1,-16,0,
-16,-12,-18,-9,-26,-27,-10,-22,53,45,
--10,-47,-75,-82,-105,-109,8,25,49,77,
-50,65,114,117,124,118,115,96,90,61,
--9,-45,-63,-60,-75,-57,8,11,20,29,
-0,-35,-49,-43,40,47,35,40,55,38,
--24,-76,-103,-112,-27,3,23,34,52,75,
-8,-29,-43,12,63,38,35,29,24,8,
-25,11,1,-15,-18,-43,-7,37,40,21,
--20,-56,-19,-19,-4,-2,11,29,51,63,
--2,-44,-62,-75,-89,30,57,51,74,51,
-50,46,68,64,65,52,63,55,65,43,
-18,-9,-26,-35,-55,-69,3,6,8,17,
--15,-61,-86,-97,1,86,93,74,78,67,
--1,-38,-66,-48,48,39,29,25,17,-1,
-13,13,29,39,50,51,69,82,97,98,
--2,-36,-46,-27,-16,-30,-13,-4,-7,-4,
-25,-5,-11,-6,-25,-21,33,12,31,29,
--8,-38,-52,-63,-68,-89,-33,-1,10,74,
--2,-15,59,91,105,105,101,87,84,62,
--7,-33,-50,-35,-54,-47,25,17,82,81,
--13,-56,-83,21,58,31,42,25,72,65,
--24,-66,-91,-56,9,-2,21,10,69,75,
-2,-24,11,22,25,28,38,34,48,33,
-7,-29,-26,17,15,-1,14,0,-2,0,
--6,-41,-67,6,-2,-9,19,2,85,74,
--22,-67,-84,-71,-50,3,11,-9,2,62};
-
-const signed char cdbk_nb_low1[320]={
--34,-52,-15,45,2,
-23,21,52,24,-33,
--9,-1,9,-44,-41,
--13,-17,44,22,-17,
--6,-4,-1,22,38,
-26,16,2,50,27,
--35,-34,-9,-41,6,
-0,-16,-34,51,8,
--14,-31,-49,15,-33,
-45,49,33,-11,-37,
--62,-54,45,11,-5,
--72,11,-1,-12,-11,
-24,27,-11,-43,46,
-43,33,-12,-9,-1,
-1,-4,-23,-57,-71,
-11,8,16,17,-8,
--20,-31,-41,53,48,
--16,3,65,-24,-8,
--23,-32,-37,-32,-49,
--10,-17,6,38,5,
--9,-17,-46,8,52,
-3,6,45,40,39,
--7,-6,-34,-74,31,
-8,1,-16,43,68,
--11,-19,-31,4,6,
-0,-6,-17,-16,-38,
--16,-30,2,9,-39,
--16,-1,43,-10,48,
-3,3,-16,-31,-3,
-62,68,43,13,3,
--10,8,20,-56,12,
-12,-2,-18,22,-15,
--40,-36,1,7,41,
-0,1,46,-6,-62,
--4,-12,-2,-11,-83,
--13,-2,91,33,-10,
-0,4,-11,-16,79,
-32,37,14,9,51,
--21,-28,-56,-34,0,
-21,9,-26,11,28,
--42,-54,-23,-2,-15,
-31,30,8,-39,-66,
--39,-36,31,-28,-40,
--46,35,40,22,24,
-33,48,23,-34,14,
-40,32,17,27,-3,
-25,26,-13,-61,-17,
-11,4,31,60,-6,
--26,-41,-64,13,16,
--26,54,31,-11,-23,
--9,-11,-34,-71,-21,
--34,-35,55,50,29,
--22,-27,-50,-38,57,
-33,42,57,48,26,
-11,0,-49,-31,26,
--4,-14,5,78,37,
-17,0,-49,-12,-23,
-26,14,2,2,-43,
--17,-12,10,-8,-4,
-8,18,12,-6,20,
--12,-6,-13,-25,34,
-15,40,49,7,8,
-13,20,20,-19,-22,
--2,-8,2,51,-51};
-
-const signed char cdbk_nb_low2[320]={
--6,53,-21,-24,4,
-26,17,-4,-37,25,
-17,-36,-13,31,3,
--6,27,15,-10,31,
-28,26,-10,-10,-40,
-16,-7,15,13,41,
--9,0,-4,50,-6,
--7,14,38,22,0,
--48,2,1,-13,-19,
-32,-3,-60,11,-17,
--1,-24,-34,-1,35,
--5,-27,28,44,13,
-25,15,42,-11,15,
-51,35,-36,20,8,
--4,-12,-29,19,-47,
-49,-15,-4,16,-29,
--39,14,-30,4,25,
--9,-5,-51,-14,-3,
--40,-32,38,5,-9,
--8,-4,-1,-22,71,
--3,14,26,-18,-22,
-24,-41,-25,-24,6,
-23,19,-10,39,-26,
--27,65,45,2,-7,
--26,-8,22,-12,16,
-15,16,-35,-5,33,
--21,-8,0,23,33,
-34,6,21,36,6,
--7,-22,8,-37,-14,
-31,38,11,-4,-3,
--39,-32,-8,32,-23,
--6,-12,16,20,-28,
--4,23,13,-52,-1,
-22,6,-33,-40,-6,
-4,-62,13,5,-26,
-35,39,11,2,57,
--11,9,-20,-28,-33,
-52,-5,-6,-2,22,
--14,-16,-48,35,1,
--58,20,13,33,-1,
--74,56,-18,-22,-31,
-12,6,-14,4,-2,
--9,-47,10,-3,29,
--17,-5,61,14,47,
--12,2,72,-39,-17,
-92,64,-53,-51,-15,
--30,-38,-41,-29,-28,
-27,9,36,9,-35,
--42,81,-21,20,25,
--16,-5,-17,-35,21,
-15,-28,48,2,-2,
-9,-19,29,-40,30,
--18,-18,18,-16,-57,
-15,-20,-12,-15,-37,
--15,33,-39,21,-22,
--13,35,11,13,-38,
--63,29,23,-27,32,
-18,3,-26,42,33,
--64,-66,-17,16,56,
-2,36,3,31,21,
--41,-39,8,-57,14,
-37,-2,19,-36,-19,
--23,-29,-16,1,-3,
--8,-10,31,64,-65};
-
-const signed char cdbk_nb_high1[320]={
--26,-8,29,21,4,
-19,-39,33,-7,-36,
-56,54,48,40,29,
--4,-24,-42,-66,-43,
--60,19,-2,37,41,
--10,-37,-60,-64,18,
--22,77,73,40,25,
-4,19,-19,-66,-2,
-11,5,21,14,26,
--25,-86,-4,18,1,
-26,-37,10,37,-1,
-24,-12,-59,-11,20,
--6,34,-16,-16,42,
-19,-28,-51,53,32,
-4,10,62,21,-12,
--34,27,4,-48,-48,
--50,-49,31,-7,-21,
--42,-25,-4,-43,-22,
-59,2,27,12,-9,
--6,-16,-8,-32,-58,
--16,-29,-5,41,23,
--30,-33,-46,-13,-10,
--38,52,52,1,-17,
--9,10,26,-25,-6,
-33,-20,53,55,25,
--32,-5,-42,23,21,
-66,5,-28,20,9,
-75,29,-7,-42,-39,
-15,3,-23,21,6,
-11,1,-29,14,63,
-10,54,26,-24,-51,
--49,7,-23,-51,15,
--66,1,60,25,10,
-0,-30,-4,-15,17,
-19,59,40,4,-5,
-33,6,-22,-58,-70,
--5,23,-6,60,44,
--29,-16,-47,-29,52,
--19,50,28,16,35,
-31,36,0,-21,6,
-21,27,22,42,7,
--66,-40,-8,7,19,
-46,0,-4,60,36,
-45,-7,-29,-6,-32,
--39,2,6,-9,33,
-20,-51,-34,18,-6,
-19,6,11,5,-19,
--29,-2,42,-11,-45,
--21,-55,57,37,2,
--14,-67,-16,-27,-38,
-69,48,19,2,-17,
-20,-20,-16,-34,-17,
--25,-61,10,73,45,
-16,-40,-64,-17,-29,
--22,56,17,-39,8,
--11,8,-25,-18,-13,
--19,8,54,57,36,
--17,-26,-4,6,-21,
-40,42,-4,20,31,
-53,10,-34,-53,31,
--17,35,0,15,-6,
--20,-63,-73,22,25,
-29,17,8,-29,-39,
--69,18,15,-15,-5};
-
-const signed char cdbk_nb_high2[320]={
-11,47,16,-9,-46,
--32,26,-64,34,-5,
-38,-7,47,20,2,
--73,-99,-3,-45,20,
-70,-52,15,-6,-7,
--82,31,21,47,51,
-39,-3,9,0,-41,
--7,-15,-54,2,0,
-27,-31,9,-45,-22,
--38,-24,-24,8,-33,
-23,5,50,-36,-17,
--18,-51,-2,13,19,
-43,12,-15,-12,61,
-38,38,7,13,0,
-6,-1,3,62,9,
-27,22,-33,38,-35,
--9,30,-43,-9,-32,
--1,4,-4,1,-5,
--11,-8,38,31,11,
--10,-42,-21,-37,1,
-43,15,-13,-35,-19,
--18,15,23,-26,59,
-1,-21,53,8,-41,
--50,-14,-28,4,21,
-25,-28,-40,5,-40,
--41,4,51,-33,-8,
--8,1,17,-60,12,
-25,-41,17,34,43,
-19,45,7,-37,24,
--15,56,-2,35,-10,
-48,4,-47,-2,5,
--5,-54,5,-3,-33,
--10,30,-2,-44,-24,
--38,9,-9,42,4,
-6,-56,44,-16,9,
--40,-26,18,-20,10,
-28,-41,-21,-4,13,
--18,32,-30,-3,37,
-15,22,28,50,-40,
-3,-29,-64,7,51,
--19,-11,17,-27,-40,
--64,24,-12,-7,-27,
-3,37,48,-1,2,
--9,-38,-34,46,1,
-27,-6,19,-13,26,
-10,34,20,25,40,
-50,-6,-7,30,9,
--24,0,-23,71,-61,
-22,58,-34,-4,2,
--49,-33,25,30,-8,
--6,-16,77,2,38,
--8,-35,-6,-30,56,
-78,31,33,-20,13,
--39,20,22,4,21,
--8,4,-6,10,-83,
--41,9,-25,-43,15,
--7,-12,-34,-39,-37,
--33,19,30,16,-33,
-42,-25,25,-68,44,
--15,-11,-4,23,50,
-14,4,-39,-43,20,
--30,60,9,-20,7,
-16,19,-33,37,29,
-16,-35,7,38,-27};
diff --git a/drivers/speex/ltp.c b/drivers/speex/ltp.c
deleted file mode 100644
index 9134506c1..000000000
--- a/drivers/speex/ltp.c
+++ /dev/null
@@ -1,839 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
- File: ltp.c
- Long-Term Prediction functions
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include <math.h>
-#include "ltp.h"
-#include "stack_alloc.h"
-#include "filters.h"
-#include <speex/speex_bits.h>
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-#ifdef _USE_SSE
-#include "ltp_sse.h"
-#elif defined (ARM4_ASM) || defined(ARM5E_ASM)
-#include "ltp_arm4.h"
-#elif defined (BFIN_ASM)
-#include "ltp_bfin.h"
-#endif
-
-#ifndef OVERRIDE_INNER_PROD
-spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
-{
- spx_word32_t sum=0;
- len >>= 2;
- while(len--)
- {
- spx_word32_t part=0;
- part = MAC16_16(part,*x++,*y++);
- part = MAC16_16(part,*x++,*y++);
- part = MAC16_16(part,*x++,*y++);
- part = MAC16_16(part,*x++,*y++);
- /* HINT: If you had a 40-bit accumulator, you could shift only at the end */
- sum = ADD32(sum,SHR32(part,6));
- }
- return sum;
-}
-#endif
-
-#ifndef OVERRIDE_PITCH_XCORR
-#if 0 /* HINT: Enable this for machines with enough registers (i.e. not x86) */
-void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
-{
- int i,j;
- for (i=0;i<nb_pitch;i+=4)
- {
- /* Compute correlation*/
- /*corr[nb_pitch-1-i]=inner_prod(x, _y+i, len);*/
- spx_word32_t sum1=0;
- spx_word32_t sum2=0;
- spx_word32_t sum3=0;
- spx_word32_t sum4=0;
- const spx_word16_t *y = _y+i;
- const spx_word16_t *x = _x;
- spx_word16_t y0, y1, y2, y3;
- /*y0=y[0];y1=y[1];y2=y[2];y3=y[3];*/
- y0=*y++;
- y1=*y++;
- y2=*y++;
- y3=*y++;
- for (j=0;j<len;j+=4)
- {
- spx_word32_t part1;
- spx_word32_t part2;
- spx_word32_t part3;
- spx_word32_t part4;
- part1 = MULT16_16(*x,y0);
- part2 = MULT16_16(*x,y1);
- part3 = MULT16_16(*x,y2);
- part4 = MULT16_16(*x,y3);
- x++;
- y0=*y++;
- part1 = MAC16_16(part1,*x,y1);
- part2 = MAC16_16(part2,*x,y2);
- part3 = MAC16_16(part3,*x,y3);
- part4 = MAC16_16(part4,*x,y0);
- x++;
- y1=*y++;
- part1 = MAC16_16(part1,*x,y2);
- part2 = MAC16_16(part2,*x,y3);
- part3 = MAC16_16(part3,*x,y0);
- part4 = MAC16_16(part4,*x,y1);
- x++;
- y2=*y++;
- part1 = MAC16_16(part1,*x,y3);
- part2 = MAC16_16(part2,*x,y0);
- part3 = MAC16_16(part3,*x,y1);
- part4 = MAC16_16(part4,*x,y2);
- x++;
- y3=*y++;
-
- sum1 = ADD32(sum1,SHR32(part1,6));
- sum2 = ADD32(sum2,SHR32(part2,6));
- sum3 = ADD32(sum3,SHR32(part3,6));
- sum4 = ADD32(sum4,SHR32(part4,6));
- }
- corr[nb_pitch-1-i]=sum1;
- corr[nb_pitch-2-i]=sum2;
- corr[nb_pitch-3-i]=sum3;
- corr[nb_pitch-4-i]=sum4;
- }
-
-}
-#else
-void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
-{
- int i;
- for (i=0;i<nb_pitch;i++)
- {
- /* Compute correlation*/
- corr[nb_pitch-1-i]=inner_prod(_x, _y+i, len);
- }
-
-}
-#endif
-#endif
-
-#ifndef OVERRIDE_COMPUTE_PITCH_ERROR
-static SPEEX_INLINE spx_word32_t compute_pitch_error(spx_word16_t *C, spx_word16_t *g, spx_word16_t pitch_control)
-{
- spx_word32_t sum = 0;
- sum = ADD32(sum,MULT16_16(MULT16_16_16(g[0],pitch_control),C[0]));
- sum = ADD32(sum,MULT16_16(MULT16_16_16(g[1],pitch_control),C[1]));
- sum = ADD32(sum,MULT16_16(MULT16_16_16(g[2],pitch_control),C[2]));
- sum = SUB32(sum,MULT16_16(MULT16_16_16(g[0],g[1]),C[3]));
- sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[1]),C[4]));
- sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[0]),C[5]));
- sum = SUB32(sum,MULT16_16(MULT16_16_16(g[0],g[0]),C[6]));
- sum = SUB32(sum,MULT16_16(MULT16_16_16(g[1],g[1]),C[7]));
- sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[2]),C[8]));
- return sum;
-}
-#endif
-
-#ifndef OVERRIDE_OPEN_LOOP_NBEST_PITCH
-void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack)
-{
- int i,j,k;
- VARDECL(spx_word32_t *best_score);
- VARDECL(spx_word32_t *best_ener);
- spx_word32_t e0;
- VARDECL(spx_word32_t *corr);
-#ifdef FIXED_POINT
- /* In fixed-point, we need only one (temporary) array of 32-bit values and two (corr16, ener16)
- arrays for (normalized) 16-bit values */
- VARDECL(spx_word16_t *corr16);
- VARDECL(spx_word16_t *ener16);
- spx_word32_t *energy;
- int cshift=0, eshift=0;
- int scaledown = 0;
- ALLOC(corr16, end-start+1, spx_word16_t);
- ALLOC(ener16, end-start+1, spx_word16_t);
- ALLOC(corr, end-start+1, spx_word32_t);
- energy = corr;
-#else
- /* In floating-point, we need to float arrays and no normalized copies */
- VARDECL(spx_word32_t *energy);
- spx_word16_t *corr16;
- spx_word16_t *ener16;
- ALLOC(energy, end-start+2, spx_word32_t);
- ALLOC(corr, end-start+1, spx_word32_t);
- corr16 = corr;
- ener16 = energy;
-#endif
-
- ALLOC(best_score, N, spx_word32_t);
- ALLOC(best_ener, N, spx_word32_t);
- for (i=0;i<N;i++)
- {
- best_score[i]=-1;
- best_ener[i]=0;
- pitch[i]=start;
- }
-
-#ifdef FIXED_POINT
- for (i=-end;i<len;i++)
- {
- if (ABS16(sw[i])>16383)
- {
- scaledown=1;
- break;
- }
- }
- /* If the weighted input is close to saturation, then we scale it down */
- if (scaledown)
- {
- for (i=-end;i<len;i++)
- {
- sw[i]=SHR16(sw[i],1);
- }
- }
-#endif
- energy[0]=inner_prod(sw-start, sw-start, len);
- e0=inner_prod(sw, sw, len);
- for (i=start;i<end;i++)
- {
- /* Update energy for next pitch*/
- energy[i-start+1] = SUB32(ADD32(energy[i-start],SHR32(MULT16_16(sw[-i-1],sw[-i-1]),6)), SHR32(MULT16_16(sw[-i+len-1],sw[-i+len-1]),6));
- if (energy[i-start+1] < 0)
- energy[i-start+1] = 0;
- }
-
-#ifdef FIXED_POINT
- eshift = normalize16(energy, ener16, 32766, end-start+1);
-#endif
-
- /* In fixed-point, this actually overrites the energy array (aliased to corr) */
- pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack);
-
-#ifdef FIXED_POINT
- /* Normalize to 180 so we can square it and it still fits in 16 bits */
- cshift = normalize16(corr, corr16, 180, end-start+1);
- /* If we scaled weighted input down, we need to scale it up again (OK, so we've just lost the LSB, who cares?) */
- if (scaledown)
- {
- for (i=-end;i<len;i++)
- {
- sw[i]=SHL16(sw[i],1);
- }
- }
-#endif
-
- /* Search for the best pitch prediction gain */
- for (i=start;i<=end;i++)
- {
- spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]);
- /* Instead of dividing the tmp by the energy, we multiply on the other side */
- if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start])))
- {
- /* We can safely put it last and then check */
- best_score[N-1]=tmp;
- best_ener[N-1]=ener16[i-start]+1;
- pitch[N-1]=i;
- /* Check if it comes in front of others */
- for (j=0;j<N-1;j++)
- {
- if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start])))
- {
- for (k=N-1;k>j;k--)
- {
- best_score[k]=best_score[k-1];
- best_ener[k]=best_ener[k-1];
- pitch[k]=pitch[k-1];
- }
- best_score[j]=tmp;
- best_ener[j]=ener16[i-start]+1;
- pitch[j]=i;
- break;
- }
- }
- }
- }
-
- /* Compute open-loop gain if necessary */
- if (gain)
- {
- for (j=0;j<N;j++)
- {
- spx_word16_t g;
- i=pitch[j];
- g = DIV32(SHL32(EXTEND32(corr16[i-start]),cshift), 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(SHL32(EXTEND32(ener16[i-start]),eshift))),6));
- /* FIXME: g = max(g,corr/energy) */
- if (g<0)
- g = 0;
- gain[j]=g;
- }
- }
-
-
-}
-#endif
-
-#ifndef OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ
-static int pitch_gain_search_3tap_vq(
- const signed char *gain_cdbk,
- int gain_cdbk_size,
- spx_word16_t *C16,
- spx_word16_t max_gain
-)
-{
- const signed char *ptr=gain_cdbk;
- int best_cdbk=0;
- spx_word32_t best_sum=-VERY_LARGE32;
- spx_word32_t sum=0;
- spx_word16_t g[3];
- spx_word16_t pitch_control=64;
- spx_word16_t gain_sum;
- int i;
-
- for (i=0;i<gain_cdbk_size;i++) {
-
- ptr = gain_cdbk+4*i;
- g[0]=ADD16((spx_word16_t)ptr[0],32);
- g[1]=ADD16((spx_word16_t)ptr[1],32);
- g[2]=ADD16((spx_word16_t)ptr[2],32);
- gain_sum = (spx_word16_t)ptr[3];
-
- sum = compute_pitch_error(C16, g, pitch_control);
-
- if (sum>best_sum && gain_sum<=max_gain) {
- best_sum=sum;
- best_cdbk=i;
- }
- }
-
- return best_cdbk;
-}
-#endif
-
-/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
-static spx_word32_t pitch_gain_search_3tap(
-const spx_word16_t target[], /* Target vector */
-const spx_coef_t ak[], /* LPCs for this subframe */
-const spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */
-const spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[], /* Excitation */
-const signed char *gain_cdbk,
-int gain_cdbk_size,
-int pitch, /* Pitch value */
-int p, /* Number of LPC coeffs */
-int nsf, /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-const spx_word16_t *exc2,
-const spx_word16_t *r,
-spx_word16_t *new_target,
-int *cdbk_index,
-int plc_tuning,
-spx_word32_t cumul_gain,
-int scaledown
-)
-{
- int i,j;
- VARDECL(spx_word16_t *tmp1);
- VARDECL(spx_word16_t *e);
- spx_word16_t *x[3];
- spx_word32_t corr[3];
- spx_word32_t A[3][3];
- spx_word16_t gain[3];
- spx_word32_t err;
- spx_word16_t max_gain=128;
- int best_cdbk=0;
-
- ALLOC(tmp1, 3*nsf, spx_word16_t);
- ALLOC(e, nsf, spx_word16_t);
-
- if (cumul_gain > 262144)
- max_gain = 31;
-
- x[0]=tmp1;
- x[1]=tmp1+nsf;
- x[2]=tmp1+2*nsf;
-
- for (j=0;j<nsf;j++)
- new_target[j] = target[j];
-
- {
- VARDECL(spx_mem_t *mm);
- int pp=pitch-1;
- ALLOC(mm, p, spx_mem_t);
- for (j=0;j<nsf;j++)
- {
- if (j-pp<0)
- e[j]=exc2[j-pp];
- else if (j-pp-pitch<0)
- e[j]=exc2[j-pp-pitch];
- else
- e[j]=0;
- }
-#ifdef FIXED_POINT
- /* Scale target and excitation down if needed (avoiding overflow) */
- if (scaledown)
- {
- for (j=0;j<nsf;j++)
- e[j] = SHR16(e[j],1);
- for (j=0;j<nsf;j++)
- new_target[j] = SHR16(new_target[j],1);
- }
-#endif
- for (j=0;j<p;j++)
- mm[j] = 0;
- iir_mem16(e, ak, e, nsf, p, mm, stack);
- for (j=0;j<p;j++)
- mm[j] = 0;
- filter_mem16(e, awk1, awk2, e, nsf, p, mm, stack);
- for (j=0;j<nsf;j++)
- x[2][j] = e[j];
- }
- for (i=1;i>=0;i--)
- {
- spx_word16_t e0=exc2[-pitch-1+i];
-#ifdef FIXED_POINT
- /* Scale excitation down if needed (avoiding overflow) */
- if (scaledown)
- e0 = SHR16(e0,1);
-#endif
- x[i][0]=MULT16_16_Q14(r[0], e0);
- for (j=0;j<nsf-1;j++)
- x[i][j+1]=ADD32(x[i+1][j],MULT16_16_P14(r[j+1], e0));
- }
-
- for (i=0;i<3;i++)
- corr[i]=inner_prod(x[i],new_target,nsf);
- for (i=0;i<3;i++)
- for (j=0;j<=i;j++)
- A[i][j]=A[j][i]=inner_prod(x[i],x[j],nsf);
-
- {
- spx_word32_t C[9];
-#ifdef FIXED_POINT
- spx_word16_t C16[9];
-#else
- spx_word16_t *C16=C;
-#endif
- C[0]=corr[2];
- C[1]=corr[1];
- C[2]=corr[0];
- C[3]=A[1][2];
- C[4]=A[0][1];
- C[5]=A[0][2];
- C[6]=A[2][2];
- C[7]=A[1][1];
- C[8]=A[0][0];
-
- /*plc_tuning *= 2;*/
- if (plc_tuning<2)
- plc_tuning=2;
- if (plc_tuning>30)
- plc_tuning=30;
-#ifdef FIXED_POINT
- C[0] = SHL32(C[0],1);
- C[1] = SHL32(C[1],1);
- C[2] = SHL32(C[2],1);
- C[3] = SHL32(C[3],1);
- C[4] = SHL32(C[4],1);
- C[5] = SHL32(C[5],1);
- C[6] = MAC16_32_Q15(C[6],MULT16_16_16(plc_tuning,655),C[6]);
- C[7] = MAC16_32_Q15(C[7],MULT16_16_16(plc_tuning,655),C[7]);
- C[8] = MAC16_32_Q15(C[8],MULT16_16_16(plc_tuning,655),C[8]);
- normalize16(C, C16, 32767, 9);
-#else
- C[6]*=.5*(1+.02*plc_tuning);
- C[7]*=.5*(1+.02*plc_tuning);
- C[8]*=.5*(1+.02*plc_tuning);
-#endif
-
- best_cdbk = pitch_gain_search_3tap_vq(gain_cdbk, gain_cdbk_size, C16, max_gain);
-
-#ifdef FIXED_POINT
- gain[0] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4]);
- gain[1] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4+1]);
- gain[2] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4+2]);
- /*printf ("%d %d %d %d\n",gain[0],gain[1],gain[2], best_cdbk);*/
-#else
- gain[0] = 0.015625*gain_cdbk[best_cdbk*4] + .5;
- gain[1] = 0.015625*gain_cdbk[best_cdbk*4+1]+ .5;
- gain[2] = 0.015625*gain_cdbk[best_cdbk*4+2]+ .5;
-#endif
- *cdbk_index=best_cdbk;
- }
-
- SPEEX_MEMSET(exc, 0, nsf);
- for (i=0;i<3;i++)
- {
- int j;
- int tmp1, tmp3;
- int pp=pitch+1-i;
- tmp1=nsf;
- if (tmp1>pp)
- tmp1=pp;
- for (j=0;j<tmp1;j++)
- exc[j]=MAC16_16(exc[j],SHL16(gain[2-i],7),exc2[j-pp]);
- tmp3=nsf;
- if (tmp3>pp+pitch)
- tmp3=pp+pitch;
- for (j=tmp1;j<tmp3;j++)
- exc[j]=MAC16_16(exc[j],SHL16(gain[2-i],7),exc2[j-pp-pitch]);
- }
- for (i=0;i<nsf;i++)
- {
- spx_word32_t tmp = ADD32(ADD32(MULT16_16(gain[0],x[2][i]),MULT16_16(gain[1],x[1][i])),
- MULT16_16(gain[2],x[0][i]));
- new_target[i] = SUB16(new_target[i], EXTRACT16(PSHR32(tmp,6)));
- }
- err = inner_prod(new_target, new_target, nsf);
-
- return err;
-}
-
-/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
-int pitch_search_3tap(
-spx_word16_t target[], /* Target vector */
-spx_word16_t *sw,
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[], /* Excitation */
-const void *par,
-int start, /* Smallest pitch value allowed */
-int end, /* Largest pitch value allowed */
-spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */
-int p, /* Number of LPC coeffs */
-int nsf, /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_word16_t *exc2,
-spx_word16_t *r,
-int complexity,
-int cdbk_offset,
-int plc_tuning,
-spx_word32_t *cumul_gain
-)
-{
- int i;
- int cdbk_index, pitch=0, best_gain_index=0;
- VARDECL(spx_sig_t *best_exc);
- VARDECL(spx_word16_t *new_target);
- VARDECL(spx_word16_t *best_target);
- int best_pitch=0;
- spx_word32_t err, best_err=-1;
- int N;
- const ltp_params *params;
- const signed char *gain_cdbk;
- int gain_cdbk_size;
- int scaledown=0;
-
- VARDECL(int *nbest);
-
- params = (const ltp_params*) par;
- gain_cdbk_size = 1<<params->gain_bits;
- gain_cdbk = params->gain_cdbk + 4*gain_cdbk_size*cdbk_offset;
-
- N=complexity;
- if (N>10)
- N=10;
- if (N<1)
- N=1;
-
- ALLOC(nbest, N, int);
- params = (const ltp_params*) par;
-
- if (end<start)
- {
- speex_bits_pack(bits, 0, params->pitch_bits);
- speex_bits_pack(bits, 0, params->gain_bits);
- SPEEX_MEMSET(exc, 0, nsf);
- return start;
- }
-
-#ifdef FIXED_POINT
- /* Check if we need to scale everything down in the pitch search to avoid overflows */
- for (i=0;i<nsf;i++)
- {
- if (ABS16(target[i])>16383)
- {
- scaledown=1;
- break;
- }
- }
- for (i=-end;i<nsf;i++)
- {
- if (ABS16(exc2[i])>16383)
- {
- scaledown=1;
- break;
- }
- }
-#endif
- if (N>end-start+1)
- N=end-start+1;
- if (end != start)
- open_loop_nbest_pitch(sw, start, end, nsf, nbest, NULL, N, stack);
- else
- nbest[0] = start;
-
- ALLOC(best_exc, nsf, spx_sig_t);
- ALLOC(new_target, nsf, spx_word16_t);
- ALLOC(best_target, nsf, spx_word16_t);
-
- for (i=0;i<N;i++)
- {
- pitch=nbest[i];
- SPEEX_MEMSET(exc, 0, nsf);
- err=pitch_gain_search_3tap(target, ak, awk1, awk2, exc, gain_cdbk, gain_cdbk_size, pitch, p, nsf,
- bits, stack, exc2, r, new_target, &cdbk_index, plc_tuning, *cumul_gain, scaledown);
- if (err<best_err || best_err<0)
- {
- SPEEX_COPY(best_exc, exc, nsf);
- SPEEX_COPY(best_target, new_target, nsf);
- best_err=err;
- best_pitch=pitch;
- best_gain_index=cdbk_index;
- }
- }
- /*printf ("pitch: %d %d\n", best_pitch, best_gain_index);*/
- speex_bits_pack(bits, best_pitch-start, params->pitch_bits);
- speex_bits_pack(bits, best_gain_index, params->gain_bits);
-#ifdef FIXED_POINT
- *cumul_gain = MULT16_32_Q13(SHL16(params->gain_cdbk[4*best_gain_index+3],8), MAX32(1024,*cumul_gain));
-#else
- *cumul_gain = 0.03125*MAX32(1024,*cumul_gain)*params->gain_cdbk[4*best_gain_index+3];
-#endif
- /*printf ("%f\n", cumul_gain);*/
- /*printf ("encode pitch: %d %d\n", best_pitch, best_gain_index);*/
- SPEEX_COPY(exc, best_exc, nsf);
- SPEEX_COPY(target, best_target, nsf);
-#ifdef FIXED_POINT
- /* Scale target back up if needed */
- if (scaledown)
- {
- for (i=0;i<nsf;i++)
- target[i]=SHL16(target[i],1);
- }
-#endif
- return pitch;
-}
-
-void pitch_unquant_3tap(
-spx_word16_t exc[], /* Input excitation */
-spx_word32_t exc_out[], /* Output excitation */
-int start, /* Smallest pitch value allowed */
-int end, /* Largest pitch value allowed */
-spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */
-const void *par,
-int nsf, /* Number of samples in subframe */
-int *pitch_val,
-spx_word16_t *gain_val,
-SpeexBits *bits,
-char *stack,
-int count_lost,
-int subframe_offset,
-spx_word16_t last_pitch_gain,
-int cdbk_offset
-)
-{
- int i;
- int pitch;
- int gain_index;
- spx_word16_t gain[3];
- const signed char *gain_cdbk;
- int gain_cdbk_size;
- const ltp_params *params;
-
- params = (const ltp_params*) par;
- gain_cdbk_size = 1<<params->gain_bits;
- gain_cdbk = params->gain_cdbk + 4*gain_cdbk_size*cdbk_offset;
-
- pitch = speex_bits_unpack_unsigned(bits, params->pitch_bits);
- pitch += start;
- gain_index = speex_bits_unpack_unsigned(bits, params->gain_bits);
- /*printf ("decode pitch: %d %d\n", pitch, gain_index);*/
-#ifdef FIXED_POINT
- gain[0] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4]);
- gain[1] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4+1]);
- gain[2] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4+2]);
-#else
- gain[0] = 0.015625*gain_cdbk[gain_index*4]+.5;
- gain[1] = 0.015625*gain_cdbk[gain_index*4+1]+.5;
- gain[2] = 0.015625*gain_cdbk[gain_index*4+2]+.5;
-#endif
-
- if (count_lost && pitch > subframe_offset)
- {
- spx_word16_t gain_sum;
- if (1) {
-#ifdef FIXED_POINT
- spx_word16_t tmp = count_lost < 4 ? last_pitch_gain : SHR16(last_pitch_gain,1);
- if (tmp>62)
- tmp=62;
-#else
- spx_word16_t tmp = count_lost < 4 ? last_pitch_gain : 0.5 * last_pitch_gain;
- if (tmp>.95)
- tmp=.95;
-#endif
- gain_sum = gain_3tap_to_1tap(gain);
-
- if (gain_sum > tmp)
- {
- spx_word16_t fact = DIV32_16(SHL32(EXTEND32(tmp),14),gain_sum);
- for (i=0;i<3;i++)
- gain[i]=MULT16_16_Q14(fact,gain[i]);
- }
-
- }
-
- }
-
- *pitch_val = pitch;
- gain_val[0]=gain[0];
- gain_val[1]=gain[1];
- gain_val[2]=gain[2];
- gain[0] = SHL16(gain[0],7);
- gain[1] = SHL16(gain[1],7);
- gain[2] = SHL16(gain[2],7);
- SPEEX_MEMSET(exc_out, 0, nsf);
- for (i=0;i<3;i++)
- {
- int j;
- int tmp1, tmp3;
- int pp=pitch+1-i;
- tmp1=nsf;
- if (tmp1>pp)
- tmp1=pp;
- for (j=0;j<tmp1;j++)
- exc_out[j]=MAC16_16(exc_out[j],gain[2-i],exc[j-pp]);
- tmp3=nsf;
- if (tmp3>pp+pitch)
- tmp3=pp+pitch;
- for (j=tmp1;j<tmp3;j++)
- exc_out[j]=MAC16_16(exc_out[j],gain[2-i],exc[j-pp-pitch]);
- }
- /*for (i=0;i<nsf;i++)
- exc[i]=PSHR32(exc32[i],13);*/
-}
-
-
-/** Forced pitch delay and gain */
-int forced_pitch_quant(
-spx_word16_t target[], /* Target vector */
-spx_word16_t *sw,
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[], /* Excitation */
-const void *par,
-int start, /* Smallest pitch value allowed */
-int end, /* Largest pitch value allowed */
-spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */
-int p, /* Number of LPC coeffs */
-int nsf, /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_word16_t *exc2,
-spx_word16_t *r,
-int complexity,
-int cdbk_offset,
-int plc_tuning,
-spx_word32_t *cumul_gain
-)
-{
- int i;
- VARDECL(spx_word16_t *res);
- ALLOC(res, nsf, spx_word16_t);
-#ifdef FIXED_POINT
- if (pitch_coef>63)
- pitch_coef=63;
-#else
- if (pitch_coef>.99)
- pitch_coef=.99;
-#endif
- for (i=0;i<nsf&&i<start;i++)
- {
- exc[i]=MULT16_16(SHL16(pitch_coef, 7),exc2[i-start]);
- }
- for (;i<nsf;i++)
- {
- exc[i]=MULT16_32_Q15(SHL16(pitch_coef, 9),exc[i-start]);
- }
- for (i=0;i<nsf;i++)
- res[i] = EXTRACT16(PSHR32(exc[i], SIG_SHIFT-1));
- syn_percep_zero16(res, ak, awk1, awk2, res, nsf, p, stack);
- for (i=0;i<nsf;i++)
- target[i]=EXTRACT16(SATURATE(SUB32(EXTEND32(target[i]),EXTEND32(res[i])),32700));
- return start;
-}
-
-/** Unquantize forced pitch delay and gain */
-void forced_pitch_unquant(
-spx_word16_t exc[], /* Input excitation */
-spx_word32_t exc_out[], /* Output excitation */
-int start, /* Smallest pitch value allowed */
-int end, /* Largest pitch value allowed */
-spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */
-const void *par,
-int nsf, /* Number of samples in subframe */
-int *pitch_val,
-spx_word16_t *gain_val,
-SpeexBits *bits,
-char *stack,
-int count_lost,
-int subframe_offset,
-spx_word16_t last_pitch_gain,
-int cdbk_offset
-)
-{
- int i;
-#ifdef FIXED_POINT
- if (pitch_coef>63)
- pitch_coef=63;
-#else
- if (pitch_coef>.99)
- pitch_coef=.99;
-#endif
- for (i=0;i<nsf;i++)
- {
- exc_out[i]=MULT16_16(exc[i-start],SHL16(pitch_coef,7));
- exc[i] = EXTRACT16(PSHR32(exc_out[i],13));
- }
- *pitch_val = start;
- gain_val[0]=gain_val[2]=0;
- gain_val[1] = pitch_coef;
-}
diff --git a/drivers/speex/ltp.h b/drivers/speex/ltp.h
deleted file mode 100644
index 1e435bc36..000000000
--- a/drivers/speex/ltp.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file ltp.h
- @brief Long-Term Prediction functions
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <speex/speex_bits.h>
-#include "arch.h"
-
-/** LTP parameters. */
-typedef struct {
- const signed char *gain_cdbk;
- int gain_bits;
- int pitch_bits;
-} ltp_params;
-
-#ifdef FIXED_POINT
-#define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -SHR16(g[0],1)) + (g[2]>0 ? g[2] : -SHR16(g[2],1)))
-#else
-#define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -.5*g[0]) + (g[2]>0 ? g[2] : -.5*g[2]))
-#endif
-
-spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len);
-void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack);
-
-void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack);
-
-
-/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
-int pitch_search_3tap(
-spx_word16_t target[], /* Target vector */
-spx_word16_t *sw,
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[], /* Overlapping codebook */
-const void *par,
-int start, /* Smallest pitch value allowed */
-int end, /* Largest pitch value allowed */
-spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */
-int p, /* Number of LPC coeffs */
-int nsf, /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_word16_t *exc2,
-spx_word16_t *r,
-int complexity,
-int cdbk_offset,
-int plc_tuning,
-spx_word32_t *cumul_gain
-);
-
-/*Unquantize adaptive codebook and update pitch contribution*/
-void pitch_unquant_3tap(
-spx_word16_t exc[], /* Input excitation */
-spx_word32_t exc_out[], /* Output excitation */
-int start, /* Smallest pitch value allowed */
-int end, /* Largest pitch value allowed */
-spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */
-const void *par,
-int nsf, /* Number of samples in subframe */
-int *pitch_val,
-spx_word16_t *gain_val,
-SpeexBits *bits,
-char *stack,
-int lost,
-int subframe_offset,
-spx_word16_t last_pitch_gain,
-int cdbk_offset
-);
-
-/** Forced pitch delay and gain */
-int forced_pitch_quant(
-spx_word16_t target[], /* Target vector */
-spx_word16_t *sw,
-spx_coef_t ak[], /* LPCs for this subframe */
-spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */
-spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[], /* Excitation */
-const void *par,
-int start, /* Smallest pitch value allowed */
-int end, /* Largest pitch value allowed */
-spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */
-int p, /* Number of LPC coeffs */
-int nsf, /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_word16_t *exc2,
-spx_word16_t *r,
-int complexity,
-int cdbk_offset,
-int plc_tuning,
-spx_word32_t *cumul_gain
-);
-
-/** Unquantize forced pitch delay and gain */
-void forced_pitch_unquant(
-spx_word16_t exc[], /* Input excitation */
-spx_word32_t exc_out[], /* Output excitation */
-int start, /* Smallest pitch value allowed */
-int end, /* Largest pitch value allowed */
-spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */
-const void *par,
-int nsf, /* Number of samples in subframe */
-int *pitch_val,
-spx_word16_t *gain_val,
-SpeexBits *bits,
-char *stack,
-int lost,
-int subframe_offset,
-spx_word16_t last_pitch_gain,
-int cdbk_offset
-);
diff --git a/drivers/speex/ltp_arm4.h b/drivers/speex/ltp_arm4.h
deleted file mode 100644
index cdb94e603..000000000
--- a/drivers/speex/ltp_arm4.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* Copyright (C) 2004 Jean-Marc Valin */
-/**
- @file ltp_arm4.h
- @brief Long-Term Prediction functions (ARM4 version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_INNER_PROD
-spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
-{
- spx_word32_t sum1=0,sum2=0;
- spx_word16_t *deadx, *deady;
- int deadlen, dead1, dead2, dead3, dead4, dead5, dead6;
- __asm__ __volatile__ (
- "\tldrsh %5, [%0], #2 \n"
- "\tldrsh %6, [%1], #2 \n"
- ".inner_prod_loop%=:\n"
- "\tsub %7, %7, %7\n"
- "\tsub %10, %10, %10\n"
-
- "\tldrsh %8, [%0], #2 \n"
- "\tldrsh %9, [%1], #2 \n"
- "\tmla %7, %5, %6, %7\n"
- "\tldrsh %5, [%0], #2 \n"
- "\tldrsh %6, [%1], #2 \n"
- "\tmla %10, %8, %9, %10\n"
- "\tldrsh %8, [%0], #2 \n"
- "\tldrsh %9, [%1], #2 \n"
- "\tmla %7, %5, %6, %7\n"
- "\tldrsh %5, [%0], #2 \n"
- "\tldrsh %6, [%1], #2 \n"
- "\tmla %10, %8, %9, %10\n"
-
- "\tldrsh %8, [%0], #2 \n"
- "\tldrsh %9, [%1], #2 \n"
- "\tmla %7, %5, %6, %7\n"
- "\tldrsh %5, [%0], #2 \n"
- "\tldrsh %6, [%1], #2 \n"
- "\tmla %10, %8, %9, %10\n"
- "\tldrsh %8, [%0], #2 \n"
- "\tldrsh %9, [%1], #2 \n"
- "\tmla %7, %5, %6, %7\n"
- "\tldrsh %5, [%0], #2 \n"
- "\tldrsh %6, [%1], #2 \n"
- "\tmla %10, %8, %9, %10\n"
-
- "\tsubs %4, %4, #1\n"
- "\tadd %2, %2, %7, asr #5\n"
- "\tadd %3, %3, %10, asr #5\n"
- "\tbne .inner_prod_loop%=\n"
- : "=r" (deadx), "=r" (deady), "+r" (sum1), "+r" (sum2),
- "=r" (deadlen), "=r" (dead1), "=r" (dead2), "=r" (dead3),
- "=r" (dead4), "=r" (dead5), "=r" (dead6)
- : "0" (x), "1" (y), "4" (len>>3)
- : "cc"
- );
- return (sum1+sum2)>>1;
-}
-
-#define OVERRIDE_PITCH_XCORR
-void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
-{
- int i,j;
- for (i=0;i<nb_pitch;i+=4)
- {
- /* Compute correlation*/
- //corr[nb_pitch-1-i]=inner_prod(x, _y+i, len);
- spx_word32_t sum1=0;
- spx_word32_t sum2=0;
- spx_word32_t sum3=0;
- spx_word32_t sum4=0;
- const spx_word16_t *y = _y+i;
- const spx_word16_t *x = _x;
- spx_word32_t y0, y1, y2, y3;
- y0=*y++;
- y1=*y++;
- y2=*y++;
- y3=*y++;
- for (j=0;j<len;j+=4)
- {
- spx_word32_t part1, part2, part3, part4, x0;
- spx_word32_t dead1;
- __asm__ __volatile__ (
-#ifdef SHORTCUTS
- "\tldrsh %10, [%8], #4 \n"
- "\tmul %4, %10, %0 \n"
- "\tldrsh %15, [%8], #4 \n"
- "\tmul %5, %10, %1 \n"
- "\tldrsh %0, [%9], #2 \n"
- "\tmul %6, %10, %2 \n"
- "\tldrsh %1, [%9], #2 \n"
- "\tmul %7, %10, %3 \n"
-
-
- "\tmla %4, %15, %2, %4 \n"
- "\tldrsh %2, [%9], #2 \n"
- "\tmla %5, %15, %3, %5 \n"
- "\tldrsh %3, [%9], #2 \n"
- "\tmla %6, %15, %0, %6 \n"
- "\tmla %7, %15, %1, %7 \n"
-
-#else
- "\tldrsh %10, [%8], #2 \n"
- "\tmul %4, %10, %0 \n"
- "\tmul %5, %10, %1 \n"
- "\tmul %6, %10, %2 \n"
- "\tmul %7, %10, %3 \n"
-
- "\tldrsh %10, [%8], #2 \n"
- "\tldrsh %0, [%9], #2 \n"
- "\tmla %4, %10, %1, %4 \n"
- "\tmla %5, %10, %2, %5 \n"
- "\tmla %6, %10, %3, %6 \n"
- "\tmla %7, %10, %0, %7 \n"
-
- "\tldrsh %10, [%8], #2 \n"
- "\tldrsh %1, [%9], #2 \n"
- "\tmla %4, %10, %2, %4 \n"
- "\tmla %5, %10, %3, %5 \n"
- "\tmla %6, %10, %0, %6 \n"
- "\tmla %7, %10, %1, %7 \n"
-
- "\tldrsh %10, [%8], #2 \n"
- "\tldrsh %2, [%9], #2 \n"
- "\tmla %4, %10, %3, %4 \n"
- "\tmla %5, %10, %0, %5 \n"
- "\tmla %6, %10, %1, %6 \n"
- "\tmla %7, %10, %2, %7 \n"
-
- "\tldrsh %3, [%9], #2 \n"
-#endif
-
- "\tldr %10, %11 \n"
- "\tldr %15, %12 \n"
- "\tadd %4, %10, %4, asr #6 \n"
- "\tstr %4, %11 \n"
- "\tldr %10, %13 \n"
- "\tadd %5, %15, %5, asr #6 \n"
- "\tstr %5, %12 \n"
- "\tldr %15, %14 \n"
- "\tadd %6, %10, %6, asr #6 \n"
- "\tadd %7, %15, %7, asr #6 \n"
- "\tstr %6, %13 \n"
- "\tstr %7, %14 \n"
-
- : "+r" (y0), "+r" (y1), "+r" (y2), "+r" (y3),
- "=r" (part1), "=r" (part2), "=r" (part3), "=r" (part4),
- "+r" (x), "+r" (y), "=r" (x0), "+m" (sum1),
- "+m" (sum2), "+m" (sum3), "+m" (sum4), "=r" (dead1)
- :
- : "cc", "memory"
- );
- }
- corr[nb_pitch-1-i]=sum1;
- corr[nb_pitch-2-i]=sum2;
- corr[nb_pitch-3-i]=sum3;
- corr[nb_pitch-4-i]=sum4;
- }
-
-}
diff --git a/drivers/speex/ltp_bfin.h b/drivers/speex/ltp_bfin.h
deleted file mode 100644
index b530f8598..000000000
--- a/drivers/speex/ltp_bfin.h
+++ /dev/null
@@ -1,419 +0,0 @@
-/* Copyright (C) 2005 Analog Devices */
-/**
- @file ltp_bfin.h
- @author Jean-Marc Valin
- @brief Long-Term Prediction functions (Blackfin version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_INNER_PROD
-spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
-{
- spx_word32_t sum=0;
- __asm__ __volatile__ (
- "P0 = %3;\n\t"
- "P1 = %1;\n\t"
- "P2 = %2;\n\t"
- "I0 = P1;\n\t"
- "I1 = P2;\n\t"
- "L0 = 0;\n\t"
- "L1 = 0;\n\t"
- "A0 = 0;\n\t"
- "R0.L = W[I0++] || R1.L = W[I1++];\n\t"
- "LOOP inner%= LC0 = P0;\n\t"
- "LOOP_BEGIN inner%=;\n\t"
- "A0 += R0.L*R1.L (IS) || R0.L = W[I0++] || R1.L = W[I1++];\n\t"
- "LOOP_END inner%=;\n\t"
- "A0 += R0.L*R1.L (IS);\n\t"
- "A0 = A0 >>> 6;\n\t"
- "R0 = A0;\n\t"
- "%0 = R0;\n\t"
- : "=m" (sum)
- : "m" (x), "m" (y), "d" (len-1)
- : "P0", "P1", "P2", "R0", "R1", "A0", "I0", "I1", "L0", "L1", "R3"
- );
- return sum;
-}
-
-#define OVERRIDE_PITCH_XCORR
-void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
-{
- corr += nb_pitch - 1;
- __asm__ __volatile__ (
- "P2 = %0;\n\t"
- "I0 = P2;\n\t" /* x in I0 */
- "B0 = P2;\n\t" /* x in B0 */
- "R0 = %3;\n\t" /* len in R0 */
- "P3 = %3;\n\t"
- "P3 += -2;\n\t" /* len in R0 */
- "P4 = %4;\n\t" /* nb_pitch in R0 */
- "R1 = R0 << 1;\n\t" /* number of bytes in x */
- "L0 = R1;\n\t"
- "P0 = %1;\n\t"
-
- "P1 = %2;\n\t"
- "B1 = P1;\n\t"
- "L1 = 0;\n\t" /*Disable looping on I1*/
-
- "r0 = [I0++];\n\t"
- "LOOP pitch%= LC0 = P4 >> 1;\n\t"
- "LOOP_BEGIN pitch%=;\n\t"
- "I1 = P0;\n\t"
- "A1 = A0 = 0;\n\t"
- "R1 = [I1++];\n\t"
- "LOOP inner_prod%= LC1 = P3 >> 1;\n\t"
- "LOOP_BEGIN inner_prod%=;\n\t"
- "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t"
- "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R1.H = W[I1++] || R0 = [I0++];\n\t"
- "LOOP_END inner_prod%=;\n\t"
- "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t"
- "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R0 = [I0++];\n\t"
- "A0 = A0 >>> 6;\n\t"
- "A1 = A1 >>> 6;\n\t"
- "R2 = A0, R3 = A1;\n\t"
- "[P1--] = r2;\n\t"
- "[P1--] = r3;\n\t"
- "P0 += 4;\n\t"
- "LOOP_END pitch%=;\n\t"
- "L0 = 0;\n\t"
- : : "m" (_x), "m" (_y), "m" (corr), "m" (len), "m" (nb_pitch)
- : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "R3", "I0", "I1", "L0", "L1", "B0", "B1", "memory"
- );
-}
-
-#define OVERRIDE_COMPUTE_PITCH_ERROR
-static inline spx_word32_t compute_pitch_error(spx_word16_t *C, spx_word16_t *g, spx_word16_t pitch_control)
-{
- spx_word32_t sum;
- __asm__ __volatile__
- (
- "A0 = 0;\n\t"
-
- "R0 = W[%1++];\n\t"
- "R1.L = %2.L*%5.L (IS);\n\t"
- "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
-
- "R1.L = %3.L*%5.L (IS);\n\t"
- "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
-
- "R1.L = %4.L*%5.L (IS);\n\t"
- "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
-
- "R1.L = %2.L*%3.L (IS);\n\t"
- "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
-
- "R1.L = %4.L*%3.L (IS);\n\t"
- "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
-
- "R1.L = %4.L*%2.L (IS);\n\t"
- "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
-
- "R1.L = %2.L*%2.L (IS);\n\t"
- "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
-
- "R1.L = %3.L*%3.L (IS);\n\t"
- "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
-
- "R1.L = %4.L*%4.L (IS);\n\t"
- "A0 -= R1.L*R0.L (IS);\n\t"
-
- "%0 = A0;\n\t"
- : "=&D" (sum), "=a" (C)
- : "d" (g[0]), "d" (g[1]), "d" (g[2]), "d" (pitch_control), "1" (C)
- : "R0", "R1", "R2", "A0"
- );
- return sum;
-}
-
-#define OVERRIDE_OPEN_LOOP_NBEST_PITCH
-#ifdef OVERRIDE_OPEN_LOOP_NBEST_PITCH
-void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack)
-{
- int i,j,k;
- VARDECL(spx_word32_t *best_score);
- VARDECL(spx_word32_t *best_ener);
- spx_word32_t e0;
- VARDECL(spx_word32_t *corr);
- VARDECL(spx_word32_t *energy);
-
- ALLOC(best_score, N, spx_word32_t);
- ALLOC(best_ener, N, spx_word32_t);
- ALLOC(corr, end-start+1, spx_word32_t);
- ALLOC(energy, end-start+2, spx_word32_t);
-
- for (i=0;i<N;i++)
- {
- best_score[i]=-1;
- best_ener[i]=0;
- pitch[i]=start;
- }
-
- energy[0]=inner_prod(sw-start, sw-start, len);
- e0=inner_prod(sw, sw, len);
-
- /* energy update -------------------------------------*/
-
- __asm__ __volatile__
- (
-" P0 = %0;\n\t"
-" I1 = %1;\n\t"
-" L1 = 0;\n\t"
-" I2 = %2;\n\t"
-" L2 = 0;\n\t"
-" R2 = [P0++];\n\t"
-" R3 = 0;\n\t"
-" LSETUP (eu1, eu2) LC1 = %3;\n\t"
-"eu1: R1.L = W [I1--] || R0.L = W [I2--] ;\n\t"
-" R1 = R1.L * R1.L (IS);\n\t"
-" R0 = R0.L * R0.L (IS);\n\t"
-" R1 >>>= 6;\n\t"
-" R1 = R1 + R2;\n\t"
-" R0 >>>= 6;\n\t"
-" R1 = R1 - R0;\n\t"
-" R2 = MAX(R1,R3);\n\t"
-"eu2: [P0++] = R2;\n\t"
- : : "d" (energy), "d" (&sw[-start-1]), "d" (&sw[-start+len-1]),
- "a" (end-start)
- : "P0", "I1", "I2", "R0", "R1", "R2", "R3"
-#if (__GNUC__ == 4)
- , "LC1"
-#endif
- );
-
- pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack);
-
- /* FIXME: Fixed-point and floating-point code should be merged */
- {
- VARDECL(spx_word16_t *corr16);
- VARDECL(spx_word16_t *ener16);
- ALLOC(corr16, end-start+1, spx_word16_t);
- ALLOC(ener16, end-start+1, spx_word16_t);
- /* Normalize to 180 so we can square it and it still fits in 16 bits */
- normalize16(corr, corr16, 180, end-start+1);
- normalize16(energy, ener16, 180, end-start+1);
-
- if (N == 1) {
- /* optimised asm to handle N==1 case */
- __asm__ __volatile__
- (
-" I0 = %1;\n\t" /* I0: corr16[] */
-" L0 = 0;\n\t"
-" I1 = %2;\n\t" /* I1: energy */
-" L1 = 0;\n\t"
-" R2 = -1;\n\t" /* R2: best score */
-" R3 = 0;\n\t" /* R3: best energy */
-" P0 = %4;\n\t" /* P0: best pitch */
-" P1 = %4;\n\t" /* P1: counter */
-" LSETUP (sl1, sl2) LC1 = %3;\n\t"
-"sl1: R0.L = W [I0++] || R1.L = W [I1++];\n\t"
-" R0 = R0.L * R0.L (IS);\n\t"
-" R1 += 1;\n\t"
-" R4 = R0.L * R3.L;\n\t"
-" R5 = R2.L * R1.L;\n\t"
-" cc = R5 < R4;\n\t"
-" if cc R2 = R0;\n\t"
-" if cc R3 = R1;\n\t"
-" if cc P0 = P1;\n\t"
-"sl2: P1 += 1;\n\t"
-" %0 = P0;\n\t"
- : "=&d" (pitch[0])
- : "a" (corr16), "a" (ener16), "a" (end+1-start), "d" (start)
- : "P0", "P1", "I0", "I1", "R0", "R1", "R2", "R3", "R4", "R5"
-#if (__GNUC__ == 4)
- , "LC1"
-#endif
- );
-
- }
- else {
- for (i=start;i<=end;i++)
- {
- spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]);
- /* Instead of dividing the tmp by the energy, we multiply on the other side */
- if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start])))
- {
- /* We can safely put it last and then check */
- best_score[N-1]=tmp;
- best_ener[N-1]=ener16[i-start]+1;
- pitch[N-1]=i;
- /* Check if it comes in front of others */
- for (j=0;j<N-1;j++)
- {
- if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start])))
- {
- for (k=N-1;k>j;k--)
- {
- best_score[k]=best_score[k-1];
- best_ener[k]=best_ener[k-1];
- pitch[k]=pitch[k-1];
- }
- best_score[j]=tmp;
- best_ener[j]=ener16[i-start]+1;
- pitch[j]=i;
- break;
- }
- }
- }
- }
- }
- }
-
- /* Compute open-loop gain */
- if (gain)
- {
- for (j=0;j<N;j++)
- {
- spx_word16_t g;
- i=pitch[j];
- g = DIV32(corr[i-start], 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(energy[i-start])),6));
- /* FIXME: g = max(g,corr/energy) */
- if (g<0)
- g = 0;
- gain[j]=g;
- }
- }
-}
-#endif
-
-#define OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ
-#ifdef OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ
-static int pitch_gain_search_3tap_vq(
- const signed char *gain_cdbk,
- int gain_cdbk_size,
- spx_word16_t *C16,
- spx_word16_t max_gain
-)
-{
- const signed char *ptr=gain_cdbk;
- int best_cdbk=0;
- spx_word32_t best_sum=-VERY_LARGE32;
- spx_word32_t sum=0;
- spx_word16_t g[3];
- spx_word16_t pitch_control=64;
- spx_word16_t gain_sum;
- int i;
-
- /* fast asm version of VQ codebook search */
-
- __asm__ __volatile__
- (
-
-" P0 = %2;\n\t" /* P0: ptr to gain_cdbk */
-" L1 = 0;\n\t" /* no circ addr for L1 */
-" %0 = 0;\n\t" /* %0: best_sum */
-" %1 = 0;\n\t" /* %1: best_cbdk */
-" P1 = 0;\n\t" /* P1: loop counter */
-
-" LSETUP (pgs1, pgs2) LC1 = %4;\n\t"
-"pgs1: R2 = B [P0++] (X);\n\t" /* R2: g[0] */
-" R3 = B [P0++] (X);\n\t" /* R3: g[1] */
-" R4 = B [P0++] (X);\n\t" /* R4: g[2] */
-" R2 += 32;\n\t"
-" R3 += 32;\n\t"
-" R4 += 32;\n\t"
-" R4.H = 64;\n\t" /* R4.H: pitch_control */
-
-" R0 = B [P0++] (X);\n\t"
-" B0 = R0;\n\t" /* BO: gain_sum */
-
- /* compute_pitch_error() -------------------------------*/
-
-" I1 = %3;\n\t" /* I1: ptr to C */
-" A0 = 0;\n\t"
-
-" R0.L = W[I1++];\n\t"
-" R1.L = R2.L*R4.H (IS);\n\t"
-" A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
-
-" R1.L = R3.L*R4.H (IS);\n\t"
-" A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
-
-" R1.L = R4.L*R4.H (IS);\n\t"
-" A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
-
-" R1.L = R2.L*R3.L (IS);\n\t"
-" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
-
-" R1.L = R4.L*R3.L (IS);\n\t"
-" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
-
-" R1.L = R4.L*R2.L (IS);\n\t"
-" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
-
-" R1.L = R2.L*R2.L (IS);\n\t"
-" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
-
-" R1.L = R3.L*R3.L (IS);\n\t"
-" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
-
-" R1.L = R4.L*R4.L (IS);\n\t"
-" R0 = (A0 -= R1.L*R0.L) (IS);\n\t"
-
-/*
- Re-arrange the if-then to code efficiently on the Blackfin:
-
- if (sum>best_sum && gain_sum<=max_gain) ------ (1)
-
- if (sum>best_sum && !(gain_sum>max_gain)) ------ (2)
-
- if (max_gain<=gain_sum) { ------ (3)
- sum = -VERY_LARGE32;
- }
- if (best_sum<=sum)
-
- The blackin cc instructions are all of the form:
-
- cc = x < y (or cc = x <= y)
-*/
-" R1 = B0\n\t"
-" R2 = %5\n\t"
-" R3 = %6\n\t"
-" cc = R2 <= R1;\n\t"
-" if cc R0 = R3;\n\t"
-" cc = %0 <= R0;\n\t"
-" if cc %0 = R0;\n\t"
-" if cc %1 = P1;\n\t"
-
-"pgs2: P1 += 1;\n\t"
-
- : "=&d" (best_sum), "=&d" (best_cdbk)
- : "a" (gain_cdbk), "a" (C16), "a" (gain_cdbk_size), "a" (max_gain),
- "b" (-VERY_LARGE32)
- : "R0", "R1", "R2", "R3", "R4", "P0",
- "P1", "I1", "L1", "A0", "B0"
-#if (__GNUC__ == 4)
- , "LC1"
-#endif
- );
-
- return best_cdbk;
-}
-#endif
-
diff --git a/drivers/speex/ltp_sse.h b/drivers/speex/ltp_sse.h
deleted file mode 100644
index bed6eaac9..000000000
--- a/drivers/speex/ltp_sse.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file ltp_sse.h
- @brief Long-Term Prediction functions (SSE version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <xmmintrin.h>
-
-#define OVERRIDE_INNER_PROD
-float inner_prod(const float *a, const float *b, int len)
-{
- int i;
- float ret;
- __m128 sum = _mm_setzero_ps();
- for (i=0;i<(len>>2);i+=2)
- {
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+0), _mm_loadu_ps(b+0)));
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+4), _mm_loadu_ps(b+4)));
- a += 8;
- b += 8;
- }
- sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
- sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
- _mm_store_ss(&ret, sum);
- return ret;
-}
-
-#define OVERRIDE_PITCH_XCORR
-void pitch_xcorr(const float *_x, const float *_y, float *corr, int len, int nb_pitch, char *stack)
-{
- int i, offset;
- VARDECL(__m128 *x);
- VARDECL(__m128 *y);
- int N, L;
- N = len>>2;
- L = nb_pitch>>2;
- ALLOC(x, N, __m128);
- ALLOC(y, N+L, __m128);
- for (i=0;i<N;i++)
- x[i] = _mm_loadu_ps(_x+(i<<2));
- for (offset=0;offset<4;offset++)
- {
- for (i=0;i<N+L;i++)
- y[i] = _mm_loadu_ps(_y+(i<<2)+offset);
- for (i=0;i<L;i++)
- {
- int j;
- __m128 sum, *xx, *yy;
- sum = _mm_setzero_ps();
- yy = y+i;
- xx = x;
- for (j=0;j<N;j+=2)
- {
- sum = _mm_add_ps(sum, _mm_mul_ps(xx[0], yy[0]));
- sum = _mm_add_ps(sum, _mm_mul_ps(xx[1], yy[1]));
- xx += 2;
- yy += 2;
- }
- sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
- sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
- _mm_store_ss(corr+nb_pitch-1-(i<<2)-offset, sum);
- }
- }
-}
diff --git a/drivers/speex/math_approx.h b/drivers/speex/math_approx.h
deleted file mode 100644
index 8a82ab526..000000000
--- a/drivers/speex/math_approx.h
+++ /dev/null
@@ -1,333 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file math_approx.h
- @brief Various math approximation functions for Speex
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef MATH_APPROX_H
-#define MATH_APPROX_H
-
-#include "arch.h"
-#include "os_support.h"
-
-#ifndef FIXED_POINT
-
-#define spx_sqrt sqrt
-#define spx_acos acos
-#define spx_exp exp
-#define spx_cos_norm(x) (cos((.5f*M_PI)*(x)))
-#define spx_atan atan
-
-/** Generate a pseudo-random number */
-static SPEEX_INLINE spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
-{
- const unsigned int jflone = 0x3f800000;
- const unsigned int jflmsk = 0x007fffff;
- union {int i; float f;} ran;
- *seed = 1664525 * *seed + 1013904223;
- ran.i = jflone | (jflmsk & *seed);
- ran.f -= 1.5;
- return 3.4642*std*ran.f;
-}
-
-
-#endif
-
-
-static SPEEX_INLINE spx_int16_t spx_ilog2(spx_uint32_t x)
-{
- int r=0;
- if (x>=(spx_int32_t)65536)
- {
- x >>= 16;
- r += 16;
- }
- if (x>=256)
- {
- x >>= 8;
- r += 8;
- }
- if (x>=16)
- {
- x >>= 4;
- r += 4;
- }
- if (x>=4)
- {
- x >>= 2;
- r += 2;
- }
- if (x>=2)
- {
- r += 1;
- }
- return r;
-}
-
-static SPEEX_INLINE spx_int16_t spx_ilog4(spx_uint32_t x)
-{
- int r=0;
- if (x>=(spx_int32_t)65536)
- {
- x >>= 16;
- r += 8;
- }
- if (x>=256)
- {
- x >>= 8;
- r += 4;
- }
- if (x>=16)
- {
- x >>= 4;
- r += 2;
- }
- if (x>=4)
- {
- r += 1;
- }
- return r;
-}
-
-#ifdef FIXED_POINT
-
-/** Generate a pseudo-random number */
-static SPEEX_INLINE spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
-{
- spx_word32_t res;
- *seed = 1664525 * *seed + 1013904223;
- res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
- return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14));
-}
-
-/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25723*x^3 (for .25 < x < 1) */
-/*#define C0 3634
-#define C1 21173
-#define C2 -12627
-#define C3 4215*/
-
-/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25659*x^3 (for .25 < x < 1) */
-#define C0 3634
-#define C1 21173
-#define C2 -12627
-#define C3 4204
-
-static SPEEX_INLINE spx_word16_t spx_sqrt(spx_word32_t x)
-{
- int k;
- spx_word32_t rt;
- k = spx_ilog4(x)-6;
- x = VSHR32(x, (k<<1));
- rt = ADD16(C0, MULT16_16_Q14(x, ADD16(C1, MULT16_16_Q14(x, ADD16(C2, MULT16_16_Q14(x, (C3)))))));
- rt = VSHR32(rt,7-k);
- return rt;
-}
-
-/* log(x) ~= -2.18151 + 4.20592*x - 2.88938*x^2 + 0.86535*x^3 (for .5 < x < 1) */
-
-
-#define A1 16469
-#define A2 2242
-#define A3 1486
-
-static SPEEX_INLINE spx_word16_t spx_acos(spx_word16_t x)
-{
- int s=0;
- spx_word16_t ret;
- spx_word16_t sq;
- if (x<0)
- {
- s=1;
- x = NEG16(x);
- }
- x = SUB16(16384,x);
-
- x = x >> 1;
- sq = MULT16_16_Q13(x, ADD16(A1, MULT16_16_Q13(x, ADD16(A2, MULT16_16_Q13(x, (A3))))));
- ret = spx_sqrt(SHL32(EXTEND32(sq),13));
-
- /*ret = spx_sqrt(67108864*(-1.6129e-04 + 2.0104e+00*f + 2.7373e-01*f*f + 1.8136e-01*f*f*f));*/
- if (s)
- ret = SUB16(25736,ret);
- return ret;
-}
-
-
-#define K1 8192
-#define K2 -4096
-#define K3 340
-#define K4 -10
-
-static SPEEX_INLINE spx_word16_t spx_cos(spx_word16_t x)
-{
- spx_word16_t x2;
-
- if (x<12868)
- {
- x2 = MULT16_16_P13(x,x);
- return ADD32(K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2))))));
- } else {
- x = SUB16(25736,x);
- x2 = MULT16_16_P13(x,x);
- return SUB32(-K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2))))));
- }
-}
-
-#define L1 32767
-#define L2 -7651
-#define L3 8277
-#define L4 -626
-
-static SPEEX_INLINE spx_word16_t _spx_cos_pi_2(spx_word16_t x)
-{
- spx_word16_t x2;
-
- x2 = MULT16_16_P15(x,x);
- return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MULT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2))))))));
-}
-
-static SPEEX_INLINE spx_word16_t spx_cos_norm(spx_word32_t x)
-{
- x = x&0x0001ffff;
- if (x>SHL32(EXTEND32(1), 16))
- x = SUB32(SHL32(EXTEND32(1), 17),x);
- if (x&0x00007fff)
- {
- if (x<SHL32(EXTEND32(1), 15))
- {
- return _spx_cos_pi_2(EXTRACT16(x));
- } else {
- return NEG32(_spx_cos_pi_2(EXTRACT16(65536-x)));
- }
- } else {
- if (x&0x0000ffff)
- return 0;
- else if (x&0x0001ffff)
- return -32767;
- else
- return 32767;
- }
-}
-
-/*
- K0 = 1
- K1 = log(2)
- K2 = 3-4*log(2)
- K3 = 3*log(2) - 2
-*/
-#define D0 16384
-#define D1 11356
-#define D2 3726
-#define D3 1301
-/* Input in Q11 format, output in Q16 */
-static SPEEX_INLINE spx_word32_t spx_exp2(spx_word16_t x)
-{
- int integer;
- spx_word16_t frac;
- integer = SHR16(x,11);
- if (integer>14)
- return 0x7fffffff;
- else if (integer < -15)
- return 0;
- frac = SHL16(x-SHL16(integer,11),3);
- frac = ADD16(D0, MULT16_16_Q14(frac, ADD16(D1, MULT16_16_Q14(frac, ADD16(D2 , MULT16_16_Q14(D3,frac))))));
- return VSHR32(EXTEND32(frac), -integer-2);
-}
-
-/* Input in Q11 format, output in Q16 */
-static SPEEX_INLINE spx_word32_t spx_exp(spx_word16_t x)
-{
- if (x>21290)
- return 0x7fffffff;
- else if (x<-21290)
- return 0;
- else
- return spx_exp2(MULT16_16_P14(23637,x));
-}
-#define M1 32767
-#define M2 -21
-#define M3 -11943
-#define M4 4936
-
-static SPEEX_INLINE spx_word16_t spx_atan01(spx_word16_t x)
-{
- return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x)))))));
-}
-
-#undef M1
-#undef M2
-#undef M3
-#undef M4
-
-/* Input in Q15, output in Q14 */
-static SPEEX_INLINE spx_word16_t spx_atan(spx_word32_t x)
-{
- if (x <= 32767)
- {
- return SHR16(spx_atan01(x),1);
- } else {
- int e = spx_ilog2(x);
- if (e>=29)
- return 25736;
- x = DIV32_16(SHL32(EXTEND32(32767),29-e), EXTRACT16(SHR32(x, e-14)));
- return SUB16(25736, SHR16(spx_atan01(x),1));
- }
-}
-#else
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif
-
-#define C1 0.9999932946f
-#define C2 -0.4999124376f
-#define C3 0.0414877472f
-#define C4 -0.0012712095f
-
-
-#define SPX_PI_2 1.5707963268
-static SPEEX_INLINE spx_word16_t spx_cos(spx_word16_t x)
-{
- if (x<SPX_PI_2)
- {
- x *= x;
- return C1 + x*(C2+x*(C3+C4*x));
- } else {
- x = M_PI-x;
- x *= x;
- return NEG16(C1 + x*(C2+x*(C3+C4*x)));
- }
-}
-
-#endif
-
-
-#endif
diff --git a/drivers/speex/mdf.c b/drivers/speex/mdf.c
deleted file mode 100644
index 1f9ff93f7..000000000
--- a/drivers/speex/mdf.c
+++ /dev/null
@@ -1,1285 +0,0 @@
-/* Copyright (C) 2003-2008 Jean-Marc Valin
-
- File: mdf.c
- Echo canceller based on the MDF algorithm (see below)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- The echo canceller is based on the MDF algorithm described in:
-
- J. S. Soo, K. K. Pang Multidelay block frequency adaptive filter,
- IEEE Trans. Acoust. Speech Signal Process., Vol. ASSP-38, No. 2,
- February 1990.
-
- We use the Alternatively Updated MDF (AUMDF) variant. Robustness to
- double-talk is achieved using a variable learning rate as described in:
-
- Valin, J.-M., On Adjusting the Learning Rate in Frequency Domain Echo
- Cancellation With Double-Talk. IEEE Transactions on Audio,
- Speech and Language Processing, Vol. 15, No. 3, pp. 1030-1034, 2007.
- http://people.xiph.org/~jm/papers/valin_taslp2006.pdf
-
- There is no explicit double-talk detection, but a continuous variation
- in the learning rate based on residual echo, double-talk and background
- noise.
-
- About the fixed-point version:
- All the signals are represented with 16-bit words. The filter weights
- are represented with 32-bit words, but only the top 16 bits are used
- in most cases. The lower 16 bits are completely unreliable (due to the
- fact that the update is done only on the top bits), but help in the
- adaptation -- probably by removing a "threshold effect" due to
- quantization (rounding going to zero) when the gradient is small.
-
- Another kludge that seems to work good: when performing the weight
- update, we only move half the way toward the "goal" this seems to
- reduce the effect of quantization noise in the update phase. This
- can be seen as applying a gradient descent on a "soft constraint"
- instead of having a hard constraint.
-
-*/
-
-
-#include "config.h"
-
-
-#include "arch.h"
-#include "speex/speex_echo.h"
-#include "fftwrap.h"
-#include "pseudofloat.h"
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#ifdef FIXED_POINT
-#define WEIGHT_SHIFT 11
-#define NORMALIZE_SCALEDOWN 5
-#define NORMALIZE_SCALEUP 3
-#else
-#define WEIGHT_SHIFT 0
-#endif
-
-#ifdef FIXED_POINT
-#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
-#else
-#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))
-#endif
-
-/* If enabled, the AEC will use a foreground filter and a background filter to be more robust to double-talk
- and difficult signals in general. The cost is an extra FFT and a matrix-vector multiply */
-#define TWO_PATH
-
-#ifdef FIXED_POINT
-static const spx_float_t MIN_LEAK = {20972, -22};
-
-/* Constants for the two-path filter */
-static const spx_float_t VAR1_SMOOTH = {23593, -16};
-static const spx_float_t VAR2_SMOOTH = {23675, -15};
-static const spx_float_t VAR1_UPDATE = {16384, -15};
-static const spx_float_t VAR2_UPDATE = {16384, -16};
-static const spx_float_t VAR_BACKTRACK = {16384, -12};
-#define TOP16(x) ((x)>>16)
-
-#else
-
-static const spx_float_t MIN_LEAK = .005f;
-
-/* Constants for the two-path filter */
-static const spx_float_t VAR1_SMOOTH = .36f;
-static const spx_float_t VAR2_SMOOTH = .7225f;
-static const spx_float_t VAR1_UPDATE = .5f;
-static const spx_float_t VAR2_UPDATE = .25f;
-static const spx_float_t VAR_BACKTRACK = 4.f;
-#define TOP16(x) (x)
-#endif
-
-
-#define PLAYBACK_DELAY 2
-
-void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *Yout, int len);
-
-
-/** Speex echo cancellation state. */
-struct SpeexEchoState_ {
- int frame_size; /**< Number of samples processed each time */
- int window_size;
- int M;
- int cancel_count;
- int adapted;
- int saturated;
- int screwed_up;
- int C; /** Number of input channels (microphones) */
- int K; /** Number of output channels (loudspeakers) */
- spx_int32_t sampling_rate;
- spx_word16_t spec_average;
- spx_word16_t beta0;
- spx_word16_t beta_max;
- spx_word32_t sum_adapt;
- spx_word16_t leak_estimate;
-
- spx_word16_t *e; /* scratch */
- spx_word16_t *x; /* Far-end input buffer (2N) */
- spx_word16_t *X; /* Far-end buffer (M+1 frames) in frequency domain */
- spx_word16_t *input; /* scratch */
- spx_word16_t *y; /* scratch */
- spx_word16_t *last_y;
- spx_word16_t *Y; /* scratch */
- spx_word16_t *E;
- spx_word32_t *PHI; /* scratch */
- spx_word32_t *W; /* (Background) filter weights */
-#ifdef TWO_PATH
- spx_word16_t *foreground; /* Foreground filter weights */
- spx_word32_t Davg1; /* 1st recursive average of the residual power difference */
- spx_word32_t Davg2; /* 2nd recursive average of the residual power difference */
- spx_float_t Dvar1; /* Estimated variance of 1st estimator */
- spx_float_t Dvar2; /* Estimated variance of 2nd estimator */
-#endif
- spx_word32_t *power; /* Power of the far-end signal */
- spx_float_t *power_1;/* Inverse power of far-end */
- spx_word16_t *wtmp; /* scratch */
-#ifdef FIXED_POINT
- spx_word16_t *wtmp2; /* scratch */
-#endif
- spx_word32_t *Rf; /* scratch */
- spx_word32_t *Yf; /* scratch */
- spx_word32_t *Xf; /* scratch */
- spx_word32_t *Eh;
- spx_word32_t *Yh;
- spx_float_t Pey;
- spx_float_t Pyy;
- spx_word16_t *window;
- spx_word16_t *prop;
- void *fft_table;
- spx_word16_t *memX, *memD, *memE;
- spx_word16_t preemph;
- spx_word16_t notch_radius;
- spx_mem_t *notch_mem;
-
- /* NOTE: If you only use speex_echo_cancel() and want to save some memory, remove this */
- spx_int16_t *play_buf;
- int play_buf_pos;
- int play_buf_started;
-};
-
-static SPEEX_INLINE void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, spx_word16_t *out, int len, spx_mem_t *mem, int stride)
-{
- int i;
- spx_word16_t den2;
-#ifdef FIXED_POINT
- den2 = MULT16_16_Q15(radius,radius) + MULT16_16_Q15(QCONST16(.7,15),MULT16_16_Q15(32767-radius,32767-radius));
-#else
- den2 = radius*radius + .7*(1-radius)*(1-radius);
-#endif
- /*printf ("%d %d %d %d %d %d\n", num[0], num[1], num[2], den[0], den[1], den[2]);*/
- for (i=0;i<len;i++)
- {
- spx_word16_t vin = in[i*stride];
- spx_word32_t vout = mem[0] + SHL32(EXTEND32(vin),15);
-#ifdef FIXED_POINT
- mem[0] = mem[1] + SHL32(SHL32(-EXTEND32(vin),15) + MULT16_32_Q15(radius,vout),1);
-#else
- mem[0] = mem[1] + 2*(-vin + radius*vout);
-#endif
- mem[1] = SHL32(EXTEND32(vin),15) - MULT16_32_Q15(den2,vout);
- out[i] = SATURATE32(PSHR32(MULT16_32_Q15(radius,vout),15),32767);
- }
-}
-
-/* This inner product is slightly different from the codec version because of fixed-point */
-static SPEEX_INLINE spx_word32_t mdf_inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
-{
- spx_word32_t sum=0;
- len >>= 1;
- while(len--)
- {
- spx_word32_t part=0;
- part = MAC16_16(part,*x++,*y++);
- part = MAC16_16(part,*x++,*y++);
- /* HINT: If you had a 40-bit accumulator, you could shift only at the end */
- sum = ADD32(sum,SHR32(part,6));
- }
- return sum;
-}
-
-/** Compute power spectrum of a half-complex (packed) vector */
-static SPEEX_INLINE void power_spectrum(const spx_word16_t *X, spx_word32_t *ps, int N)
-{
- int i, j;
- ps[0]=MULT16_16(X[0],X[0]);
- for (i=1,j=1;i<N-1;i+=2,j++)
- {
- ps[j] = MULT16_16(X[i],X[i]) + MULT16_16(X[i+1],X[i+1]);
- }
- ps[j]=MULT16_16(X[i],X[i]);
-}
-
-/** Compute power spectrum of a half-complex (packed) vector and accumulate */
-static SPEEX_INLINE void power_spectrum_accum(const spx_word16_t *X, spx_word32_t *ps, int N)
-{
- int i, j;
- ps[0]+=MULT16_16(X[0],X[0]);
- for (i=1,j=1;i<N-1;i+=2,j++)
- {
- ps[j] += MULT16_16(X[i],X[i]) + MULT16_16(X[i+1],X[i+1]);
- }
- ps[j]+=MULT16_16(X[i],X[i]);
-}
-
-/** Compute cross-power spectrum of a half-complex (packed) vectors and add to acc */
-#ifdef FIXED_POINT
-static SPEEX_INLINE void spectral_mul_accum(const spx_word16_t *X, const spx_word32_t *Y, spx_word16_t *acc, int N, int M)
-{
- int i,j;
- spx_word32_t tmp1=0,tmp2=0;
- for (j=0;j<M;j++)
- {
- tmp1 = MAC16_16(tmp1, X[j*N],TOP16(Y[j*N]));
- }
- acc[0] = PSHR32(tmp1,WEIGHT_SHIFT);
- for (i=1;i<N-1;i+=2)
- {
- tmp1 = tmp2 = 0;
- for (j=0;j<M;j++)
- {
- tmp1 = SUB32(MAC16_16(tmp1, X[j*N+i],TOP16(Y[j*N+i])), MULT16_16(X[j*N+i+1],TOP16(Y[j*N+i+1])));
- tmp2 = MAC16_16(MAC16_16(tmp2, X[j*N+i+1],TOP16(Y[j*N+i])), X[j*N+i], TOP16(Y[j*N+i+1]));
- }
- acc[i] = PSHR32(tmp1,WEIGHT_SHIFT);
- acc[i+1] = PSHR32(tmp2,WEIGHT_SHIFT);
- }
- tmp1 = tmp2 = 0;
- for (j=0;j<M;j++)
- {
- tmp1 = MAC16_16(tmp1, X[(j+1)*N-1],TOP16(Y[(j+1)*N-1]));
- }
- acc[N-1] = PSHR32(tmp1,WEIGHT_SHIFT);
-}
-static SPEEX_INLINE void spectral_mul_accum16(const spx_word16_t *X, const spx_word16_t *Y, spx_word16_t *acc, int N, int M)
-{
- int i,j;
- spx_word32_t tmp1=0,tmp2=0;
- for (j=0;j<M;j++)
- {
- tmp1 = MAC16_16(tmp1, X[j*N],Y[j*N]);
- }
- acc[0] = PSHR32(tmp1,WEIGHT_SHIFT);
- for (i=1;i<N-1;i+=2)
- {
- tmp1 = tmp2 = 0;
- for (j=0;j<M;j++)
- {
- tmp1 = SUB32(MAC16_16(tmp1, X[j*N+i],Y[j*N+i]), MULT16_16(X[j*N+i+1],Y[j*N+i+1]));
- tmp2 = MAC16_16(MAC16_16(tmp2, X[j*N+i+1],Y[j*N+i]), X[j*N+i], Y[j*N+i+1]);
- }
- acc[i] = PSHR32(tmp1,WEIGHT_SHIFT);
- acc[i+1] = PSHR32(tmp2,WEIGHT_SHIFT);
- }
- tmp1 = tmp2 = 0;
- for (j=0;j<M;j++)
- {
- tmp1 = MAC16_16(tmp1, X[(j+1)*N-1],Y[(j+1)*N-1]);
- }
- acc[N-1] = PSHR32(tmp1,WEIGHT_SHIFT);
-}
-
-#else
-static SPEEX_INLINE void spectral_mul_accum(const spx_word16_t *X, const spx_word32_t *Y, spx_word16_t *acc, int N, int M)
-{
- int i,j;
- for (i=0;i<N;i++)
- acc[i] = 0;
- for (j=0;j<M;j++)
- {
- acc[0] += X[0]*Y[0];
- for (i=1;i<N-1;i+=2)
- {
- acc[i] += (X[i]*Y[i] - X[i+1]*Y[i+1]);
- acc[i+1] += (X[i+1]*Y[i] + X[i]*Y[i+1]);
- }
- acc[i] += X[i]*Y[i];
- X += N;
- Y += N;
- }
-}
-#define spectral_mul_accum16 spectral_mul_accum
-#endif
-
-/** Compute weighted cross-power spectrum of a half-complex (packed) vector with conjugate */
-static SPEEX_INLINE void weighted_spectral_mul_conj(const spx_float_t *w, const spx_float_t p, const spx_word16_t *X, const spx_word16_t *Y, spx_word32_t *prod, int N)
-{
- int i, j;
- spx_float_t W;
- W = FLOAT_AMULT(p, w[0]);
- prod[0] = FLOAT_MUL32(W,MULT16_16(X[0],Y[0]));
- for (i=1,j=1;i<N-1;i+=2,j++)
- {
- W = FLOAT_AMULT(p, w[j]);
- prod[i] = FLOAT_MUL32(W,MAC16_16(MULT16_16(X[i],Y[i]), X[i+1],Y[i+1]));
- prod[i+1] = FLOAT_MUL32(W,MAC16_16(MULT16_16(-X[i+1],Y[i]), X[i],Y[i+1]));
- }
- W = FLOAT_AMULT(p, w[j]);
- prod[i] = FLOAT_MUL32(W,MULT16_16(X[i],Y[i]));
-}
-
-static SPEEX_INLINE void mdf_adjust_prop(const spx_word32_t *W, int N, int M, int P, spx_word16_t *prop)
-{
- int i, j, p;
- spx_word16_t max_sum = 1;
- spx_word32_t prop_sum = 1;
- for (i=0;i<M;i++)
- {
- spx_word32_t tmp = 1;
- for (p=0;p<P;p++)
- for (j=0;j<N;j++)
- tmp += MULT16_16(EXTRACT16(SHR32(W[p*N*M + i*N+j],18)), EXTRACT16(SHR32(W[p*N*M + i*N+j],18)));
-#ifdef FIXED_POINT
- /* Just a security in case an overflow were to occur */
- tmp = MIN32(ABS32(tmp), 536870912);
-#endif
- prop[i] = spx_sqrt(tmp);
- if (prop[i] > max_sum)
- max_sum = prop[i];
- }
- for (i=0;i<M;i++)
- {
- prop[i] += MULT16_16_Q15(QCONST16(.1f,15),max_sum);
- prop_sum += EXTEND32(prop[i]);
- }
- for (i=0;i<M;i++)
- {
- prop[i] = DIV32(MULT16_16(QCONST16(.99f,15), prop[i]),prop_sum);
- /*printf ("%f ", prop[i]);*/
- }
- /*printf ("\n");*/
-}
-
-#ifdef DUMP_ECHO_CANCEL_DATA
-#include <stdio.h>
-static FILE *rFile=NULL, *pFile=NULL, *oFile=NULL;
-
-static void dump_audio(const spx_int16_t *rec, const spx_int16_t *play, const spx_int16_t *out, int len)
-{
- if (!(rFile && pFile && oFile))
- {
- speex_fatal("Dump files not open");
- }
- fwrite(rec, sizeof(spx_int16_t), len, rFile);
- fwrite(play, sizeof(spx_int16_t), len, pFile);
- fwrite(out, sizeof(spx_int16_t), len, oFile);
-}
-#endif
-
-/** Creates a new echo canceller state */
-EXPORT SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length)
-{
- return speex_echo_state_init_mc(frame_size, filter_length, 1, 1);
-}
-
-EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers)
-{
- int i,N,M, C, K;
- SpeexEchoState *st = (SpeexEchoState *)speex_alloc(sizeof(SpeexEchoState));
-
- st->K = nb_speakers;
- st->C = nb_mic;
- C=st->C;
- K=st->K;
-#ifdef DUMP_ECHO_CANCEL_DATA
- if (rFile || pFile || oFile)
- speex_fatal("Opening dump files twice");
- rFile = fopen("aec_rec.sw", "wb");
- pFile = fopen("aec_play.sw", "wb");
- oFile = fopen("aec_out.sw", "wb");
-#endif
-
- st->frame_size = frame_size;
- st->window_size = 2*frame_size;
- N = st->window_size;
- M = st->M = (filter_length+st->frame_size-1)/frame_size;
- st->cancel_count=0;
- st->sum_adapt = 0;
- st->saturated = 0;
- st->screwed_up = 0;
- /* This is the default sampling rate */
- st->sampling_rate = 8000;
- st->spec_average = DIV32_16(SHL32(EXTEND32(st->frame_size), 15), st->sampling_rate);
-#ifdef FIXED_POINT
- st->beta0 = DIV32_16(SHL32(EXTEND32(st->frame_size), 16), st->sampling_rate);
- st->beta_max = DIV32_16(SHL32(EXTEND32(st->frame_size), 14), st->sampling_rate);
-#else
- st->beta0 = (2.0f*st->frame_size)/st->sampling_rate;
- st->beta_max = (.5f*st->frame_size)/st->sampling_rate;
-#endif
- st->leak_estimate = 0;
-
- st->fft_table = spx_fft_init(N);
-
- st->e = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
- st->x = (spx_word16_t*)speex_alloc(K*N*sizeof(spx_word16_t));
- st->input = (spx_word16_t*)speex_alloc(C*st->frame_size*sizeof(spx_word16_t));
- st->y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
- st->last_y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
- st->Yf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
- st->Rf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
- st->Xf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
- st->Yh = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
- st->Eh = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t));
-
- st->X = (spx_word16_t*)speex_alloc(K*(M+1)*N*sizeof(spx_word16_t));
- st->Y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
- st->E = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
- st->W = (spx_word32_t*)speex_alloc(C*K*M*N*sizeof(spx_word32_t));
-#ifdef TWO_PATH
- st->foreground = (spx_word16_t*)speex_alloc(M*N*C*K*sizeof(spx_word16_t));
-#endif
- st->PHI = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
- st->power = (spx_word32_t*)speex_alloc((frame_size+1)*sizeof(spx_word32_t));
- st->power_1 = (spx_float_t*)speex_alloc((frame_size+1)*sizeof(spx_float_t));
- st->window = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
- st->prop = (spx_word16_t*)speex_alloc(M*sizeof(spx_word16_t));
- st->wtmp = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
-#ifdef FIXED_POINT
- st->wtmp2 = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t));
- for (i=0;i<N>>1;i++)
- {
- st->window[i] = (16383-SHL16(spx_cos(DIV32_16(MULT16_16(25736,i<<1),N)),1));
- st->window[N-i-1] = st->window[i];
- }
-#else
- for (i=0;i<N;i++)
- st->window[i] = .5-.5*cos(2*M_PI*i/N);
-#endif
- for (i=0;i<=st->frame_size;i++)
- st->power_1[i] = FLOAT_ONE;
- for (i=0;i<N*M*K*C;i++)
- st->W[i] = 0;
- {
- spx_word32_t sum = 0;
- /* Ratio of ~10 between adaptation rate of first and last block */
- spx_word16_t decay = SHR32(spx_exp(NEG16(DIV32_16(QCONST16(2.4,11),M))),1);
- st->prop[0] = QCONST16(.7, 15);
- sum = EXTEND32(st->prop[0]);
- for (i=1;i<M;i++)
- {
- st->prop[i] = MULT16_16_Q15(st->prop[i-1], decay);
- sum = ADD32(sum, EXTEND32(st->prop[i]));
- }
- for (i=M-1;i>=0;i--)
- {
- st->prop[i] = DIV32(MULT16_16(QCONST16(.8f,15), st->prop[i]),sum);
- }
- }
-
- st->memX = (spx_word16_t*)speex_alloc(K*sizeof(spx_word16_t));
- st->memD = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t));
- st->memE = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t));
- st->preemph = QCONST16(.9,15);
- if (st->sampling_rate<12000)
- st->notch_radius = QCONST16(.9, 15);
- else if (st->sampling_rate<24000)
- st->notch_radius = QCONST16(.982, 15);
- else
- st->notch_radius = QCONST16(.992, 15);
-
- st->notch_mem = (spx_mem_t*)speex_alloc(2*C*sizeof(spx_mem_t));
- st->adapted = 0;
- st->Pey = st->Pyy = FLOAT_ONE;
-
-#ifdef TWO_PATH
- st->Davg1 = st->Davg2 = 0;
- st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
-#endif
-
- st->play_buf = (spx_int16_t*)speex_alloc(K*(PLAYBACK_DELAY+1)*st->frame_size*sizeof(spx_int16_t));
- st->play_buf_pos = PLAYBACK_DELAY*st->frame_size;
- st->play_buf_started = 0;
-
- return st;
-}
-
-/** Resets echo canceller state */
-EXPORT void speex_echo_state_reset(SpeexEchoState *st)
-{
- int i, M, N, C, K;
- st->cancel_count=0;
- st->screwed_up = 0;
- N = st->window_size;
- M = st->M;
- C=st->C;
- K=st->K;
- for (i=0;i<N*M;i++)
- st->W[i] = 0;
-#ifdef TWO_PATH
- for (i=0;i<N*M;i++)
- st->foreground[i] = 0;
-#endif
- for (i=0;i<N*(M+1);i++)
- st->X[i] = 0;
- for (i=0;i<=st->frame_size;i++)
- {
- st->power[i] = 0;
- st->power_1[i] = FLOAT_ONE;
- st->Eh[i] = 0;
- st->Yh[i] = 0;
- }
- for (i=0;i<st->frame_size;i++)
- {
- st->last_y[i] = 0;
- }
- for (i=0;i<N*C;i++)
- {
- st->E[i] = 0;
- }
- for (i=0;i<N*K;i++)
- {
- st->x[i] = 0;
- }
- for (i=0;i<2*C;i++)
- st->notch_mem[i] = 0;
- for (i=0;i<C;i++)
- st->memD[i]=st->memE[i]=0;
- for (i=0;i<K;i++)
- st->memX[i]=0;
-
- st->saturated = 0;
- st->adapted = 0;
- st->sum_adapt = 0;
- st->Pey = st->Pyy = FLOAT_ONE;
-#ifdef TWO_PATH
- st->Davg1 = st->Davg2 = 0;
- st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
-#endif
- for (i=0;i<3*st->frame_size;i++)
- st->play_buf[i] = 0;
- st->play_buf_pos = PLAYBACK_DELAY*st->frame_size;
- st->play_buf_started = 0;
-
-}
-
-/** Destroys an echo canceller state */
-EXPORT void speex_echo_state_destroy(SpeexEchoState *st)
-{
- spx_fft_destroy(st->fft_table);
-
- speex_free(st->e);
- speex_free(st->x);
- speex_free(st->input);
- speex_free(st->y);
- speex_free(st->last_y);
- speex_free(st->Yf);
- speex_free(st->Rf);
- speex_free(st->Xf);
- speex_free(st->Yh);
- speex_free(st->Eh);
-
- speex_free(st->X);
- speex_free(st->Y);
- speex_free(st->E);
- speex_free(st->W);
-#ifdef TWO_PATH
- speex_free(st->foreground);
-#endif
- speex_free(st->PHI);
- speex_free(st->power);
- speex_free(st->power_1);
- speex_free(st->window);
- speex_free(st->prop);
- speex_free(st->wtmp);
-#ifdef FIXED_POINT
- speex_free(st->wtmp2);
-#endif
- speex_free(st->memX);
- speex_free(st->memD);
- speex_free(st->memE);
- speex_free(st->notch_mem);
-
- speex_free(st->play_buf);
- speex_free(st);
-
-#ifdef DUMP_ECHO_CANCEL_DATA
- fclose(rFile);
- fclose(pFile);
- fclose(oFile);
- rFile = pFile = oFile = NULL;
-#endif
-}
-
-EXPORT void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out)
-{
- int i;
- /*speex_warning_int("capture with fill level ", st->play_buf_pos/st->frame_size);*/
- st->play_buf_started = 1;
- if (st->play_buf_pos>=st->frame_size)
- {
- speex_echo_cancellation(st, rec, st->play_buf, out);
- st->play_buf_pos -= st->frame_size;
- for (i=0;i<st->play_buf_pos;i++)
- st->play_buf[i] = st->play_buf[i+st->frame_size];
- } else {
- speex_warning("No playback frame available (your application is buggy and/or got xruns)");
- if (st->play_buf_pos!=0)
- {
- speex_warning("internal playback buffer corruption?");
- st->play_buf_pos = 0;
- }
- for (i=0;i<st->frame_size;i++)
- out[i] = rec[i];
- }
-}
-
-EXPORT void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play)
-{
- /*speex_warning_int("playback with fill level ", st->play_buf_pos/st->frame_size);*/
- if (!st->play_buf_started)
- {
- speex_warning("discarded first playback frame");
- return;
- }
- if (st->play_buf_pos<=PLAYBACK_DELAY*st->frame_size)
- {
- int i;
- for (i=0;i<st->frame_size;i++)
- st->play_buf[st->play_buf_pos+i] = play[i];
- st->play_buf_pos += st->frame_size;
- if (st->play_buf_pos <= (PLAYBACK_DELAY-1)*st->frame_size)
- {
- speex_warning("Auto-filling the buffer (your application is buggy and/or got xruns)");
- for (i=0;i<st->frame_size;i++)
- st->play_buf[st->play_buf_pos+i] = play[i];
- st->play_buf_pos += st->frame_size;
- }
- } else {
- speex_warning("Had to discard a playback frame (your application is buggy and/or got xruns)");
- }
-}
-
-/** Performs echo cancellation on a frame (deprecated, last arg now ignored) */
-EXPORT void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out, spx_int32_t *Yout)
-{
- speex_echo_cancellation(st, in, far_end, out);
-}
-
-/** Performs echo cancellation on a frame */
-EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out)
-{
- int i,j, chan, speak;
- int N,M, C, K;
- spx_word32_t Syy,See,Sxx,Sdd, Sff;
-#ifdef TWO_PATH
- spx_word32_t Dbf;
- int update_foreground;
-#endif
- spx_word32_t Sey;
- spx_word16_t ss, ss_1;
- spx_float_t Pey = FLOAT_ONE, Pyy=FLOAT_ONE;
- spx_float_t alpha, alpha_1;
- spx_word16_t RER;
- spx_word32_t tmp32;
-
- N = st->window_size;
- M = st->M;
- C = st->C;
- K = st->K;
-
- st->cancel_count++;
-#ifdef FIXED_POINT
- ss=DIV32_16(11469,M);
- ss_1 = SUB16(32767,ss);
-#else
- ss=.35/M;
- ss_1 = 1-ss;
-#endif
-
- for (chan = 0; chan < C; chan++)
- {
- /* Apply a notch filter to make sure DC doesn't end up causing problems */
- filter_dc_notch16(in+chan, st->notch_radius, st->input+chan*st->frame_size, st->frame_size, st->notch_mem+2*chan, C);
- /* Copy input data to buffer and apply pre-emphasis */
- /* Copy input data to buffer */
- for (i=0;i<st->frame_size;i++)
- {
- spx_word32_t tmp32;
- /* FIXME: This core has changed a bit, need to merge properly */
- tmp32 = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(MULT16_16_P15(st->preemph, st->memD[chan])));
-#ifdef FIXED_POINT
- if (tmp32 > 32767)
- {
- tmp32 = 32767;
- if (st->saturated == 0)
- st->saturated = 1;
- }
- if (tmp32 < -32767)
- {
- tmp32 = -32767;
- if (st->saturated == 0)
- st->saturated = 1;
- }
-#endif
- st->memD[chan] = st->input[chan*st->frame_size+i];
- st->input[chan*st->frame_size+i] = EXTRACT16(tmp32);
- }
- }
-
- for (speak = 0; speak < K; speak++)
- {
- for (i=0;i<st->frame_size;i++)
- {
- spx_word32_t tmp32;
- st->x[speak*N+i] = st->x[speak*N+i+st->frame_size];
- tmp32 = SUB32(EXTEND32(far_end[i*K+speak]), EXTEND32(MULT16_16_P15(st->preemph, st->memX[speak])));
-#ifdef FIXED_POINT
- /*FIXME: If saturation occurs here, we need to freeze adaptation for M frames (not just one) */
- if (tmp32 > 32767)
- {
- tmp32 = 32767;
- st->saturated = M+1;
- }
- if (tmp32 < -32767)
- {
- tmp32 = -32767;
- st->saturated = M+1;
- }
-#endif
- st->x[speak*N+i+st->frame_size] = EXTRACT16(tmp32);
- st->memX[speak] = far_end[i*K+speak];
- }
- }
-
- for (speak = 0; speak < K; speak++)
- {
- /* Shift memory: this could be optimized eventually*/
- for (j=M-1;j>=0;j--)
- {
- for (i=0;i<N;i++)
- st->X[(j+1)*N*K+speak*N+i] = st->X[j*N*K+speak*N+i];
- }
- /* Convert x (echo input) to frequency domain */
- spx_fft(st->fft_table, st->x+speak*N, &st->X[speak*N]);
- }
-
- Sxx = 0;
- for (speak = 0; speak < K; speak++)
- {
- Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size);
- power_spectrum_accum(st->X+speak*N, st->Xf, N);
- }
-
- Sff = 0;
- for (chan = 0; chan < C; chan++)
- {
-#ifdef TWO_PATH
- /* Compute foreground filter */
- spectral_mul_accum16(st->X, st->foreground+chan*N*K*M, st->Y+chan*N, N, M*K);
- spx_ifft(st->fft_table, st->Y+chan*N, st->e+chan*N);
- for (i=0;i<st->frame_size;i++)
- st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->e[chan*N+i+st->frame_size]);
- Sff += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
-#endif
- }
-
- /* Adjust proportional adaption rate */
- /* FIXME: Adjust that for C, K*/
- if (st->adapted)
- mdf_adjust_prop (st->W, N, M, C*K, st->prop);
- /* Compute weight gradient */
- if (st->saturated == 0)
- {
- for (chan = 0; chan < C; chan++)
- {
- for (speak = 0; speak < K; speak++)
- {
- for (j=M-1;j>=0;j--)
- {
- weighted_spectral_mul_conj(st->power_1, FLOAT_SHL(PSEUDOFLOAT(st->prop[j]),-15), &st->X[(j+1)*N*K+speak*N], st->E+chan*N, st->PHI, N);
- for (i=0;i<N;i++)
- st->W[chan*N*K*M + j*N*K + speak*N + i] += st->PHI[i];
- }
- }
- }
- } else {
- st->saturated--;
- }
-
- /* FIXME: MC conversion required */
- /* Update weight to prevent circular convolution (MDF / AUMDF) */
- for (chan = 0; chan < C; chan++)
- {
- for (speak = 0; speak < K; speak++)
- {
- for (j=0;j<M;j++)
- {
- /* This is a variant of the Alternatively Updated MDF (AUMDF) */
- /* Remove the "if" to make this an MDF filter */
- if (j==0 || st->cancel_count%(M-1) == j-1)
- {
-#ifdef FIXED_POINT
- for (i=0;i<N;i++)
- st->wtmp2[i] = EXTRACT16(PSHR32(st->W[chan*N*K*M + j*N*K + speak*N + i],NORMALIZE_SCALEDOWN+16));
- spx_ifft(st->fft_table, st->wtmp2, st->wtmp);
- for (i=0;i<st->frame_size;i++)
- {
- st->wtmp[i]=0;
- }
- for (i=st->frame_size;i<N;i++)
- {
- st->wtmp[i]=SHL16(st->wtmp[i],NORMALIZE_SCALEUP);
- }
- spx_fft(st->fft_table, st->wtmp, st->wtmp2);
- /* The "-1" in the shift is a sort of kludge that trades less efficient update speed for decrease noise */
- for (i=0;i<N;i++)
- st->W[chan*N*K*M + j*N*K + speak*N + i] -= SHL32(EXTEND32(st->wtmp2[i]),16+NORMALIZE_SCALEDOWN-NORMALIZE_SCALEUP-1);
-#else
- spx_ifft(st->fft_table, &st->W[chan*N*K*M + j*N*K + speak*N], st->wtmp);
- for (i=st->frame_size;i<N;i++)
- {
- st->wtmp[i]=0;
- }
- spx_fft(st->fft_table, st->wtmp, &st->W[chan*N*K*M + j*N*K + speak*N]);
-#endif
- }
- }
- }
- }
-
- /* So we can use power_spectrum_accum */
- for (i=0;i<=st->frame_size;i++)
- st->Rf[i] = st->Yf[i] = st->Xf[i] = 0;
-
- Dbf = 0;
- See = 0;
-#ifdef TWO_PATH
- /* Difference in response, this is used to estimate the variance of our residual power estimate */
- for (chan = 0; chan < C; chan++)
- {
- spectral_mul_accum(st->X, st->W+chan*N*K*M, st->Y+chan*N, N, M*K);
- spx_ifft(st->fft_table, st->Y+chan*N, st->y+chan*N);
- for (i=0;i<st->frame_size;i++)
- st->e[chan*N+i] = SUB16(st->e[chan*N+i+st->frame_size], st->y[chan*N+i+st->frame_size]);
- Dbf += 10+mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
- for (i=0;i<st->frame_size;i++)
- st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]);
- See += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
- }
-#endif
-
-#ifndef TWO_PATH
- Sff = See;
-#endif
-
-#ifdef TWO_PATH
- /* Logic for updating the foreground filter */
-
- /* For two time windows, compute the mean of the energy difference, as well as the variance */
- st->Davg1 = ADD32(MULT16_32_Q15(QCONST16(.6f,15),st->Davg1), MULT16_32_Q15(QCONST16(.4f,15),SUB32(Sff,See)));
- st->Davg2 = ADD32(MULT16_32_Q15(QCONST16(.85f,15),st->Davg2), MULT16_32_Q15(QCONST16(.15f,15),SUB32(Sff,See)));
- st->Dvar1 = FLOAT_ADD(FLOAT_MULT(VAR1_SMOOTH, st->Dvar1), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.4f,15),Sff), MULT16_32_Q15(QCONST16(.4f,15),Dbf)));
- st->Dvar2 = FLOAT_ADD(FLOAT_MULT(VAR2_SMOOTH, st->Dvar2), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.15f,15),Sff), MULT16_32_Q15(QCONST16(.15f,15),Dbf)));
-
- /* Equivalent float code:
- st->Davg1 = .6*st->Davg1 + .4*(Sff-See);
- st->Davg2 = .85*st->Davg2 + .15*(Sff-See);
- st->Dvar1 = .36*st->Dvar1 + .16*Sff*Dbf;
- st->Dvar2 = .7225*st->Dvar2 + .0225*Sff*Dbf;
- */
-
- update_foreground = 0;
- /* Check if we have a statistically significant reduction in the residual echo */
- /* Note that this is *not* Gaussian, so we need to be careful about the longer tail */
- if (FLOAT_GT(FLOAT_MUL32U(SUB32(Sff,See),ABS32(SUB32(Sff,See))), FLOAT_MUL32U(Sff,Dbf)))
- update_foreground = 1;
- else if (FLOAT_GT(FLOAT_MUL32U(st->Davg1, ABS32(st->Davg1)), FLOAT_MULT(VAR1_UPDATE,(st->Dvar1))))
- update_foreground = 1;
- else if (FLOAT_GT(FLOAT_MUL32U(st->Davg2, ABS32(st->Davg2)), FLOAT_MULT(VAR2_UPDATE,(st->Dvar2))))
- update_foreground = 1;
-
- /* Do we update? */
- if (update_foreground)
- {
- st->Davg1 = st->Davg2 = 0;
- st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
- /* Copy background filter to foreground filter */
- for (i=0;i<N*M*C*K;i++)
- st->foreground[i] = EXTRACT16(PSHR32(st->W[i],16));
- /* Apply a smooth transition so as to not introduce blocking artifacts */
- for (chan = 0; chan < C; chan++)
- for (i=0;i<st->frame_size;i++)
- st->e[chan*N+i+st->frame_size] = MULT16_16_Q15(st->window[i+st->frame_size],st->e[chan*N+i+st->frame_size]) + MULT16_16_Q15(st->window[i],st->y[chan*N+i+st->frame_size]);
- } else {
- int reset_background=0;
- /* Otherwise, check if the background filter is significantly worse */
- if (FLOAT_GT(FLOAT_MUL32U(NEG32(SUB32(Sff,See)),ABS32(SUB32(Sff,See))), FLOAT_MULT(VAR_BACKTRACK,FLOAT_MUL32U(Sff,Dbf))))
- reset_background = 1;
- if (FLOAT_GT(FLOAT_MUL32U(NEG32(st->Davg1), ABS32(st->Davg1)), FLOAT_MULT(VAR_BACKTRACK,st->Dvar1)))
- reset_background = 1;
- if (FLOAT_GT(FLOAT_MUL32U(NEG32(st->Davg2), ABS32(st->Davg2)), FLOAT_MULT(VAR_BACKTRACK,st->Dvar2)))
- reset_background = 1;
- if (reset_background)
- {
- /* Copy foreground filter to background filter */
- for (i=0;i<N*M*C*K;i++)
- st->W[i] = SHL32(EXTEND32(st->foreground[i]),16);
- /* We also need to copy the output so as to get correct adaptation */
- for (chan = 0; chan < C; chan++)
- {
- for (i=0;i<st->frame_size;i++)
- st->y[chan*N+i+st->frame_size] = st->e[chan*N+i+st->frame_size];
- for (i=0;i<st->frame_size;i++)
- st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]);
- }
- See = Sff;
- st->Davg1 = st->Davg2 = 0;
- st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
- }
- }
-#endif
-
- Sey = Syy = Sdd = 0;
- for (chan = 0; chan < C; chan++)
- {
- /* Compute error signal (for the output with de-emphasis) */
- for (i=0;i<st->frame_size;i++)
- {
- spx_word32_t tmp_out;
-#ifdef TWO_PATH
- tmp_out = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(st->e[chan*N+i+st->frame_size]));
-#else
- tmp_out = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(st->y[chan*N+i+st->frame_size]));
-#endif
- tmp_out = ADD32(tmp_out, EXTEND32(MULT16_16_P15(st->preemph, st->memE[chan])));
- /* This is an arbitrary test for saturation in the microphone signal */
- if (in[i*C+chan] <= -32000 || in[i*C+chan] >= 32000)
- {
- if (st->saturated == 0)
- st->saturated = 1;
- }
- out[i*C+chan] = WORD2INT(tmp_out);
- st->memE[chan] = tmp_out;
- }
-
-#ifdef DUMP_ECHO_CANCEL_DATA
- dump_audio(in, far_end, out, st->frame_size);
-#endif
-
- /* Compute error signal (filter update version) */
- for (i=0;i<st->frame_size;i++)
- {
- st->e[chan*N+i+st->frame_size] = st->e[chan*N+i];
- st->e[chan*N+i] = 0;
- }
-
- /* Compute a bunch of correlations */
- /* FIXME: bad merge */
- Sey += mdf_inner_prod(st->e+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size);
- Syy += mdf_inner_prod(st->y+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size);
- Sdd += mdf_inner_prod(st->input+chan*st->frame_size, st->input+chan*st->frame_size, st->frame_size);
-
- /* Convert error to frequency domain */
- spx_fft(st->fft_table, st->e+chan*N, st->E+chan*N);
- for (i=0;i<st->frame_size;i++)
- st->y[i+chan*N] = 0;
- spx_fft(st->fft_table, st->y+chan*N, st->Y+chan*N);
-
- /* Compute power spectrum of echo (X), error (E) and filter response (Y) */
- power_spectrum_accum(st->E+chan*N, st->Rf, N);
- power_spectrum_accum(st->Y+chan*N, st->Yf, N);
-
- }
-
- /*printf ("%f %f %f %f\n", Sff, See, Syy, Sdd, st->update_cond);*/
-
- /* Do some sanity check */
- if (!(Syy>=0 && Sxx>=0 && See >= 0)
-#ifndef FIXED_POINT
- || !(Sff < N*1e9 && Syy < N*1e9 && Sxx < N*1e9)
-#endif
- )
- {
- /* Things have gone really bad */
- st->screwed_up += 50;
- for (i=0;i<st->frame_size*C;i++)
- out[i] = 0;
- } else if (SHR32(Sff, 2) > ADD32(Sdd, SHR32(MULT16_16(N, 10000),6)))
- {
- /* AEC seems to add lots of echo instead of removing it, let's see if it will improve */
- st->screwed_up++;
- } else {
- /* Everything's fine */
- st->screwed_up=0;
- }
- if (st->screwed_up>=50)
- {
- speex_warning("The echo canceller started acting funny and got slapped (reset). It swears it will behave now.");
- speex_echo_state_reset(st);
- return;
- }
-
- /* Add a small noise floor to make sure not to have problems when dividing */
- See = MAX32(See, SHR32(MULT16_16(N, 100),6));
-
- for (speak = 0; speak < K; speak++)
- {
- Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size);
- power_spectrum_accum(st->X+speak*N, st->Xf, N);
- }
-
-
- /* Smooth far end energy estimate over time */
- for (j=0;j<=st->frame_size;j++)
- st->power[j] = MULT16_32_Q15(ss_1,st->power[j]) + 1 + MULT16_32_Q15(ss,st->Xf[j]);
-
- /* Compute filtered spectra and (cross-)correlations */
- for (j=st->frame_size;j>=0;j--)
- {
- spx_float_t Eh, Yh;
- Eh = PSEUDOFLOAT(st->Rf[j] - st->Eh[j]);
- Yh = PSEUDOFLOAT(st->Yf[j] - st->Yh[j]);
- Pey = FLOAT_ADD(Pey,FLOAT_MULT(Eh,Yh));
- Pyy = FLOAT_ADD(Pyy,FLOAT_MULT(Yh,Yh));
-#ifdef FIXED_POINT
- st->Eh[j] = MAC16_32_Q15(MULT16_32_Q15(SUB16(32767,st->spec_average),st->Eh[j]), st->spec_average, st->Rf[j]);
- st->Yh[j] = MAC16_32_Q15(MULT16_32_Q15(SUB16(32767,st->spec_average),st->Yh[j]), st->spec_average, st->Yf[j]);
-#else
- st->Eh[j] = (1-st->spec_average)*st->Eh[j] + st->spec_average*st->Rf[j];
- st->Yh[j] = (1-st->spec_average)*st->Yh[j] + st->spec_average*st->Yf[j];
-#endif
- }
-
- Pyy = FLOAT_SQRT(Pyy);
- Pey = FLOAT_DIVU(Pey,Pyy);
-
- /* Compute correlation updatete rate */
- tmp32 = MULT16_32_Q15(st->beta0,Syy);
- if (tmp32 > MULT16_32_Q15(st->beta_max,See))
- tmp32 = MULT16_32_Q15(st->beta_max,See);
- alpha = FLOAT_DIV32(tmp32, See);
- alpha_1 = FLOAT_SUB(FLOAT_ONE, alpha);
- /* Update correlations (recursive average) */
- st->Pey = FLOAT_ADD(FLOAT_MULT(alpha_1,st->Pey) , FLOAT_MULT(alpha,Pey));
- st->Pyy = FLOAT_ADD(FLOAT_MULT(alpha_1,st->Pyy) , FLOAT_MULT(alpha,Pyy));
- if (FLOAT_LT(st->Pyy, FLOAT_ONE))
- st->Pyy = FLOAT_ONE;
- /* We don't really hope to get better than 33 dB (MIN_LEAK-3dB) attenuation anyway */
- if (FLOAT_LT(st->Pey, FLOAT_MULT(MIN_LEAK,st->Pyy)))
- st->Pey = FLOAT_MULT(MIN_LEAK,st->Pyy);
- if (FLOAT_GT(st->Pey, st->Pyy))
- st->Pey = st->Pyy;
- /* leak_estimate is the linear regression result */
- st->leak_estimate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIVU(st->Pey, st->Pyy),14));
- /* This looks like a stupid bug, but it's right (because we convert from Q14 to Q15) */
- if (st->leak_estimate > 16383)
- st->leak_estimate = 32767;
- else
- st->leak_estimate = SHL16(st->leak_estimate,1);
- /*printf ("%f\n", st->leak_estimate);*/
-
- /* Compute Residual to Error Ratio */
-#ifdef FIXED_POINT
- tmp32 = MULT16_32_Q15(st->leak_estimate,Syy);
- tmp32 = ADD32(SHR32(Sxx,13), ADD32(tmp32, SHL32(tmp32,1)));
- /* Check for y in e (lower bound on RER) */
- {
- spx_float_t bound = PSEUDOFLOAT(Sey);
- bound = FLOAT_DIVU(FLOAT_MULT(bound, bound), PSEUDOFLOAT(ADD32(1,Syy)));
- if (FLOAT_GT(bound, PSEUDOFLOAT(See)))
- tmp32 = See;
- else if (tmp32 < FLOAT_EXTRACT32(bound))
- tmp32 = FLOAT_EXTRACT32(bound);
- }
- if (tmp32 > SHR32(See,1))
- tmp32 = SHR32(See,1);
- RER = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32,See),15));
-#else
- RER = (.0001*Sxx + 3.*MULT16_32_Q15(st->leak_estimate,Syy)) / See;
- /* Check for y in e (lower bound on RER) */
- if (RER < Sey*Sey/(1+See*Syy))
- RER = Sey*Sey/(1+See*Syy);
- if (RER > .5)
- RER = .5;
-#endif
-
- /* We consider that the filter has had minimal adaptation if the following is true*/
- if (!st->adapted && st->sum_adapt > SHL32(EXTEND32(M),15) && MULT16_32_Q15(st->leak_estimate,Syy) > MULT16_32_Q15(QCONST16(.03f,15),Syy))
- {
- st->adapted = 1;
- }
-
- if (st->adapted)
- {
- /* Normal learning rate calculation once we're past the minimal adaptation phase */
- for (i=0;i<=st->frame_size;i++)
- {
- spx_word32_t r, e;
- /* Compute frequency-domain adaptation mask */
- r = MULT16_32_Q15(st->leak_estimate,SHL32(st->Yf[i],3));
- e = SHL32(st->Rf[i],3)+1;
-#ifdef FIXED_POINT
- if (r>SHR32(e,1))
- r = SHR32(e,1);
-#else
- if (r>.5*e)
- r = .5*e;
-#endif
- r = MULT16_32_Q15(QCONST16(.7,15),r) + MULT16_32_Q15(QCONST16(.3,15),(spx_word32_t)(MULT16_32_Q15(RER,e)));
- /*st->power_1[i] = adapt_rate*r/(e*(1+st->power[i]));*/
- st->power_1[i] = FLOAT_SHL(FLOAT_DIV32_FLOAT(r,FLOAT_MUL32U(e,st->power[i]+10)),WEIGHT_SHIFT+16);
- }
- } else {
- /* Temporary adaption rate if filter is not yet adapted enough */
- spx_word16_t adapt_rate=0;
-
- if (Sxx > SHR32(MULT16_16(N, 1000),6))
- {
- tmp32 = MULT16_32_Q15(QCONST16(.25f, 15), Sxx);
-#ifdef FIXED_POINT
- if (tmp32 > SHR32(See,2))
- tmp32 = SHR32(See,2);
-#else
- if (tmp32 > .25*See)
- tmp32 = .25*See;
-#endif
- adapt_rate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32, See),15));
- }
- for (i=0;i<=st->frame_size;i++)
- st->power_1[i] = FLOAT_SHL(FLOAT_DIV32(EXTEND32(adapt_rate),ADD32(st->power[i],10)),WEIGHT_SHIFT+1);
-
-
- /* How much have we adapted so far? */
- st->sum_adapt = ADD32(st->sum_adapt,adapt_rate);
- }
-
- /* FIXME: MC conversion required */
- for (i=0;i<st->frame_size;i++)
- st->last_y[i] = st->last_y[st->frame_size+i];
- if (st->adapted)
- {
- /* If the filter is adapted, take the filtered echo */
- for (i=0;i<st->frame_size;i++)
- st->last_y[st->frame_size+i] = in[i]-out[i];
- } else {
- /* If filter isn't adapted yet, all we can do is take the far end signal directly */
- /* moved earlier: for (i=0;i<N;i++)
- st->last_y[i] = st->x[i];*/
- }
-
-}
-
-/* Compute spectrum of estimated echo for use in an echo post-filter */
-void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *residual_echo, int len)
-{
- int i;
- spx_word16_t leak2;
- int N;
-
- N = st->window_size;
-
- /* Apply hanning window (should pre-compute it)*/
- for (i=0;i<N;i++)
- st->y[i] = MULT16_16_Q15(st->window[i],st->last_y[i]);
-
- /* Compute power spectrum of the echo */
- spx_fft(st->fft_table, st->y, st->Y);
- power_spectrum(st->Y, residual_echo, N);
-
-#ifdef FIXED_POINT
- if (st->leak_estimate > 16383)
- leak2 = 32767;
- else
- leak2 = SHL16(st->leak_estimate, 1);
-#else
- if (st->leak_estimate>.5)
- leak2 = 1;
- else
- leak2 = 2*st->leak_estimate;
-#endif
- /* Estimate residual echo */
- for (i=0;i<=st->frame_size;i++)
- residual_echo[i] = (spx_int32_t)MULT16_32_Q15(leak2,residual_echo[i]);
-
-}
-
-EXPORT int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
-{
- switch(request)
- {
-
- case SPEEX_ECHO_GET_FRAME_SIZE:
- (*(int*)ptr) = st->frame_size;
- break;
- case SPEEX_ECHO_SET_SAMPLING_RATE:
- st->sampling_rate = (*(int*)ptr);
- st->spec_average = DIV32_16(SHL32(EXTEND32(st->frame_size), 15), st->sampling_rate);
-#ifdef FIXED_POINT
- st->beta0 = DIV32_16(SHL32(EXTEND32(st->frame_size), 16), st->sampling_rate);
- st->beta_max = DIV32_16(SHL32(EXTEND32(st->frame_size), 14), st->sampling_rate);
-#else
- st->beta0 = (2.0f*st->frame_size)/st->sampling_rate;
- st->beta_max = (.5f*st->frame_size)/st->sampling_rate;
-#endif
- if (st->sampling_rate<12000)
- st->notch_radius = QCONST16(.9, 15);
- else if (st->sampling_rate<24000)
- st->notch_radius = QCONST16(.982, 15);
- else
- st->notch_radius = QCONST16(.992, 15);
- break;
- case SPEEX_ECHO_GET_SAMPLING_RATE:
- (*(int*)ptr) = st->sampling_rate;
- break;
- case SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE:
- /*FIXME: Implement this for multiple channels */
- *((spx_int32_t *)ptr) = st->M * st->frame_size;
- break;
- case SPEEX_ECHO_GET_IMPULSE_RESPONSE:
- {
- int M = st->M, N = st->window_size, n = st->frame_size, i, j;
- spx_int32_t *filt = (spx_int32_t *) ptr;
- for(j=0;j<M;j++)
- {
- /*FIXME: Implement this for multiple channels */
-#ifdef FIXED_POINT
- for (i=0;i<N;i++)
- st->wtmp2[i] = EXTRACT16(PSHR32(st->W[j*N+i],16+NORMALIZE_SCALEDOWN));
- spx_ifft(st->fft_table, st->wtmp2, st->wtmp);
-#else
- spx_ifft(st->fft_table, &st->W[j*N], st->wtmp);
-#endif
- for(i=0;i<n;i++)
- filt[j*n+i] = PSHR32(MULT16_16(32767,st->wtmp[i]), WEIGHT_SHIFT-NORMALIZE_SCALEDOWN);
- }
- }
- break;
- default:
- speex_warning_int("Unknown speex_echo_ctl request: ", request);
- return -1;
- }
- return 0;
-}
diff --git a/drivers/speex/misc_bfin.h b/drivers/speex/misc_bfin.h
deleted file mode 100644
index 77b082c05..000000000
--- a/drivers/speex/misc_bfin.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 2005 Analog Devices */
-/**
- @file misc_bfin.h
- @author Jean-Marc Valin
- @brief Various compatibility routines for Speex (Blackfin version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_SPEEX_MOVE
-void *speex_move (void *dest, void *src, int n)
-{
- __asm__ __volatile__
- (
- "L0 = 0;\n\t"
- "I0 = %0;\n\t"
- "R0 = [I0++];\n\t"
- "LOOP move%= LC0 = %2;\n\t"
- "LOOP_BEGIN move%=;\n\t"
- "[%1++] = R0 || R0 = [I0++];\n\t"
- "LOOP_END move%=;\n\t"
- "[%1++] = R0;\n\t"
- : "=a" (src), "=a" (dest)
- : "a" ((n>>2)-1), "0" (src), "1" (dest)
- : "R0", "I0", "L0", "memory"
- );
- return dest;
-}
diff --git a/drivers/speex/modes.c b/drivers/speex/modes.c
deleted file mode 100644
index 08c8633a7..000000000
--- a/drivers/speex/modes.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
- File: modes.c
-
- Describes the different modes of the codec
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#include "config.h"
-
-
-#include "modes.h"
-#include "ltp.h"
-#include "quant_lsp.h"
-#include "cb_search.h"
-#include "sb_celp.h"
-#include "nb_celp.h"
-#include "vbr.h"
-#include "arch.h"
-#include <math.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-/* Extern declarations for all codebooks we use here */
-extern const signed char gain_cdbk_nb[];
-extern const signed char gain_cdbk_lbr[];
-extern const signed char exc_5_256_table[];
-extern const signed char exc_5_64_table[];
-extern const signed char exc_8_128_table[];
-extern const signed char exc_10_32_table[];
-extern const signed char exc_10_16_table[];
-extern const signed char exc_20_32_table[];
-
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_nb = {
- gain_cdbk_nb,
- 7,
- 7
-};
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_vlbr = {
- gain_cdbk_lbr,
- 5,
- 0
-};
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_lbr = {
- gain_cdbk_lbr,
- 5,
- 7
-};
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_med = {
- gain_cdbk_lbr,
- 5,
- 7
-};
-
-/* Split-VQ innovation parameters for very low bit-rate narrowband */
-static const split_cb_params split_cb_nb_vlbr = {
- 10, /*subvect_size*/
- 4, /*nb_subvect*/
- exc_10_16_table, /*shape_cb*/
- 4, /*shape_bits*/
- 0,
-};
-
-/* Split-VQ innovation parameters for very low bit-rate narrowband */
-static const split_cb_params split_cb_nb_ulbr = {
- 20, /*subvect_size*/
- 2, /*nb_subvect*/
- exc_20_32_table, /*shape_cb*/
- 5, /*shape_bits*/
- 0,
-};
-
-/* Split-VQ innovation parameters for low bit-rate narrowband */
-static const split_cb_params split_cb_nb_lbr = {
- 10, /*subvect_size*/
- 4, /*nb_subvect*/
- exc_10_32_table, /*shape_cb*/
- 5, /*shape_bits*/
- 0,
-};
-
-
-/* Split-VQ innovation parameters narrowband */
-static const split_cb_params split_cb_nb = {
- 5, /*subvect_size*/
- 8, /*nb_subvect*/
- exc_5_64_table, /*shape_cb*/
- 6, /*shape_bits*/
- 0,
-};
-
-/* Split-VQ innovation parameters narrowband */
-static const split_cb_params split_cb_nb_med = {
- 8, /*subvect_size*/
- 5, /*nb_subvect*/
- exc_8_128_table, /*shape_cb*/
- 7, /*shape_bits*/
- 0,
-};
-
-/* Split-VQ innovation for low-band wideband */
-static const split_cb_params split_cb_sb = {
- 5, /*subvect_size*/
- 8, /*nb_subvect*/
- exc_5_256_table, /*shape_cb*/
- 8, /*shape_bits*/
- 0,
-};
-
-
-
-/* 2150 bps "vocoder-like" mode for comfort noise */
-static const SpeexSubmode nb_submode1 = {
- 0,
- 1,
- 0,
- 0,
- /* LSP quantization */
- lsp_quant_lbr,
- lsp_unquant_lbr,
- /* No pitch quantization */
- forced_pitch_quant,
- forced_pitch_unquant,
- NULL,
- /* No innovation quantization (noise only) */
- noise_codebook_quant,
- noise_codebook_unquant,
- NULL,
- -1,
- 43
-};
-
-/* 3.95 kbps very low bit-rate mode */
-static const SpeexSubmode nb_submode8 = {
- 0,
- 1,
- 0,
- 0,
- /*LSP quantization*/
- lsp_quant_lbr,
- lsp_unquant_lbr,
- /*No pitch quantization*/
- forced_pitch_quant,
- forced_pitch_unquant,
- NULL,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
- &split_cb_nb_ulbr,
- QCONST16(.5,15),
- 79
-};
-
-/* 5.95 kbps very low bit-rate mode */
-static const SpeexSubmode nb_submode2 = {
- 0,
- 0,
- 0,
- 0,
- /*LSP quantization*/
- lsp_quant_lbr,
- lsp_unquant_lbr,
- /*No pitch quantization*/
- pitch_search_3tap,
- pitch_unquant_3tap,
- &ltp_params_vlbr,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
- &split_cb_nb_vlbr,
- QCONST16(.6,15),
- 119
-};
-
-/* 8 kbps low bit-rate mode */
-static const SpeexSubmode nb_submode3 = {
- -1,
- 0,
- 1,
- 0,
- /*LSP quantization*/
- lsp_quant_lbr,
- lsp_unquant_lbr,
- /*Pitch quantization*/
- pitch_search_3tap,
- pitch_unquant_3tap,
- &ltp_params_lbr,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
- &split_cb_nb_lbr,
- QCONST16(.55,15),
- 160
-};
-
-/* 11 kbps medium bit-rate mode */
-static const SpeexSubmode nb_submode4 = {
- -1,
- 0,
- 1,
- 0,
- /*LSP quantization*/
- lsp_quant_lbr,
- lsp_unquant_lbr,
- /*Pitch quantization*/
- pitch_search_3tap,
- pitch_unquant_3tap,
- &ltp_params_med,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
- &split_cb_nb_med,
- QCONST16(.45,15),
- 220
-};
-
-/* 15 kbps high bit-rate mode */
-static const SpeexSubmode nb_submode5 = {
- -1,
- 0,
- 3,
- 0,
- /*LSP quantization*/
- lsp_quant_nb,
- lsp_unquant_nb,
- /*Pitch quantization*/
- pitch_search_3tap,
- pitch_unquant_3tap,
- &ltp_params_nb,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
- &split_cb_nb,
- QCONST16(.3,15),
- 300
-};
-
-/* 18.2 high bit-rate mode */
-static const SpeexSubmode nb_submode6 = {
- -1,
- 0,
- 3,
- 0,
- /*LSP quantization*/
- lsp_quant_nb,
- lsp_unquant_nb,
- /*Pitch quantization*/
- pitch_search_3tap,
- pitch_unquant_3tap,
- &ltp_params_nb,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
- &split_cb_sb,
- QCONST16(.2,15),
- 364
-};
-
-/* 24.6 kbps high bit-rate mode */
-static const SpeexSubmode nb_submode7 = {
- -1,
- 0,
- 3,
- 1,
- /*LSP quantization*/
- lsp_quant_nb,
- lsp_unquant_nb,
- /*Pitch quantization*/
- pitch_search_3tap,
- pitch_unquant_3tap,
- &ltp_params_nb,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
- &split_cb_nb,
- QCONST16(.1,15),
- 492
-};
-
-
-/* Default mode for narrowband */
-static const SpeexNBMode nb_mode = {
- 160, /*frameSize*/
- 40, /*subframeSize*/
- 10, /*lpcSize*/
- 17, /*pitchStart*/
- 144, /*pitchEnd*/
-#ifdef FIXED_POINT
- 29491, 19661, /* gamma1, gamma2 */
-#else
- 0.9, 0.6, /* gamma1, gamma2 */
-#endif
- QCONST16(.0002,15), /*lpc_floor*/
- {NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
- &nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- 5,
- {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
-};
-
-
-/* Default mode for narrowband */
-EXPORT const SpeexMode speex_nb_mode = {
- &nb_mode,
- nb_mode_query,
- "narrowband",
- 0,
- 4,
- &nb_encoder_init,
- &nb_encoder_destroy,
- &nb_encode,
- &nb_decoder_init,
- &nb_decoder_destroy,
- &nb_decode,
- &nb_encoder_ctl,
- &nb_decoder_ctl,
-};
-
-
-
-EXPORT int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
-{
- return mode->query(mode->mode, request, ptr);
-}
-
-#ifdef FIXED_DEBUG
-long long spx_mips=0;
-#endif
-
diff --git a/drivers/speex/modes.h b/drivers/speex/modes.h
deleted file mode 100644
index 26e2d8618..000000000
--- a/drivers/speex/modes.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin */
-/**
- @file modes.h
- @brief Describes the different modes of the codec
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef MODES_H
-#define MODES_H
-
-#include <speex/speex.h>
-#include <speex/speex_bits.h>
-#include "arch.h"
-
-#define NB_SUBMODES 16
-#define NB_SUBMODE_BITS 4
-
-#define SB_SUBMODES 8
-#define SB_SUBMODE_BITS 3
-
-/* Used internally, NOT TO BE USED in applications */
-/** Used internally*/
-#define SPEEX_GET_PI_GAIN 100
-/** Used internally*/
-#define SPEEX_GET_EXC 101
-/** Used internally*/
-#define SPEEX_GET_INNOV 102
-/** Used internally*/
-#define SPEEX_GET_DTX_STATUS 103
-/** Used internally*/
-#define SPEEX_SET_INNOVATION_SAVE 104
-/** Used internally*/
-#define SPEEX_SET_WIDEBAND 105
-
-/** Used internally*/
-#define SPEEX_GET_STACK 106
-
-
-/** Quantizes LSPs */
-typedef void (*lsp_quant_func)(spx_lsp_t *, spx_lsp_t *, int, SpeexBits *);
-
-/** Decodes quantized LSPs */
-typedef void (*lsp_unquant_func)(spx_lsp_t *, int, SpeexBits *);
-
-
-/** Long-term predictor quantization */
-typedef int (*ltp_quant_func)(spx_word16_t *, spx_word16_t *, spx_coef_t *, spx_coef_t *,
- spx_coef_t *, spx_sig_t *, const void *, int, int, spx_word16_t,
- int, int, SpeexBits*, char *, spx_word16_t *, spx_word16_t *, int, int, int, spx_word32_t *);
-
-/** Long-term un-quantize */
-typedef void (*ltp_unquant_func)(spx_word16_t *, spx_word32_t *, int, int, spx_word16_t, const void *, int, int *,
- spx_word16_t *, SpeexBits*, char*, int, int, spx_word16_t, int);
-
-
-/** Innovation quantization function */
-typedef void (*innovation_quant_func)(spx_word16_t *, spx_coef_t *, spx_coef_t *, spx_coef_t *, const void *, int, int,
- spx_sig_t *, spx_word16_t *, SpeexBits *, char *, int, int);
-
-/** Innovation unquantization function */
-typedef void (*innovation_unquant_func)(spx_sig_t *, const void *, int, SpeexBits*, char *, spx_int32_t *);
-
-/** Description of a Speex sub-mode (wither narrowband or wideband */
-typedef struct SpeexSubmode {
- int lbr_pitch; /**< Set to -1 for "normal" modes, otherwise encode pitch using a global pitch and allowing a +- lbr_pitch variation (for low not-rates)*/
- int forced_pitch_gain; /**< Use the same (forced) pitch gain for all sub-frames */
- int have_subframe_gain; /**< Number of bits to use as sub-frame innovation gain */
- int double_codebook; /**< Apply innovation quantization twice for higher quality (and higher bit-rate)*/
- /*LSP functions*/
- lsp_quant_func lsp_quant; /**< LSP quantization function */
- lsp_unquant_func lsp_unquant; /**< LSP unquantization function */
-
- /*Long-term predictor functions*/
- ltp_quant_func ltp_quant; /**< Long-term predictor (pitch) quantizer */
- ltp_unquant_func ltp_unquant; /**< Long-term predictor (pitch) un-quantizer */
- const void *ltp_params; /**< Pitch parameters (options) */
-
- /*Quantization of innovation*/
- innovation_quant_func innovation_quant; /**< Innovation quantization */
- innovation_unquant_func innovation_unquant; /**< Innovation un-quantization */
- const void *innovation_params; /**< Innovation quantization parameters*/
-
- spx_word16_t comb_gain; /**< Gain of enhancer comb filter */
-
- int bits_per_frame; /**< Number of bits per frame after encoding*/
-} SpeexSubmode;
-
-/** Struct defining the encoding/decoding mode*/
-typedef struct SpeexNBMode {
- int frameSize; /**< Size of frames used for encoding */
- int subframeSize; /**< Size of sub-frames used for encoding */
- int lpcSize; /**< Order of LPC filter */
- int pitchStart; /**< Smallest pitch value allowed */
- int pitchEnd; /**< Largest pitch value allowed */
-
- spx_word16_t gamma1; /**< Perceptual filter parameter #1 */
- spx_word16_t gamma2; /**< Perceptual filter parameter #2 */
- spx_word16_t lpc_floor; /**< Noise floor for LPC analysis */
-
- const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
- int defaultSubmode; /**< Default sub-mode to use when encoding */
- int quality_map[11]; /**< Mode corresponding to each quality setting */
-} SpeexNBMode;
-
-
-/** Struct defining the encoding/decoding mode for SB-CELP (wideband) */
-typedef struct SpeexSBMode {
- const SpeexMode *nb_mode; /**< Embedded narrowband mode */
- int frameSize; /**< Size of frames used for encoding */
- int subframeSize; /**< Size of sub-frames used for encoding */
- int lpcSize; /**< Order of LPC filter */
- spx_word16_t gamma1; /**< Perceptual filter parameter #1 */
- spx_word16_t gamma2; /**< Perceptual filter parameter #1 */
- spx_word16_t lpc_floor; /**< Noise floor for LPC analysis */
- spx_word16_t folding_gain;
-
- const SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */
- int defaultSubmode; /**< Default sub-mode to use when encoding */
- int low_quality_map[11]; /**< Mode corresponding to each quality setting */
- int quality_map[11]; /**< Mode corresponding to each quality setting */
-#ifndef DISABLE_VBR
- const float (*vbr_thresh)[11];
-#endif
- int nb_modes;
-} SpeexSBMode;
-
-int speex_encode_native(void *state, spx_word16_t *in, SpeexBits *bits);
-int speex_decode_native(void *state, SpeexBits *bits, spx_word16_t *out);
-
-int nb_mode_query(const void *mode, int request, void *ptr);
-int wb_mode_query(const void *mode, int request, void *ptr);
-
-#endif
diff --git a/drivers/speex/modes_wb.c b/drivers/speex/modes_wb.c
deleted file mode 100644
index e9bab88ab..000000000
--- a/drivers/speex/modes_wb.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/* Copyright (C) 2002-2007 Jean-Marc Valin
- File: modes.c
-
- Describes the wideband modes of the codec
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#include "config.h"
-
-
-#include "modes.h"
-#include "ltp.h"
-#include "quant_lsp.h"
-#include "cb_search.h"
-#include "sb_celp.h"
-#include "nb_celp.h"
-#include "vbr.h"
-#include "arch.h"
-#include <math.h>
-#include "os_support.h"
-
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-EXPORT const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
-
-extern const signed char hexc_table[];
-extern const signed char hexc_10_32_table[];
-
-#ifndef DISABLE_WIDEBAND
-
-/* Split-VQ innovation for high-band wideband */
-static const split_cb_params split_cb_high = {
- 8, /*subvect_size*/
- 5, /*nb_subvect*/
- hexc_table, /*shape_cb*/
- 7, /*shape_bits*/
- 1,
-};
-
-
-/* Split-VQ innovation for high-band wideband */
-static const split_cb_params split_cb_high_lbr = {
- 10, /*subvect_size*/
- 4, /*nb_subvect*/
- hexc_10_32_table, /*shape_cb*/
- 5, /*shape_bits*/
- 0,
-};
-
-#endif
-
-
-static const SpeexSubmode wb_submode1 = {
- 0,
- 0,
- 1,
- 0,
- /*LSP quantization*/
- lsp_quant_high,
- lsp_unquant_high,
- /*Pitch quantization*/
- NULL,
- NULL,
- NULL,
- /*No innovation quantization*/
- NULL,
- NULL,
- NULL,
- -1,
- 36
-};
-
-
-static const SpeexSubmode wb_submode2 = {
- 0,
- 0,
- 1,
- 0,
- /*LSP quantization*/
- lsp_quant_high,
- lsp_unquant_high,
- /*Pitch quantization*/
- NULL,
- NULL,
- NULL,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
- NULL,
-#else
- &split_cb_high_lbr,
-#endif
- -1,
- 112
-};
-
-
-static const SpeexSubmode wb_submode3 = {
- 0,
- 0,
- 1,
- 0,
- /*LSP quantization*/
- lsp_quant_high,
- lsp_unquant_high,
- /*Pitch quantization*/
- NULL,
- NULL,
- NULL,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
- NULL,
-#else
- &split_cb_high,
-#endif
- -1,
- 192
-};
-
-static const SpeexSubmode wb_submode4 = {
- 0,
- 0,
- 1,
- 1,
- /*LSP quantization*/
- lsp_quant_high,
- lsp_unquant_high,
- /*Pitch quantization*/
- NULL,
- NULL,
- NULL,
- /*Innovation quantization*/
- split_cb_search_shape_sign,
- split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
- NULL,
-#else
- &split_cb_high,
-#endif
- -1,
- 352
-};
-
-
-/* Split-band wideband CELP mode*/
-static const SpeexSBMode sb_wb_mode = {
- &speex_nb_mode,
- 160, /*frameSize*/
- 40, /*subframeSize*/
- 8, /*lpcSize*/
-#ifdef FIXED_POINT
- 29491, 19661, /* gamma1, gamma2 */
-#else
- 0.9, 0.6, /* gamma1, gamma2 */
-#endif
- QCONST16(.0002,15), /*lpc_floor*/
- QCONST16(0.9f,15),
- {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
- 3,
- {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
- {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
-#ifndef DISABLE_VBR
- vbr_hb_thresh,
-#endif
- 5
-};
-
-
-EXPORT const SpeexMode speex_wb_mode = {
- &sb_wb_mode,
- wb_mode_query,
- "wideband (sub-band CELP)",
- 1,
- 4,
- &sb_encoder_init,
- &sb_encoder_destroy,
- &sb_encode,
- &sb_decoder_init,
- &sb_decoder_destroy,
- &sb_decode,
- &sb_encoder_ctl,
- &sb_decoder_ctl,
-};
-
-
-
-/* "Ultra-wideband" mode stuff */
-
-
-
-/* Split-band "ultra-wideband" (32 kbps) CELP mode*/
-static const SpeexSBMode sb_uwb_mode = {
- &speex_wb_mode,
- 320, /*frameSize*/
- 80, /*subframeSize*/
- 8, /*lpcSize*/
-#ifdef FIXED_POINT
- 29491, 19661, /* gamma1, gamma2 */
-#else
- 0.9, 0.6, /* gamma1, gamma2 */
-#endif
- QCONST16(.0002,15), /*lpc_floor*/
- QCONST16(0.7f,15),
- {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
- 1,
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
- {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
-#ifndef DISABLE_VBR
- vbr_uhb_thresh,
-#endif
- 2
-};
-
-int wb_mode_query(const void *mode, int request, void *ptr)
-{
- const SpeexSBMode *m = (const SpeexSBMode*)mode;
-
- switch (request)
- {
- case SPEEX_MODE_FRAME_SIZE:
- *((int*)ptr)=2*m->frameSize;
- break;
- case SPEEX_SUBMODE_BITS_PER_FRAME:
- if (*((int*)ptr)==0)
- *((int*)ptr) = SB_SUBMODE_BITS+1;
- else if (m->submodes[*((int*)ptr)]==NULL)
- *((int*)ptr) = -1;
- else
- *((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
- break;
- default:
- speex_warning_int("Unknown wb_mode_query request: ", request);
- return -1;
- }
- return 0;
-}
-
-
-EXPORT const SpeexMode speex_uwb_mode = {
- &sb_uwb_mode,
- wb_mode_query,
- "ultra-wideband (sub-band CELP)",
- 2,
- 4,
- &sb_encoder_init,
- &sb_encoder_destroy,
- &sb_encode,
- &sb_decoder_init,
- &sb_decoder_destroy,
- &sb_decode,
- &sb_encoder_ctl,
- &sb_decoder_ctl,
-};
-
-/* We have defined speex_lib_get_mode() as a macro in speex.h */
-#undef speex_lib_get_mode
-
-EXPORT const SpeexMode * speex_lib_get_mode (int mode)
-{
- if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
-
- return speex_mode_list[mode];
-}
-
-
-
diff --git a/drivers/speex/nb_celp.c b/drivers/speex/nb_celp.c
deleted file mode 100644
index 6807c16c9..000000000
--- a/drivers/speex/nb_celp.c
+++ /dev/null
@@ -1,1903 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
- File: nb_celp.c
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include <math.h>
-#include "nb_celp.h"
-#include "lpc.h"
-#include "lsp.h"
-#include "ltp.h"
-#include "quant_lsp.h"
-#include "cb_search.h"
-#include "filters.h"
-#include "stack_alloc.h"
-#include "vq.h"
-#include <speex/speex_bits.h>
-#include "vbr.h"
-#include "arch.h"
-#include "math_approx.h"
-#include "os_support.h"
-#include <speex/speex_callbacks.h>
-
-#ifdef VORBIS_PSYCHO
-#include "vorbis_psy.h"
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define SUBMODE(x) st->submodes[st->submodeID]->x
-
-/* Default size for the encoder and decoder stack (can be changed at compile time).
- This does not apply when using variable-size arrays or alloca. */
-#ifndef NB_ENC_STACK
-#define NB_ENC_STACK (8000*sizeof(spx_sig_t))
-#endif
-
-#ifndef NB_DEC_STACK
-#define NB_DEC_STACK (4000*sizeof(spx_sig_t))
-#endif
-
-
-#ifdef FIXED_POINT
-const spx_word32_t ol_gain_table[32]={18900, 25150, 33468, 44536, 59265, 78865, 104946, 139653, 185838, 247297, 329081, 437913, 582736, 775454, 1031906, 1373169, 1827293, 2431601, 3235761, 4305867, 5729870, 7624808, 10146425, 13501971, 17967238, 23909222, 31816294, 42338330, 56340132, 74972501, 99766822, 132760927};
-const spx_word16_t exc_gain_quant_scal3_bound[7]={1841, 3883, 6051, 8062, 10444, 13580, 18560};
-const spx_word16_t exc_gain_quant_scal3[8]={1002, 2680, 5086, 7016, 9108, 11781, 15380, 21740};
-const spx_word16_t exc_gain_quant_scal1_bound[1]={14385};
-const spx_word16_t exc_gain_quant_scal1[2]={11546, 17224};
-
-#define LSP_MARGIN 16
-#define LSP_DELTA1 6553
-#define LSP_DELTA2 1638
-
-#else
-
-const float exc_gain_quant_scal3_bound[7]={0.112338f, 0.236980f, 0.369316f, 0.492054f, 0.637471f, 0.828874f, 1.132784f};
-const float exc_gain_quant_scal3[8]={0.061130f, 0.163546f, 0.310413f, 0.428220f, 0.555887f, 0.719055f, 0.938694f, 1.326874f};
-const float exc_gain_quant_scal1_bound[1]={0.87798f};
-const float exc_gain_quant_scal1[2]={0.70469f, 1.05127f};
-
-#define LSP_MARGIN .002f
-#define LSP_DELTA1 .2f
-#define LSP_DELTA2 .05f
-
-#endif
-
-#ifdef VORBIS_PSYCHO
-#define EXTRA_BUFFER 100
-#else
-#define EXTRA_BUFFER 0
-#endif
-
-
-#define sqr(x) ((x)*(x))
-
-extern const spx_word16_t lag_window[];
-extern const spx_word16_t lpc_window[];
-
-void *nb_encoder_init(const SpeexMode *m)
-{
- EncState *st;
- const SpeexNBMode *mode;
- int i;
-
- mode=(const SpeexNBMode *)m->mode;
- st = (EncState*)speex_alloc(sizeof(EncState));
- if (!st)
- return NULL;
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
- st->stack = NULL;
-#else
- st->stack = (char*)speex_alloc_scratch(NB_ENC_STACK);
-#endif
-
- st->mode=m;
-
- st->frameSize = mode->frameSize;
- st->nbSubframes=mode->frameSize/mode->subframeSize;
- st->subframeSize=mode->subframeSize;
- st->windowSize = st->frameSize+st->subframeSize;
- st->lpcSize = mode->lpcSize;
- st->gamma1=mode->gamma1;
- st->gamma2=mode->gamma2;
- st->min_pitch=mode->pitchStart;
- st->max_pitch=mode->pitchEnd;
- st->lpc_floor = mode->lpc_floor;
-
- st->submodes=mode->submodes;
- st->submodeID=st->submodeSelect=mode->defaultSubmode;
- st->bounded_pitch = 1;
-
- st->encode_submode = 1;
-
-#ifdef VORBIS_PSYCHO
- st->psy = vorbis_psy_init(8000, 256);
- st->curve = (float*)speex_alloc(128*sizeof(float));
- st->old_curve = (float*)speex_alloc(128*sizeof(float));
- st->psy_window = (float*)speex_alloc(256*sizeof(float));
-#endif
-
- st->cumul_gain = 1024;
-
- /* Allocating input buffer */
- st->winBuf = (spx_word16_t*)speex_alloc((st->windowSize-st->frameSize)*sizeof(spx_word16_t));
- /* Allocating excitation buffer */
- st->excBuf = (spx_word16_t*)speex_alloc((mode->frameSize+mode->pitchEnd+2)*sizeof(spx_word16_t));
- st->exc = st->excBuf + mode->pitchEnd + 2;
- st->swBuf = (spx_word16_t*)speex_alloc((mode->frameSize+mode->pitchEnd+2)*sizeof(spx_word16_t));
- st->sw = st->swBuf + mode->pitchEnd + 2;
-
- st->window= lpc_window;
-
- /* Create the window for autocorrelation (lag-windowing) */
- st->lagWindow = lag_window;
-
- st->old_lsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
- st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
- st->first = 1;
- for (i=0;i<st->lpcSize;i++)
- st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
-
- st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
- st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
- st->mem_sw_whole = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
- st->mem_exc = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
- st->mem_exc2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-
- st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
- st->innov_rms_save = NULL;
-
- st->pitch = (int*)speex_alloc((st->nbSubframes)*sizeof(int));
-
-#ifndef DISABLE_VBR
- st->vbr = (VBRState*)speex_alloc(sizeof(VBRState));
- vbr_init(st->vbr);
- st->vbr_quality = 8;
- st->vbr_enabled = 0;
- st->vbr_max = 0;
- st->vad_enabled = 0;
- st->dtx_enabled = 0;
- st->dtx_count=0;
- st->abr_enabled = 0;
- st->abr_drift = 0;
- st->abr_drift2 = 0;
-#endif /* #ifndef DISABLE_VBR */
-
- st->plc_tuning = 2;
- st->complexity=2;
- st->sampling_rate=8000;
- st->isWideband = 0;
- st->highpass_enabled = 1;
-
-#ifdef ENABLE_VALGRIND
- VALGRIND_MAKE_READABLE(st, NB_ENC_STACK);
-#endif
- return st;
-}
-
-void nb_encoder_destroy(void *state)
-{
- EncState *st=(EncState *)state;
- /* Free all allocated memory */
-#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
- speex_free_scratch(st->stack);
-#endif
-
- speex_free (st->winBuf);
- speex_free (st->excBuf);
- speex_free (st->old_qlsp);
- speex_free (st->swBuf);
-
- speex_free (st->old_lsp);
- speex_free (st->mem_sp);
- speex_free (st->mem_sw);
- speex_free (st->mem_sw_whole);
- speex_free (st->mem_exc);
- speex_free (st->mem_exc2);
- speex_free (st->pi_gain);
- speex_free (st->pitch);
-
-#ifndef DISABLE_VBR
- vbr_destroy(st->vbr);
- speex_free (st->vbr);
-#endif /* #ifndef DISABLE_VBR */
-
-#ifdef VORBIS_PSYCHO
- vorbis_psy_destroy(st->psy);
- speex_free (st->curve);
- speex_free (st->old_curve);
- speex_free (st->psy_window);
-#endif
-
- /*Free state memory... should be last*/
- speex_free(st);
-}
-
-int nb_encode(void *state, void *vin, SpeexBits *bits)
-{
- EncState *st;
- int i, sub, roots;
- int ol_pitch;
- spx_word16_t ol_pitch_coef;
- spx_word32_t ol_gain;
- VARDECL(spx_word16_t *ringing);
- VARDECL(spx_word16_t *target);
- VARDECL(spx_sig_t *innov);
- VARDECL(spx_word32_t *exc32);
- VARDECL(spx_mem_t *mem);
- VARDECL(spx_coef_t *bw_lpc1);
- VARDECL(spx_coef_t *bw_lpc2);
- VARDECL(spx_coef_t *lpc);
- VARDECL(spx_lsp_t *lsp);
- VARDECL(spx_lsp_t *qlsp);
- VARDECL(spx_lsp_t *interp_lsp);
- VARDECL(spx_lsp_t *interp_qlsp);
- VARDECL(spx_coef_t *interp_lpc);
- VARDECL(spx_coef_t *interp_qlpc);
- char *stack;
- VARDECL(spx_word16_t *syn_resp);
- VARDECL(spx_word16_t *real_exc);
-
- spx_word32_t ener=0;
- spx_word16_t fine_gain;
- spx_word16_t *in = (spx_word16_t*)vin;
-
- st=(EncState *)state;
- stack=st->stack;
-
- ALLOC(lpc, st->lpcSize, spx_coef_t);
- ALLOC(bw_lpc1, st->lpcSize, spx_coef_t);
- ALLOC(bw_lpc2, st->lpcSize, spx_coef_t);
- ALLOC(lsp, st->lpcSize, spx_lsp_t);
- ALLOC(qlsp, st->lpcSize, spx_lsp_t);
- ALLOC(interp_lsp, st->lpcSize, spx_lsp_t);
- ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
- ALLOC(interp_lpc, st->lpcSize, spx_coef_t);
- ALLOC(interp_qlpc, st->lpcSize, spx_coef_t);
-
- /* Move signals 1 frame towards the past */
- SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, st->max_pitch+2);
- SPEEX_MOVE(st->swBuf, st->swBuf+st->frameSize, st->max_pitch+2);
-
- if (st->highpass_enabled)
- highpass(in, in, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_INPUT, st->mem_hp);
-
- {
- VARDECL(spx_word16_t *w_sig);
- VARDECL(spx_word16_t *autocorr);
- ALLOC(w_sig, st->windowSize, spx_word16_t);
- ALLOC(autocorr, st->lpcSize+1, spx_word16_t);
- /* Window for analysis */
- for (i=0;i<st->windowSize-st->frameSize;i++)
- w_sig[i] = EXTRACT16(SHR32(MULT16_16(st->winBuf[i],st->window[i]),SIG_SHIFT));
- for (;i<st->windowSize;i++)
- w_sig[i] = EXTRACT16(SHR32(MULT16_16(in[i-st->windowSize+st->frameSize],st->window[i]),SIG_SHIFT));
- /* Compute auto-correlation */
- _spx_autocorr(w_sig, autocorr, st->lpcSize+1, st->windowSize);
- autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
-
- /* Lag windowing: equivalent to filtering in the power-spectrum domain */
- for (i=0;i<st->lpcSize+1;i++)
- autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]);
-
- /* Levinson-Durbin */
- _spx_lpc(lpc, autocorr, st->lpcSize);
- /* LPC to LSPs (x-domain) transform */
- roots=lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA1, stack);
- /* Check if we found all the roots */
- if (roots!=st->lpcSize)
- {
- /*If we can't find all LSP's, do some damage control and use previous filter*/
- for (i=0;i<st->lpcSize;i++)
- {
- lsp[i]=st->old_lsp[i];
- }
- }
- }
-
-
-
-
- /* Whole frame analysis (open-loop estimation of pitch and excitation gain) */
- {
- int diff = st->windowSize-st->frameSize;
- if (st->first)
- for (i=0;i<st->lpcSize;i++)
- interp_lsp[i] = lsp[i];
- else
- lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, st->nbSubframes, st->nbSubframes<<1);
-
- lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN);
-
- /* Compute interpolated LPCs (unquantized) for whole frame*/
- lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack);
-
-
- /*Open-loop pitch*/
- if (!st->submodes[st->submodeID] || (st->complexity>2 && SUBMODE(have_subframe_gain)<3) || SUBMODE(forced_pitch_gain) || SUBMODE(lbr_pitch) != -1
-#ifndef DISABLE_VBR
- || st->vbr_enabled || st->vad_enabled
-#endif
- )
- {
- int nol_pitch[6];
- spx_word16_t nol_pitch_coef[6];
-
- bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize);
- bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
-
- SPEEX_COPY(st->sw, st->winBuf, diff);
- SPEEX_COPY(st->sw+diff, in, st->frameSize-diff);
- filter_mem16(st->sw, bw_lpc1, bw_lpc2, st->sw, st->frameSize, st->lpcSize, st->mem_sw_whole, stack);
-
- open_loop_nbest_pitch(st->sw, st->min_pitch, st->max_pitch, st->frameSize,
- nol_pitch, nol_pitch_coef, 6, stack);
- ol_pitch=nol_pitch[0];
- ol_pitch_coef = nol_pitch_coef[0];
- /*Try to remove pitch multiples*/
- for (i=1;i<6;i++)
- {
-#ifdef FIXED_POINT
- if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],27853)) &&
-#else
- if ((nol_pitch_coef[i]>.85*nol_pitch_coef[0]) &&
-#endif
- (ABS(2*nol_pitch[i]-ol_pitch)<=2 || ABS(3*nol_pitch[i]-ol_pitch)<=3 ||
- ABS(4*nol_pitch[i]-ol_pitch)<=4 || ABS(5*nol_pitch[i]-ol_pitch)<=5))
- {
- /*ol_pitch_coef=nol_pitch_coef[i];*/
- ol_pitch = nol_pitch[i];
- }
- }
- /*if (ol_pitch>50)
- ol_pitch/=2;*/
- /*ol_pitch_coef = sqrt(ol_pitch_coef);*/
-
- } else {
- ol_pitch=0;
- ol_pitch_coef=0;
- }
-
- /*Compute "real" excitation*/
- SPEEX_COPY(st->exc, st->winBuf, diff);
- SPEEX_COPY(st->exc+diff, in, st->frameSize-diff);
- fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack);
-
- /* Compute open-loop excitation gain */
- {
- spx_word16_t g = compute_rms16(st->exc, st->frameSize);
- if (st->submodeID!=1 && ol_pitch>0)
- ol_gain = MULT16_16(g, MULT16_16_Q14(QCONST16(1.1,14),
- spx_sqrt(QCONST32(1.,28)-MULT16_32_Q15(QCONST16(.8,15),SHL32(MULT16_16(ol_pitch_coef,ol_pitch_coef),16)))));
- else
- ol_gain = SHL32(EXTEND32(g),SIG_SHIFT);
- }
- }
-
-#ifdef VORBIS_PSYCHO
- SPEEX_MOVE(st->psy_window, st->psy_window+st->frameSize, 256-st->frameSize);
- SPEEX_COPY(&st->psy_window[256-st->frameSize], in, st->frameSize);
- compute_curve(st->psy, st->psy_window, st->curve);
- /*print_vec(st->curve, 128, "curve");*/
- if (st->first)
- SPEEX_COPY(st->old_curve, st->curve, 128);
-#endif
-
- /*VBR stuff*/
-#ifndef DISABLE_VBR
- if (st->vbr && (st->vbr_enabled||st->vad_enabled))
- {
- float lsp_dist=0;
- for (i=0;i<st->lpcSize;i++)
- lsp_dist += (st->old_lsp[i] - lsp[i])*(st->old_lsp[i] - lsp[i]);
- lsp_dist /= LSP_SCALING*LSP_SCALING;
-
- if (st->abr_enabled)
- {
- float qual_change=0;
- if (st->abr_drift2 * st->abr_drift > 0)
- {
- /* Only adapt if long-term and short-term drift are the same sign */
- qual_change = -.00001*st->abr_drift/(1+st->abr_count);
- if (qual_change>.05)
- qual_change=.05;
- if (qual_change<-.05)
- qual_change=-.05;
- }
- st->vbr_quality += qual_change;
- if (st->vbr_quality>10)
- st->vbr_quality=10;
- if (st->vbr_quality<0)
- st->vbr_quality=0;
- }
-
- st->relative_quality = vbr_analysis(st->vbr, in, st->frameSize, ol_pitch, GAIN_SCALING_1*ol_pitch_coef);
- /*if (delta_qual<0)*/
- /* delta_qual*=.1*(3+st->vbr_quality);*/
- if (st->vbr_enabled)
- {
- spx_int32_t mode;
- int choice=0;
- float min_diff=100;
- mode = 8;
- while (mode)
- {
- int v1;
- float thresh;
- v1=(int)floor(st->vbr_quality);
- if (v1==10)
- thresh = vbr_nb_thresh[mode][v1];
- else
- thresh = (st->vbr_quality-v1)*vbr_nb_thresh[mode][v1+1] + (1+v1-st->vbr_quality)*vbr_nb_thresh[mode][v1];
- if (st->relative_quality > thresh &&
- st->relative_quality-thresh<min_diff)
- {
- choice = mode;
- min_diff = st->relative_quality-thresh;
- }
- mode--;
- }
- mode=choice;
- if (mode==0)
- {
- if (st->dtx_count==0 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20)
- {
- mode=1;
- st->dtx_count=1;
- } else {
- mode=0;
- st->dtx_count++;
- }
- } else {
- st->dtx_count=0;
- }
-
- speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);
- if (st->vbr_max>0)
- {
- spx_int32_t rate;
- speex_encoder_ctl(state, SPEEX_GET_BITRATE, &rate);
- if (rate > st->vbr_max)
- {
- rate = st->vbr_max;
- speex_encoder_ctl(state, SPEEX_SET_BITRATE, &rate);
- }
- }
-
- if (st->abr_enabled)
- {
- spx_int32_t bitrate;
- speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate);
- st->abr_drift+=(bitrate-st->abr_enabled);
- st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled);
- st->abr_count += 1.0;
- }
-
- } else {
- /*VAD only case*/
- int mode;
- if (st->relative_quality<2)
- {
- if (st->dtx_count==0 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20)
- {
- st->dtx_count=1;
- mode=1;
- } else {
- mode=0;
- st->dtx_count++;
- }
- } else {
- st->dtx_count = 0;
- mode=st->submodeSelect;
- }
- /*speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);*/
- st->submodeID=mode;
- }
- } else {
- st->relative_quality = -1;
- }
-#endif /* #ifndef DISABLE_VBR */
-
- if (st->encode_submode)
- {
- /* First, transmit a zero for narrowband */
- speex_bits_pack(bits, 0, 1);
-
- /* Transmit the sub-mode we use for this frame */
- speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS);
-
- }
-
- /* If null mode (no transmission), just set a couple things to zero*/
- if (st->submodes[st->submodeID] == NULL)
- {
- for (i=0;i<st->frameSize;i++)
- st->exc[i]=st->sw[i]=VERY_SMALL;
-
- for (i=0;i<st->lpcSize;i++)
- st->mem_sw[i]=0;
- st->first=1;
- st->bounded_pitch = 1;
-
- SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize);
-
- /* Clear memory (no need to really compute it) */
- for (i=0;i<st->lpcSize;i++)
- st->mem_sp[i] = 0;
- return 0;
-
- }
-
- /* LSP Quantization */
- if (st->first)
- {
- for (i=0;i<st->lpcSize;i++)
- st->old_lsp[i] = lsp[i];
- }
-
-
- /*Quantize LSPs*/
-#if 1 /*0 for unquantized*/
- SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits);
-#else
- for (i=0;i<st->lpcSize;i++)
- qlsp[i]=lsp[i];
-#endif
-
- /*If we use low bit-rate pitch mode, transmit open-loop pitch*/
- if (SUBMODE(lbr_pitch)!=-1)
- {
- speex_bits_pack(bits, ol_pitch-st->min_pitch, 7);
- }
-
- if (SUBMODE(forced_pitch_gain))
- {
- int quant;
- /* This just damps the pitch a bit, because it tends to be too aggressive when forced */
- ol_pitch_coef = MULT16_16_Q15(QCONST16(.9,15), ol_pitch_coef);
-#ifdef FIXED_POINT
- quant = PSHR16(MULT16_16_16(15, ol_pitch_coef),GAIN_SHIFT);
-#else
- quant = (int)floor(.5+15*ol_pitch_coef*GAIN_SCALING_1);
-#endif
- if (quant>15)
- quant=15;
- if (quant<0)
- quant=0;
- speex_bits_pack(bits, quant, 4);
- ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
- }
-
-
- /*Quantize and transmit open-loop excitation gain*/
-#ifdef FIXED_POINT
- {
- int qe = scal_quant32(ol_gain, ol_gain_table, 32);
- /*ol_gain = exp(qe/3.5)*SIG_SCALING;*/
- ol_gain = MULT16_32_Q15(28406,ol_gain_table[qe]);
- speex_bits_pack(bits, qe, 5);
- }
-#else
- {
- int qe = (int)(floor(.5+3.5*log(ol_gain*1.0/SIG_SCALING)));
- if (qe<0)
- qe=0;
- if (qe>31)
- qe=31;
- ol_gain = exp(qe/3.5)*SIG_SCALING;
- speex_bits_pack(bits, qe, 5);
- }
-#endif
-
-
-
- /* Special case for first frame */
- if (st->first)
- {
- for (i=0;i<st->lpcSize;i++)
- st->old_qlsp[i] = qlsp[i];
- }
-
- /* Target signal */
- ALLOC(target, st->subframeSize, spx_word16_t);
- ALLOC(innov, st->subframeSize, spx_sig_t);
- ALLOC(exc32, st->subframeSize, spx_word32_t);
- ALLOC(ringing, st->subframeSize, spx_word16_t);
- ALLOC(syn_resp, st->subframeSize, spx_word16_t);
- ALLOC(real_exc, st->subframeSize, spx_word16_t);
- ALLOC(mem, st->lpcSize, spx_mem_t);
-
- /* Loop on sub-frames */
- for (sub=0;sub<st->nbSubframes;sub++)
- {
- int offset;
- spx_word16_t *sw;
- spx_word16_t *exc;
- int pitch;
- int response_bound = st->subframeSize;
-
- /* Offset relative to start of frame */
- offset = st->subframeSize*sub;
- /* Excitation */
- exc=st->exc+offset;
- /* Weighted signal */
- sw=st->sw+offset;
-
- /* LSP interpolation (quantized and unquantized) */
- lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes);
- lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
-
- /* Make sure the filters are stable */
- lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN);
- lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
-
- /* Compute interpolated LPCs (quantized and unquantized) */
- lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack);
-
- lsp_to_lpc(interp_qlsp, interp_qlpc, st->lpcSize, stack);
-
- /* Compute analysis filter gain at w=pi (for use in SB-CELP) */
- {
- spx_word32_t pi_g=LPC_SCALING;
- for (i=0;i<st->lpcSize;i+=2)
- {
- /*pi_g += -st->interp_qlpc[i] + st->interp_qlpc[i+1];*/
- pi_g = ADD32(pi_g, SUB32(EXTEND32(interp_qlpc[i+1]),EXTEND32(interp_qlpc[i])));
- }
- st->pi_gain[sub] = pi_g;
- }
-
-#ifdef VORBIS_PSYCHO
- {
- float curr_curve[128];
- float fact = ((float)sub+1.0f)/st->nbSubframes;
- for (i=0;i<128;i++)
- curr_curve[i] = (1.0f-fact)*st->old_curve[i] + fact*st->curve[i];
- curve_to_lpc(st->psy, curr_curve, bw_lpc1, bw_lpc2, 10);
- }
-#else
- /* Compute bandwidth-expanded (unquantized) LPCs for perceptual weighting */
- bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize);
- if (st->gamma2>=0)
- bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
- else
- {
- for (i=0;i<st->lpcSize;i++)
- bw_lpc2[i]=0;
- }
- /*print_vec(st->bw_lpc1, 10, "bw_lpc");*/
-#endif
-
- /*FIXME: This will break if we change the window size */
- speex_assert(st->windowSize-st->frameSize == st->subframeSize);
- if (sub==0)
- {
- for (i=0;i<st->subframeSize;i++)
- real_exc[i] = sw[i] = st->winBuf[i];
- } else {
- for (i=0;i<st->subframeSize;i++)
- real_exc[i] = sw[i] = in[i+((sub-1)*st->subframeSize)];
- }
- fir_mem16(real_exc, interp_qlpc, real_exc, st->subframeSize, st->lpcSize, st->mem_exc2, stack);
-
- if (st->complexity==0)
- response_bound >>= 1;
- compute_impulse_response(interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, response_bound, st->lpcSize, stack);
- for (i=response_bound;i<st->subframeSize;i++)
- syn_resp[i]=VERY_SMALL;
-
- /* Compute zero response of A(z/g1) / ( A(z/g2) * A(z) ) */
- for (i=0;i<st->lpcSize;i++)
- mem[i]=SHL32(st->mem_sp[i],1);
- for (i=0;i<st->subframeSize;i++)
- ringing[i] = VERY_SMALL;
-#ifdef SHORTCUTS2
- iir_mem16(ringing, interp_qlpc, ringing, response_bound, st->lpcSize, mem, stack);
- for (i=0;i<st->lpcSize;i++)
- mem[i]=SHL32(st->mem_sw[i],1);
- filter_mem16(ringing, st->bw_lpc1, st->bw_lpc2, ringing, response_bound, st->lpcSize, mem, stack);
- SPEEX_MEMSET(&ringing[response_bound], 0, st->subframeSize-response_bound);
-#else
- iir_mem16(ringing, interp_qlpc, ringing, st->subframeSize, st->lpcSize, mem, stack);
- for (i=0;i<st->lpcSize;i++)
- mem[i]=SHL32(st->mem_sw[i],1);
- filter_mem16(ringing, bw_lpc1, bw_lpc2, ringing, st->subframeSize, st->lpcSize, mem, stack);
-#endif
-
- /* Compute weighted signal */
- for (i=0;i<st->lpcSize;i++)
- mem[i]=st->mem_sw[i];
- filter_mem16(sw, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, mem, stack);
-
- if (st->complexity==0)
- for (i=0;i<st->lpcSize;i++)
- st->mem_sw[i]=mem[i];
-
- /* Compute target signal (saturation prevents overflows on clipped input speech) */
- for (i=0;i<st->subframeSize;i++)
- target[i]=EXTRACT16(SATURATE(SUB32(sw[i],PSHR32(ringing[i],1)),32767));
-
- /* Reset excitation */
- SPEEX_MEMSET(exc, 0, st->subframeSize);
-
- /* If we have a long-term predictor (otherwise, something's wrong) */
- speex_assert (SUBMODE(ltp_quant));
- {
- int pit_min, pit_max;
- /* Long-term prediction */
- if (SUBMODE(lbr_pitch) != -1)
- {
- /* Low bit-rate pitch handling */
- int margin;
- margin = SUBMODE(lbr_pitch);
- if (margin)
- {
- if (ol_pitch < st->min_pitch+margin-1)
- ol_pitch=st->min_pitch+margin-1;
- if (ol_pitch > st->max_pitch-margin)
- ol_pitch=st->max_pitch-margin;
- pit_min = ol_pitch-margin+1;
- pit_max = ol_pitch+margin;
- } else {
- pit_min=pit_max=ol_pitch;
- }
- } else {
- pit_min = st->min_pitch;
- pit_max = st->max_pitch;
- }
-
- /* Force pitch to use only the current frame if needed */
- if (st->bounded_pitch && pit_max>offset)
- pit_max=offset;
-
- /* Perform pitch search */
- pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
- exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
- st->lpcSize, st->subframeSize, bits, stack,
- exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain);
-
- st->pitch[sub]=pitch;
- }
- /* Quantization of innovation */
- SPEEX_MEMSET(innov, 0, st->subframeSize);
-
- /* FIXME: Make sure this is save from overflows (so far so good) */
- for (i=0;i<st->subframeSize;i++)
- real_exc[i] = EXTRACT16(SUB32(EXTEND32(real_exc[i]), PSHR32(exc32[i],SIG_SHIFT-1)));
-
- ener = SHL32(EXTEND32(compute_rms16(real_exc, st->subframeSize)),SIG_SHIFT);
-
- /*FIXME: Should use DIV32_16 and make sure result fits in 16 bits */
-#ifdef FIXED_POINT
- {
- spx_word32_t f = PDIV32(ener,PSHR32(ol_gain,SIG_SHIFT));
- if (f<=32767)
- fine_gain = f;
- else
- fine_gain = 32767;
- }
-#else
- fine_gain = PDIV32_16(ener,PSHR32(ol_gain,SIG_SHIFT));
-#endif
- /* Calculate gain correction for the sub-frame (if any) */
- if (SUBMODE(have_subframe_gain))
- {
- int qe;
- if (SUBMODE(have_subframe_gain)==3)
- {
- qe = scal_quant(fine_gain, exc_gain_quant_scal3_bound, 8);
- speex_bits_pack(bits, qe, 3);
- ener=MULT16_32_Q14(exc_gain_quant_scal3[qe],ol_gain);
- } else {
- qe = scal_quant(fine_gain, exc_gain_quant_scal1_bound, 2);
- speex_bits_pack(bits, qe, 1);
- ener=MULT16_32_Q14(exc_gain_quant_scal1[qe],ol_gain);
- }
- } else {
- ener=ol_gain;
- }
-
- /*printf ("%f %f\n", ener, ol_gain);*/
-
- /* Normalize innovation */
- signal_div(target, target, ener, st->subframeSize);
-
- /* Quantize innovation */
- speex_assert (SUBMODE(innovation_quant));
- {
- /* Codebook search */
- SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2,
- SUBMODE(innovation_params), st->lpcSize, st->subframeSize,
- innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
-
- /* De-normalize innovation and update excitation */
- signal_mul(innov, innov, ener, st->subframeSize);
-
- for (i=0;i<st->subframeSize;i++)
- exc[i] = EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
-
- /* In some (rare) modes, we do a second search (more bits) to reduce noise even more */
- if (SUBMODE(double_codebook)) {
- char *tmp_stack=stack;
- VARDECL(spx_sig_t *innov2);
- ALLOC(innov2, st->subframeSize, spx_sig_t);
- SPEEX_MEMSET(innov2, 0, st->subframeSize);
- for (i=0;i<st->subframeSize;i++)
- target[i]=MULT16_16_P13(QCONST16(2.2f,13), target[i]);
- SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2,
- SUBMODE(innovation_params), st->lpcSize, st->subframeSize,
- innov2, syn_resp, bits, stack, st->complexity, 0);
- signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize);
- for (i=0;i<st->subframeSize;i++)
- innov[i] = ADD32(innov[i],innov2[i]);
- stack = tmp_stack;
- }
- for (i=0;i<st->subframeSize;i++)
- exc[i] = EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
- if (st->innov_rms_save)
- {
- st->innov_rms_save[sub] = compute_rms(innov, st->subframeSize);
- }
- }
-
- /* Final signal synthesis from excitation */
- iir_mem16(exc, interp_qlpc, sw, st->subframeSize, st->lpcSize, st->mem_sp, stack);
-
- /* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
- if (st->complexity!=0)
- filter_mem16(sw, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack);
-
- }
-
- /* Store the LSPs for interpolation in the next frame */
- if (st->submodeID>=1)
- {
- for (i=0;i<st->lpcSize;i++)
- st->old_lsp[i] = lsp[i];
- for (i=0;i<st->lpcSize;i++)
- st->old_qlsp[i] = qlsp[i];
- }
-
-#ifdef VORBIS_PSYCHO
- if (st->submodeID>=1)
- SPEEX_COPY(st->old_curve, st->curve, 128);
-#endif
-
- if (st->submodeID==1)
- {
-#ifndef DISABLE_VBR
- if (st->dtx_count)
- speex_bits_pack(bits, 15, 4);
- else
-#endif
- speex_bits_pack(bits, 0, 4);
- }
-
- /* The next frame will not be the first (Duh!) */
- st->first = 0;
- SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize);
-
- if (SUBMODE(innovation_quant) == noise_codebook_quant || st->submodeID==0)
- st->bounded_pitch = 1;
- else
- st->bounded_pitch = 0;
-
- return 1;
-}
-
-void *nb_decoder_init(const SpeexMode *m)
-{
- DecState *st;
- const SpeexNBMode *mode;
- int i;
-
- mode=(const SpeexNBMode*)m->mode;
- st = (DecState *)speex_alloc(sizeof(DecState));
- if (!st)
- return NULL;
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
- st->stack = NULL;
-#else
- st->stack = (char*)speex_alloc_scratch(NB_DEC_STACK);
-#endif
-
- st->mode=m;
-
-
- st->encode_submode = 1;
-
- st->first=1;
- /* Codec parameters, should eventually have several "modes"*/
- st->frameSize = mode->frameSize;
- st->nbSubframes=mode->frameSize/mode->subframeSize;
- st->subframeSize=mode->subframeSize;
- st->lpcSize = mode->lpcSize;
- st->min_pitch=mode->pitchStart;
- st->max_pitch=mode->pitchEnd;
-
- st->submodes=mode->submodes;
- st->submodeID=mode->defaultSubmode;
-
- st->lpc_enh_enabled=1;
-
- st->excBuf = (spx_word16_t*)speex_alloc((st->frameSize + 2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_word16_t));
- st->exc = st->excBuf + 2*st->max_pitch + st->subframeSize + 6;
- SPEEX_MEMSET(st->excBuf, 0, st->frameSize + st->max_pitch);
-
- st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
- st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
- st->mem_sp = (spx_mem_t*)speex_alloc(st->lpcSize*sizeof(spx_mem_t));
- st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
- st->last_pitch = 40;
- st->count_lost=0;
- st->pitch_gain_buf[0] = st->pitch_gain_buf[1] = st->pitch_gain_buf[2] = 0;
- st->pitch_gain_buf_idx = 0;
- st->seed = 1000;
-
- st->sampling_rate=8000;
- st->last_ol_gain = 0;
-
- st->user_callback.func = &speex_default_user_handler;
- st->user_callback.data = NULL;
- for (i=0;i<16;i++)
- st->speex_callbacks[i].func = NULL;
-
- st->voc_m1=st->voc_m2=st->voc_mean=0;
- st->voc_offset=0;
- st->dtx_enabled=0;
- st->isWideband = 0;
- st->highpass_enabled = 1;
-
-#ifdef ENABLE_VALGRIND
- VALGRIND_MAKE_READABLE(st, NB_DEC_STACK);
-#endif
- return st;
-}
-
-void nb_decoder_destroy(void *state)
-{
- DecState *st;
- st=(DecState*)state;
-
-#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
- speex_free_scratch(st->stack);
-#endif
-
- speex_free (st->excBuf);
- speex_free (st->interp_qlpc);
- speex_free (st->old_qlsp);
- speex_free (st->mem_sp);
- speex_free (st->pi_gain);
-
- speex_free(state);
-}
-
-#define median3(a, b, c) ((a) < (b) ? ((b) < (c) ? (b) : ((a) < (c) ? (c) : (a))) : ((c) < (b) ? (b) : ((c) < (a) ? (c) : (a))))
-
-#ifdef FIXED_POINT
-const spx_word16_t attenuation[10] = {32767, 31483, 27923, 22861, 17278, 12055, 7764, 4616, 2533, 1283};
-#else
-const spx_word16_t attenuation[10] = {1., 0.961, 0.852, 0.698, 0.527, 0.368, 0.237, 0.141, 0.077, 0.039};
-
-#endif
-
-static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack)
-{
- int i;
- int pitch_val;
- spx_word16_t pitch_gain;
- spx_word16_t fact;
- spx_word16_t gain_med;
- spx_word16_t innov_gain;
- spx_word16_t noise_gain;
-
- if (st->count_lost<10)
- fact = attenuation[st->count_lost];
- else
- fact = 0;
-
- gain_med = median3(st->pitch_gain_buf[0], st->pitch_gain_buf[1], st->pitch_gain_buf[2]);
- if (gain_med < st->last_pitch_gain)
- st->last_pitch_gain = gain_med;
-
-#ifdef FIXED_POINT
- pitch_gain = st->last_pitch_gain;
- if (pitch_gain>54)
- pitch_gain = 54;
- pitch_gain = SHL16(pitch_gain, 9);
-#else
- pitch_gain = GAIN_SCALING_1*st->last_pitch_gain;
- if (pitch_gain>.85)
- pitch_gain=.85;
-#endif
- pitch_gain = MULT16_16_Q15(fact,pitch_gain) + VERY_SMALL;
- /* FIXME: This was rms of innovation (not exc) */
- innov_gain = compute_rms16(st->exc, st->frameSize);
- noise_gain = MULT16_16_Q15(innov_gain, MULT16_16_Q15(fact, SUB16(Q15ONE,MULT16_16_Q15(pitch_gain,pitch_gain))));
- /* Shift all buffers by one frame */
- SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12);
-
-
- pitch_val = st->last_pitch + SHR32((spx_int32_t)speex_rand(1+st->count_lost, &st->seed),SIG_SHIFT);
- if (pitch_val > st->max_pitch)
- pitch_val = st->max_pitch;
- if (pitch_val < st->min_pitch)
- pitch_val = st->min_pitch;
- for (i=0;i<st->frameSize;i++)
- {
- st->exc[i]= MULT16_16_Q15(pitch_gain, (st->exc[i-pitch_val]+VERY_SMALL)) +
- speex_rand(noise_gain, &st->seed);
- }
-
- bw_lpc(QCONST16(.98,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize);
- iir_mem16(&st->exc[-st->subframeSize], st->interp_qlpc, out, st->frameSize,
- st->lpcSize, st->mem_sp, stack);
- highpass(out, out, st->frameSize, HIGHPASS_NARROWBAND|HIGHPASS_OUTPUT, st->mem_hp);
-
- st->first = 0;
- st->count_lost++;
- st->pitch_gain_buf[st->pitch_gain_buf_idx++] = PSHR16(pitch_gain,9);
- if (st->pitch_gain_buf_idx > 2) /* rollover */
- st->pitch_gain_buf_idx = 0;
-}
-
-/* Just so we don't need to carry the complete wideband mode information */
-static const int wb_skip_table[8] = {0, 36, 112, 192, 352, 0, 0, 0};
-
-int nb_decode(void *state, SpeexBits *bits, void *vout)
-{
- DecState *st;
- int i, sub;
- int pitch;
- spx_word16_t pitch_gain[3];
- spx_word32_t ol_gain=0;
- int ol_pitch=0;
- spx_word16_t ol_pitch_coef=0;
- int best_pitch=40;
- spx_word16_t best_pitch_gain=0;
- int wideband;
- int m;
- char *stack;
- VARDECL(spx_sig_t *innov);
- VARDECL(spx_word32_t *exc32);
- VARDECL(spx_coef_t *ak);
- VARDECL(spx_lsp_t *qlsp);
- spx_word16_t pitch_average=0;
-
- spx_word16_t *out = (spx_word16_t*)vout;
- VARDECL(spx_lsp_t *interp_qlsp);
-
- st=(DecState*)state;
- stack=st->stack;
-
- /* Check if we're in DTX mode*/
- if (!bits && st->dtx_enabled)
- {
- st->submodeID=0;
- } else
- {
- /* If bits is NULL, consider the packet to be lost (what could we do anyway) */
- if (!bits)
- {
- nb_decode_lost(st, out, stack);
- return 0;
- }
-
- if (st->encode_submode)
- {
-
- /* Search for next narrowband block (handle requests, skip wideband blocks) */
- do {
- if (speex_bits_remaining(bits)<5)
- return -1;
- wideband = speex_bits_unpack_unsigned(bits, 1);
- if (wideband) /* Skip wideband block (for compatibility) */
- {
- int submode;
- int advance;
- advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
- /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
- advance = wb_skip_table[submode];
- if (advance < 0)
- {
- speex_notify("Invalid mode encountered. The stream is corrupted.");
- return -2;
- }
- advance -= (SB_SUBMODE_BITS+1);
- speex_bits_advance(bits, advance);
-
- if (speex_bits_remaining(bits)<5)
- return -1;
- wideband = speex_bits_unpack_unsigned(bits, 1);
- if (wideband)
- {
- advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
- /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
- advance = wb_skip_table[submode];
- if (advance < 0)
- {
- speex_notify("Invalid mode encountered. The stream is corrupted.");
- return -2;
- }
- advance -= (SB_SUBMODE_BITS+1);
- speex_bits_advance(bits, advance);
- wideband = speex_bits_unpack_unsigned(bits, 1);
- if (wideband)
- {
- speex_notify("More than two wideband layers found. The stream is corrupted.");
- return -2;
- }
-
- }
- }
- if (speex_bits_remaining(bits)<4)
- return -1;
- /* FIXME: Check for overflow */
- m = speex_bits_unpack_unsigned(bits, 4);
- if (m==15) /* We found a terminator */
- {
- return -1;
- } else if (m==14) /* Speex in-band request */
- {
- int ret = speex_inband_handler(bits, st->speex_callbacks, state);
- if (ret)
- return ret;
- } else if (m==13) /* User in-band request */
- {
- int ret = st->user_callback.func(bits, state, st->user_callback.data);
- if (ret)
- return ret;
- } else if (m>8) /* Invalid mode */
- {
- speex_notify("Invalid mode encountered. The stream is corrupted.");
- return -2;
- }
-
- } while (m>8);
-
- /* Get the sub-mode that was used */
- st->submodeID = m;
- }
-
- }
-
- /* Shift all buffers by one frame */
- SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12);
-
- /* If null mode (no transmission), just set a couple things to zero*/
- if (st->submodes[st->submodeID] == NULL)
- {
- VARDECL(spx_coef_t *lpc);
- ALLOC(lpc, st->lpcSize, spx_coef_t);
- bw_lpc(QCONST16(0.93f,15), st->interp_qlpc, lpc, st->lpcSize);
- {
- spx_word16_t innov_gain=0;
- /* FIXME: This was innov, not exc */
- innov_gain = compute_rms16(st->exc, st->frameSize);
- for (i=0;i<st->frameSize;i++)
- st->exc[i]=speex_rand(innov_gain, &st->seed);
- }
-
-
- st->first=1;
-
- /* Final signal synthesis from excitation */
- iir_mem16(st->exc, lpc, out, st->frameSize, st->lpcSize, st->mem_sp, stack);
-
- st->count_lost=0;
- return 0;
- }
-
- ALLOC(qlsp, st->lpcSize, spx_lsp_t);
-
- /* Unquantize LSPs */
- SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits);
-
- /*Damp memory if a frame was lost and the LSP changed too much*/
- if (st->count_lost)
- {
- spx_word16_t fact;
- spx_word32_t lsp_dist=0;
- for (i=0;i<st->lpcSize;i++)
- lsp_dist = ADD32(lsp_dist, EXTEND32(ABS(st->old_qlsp[i] - qlsp[i])));
-#ifdef FIXED_POINT
- fact = SHR16(19661,SHR32(lsp_dist,LSP_SHIFT+2));
-#else
- fact = .6*exp(-.2*lsp_dist);
-#endif
- for (i=0;i<st->lpcSize;i++)
- st->mem_sp[i] = MULT16_32_Q15(fact,st->mem_sp[i]);
- }
-
-
- /* Handle first frame and lost-packet case */
- if (st->first || st->count_lost)
- {
- for (i=0;i<st->lpcSize;i++)
- st->old_qlsp[i] = qlsp[i];
- }
-
- /* Get open-loop pitch estimation for low bit-rate pitch coding */
- if (SUBMODE(lbr_pitch)!=-1)
- {
- ol_pitch = st->min_pitch+speex_bits_unpack_unsigned(bits, 7);
- }
-
- if (SUBMODE(forced_pitch_gain))
- {
- int quant;
- quant = speex_bits_unpack_unsigned(bits, 4);
- ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
- }
-
- /* Get global excitation gain */
- {
- int qe;
- qe = speex_bits_unpack_unsigned(bits, 5);
-#ifdef FIXED_POINT
- /* FIXME: Perhaps we could slightly lower the gain here when the output is going to saturate? */
- ol_gain = MULT16_32_Q15(28406,ol_gain_table[qe]);
-#else
- ol_gain = SIG_SCALING*exp(qe/3.5);
-#endif
- }
-
- ALLOC(ak, st->lpcSize, spx_coef_t);
- ALLOC(innov, st->subframeSize, spx_sig_t);
- ALLOC(exc32, st->subframeSize, spx_word32_t);
-
- if (st->submodeID==1)
- {
- int extra;
- extra = speex_bits_unpack_unsigned(bits, 4);
-
- if (extra==15)
- st->dtx_enabled=1;
- else
- st->dtx_enabled=0;
- }
- if (st->submodeID>1)
- st->dtx_enabled=0;
-
- /*Loop on subframes */
- for (sub=0;sub<st->nbSubframes;sub++)
- {
- int offset;
- spx_word16_t *exc;
- spx_word16_t *sp;
- spx_word16_t *innov_save = NULL;
- spx_word16_t tmp;
-
- /* Offset relative to start of frame */
- offset = st->subframeSize*sub;
- /* Excitation */
- exc=st->exc+offset;
- /* Original signal */
- sp=out+offset;
- if (st->innov_save)
- innov_save = st->innov_save+offset;
-
-
- /* Reset excitation */
- SPEEX_MEMSET(exc, 0, st->subframeSize);
-
- /*Adaptive codebook contribution*/
- speex_assert (SUBMODE(ltp_unquant));
- {
- int pit_min, pit_max;
- /* Handle pitch constraints if any */
- if (SUBMODE(lbr_pitch) != -1)
- {
- int margin;
- margin = SUBMODE(lbr_pitch);
- if (margin)
- {
-/* GT - need optimization?
- if (ol_pitch < st->min_pitch+margin-1)
- ol_pitch=st->min_pitch+margin-1;
- if (ol_pitch > st->max_pitch-margin)
- ol_pitch=st->max_pitch-margin;
- pit_min = ol_pitch-margin+1;
- pit_max = ol_pitch+margin;
-*/
- pit_min = ol_pitch-margin+1;
- if (pit_min < st->min_pitch)
- pit_min = st->min_pitch;
- pit_max = ol_pitch+margin;
- if (pit_max > st->max_pitch)
- pit_max = st->max_pitch;
- } else {
- pit_min = pit_max = ol_pitch;
- }
- } else {
- pit_min = st->min_pitch;
- pit_max = st->max_pitch;
- }
-
-
-
- SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params),
- st->subframeSize, &pitch, &pitch_gain[0], bits, stack,
- st->count_lost, offset, st->last_pitch_gain, 0);
-
- /* Ensuring that things aren't blowing up as would happen if e.g. an encoder is
- crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat).
- We can probably be even more aggressive and limit to 15000 or so. */
- sanitize_values32(exc32, NEG32(QCONST32(32000,SIG_SHIFT-1)), QCONST32(32000,SIG_SHIFT-1), st->subframeSize);
-
- tmp = gain_3tap_to_1tap(pitch_gain);
-
- pitch_average += tmp;
- if ((tmp>best_pitch_gain&&ABS(2*best_pitch-pitch)>=3&&ABS(3*best_pitch-pitch)>=4&&ABS(4*best_pitch-pitch)>=5)
- || (tmp>MULT16_16_Q15(QCONST16(.6,15),best_pitch_gain)&&(ABS(best_pitch-2*pitch)<3||ABS(best_pitch-3*pitch)<4||ABS(best_pitch-4*pitch)<5))
- || (MULT16_16_Q15(QCONST16(.67,15),tmp)>best_pitch_gain&&(ABS(2*best_pitch-pitch)<3||ABS(3*best_pitch-pitch)<4||ABS(4*best_pitch-pitch)<5)) )
- {
- best_pitch = pitch;
- if (tmp > best_pitch_gain)
- best_pitch_gain = tmp;
- }
- }
-
- /* Unquantize the innovation */
- {
- int q_energy;
- spx_word32_t ener;
-
- SPEEX_MEMSET(innov, 0, st->subframeSize);
-
- /* Decode sub-frame gain correction */
- if (SUBMODE(have_subframe_gain)==3)
- {
- q_energy = speex_bits_unpack_unsigned(bits, 3);
- ener = MULT16_32_Q14(exc_gain_quant_scal3[q_energy],ol_gain);
- } else if (SUBMODE(have_subframe_gain)==1)
- {
- q_energy = speex_bits_unpack_unsigned(bits, 1);
- ener = MULT16_32_Q14(exc_gain_quant_scal1[q_energy],ol_gain);
- } else {
- ener = ol_gain;
- }
-
- speex_assert (SUBMODE(innovation_unquant));
- {
- /*Fixed codebook contribution*/
- SUBMODE(innovation_unquant)(innov, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed);
- /* De-normalize innovation and update excitation */
-
- signal_mul(innov, innov, ener, st->subframeSize);
-
- /* Decode second codebook (only for some modes) */
- if (SUBMODE(double_codebook))
- {
- char *tmp_stack=stack;
- VARDECL(spx_sig_t *innov2);
- ALLOC(innov2, st->subframeSize, spx_sig_t);
- SPEEX_MEMSET(innov2, 0, st->subframeSize);
- SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed);
- signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize);
- for (i=0;i<st->subframeSize;i++)
- innov[i] = ADD32(innov[i], innov2[i]);
- stack = tmp_stack;
- }
- for (i=0;i<st->subframeSize;i++)
- exc[i]=EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
- /*print_vec(exc, 40, "innov");*/
- if (innov_save)
- {
- for (i=0;i<st->subframeSize;i++)
- innov_save[i] = EXTRACT16(PSHR32(innov[i], SIG_SHIFT));
- }
- }
-
- /*Vocoder mode*/
- if (st->submodeID==1)
- {
- spx_word16_t g=ol_pitch_coef;
- g=MULT16_16_P14(QCONST16(1.5f,14),(g-QCONST16(.2f,6)));
- if (g<0)
- g=0;
- if (g>GAIN_SCALING)
- g=GAIN_SCALING;
-
- SPEEX_MEMSET(exc, 0, st->subframeSize);
- while (st->voc_offset<st->subframeSize)
- {
- /* exc[st->voc_offset]= g*sqrt(2*ol_pitch)*ol_gain;
- Not quite sure why we need the factor of two in the sqrt */
- if (st->voc_offset>=0)
- exc[st->voc_offset]=MULT16_16(spx_sqrt(MULT16_16_16(2,ol_pitch)),EXTRACT16(PSHR32(MULT16_16(g,PSHR32(ol_gain,SIG_SHIFT)),6)));
- st->voc_offset+=ol_pitch;
- }
- st->voc_offset -= st->subframeSize;
-
- for (i=0;i<st->subframeSize;i++)
- {
- spx_word16_t exci=exc[i];
- exc[i]= ADD16(ADD16(MULT16_16_Q15(QCONST16(.7f,15),exc[i]) , MULT16_16_Q15(QCONST16(.3f,15),st->voc_m1)),
- SUB16(MULT16_16_Q15(Q15_ONE-MULT16_16_16(QCONST16(.85f,9),g),EXTRACT16(PSHR32(innov[i],SIG_SHIFT))),
- MULT16_16_Q15(MULT16_16_16(QCONST16(.15f,9),g),EXTRACT16(PSHR32(st->voc_m2,SIG_SHIFT)))
- ));
- st->voc_m1 = exci;
- st->voc_m2=innov[i];
- st->voc_mean = EXTRACT16(PSHR32(ADD32(MULT16_16(QCONST16(.8f,15),st->voc_mean), MULT16_16(QCONST16(.2f,15),exc[i])), 15));
- exc[i]-=st->voc_mean;
- }
- }
-
- }
- }
-
- ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
-
- if (st->lpc_enh_enabled && SUBMODE(comb_gain)>0 && !st->count_lost)
- {
- multicomb(st->exc-st->subframeSize, out, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, 40, SUBMODE(comb_gain), stack);
- multicomb(st->exc+st->subframeSize, out+2*st->subframeSize, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, 40, SUBMODE(comb_gain), stack);
- } else {
- SPEEX_COPY(out, &st->exc[-st->subframeSize], st->frameSize);
- }
-
- /* If the last packet was lost, re-scale the excitation to obtain the same energy as encoded in ol_gain */
- if (st->count_lost)
- {
- spx_word16_t exc_ener;
- spx_word32_t gain32;
- spx_word16_t gain;
- exc_ener = compute_rms16 (st->exc, st->frameSize);
- gain32 = PDIV32(ol_gain, ADD16(exc_ener,1));
-#ifdef FIXED_POINT
- if (gain32 > 32767)
- gain32 = 32767;
- gain = EXTRACT16(gain32);
-#else
- if (gain32 > 2)
- gain32=2;
- gain = gain32;
-#endif
- for (i=0;i<st->frameSize;i++)
- {
- st->exc[i] = MULT16_16_Q14(gain, st->exc[i]);
- out[i]=st->exc[i-st->subframeSize];
- }
- }
-
- /*Loop on subframes */
- for (sub=0;sub<st->nbSubframes;sub++)
- {
- int offset;
- spx_word16_t *sp;
- spx_word16_t *exc;
- /* Offset relative to start of frame */
- offset = st->subframeSize*sub;
- /* Original signal */
- sp=out+offset;
- /* Excitation */
- exc=st->exc+offset;
-
- /* LSP interpolation (quantized and unquantized) */
- lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
-
- /* Make sure the LSP's are stable */
- lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
-
- /* Compute interpolated LPCs (unquantized) */
- lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack);
-
- /* Compute analysis filter at w=pi */
- {
- spx_word32_t pi_g=LPC_SCALING;
- for (i=0;i<st->lpcSize;i+=2)
- {
- /*pi_g += -st->interp_qlpc[i] + st->interp_qlpc[i+1];*/
- pi_g = ADD32(pi_g, SUB32(EXTEND32(ak[i+1]),EXTEND32(ak[i])));
- }
- st->pi_gain[sub] = pi_g;
- }
-
- iir_mem16(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize,
- st->mem_sp, stack);
-
- for (i=0;i<st->lpcSize;i++)
- st->interp_qlpc[i] = ak[i];
-
- }
-
- if (st->highpass_enabled)
- highpass(out, out, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_OUTPUT, st->mem_hp);
- /*for (i=0;i<st->frameSize;i++)
- printf ("%d\n", (int)st->frame[i]);*/
-
- /* Tracking output level */
- st->level = 1+PSHR32(ol_gain,SIG_SHIFT);
- st->max_level = MAX16(MULT16_16_Q15(QCONST16(.99f,15), st->max_level), st->level);
- st->min_level = MIN16(ADD16(1,MULT16_16_Q14(QCONST16(1.01f,14), st->min_level)), st->level);
- if (st->max_level < st->min_level+1)
- st->max_level = st->min_level+1;
- /*printf ("%f %f %f %d\n", og, st->min_level, st->max_level, update);*/
-
- /* Store the LSPs for interpolation in the next frame */
- for (i=0;i<st->lpcSize;i++)
- st->old_qlsp[i] = qlsp[i];
-
- /* The next frame will not be the first (Duh!) */
- st->first = 0;
- st->count_lost=0;
- st->last_pitch = best_pitch;
-#ifdef FIXED_POINT
- st->last_pitch_gain = PSHR16(pitch_average,2);
-#else
- st->last_pitch_gain = .25*pitch_average;
-#endif
- st->pitch_gain_buf[st->pitch_gain_buf_idx++] = st->last_pitch_gain;
- if (st->pitch_gain_buf_idx > 2) /* rollover */
- st->pitch_gain_buf_idx = 0;
-
- st->last_ol_gain = ol_gain;
-
- return 0;
-}
-
-int nb_encoder_ctl(void *state, int request, void *ptr)
-{
- EncState *st;
- st=(EncState*)state;
- switch(request)
- {
- case SPEEX_GET_FRAME_SIZE:
- (*(spx_int32_t*)ptr) = st->frameSize;
- break;
- case SPEEX_SET_LOW_MODE:
- case SPEEX_SET_MODE:
- st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_LOW_MODE:
- case SPEEX_GET_MODE:
- (*(spx_int32_t*)ptr) = st->submodeID;
- break;
-#ifndef DISABLE_VBR
- case SPEEX_SET_VBR:
- st->vbr_enabled = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_VBR:
- (*(spx_int32_t*)ptr) = st->vbr_enabled;
- break;
- case SPEEX_SET_VAD:
- st->vad_enabled = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_VAD:
- (*(spx_int32_t*)ptr) = st->vad_enabled;
- break;
- case SPEEX_SET_DTX:
- st->dtx_enabled = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_DTX:
- (*(spx_int32_t*)ptr) = st->dtx_enabled;
- break;
- case SPEEX_SET_ABR:
- st->abr_enabled = (*(spx_int32_t*)ptr);
- st->vbr_enabled = st->abr_enabled!=0;
- if (st->vbr_enabled)
- {
- spx_int32_t i=10;
- spx_int32_t rate, target;
- float vbr_qual;
- target = (*(spx_int32_t*)ptr);
- while (i>=0)
- {
- speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
- speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
- if (rate <= target)
- break;
- i--;
- }
- vbr_qual=i;
- if (vbr_qual<0)
- vbr_qual=0;
- speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_qual);
- st->abr_count=0;
- st->abr_drift=0;
- st->abr_drift2=0;
- }
-
- break;
- case SPEEX_GET_ABR:
- (*(spx_int32_t*)ptr) = st->abr_enabled;
- break;
-#endif /* #ifndef DISABLE_VBR */
-#if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API)
- case SPEEX_SET_VBR_QUALITY:
- st->vbr_quality = (*(float*)ptr);
- break;
- case SPEEX_GET_VBR_QUALITY:
- (*(float*)ptr) = st->vbr_quality;
- break;
-#endif /* !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) */
- case SPEEX_SET_QUALITY:
- {
- int quality = (*(spx_int32_t*)ptr);
- if (quality < 0)
- quality = 0;
- if (quality > 10)
- quality = 10;
- st->submodeSelect = st->submodeID = ((const SpeexNBMode*)(st->mode->mode))->quality_map[quality];
- }
- break;
- case SPEEX_SET_COMPLEXITY:
- st->complexity = (*(spx_int32_t*)ptr);
- if (st->complexity<0)
- st->complexity=0;
- break;
- case SPEEX_GET_COMPLEXITY:
- (*(spx_int32_t*)ptr) = st->complexity;
- break;
- case SPEEX_SET_BITRATE:
- {
- spx_int32_t i=10;
- spx_int32_t rate, target;
- target = (*(spx_int32_t*)ptr);
- while (i>=0)
- {
- speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
- speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
- if (rate <= target)
- break;
- i--;
- }
- }
- break;
- case SPEEX_GET_BITRATE:
- if (st->submodes[st->submodeID])
- (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;
- else
- (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;
- break;
- case SPEEX_SET_SAMPLING_RATE:
- st->sampling_rate = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_SAMPLING_RATE:
- (*(spx_int32_t*)ptr)=st->sampling_rate;
- break;
- case SPEEX_RESET_STATE:
- {
- int i;
- st->bounded_pitch = 1;
- st->first = 1;
- for (i=0;i<st->lpcSize;i++)
- st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
- for (i=0;i<st->lpcSize;i++)
- st->mem_sw[i]=st->mem_sw_whole[i]=st->mem_sp[i]=st->mem_exc[i]=0;
- for (i=0;i<st->frameSize+st->max_pitch+1;i++)
- st->excBuf[i]=st->swBuf[i]=0;
- for (i=0;i<st->windowSize-st->frameSize;i++)
- st->winBuf[i]=0;
- }
- break;
- case SPEEX_SET_SUBMODE_ENCODING:
- st->encode_submode = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_SUBMODE_ENCODING:
- (*(spx_int32_t*)ptr) = st->encode_submode;
- break;
- case SPEEX_GET_LOOKAHEAD:
- (*(spx_int32_t*)ptr)=(st->windowSize-st->frameSize);
- break;
- case SPEEX_SET_PLC_TUNING:
- st->plc_tuning = (*(spx_int32_t*)ptr);
- if (st->plc_tuning>100)
- st->plc_tuning=100;
- break;
- case SPEEX_GET_PLC_TUNING:
- (*(spx_int32_t*)ptr)=(st->plc_tuning);
- break;
-#ifndef DISABLE_VBR
- case SPEEX_SET_VBR_MAX_BITRATE:
- st->vbr_max = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_VBR_MAX_BITRATE:
- (*(spx_int32_t*)ptr) = st->vbr_max;
- break;
-#endif /* #ifndef DISABLE_VBR */
- case SPEEX_SET_HIGHPASS:
- st->highpass_enabled = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_HIGHPASS:
- (*(spx_int32_t*)ptr) = st->highpass_enabled;
- break;
-
- /* This is all internal stuff past this point */
- case SPEEX_GET_PI_GAIN:
- {
- int i;
- spx_word32_t *g = (spx_word32_t*)ptr;
- for (i=0;i<st->nbSubframes;i++)
- g[i]=st->pi_gain[i];
- }
- break;
- case SPEEX_GET_EXC:
- {
- int i;
- for (i=0;i<st->nbSubframes;i++)
- ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize);
- }
- break;
-#ifndef DISABLE_VBR
- case SPEEX_GET_RELATIVE_QUALITY:
- (*(float*)ptr)=st->relative_quality;
- break;
-#endif /* #ifndef DISABLE_VBR */
- case SPEEX_SET_INNOVATION_SAVE:
- st->innov_rms_save = (spx_word16_t*)ptr;
- break;
- case SPEEX_SET_WIDEBAND:
- st->isWideband = *((spx_int32_t*)ptr);
- break;
- case SPEEX_GET_STACK:
- *((char**)ptr) = st->stack;
- break;
- default:
- speex_warning_int("Unknown nb_ctl request: ", request);
- return -1;
- }
- return 0;
-}
-
-int nb_decoder_ctl(void *state, int request, void *ptr)
-{
- DecState *st;
- st=(DecState*)state;
- switch(request)
- {
- case SPEEX_SET_LOW_MODE:
- case SPEEX_SET_MODE:
- st->submodeID = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_LOW_MODE:
- case SPEEX_GET_MODE:
- (*(spx_int32_t*)ptr) = st->submodeID;
- break;
- case SPEEX_SET_ENH:
- st->lpc_enh_enabled = *((spx_int32_t*)ptr);
- break;
- case SPEEX_GET_ENH:
- *((spx_int32_t*)ptr) = st->lpc_enh_enabled;
- break;
- case SPEEX_GET_FRAME_SIZE:
- (*(spx_int32_t*)ptr) = st->frameSize;
- break;
- case SPEEX_GET_BITRATE:
- if (st->submodes[st->submodeID])
- (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;
- else
- (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;
- break;
- case SPEEX_SET_SAMPLING_RATE:
- st->sampling_rate = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_SAMPLING_RATE:
- (*(spx_int32_t*)ptr)=st->sampling_rate;
- break;
- case SPEEX_SET_HANDLER:
- {
- SpeexCallback *c = (SpeexCallback*)ptr;
- st->speex_callbacks[c->callback_id].func=c->func;
- st->speex_callbacks[c->callback_id].data=c->data;
- st->speex_callbacks[c->callback_id].callback_id=c->callback_id;
- }
- break;
- case SPEEX_SET_USER_HANDLER:
- {
- SpeexCallback *c = (SpeexCallback*)ptr;
- st->user_callback.func=c->func;
- st->user_callback.data=c->data;
- st->user_callback.callback_id=c->callback_id;
- }
- break;
- case SPEEX_RESET_STATE:
- {
- int i;
- for (i=0;i<st->lpcSize;i++)
- st->mem_sp[i]=0;
- for (i=0;i<st->frameSize + st->max_pitch + 1;i++)
- st->excBuf[i]=0;
- }
- break;
- case SPEEX_SET_SUBMODE_ENCODING:
- st->encode_submode = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_SUBMODE_ENCODING:
- (*(spx_int32_t*)ptr) = st->encode_submode;
- break;
- case SPEEX_GET_LOOKAHEAD:
- (*(spx_int32_t*)ptr)=st->subframeSize;
- break;
- case SPEEX_SET_HIGHPASS:
- st->highpass_enabled = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_GET_HIGHPASS:
- (*(spx_int32_t*)ptr) = st->highpass_enabled;
- break;
- /* FIXME: Convert to fixed-point and re-enable even when float API is disabled */
-#ifndef DISABLE_FLOAT_API
- case SPEEX_GET_ACTIVITY:
- {
- float ret;
- ret = log(st->level/st->min_level)/log(st->max_level/st->min_level);
- if (ret>1)
- ret = 1;
- /* Done in a strange way to catch NaNs as well */
- if (!(ret > 0))
- ret = 0;
- /*printf ("%f %f %f %f\n", st->level, st->min_level, st->max_level, ret);*/
- (*(spx_int32_t*)ptr) = (int)(100*ret);
- }
- break;
-#endif
- case SPEEX_GET_PI_GAIN:
- {
- int i;
- spx_word32_t *g = (spx_word32_t*)ptr;
- for (i=0;i<st->nbSubframes;i++)
- g[i]=st->pi_gain[i];
- }
- break;
- case SPEEX_GET_EXC:
- {
- int i;
- for (i=0;i<st->nbSubframes;i++)
- ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize);
- }
- break;
- case SPEEX_GET_DTX_STATUS:
- *((spx_int32_t*)ptr) = st->dtx_enabled;
- break;
- case SPEEX_SET_INNOVATION_SAVE:
- st->innov_save = (spx_word16_t*)ptr;
- break;
- case SPEEX_SET_WIDEBAND:
- st->isWideband = *((spx_int32_t*)ptr);
- break;
- case SPEEX_GET_STACK:
- *((char**)ptr) = st->stack;
- break;
- default:
- speex_warning_int("Unknown nb_ctl request: ", request);
- return -1;
- }
- return 0;
-}
diff --git a/drivers/speex/nb_celp.h b/drivers/speex/nb_celp.h
deleted file mode 100644
index 14c776ff3..000000000
--- a/drivers/speex/nb_celp.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin */
-/**
- @file nb_celp.h
- @brief Narrowband CELP encoder/decoder
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef NB_CELP_H
-#define NB_CELP_H
-
-#include "modes.h"
-#include <speex/speex_bits.h>
-#include <speex/speex_callbacks.h>
-#include "vbr.h"
-#include "filters.h"
-
-#ifdef VORBIS_PSYCHO
-#include "vorbis_psy.h"
-#endif
-
-/**Structure representing the full state of the narrowband encoder*/
-typedef struct EncState {
- const SpeexMode *mode; /**< Mode corresponding to the state */
- int first; /**< Is this the first frame? */
- int frameSize; /**< Size of frames */
- int subframeSize; /**< Size of sub-frames */
- int nbSubframes; /**< Number of sub-frames */
- int windowSize; /**< Analysis (LPC) window length */
- int lpcSize; /**< LPC order */
- int min_pitch; /**< Minimum pitch value allowed */
- int max_pitch; /**< Maximum pitch value allowed */
-
- spx_word32_t cumul_gain; /**< Product of previously used pitch gains (Q10) */
- int bounded_pitch; /**< Next frame should not rely on previous frames for pitch */
- int ol_pitch; /**< Open-loop pitch */
- int ol_voiced; /**< Open-loop voiced/non-voiced decision */
- int *pitch;
-
-#ifdef VORBIS_PSYCHO
- VorbisPsy *psy;
- float *psy_window;
- float *curve;
- float *old_curve;
-#endif
-
- spx_word16_t gamma1; /**< Perceptual filter: A(z/gamma1) */
- spx_word16_t gamma2; /**< Perceptual filter: A(z/gamma2) */
- spx_word16_t lpc_floor; /**< Noise floor multiplier for A[0] in LPC analysis*/
- char *stack; /**< Pseudo-stack allocation for temporary memory */
- spx_word16_t *winBuf; /**< Input buffer (original signal) */
- spx_word16_t *excBuf; /**< Excitation buffer */
- spx_word16_t *exc; /**< Start of excitation frame */
- spx_word16_t *swBuf; /**< Weighted signal buffer */
- spx_word16_t *sw; /**< Start of weighted signal frame */
- const spx_word16_t *window; /**< Temporary (Hanning) window */
- const spx_word16_t *lagWindow; /**< Window applied to auto-correlation */
- spx_lsp_t *old_lsp; /**< LSPs for previous frame */
- spx_lsp_t *old_qlsp; /**< Quantized LSPs for previous frame */
- spx_mem_t *mem_sp; /**< Filter memory for signal synthesis */
- spx_mem_t *mem_sw; /**< Filter memory for perceptually-weighted signal */
- spx_mem_t *mem_sw_whole; /**< Filter memory for perceptually-weighted signal (whole frame)*/
- spx_mem_t *mem_exc; /**< Filter memory for excitation (whole frame) */
- spx_mem_t *mem_exc2; /**< Filter memory for excitation (whole frame) */
- spx_mem_t mem_hp[2]; /**< High-pass filter memory */
- spx_word32_t *pi_gain; /**< Gain of LPC filter at theta=pi (fe/2) */
- spx_word16_t *innov_rms_save; /**< If non-NULL, innovation RMS is copied here */
-
-#ifndef DISABLE_VBR
- VBRState *vbr; /**< State of the VBR data */
- float vbr_quality; /**< Quality setting for VBR encoding */
- float relative_quality; /**< Relative quality that will be needed by VBR */
- spx_int32_t vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
- spx_int32_t vbr_max; /**< Max bit-rate allowed in VBR mode */
- int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */
- int dtx_enabled; /**< 1 for enabling DTX, 0 otherwise */
- int dtx_count; /**< Number of consecutive DTX frames */
- spx_int32_t abr_enabled; /**< ABR setting (in bps), 0 if off */
- float abr_drift;
- float abr_drift2;
- float abr_count;
-#endif /* #ifndef DISABLE_VBR */
-
- int complexity; /**< Complexity setting (0-10 from least complex to most complex) */
- spx_int32_t sampling_rate;
- int plc_tuning;
- int encode_submode;
- const SpeexSubmode * const *submodes; /**< Sub-mode data */
- int submodeID; /**< Activated sub-mode */
- int submodeSelect; /**< Mode chosen by the user (may differ from submodeID if VAD is on) */
- int isWideband; /**< Is this used as part of the embedded wideband codec */
- int highpass_enabled; /**< Is the input filter enabled */
-} EncState;
-
-/**Structure representing the full state of the narrowband decoder*/
-typedef struct DecState {
- const SpeexMode *mode; /**< Mode corresponding to the state */
- int first; /**< Is this the first frame? */
- int count_lost; /**< Was the last frame lost? */
- int frameSize; /**< Size of frames */
- int subframeSize; /**< Size of sub-frames */
- int nbSubframes; /**< Number of sub-frames */
- int lpcSize; /**< LPC order */
- int min_pitch; /**< Minimum pitch value allowed */
- int max_pitch; /**< Maximum pitch value allowed */
- spx_int32_t sampling_rate;
-
- spx_word16_t last_ol_gain; /**< Open-loop gain for previous frame */
-
- char *stack; /**< Pseudo-stack allocation for temporary memory */
- spx_word16_t *excBuf; /**< Excitation buffer */
- spx_word16_t *exc; /**< Start of excitation frame */
- spx_lsp_t *old_qlsp; /**< Quantized LSPs for previous frame */
- spx_coef_t *interp_qlpc; /**< Interpolated quantized LPCs */
- spx_mem_t *mem_sp; /**< Filter memory for synthesis signal */
- spx_mem_t mem_hp[2]; /**< High-pass filter memory */
- spx_word32_t *pi_gain; /**< Gain of LPC filter at theta=pi (fe/2) */
- spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */
-
- spx_word16_t level;
- spx_word16_t max_level;
- spx_word16_t min_level;
-
- /* This is used in packet loss concealment */
- int last_pitch; /**< Pitch of last correctly decoded frame */
- spx_word16_t last_pitch_gain; /**< Pitch gain of last correctly decoded frame */
- spx_word16_t pitch_gain_buf[3]; /**< Pitch gain of last decoded frames */
- int pitch_gain_buf_idx; /**< Tail of the buffer */
- spx_int32_t seed; /** Seed used for random number generation */
-
- int encode_submode;
- const SpeexSubmode * const *submodes; /**< Sub-mode data */
- int submodeID; /**< Activated sub-mode */
- int lpc_enh_enabled; /**< 1 when LPC enhancer is on, 0 otherwise */
- SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS];
-
- SpeexCallback user_callback;
-
- /*Vocoder data*/
- spx_word16_t voc_m1;
- spx_word32_t voc_m2;
- spx_word16_t voc_mean;
- int voc_offset;
-
- int dtx_enabled;
- int isWideband; /**< Is this used as part of the embedded wideband codec */
- int highpass_enabled; /**< Is the input filter enabled */
-} DecState;
-
-/** Initializes encoder state*/
-void *nb_encoder_init(const SpeexMode *m);
-
-/** De-allocates encoder state resources*/
-void nb_encoder_destroy(void *state);
-
-/** Encodes one frame*/
-int nb_encode(void *state, void *in, SpeexBits *bits);
-
-
-/** Initializes decoder state*/
-void *nb_decoder_init(const SpeexMode *m);
-
-/** De-allocates decoder state resources*/
-void nb_decoder_destroy(void *state);
-
-/** Decodes one frame*/
-int nb_decode(void *state, SpeexBits *bits, void *out);
-
-/** ioctl-like function for controlling a narrowband encoder */
-int nb_encoder_ctl(void *state, int request, void *ptr);
-
-/** ioctl-like function for controlling a narrowband decoder */
-int nb_decoder_ctl(void *state, int request, void *ptr);
-
-
-#endif
diff --git a/drivers/speex/os_support.h b/drivers/speex/os_support.h
deleted file mode 100644
index 9a18247aa..000000000
--- a/drivers/speex/os_support.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-
- File: os_support.h
- This is the (tiny) OS abstraction layer. Aside from math.h, this is the
- only place where system headers are allowed.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef OS_SUPPORT_H
-#define OS_SUPPORT_H
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-#include "config.h"
-
-#ifdef OS_SUPPORT_CUSTOM
-#include "os_support_custom.h"
-#endif
-
-#include "speex_bind.h"
-
-
-/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free
- NOTE: speex_alloc needs to CLEAR THE MEMORY */
-#ifndef OVERRIDE_SPEEX_ALLOC
-static SPEEX_INLINE void *speex_alloc (int size)
-{
- /* WARNING: this is not equivalent to malloc(). If you want to use malloc()
- or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise
- you will experience strange bugs */
- return calloc(size,1);
-}
-#endif
-
-/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
-#ifndef OVERRIDE_SPEEX_ALLOC_SCRATCH
-static SPEEX_INLINE void *speex_alloc_scratch (int size)
-{
- /* Scratch space doesn't need to be cleared */
- return calloc(size,1);
-}
-#endif
-
-/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
-#ifndef OVERRIDE_SPEEX_REALLOC
-static SPEEX_INLINE void *speex_realloc (void *ptr, int size)
-{
- return realloc(ptr, size);
-}
-#endif
-
-/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
-#ifndef OVERRIDE_SPEEX_FREE
-static SPEEX_INLINE void speex_free (void *ptr)
-{
- free(ptr);
-}
-#endif
-
-/** Same as speex_free, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
-#ifndef OVERRIDE_SPEEX_FREE_SCRATCH
-static SPEEX_INLINE void speex_free_scratch (void *ptr)
-{
- free(ptr);
-}
-#endif
-
-/** Copy n bytes of memory from src to dst. The 0* term provides compile-time type checking */
-#ifndef OVERRIDE_SPEEX_COPY
-#define SPEEX_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
-#endif
-
-/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term
- provides compile-time type checking */
-#ifndef OVERRIDE_SPEEX_MOVE
-#define SPEEX_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
-#endif
-
-/** Set n bytes of memory to value of c, starting at address s */
-#ifndef OVERRIDE_SPEEX_MEMSET
-#define SPEEX_MEMSET(dst, c, n) (memset((dst), (c), (n)*sizeof(*(dst))))
-#endif
-
-
-#ifndef OVERRIDE_SPEEX_FATAL
-static SPEEX_INLINE void _speex_fatal(const char *str, const char *file, int line)
-{
- fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
- exit(1);
-}
-#endif
-
-#ifndef OVERRIDE_SPEEX_WARNING
-static SPEEX_INLINE void speex_warning(const char *str)
-{
-#ifndef DISABLE_WARNINGS
- fprintf (stderr, "warning: %s\n", str);
-#endif
-}
-#endif
-
-#ifndef OVERRIDE_SPEEX_WARNING_INT
-static SPEEX_INLINE void speex_warning_int(const char *str, int val)
-{
-#ifndef DISABLE_WARNINGS
- fprintf (stderr, "warning: %s %d\n", str, val);
-#endif
-}
-#endif
-
-#ifndef OVERRIDE_SPEEX_NOTIFY
-static SPEEX_INLINE void speex_notify(const char *str)
-{
-#ifndef DISABLE_NOTIFICATIONS
- fprintf (stderr, "notification: %s\n", str);
-#endif
-}
-#endif
-
-#ifndef OVERRIDE_SPEEX_PUTC
-/** Speex wrapper for putc */
-static SPEEX_INLINE void _speex_putc(int ch, void *file)
-{
- FILE *f = (FILE *)file;
- fprintf(f, "%c", ch);
-}
-#endif
-
-#define speex_fatal(str) _speex_fatal(str, __FILE__, __LINE__);
-#define speex_assert(cond) {if (!(cond)) {speex_fatal("assertion failed: " #cond);}}
-
-#ifndef RELEASE
-static SPEEX_INLINE void print_vec(float *vec, int len, char *name)
-{
- int i;
- printf ("%s ", name);
- for (i=0;i<len;i++)
- printf (" %f", vec[i]);
- printf ("\n");
-}
-#endif
-
-#endif
-
diff --git a/drivers/speex/preprocess.c b/drivers/speex/preprocess.c
deleted file mode 100644
index 40b797966..000000000
--- a/drivers/speex/preprocess.c
+++ /dev/null
@@ -1,1219 +0,0 @@
-/* Copyright (C) 2003 Epic Games (written by Jean-Marc Valin)
- Copyright (C) 2004-2006 Epic Games
-
- File: preprocess.c
- Preprocessor with denoising based on the algorithm by Ephraim and Malah
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-/*
- Recommended papers:
-
- Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error
- short-time spectral amplitude estimator". IEEE Transactions on Acoustics,
- Speech and Signal Processing, vol. ASSP-32, no. 6, pp. 1109-1121, 1984.
-
- Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error
- log-spectral amplitude estimator". IEEE Transactions on Acoustics, Speech and
- Signal Processing, vol. ASSP-33, no. 2, pp. 443-445, 1985.
-
- I. Cohen and B. Berdugo, "Speech enhancement for non-stationary noise environments".
- Signal Processing, vol. 81, no. 2, pp. 2403-2418, 2001.
-
- Stefan Gustafsson, Rainer Martin, Peter Jax, and Peter Vary. "A psychoacoustic
- approach to combined acoustic echo cancellation and noise reduction". IEEE
- Transactions on Speech and Audio Processing, 2002.
-
- J.-M. Valin, J. Rouat, and F. Michaud, "Microphone array post-filter for separation
- of simultaneous non-stationary sources". In Proceedings IEEE International
- Conference on Acoustics, Speech, and Signal Processing, 2004.
-*/
-
-
-#include "config.h"
-
-
-#include <math.h>
-#include "speex/speex_preprocess.h"
-#include "speex/speex_echo.h"
-#include "arch.h"
-#include "fftwrap.h"
-#include "filterbank.h"
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifndef M_PI
-#define M_PI 3.14159263
-#endif
-
-#define LOUDNESS_EXP 5.f
-#define AMP_SCALE .001f
-#define AMP_SCALE_1 1000.f
-
-#define NB_BANDS 24
-
-#define SPEECH_PROB_START_DEFAULT QCONST16(0.35f,15)
-#define SPEECH_PROB_CONTINUE_DEFAULT QCONST16(0.20f,15)
-#define NOISE_SUPPRESS_DEFAULT -15
-#define ECHO_SUPPRESS_DEFAULT -40
-#define ECHO_SUPPRESS_ACTIVE_DEFAULT -15
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define SQR(x) ((x)*(x))
-#define SQR16(x) (MULT16_16((x),(x)))
-#define SQR16_Q15(x) (MULT16_16_Q15((x),(x)))
-
-#ifdef FIXED_POINT
-static SPEEX_INLINE spx_word16_t DIV32_16_Q8(spx_word32_t a, spx_word32_t b)
-{
- if (SHR32(a,7) >= b)
- {
- return 32767;
- } else {
- if (b>=QCONST32(1,23))
- {
- a = SHR32(a,8);
- b = SHR32(b,8);
- }
- if (b>=QCONST32(1,19))
- {
- a = SHR32(a,4);
- b = SHR32(b,4);
- }
- if (b>=QCONST32(1,15))
- {
- a = SHR32(a,4);
- b = SHR32(b,4);
- }
- a = SHL32(a,8);
- return PDIV32_16(a,b);
- }
-
-}
-static SPEEX_INLINE spx_word16_t DIV32_16_Q15(spx_word32_t a, spx_word32_t b)
-{
- if (SHR32(a,15) >= b)
- {
- return 32767;
- } else {
- if (b>=QCONST32(1,23))
- {
- a = SHR32(a,8);
- b = SHR32(b,8);
- }
- if (b>=QCONST32(1,19))
- {
- a = SHR32(a,4);
- b = SHR32(b,4);
- }
- if (b>=QCONST32(1,15))
- {
- a = SHR32(a,4);
- b = SHR32(b,4);
- }
- a = SHL32(a,15)-a;
- return DIV32_16(a,b);
- }
-}
-#define SNR_SCALING 256.f
-#define SNR_SCALING_1 0.0039062f
-#define SNR_SHIFT 8
-
-#define FRAC_SCALING 32767.f
-#define FRAC_SCALING_1 3.0518e-05
-#define FRAC_SHIFT 1
-
-#define EXPIN_SCALING 2048.f
-#define EXPIN_SCALING_1 0.00048828f
-#define EXPIN_SHIFT 11
-#define EXPOUT_SCALING_1 1.5259e-05
-
-#define NOISE_SHIFT 7
-
-#else
-
-#define DIV32_16_Q8(a,b) ((a)/(b))
-#define DIV32_16_Q15(a,b) ((a)/(b))
-#define SNR_SCALING 1.f
-#define SNR_SCALING_1 1.f
-#define SNR_SHIFT 0
-#define FRAC_SCALING 1.f
-#define FRAC_SCALING_1 1.f
-#define FRAC_SHIFT 0
-#define NOISE_SHIFT 0
-
-#define EXPIN_SCALING 1.f
-#define EXPIN_SCALING_1 1.f
-#define EXPOUT_SCALING_1 1.f
-
-#endif
-
-/** Speex pre-processor state. */
-struct SpeexPreprocessState_ {
- /* Basic info */
- int frame_size; /**< Number of samples processed each time */
- int ps_size; /**< Number of points in the power spectrum */
- int sampling_rate; /**< Sampling rate of the input/output */
- int nbands;
- FilterBank *bank;
-
- /* Parameters */
- int denoise_enabled;
- int vad_enabled;
- int dereverb_enabled;
- spx_word16_t reverb_decay;
- spx_word16_t reverb_level;
- spx_word16_t speech_prob_start;
- spx_word16_t speech_prob_continue;
- int noise_suppress;
- int echo_suppress;
- int echo_suppress_active;
- SpeexEchoState *echo_state;
-
- spx_word16_t speech_prob; /**< Probability last frame was speech */
-
- /* DSP-related arrays */
- spx_word16_t *frame; /**< Processing frame (2*ps_size) */
- spx_word16_t *ft; /**< Processing frame in freq domain (2*ps_size) */
- spx_word32_t *ps; /**< Current power spectrum */
- spx_word16_t *gain2; /**< Adjusted gains */
- spx_word16_t *gain_floor; /**< Minimum gain allowed */
- spx_word16_t *window; /**< Analysis/Synthesis window */
- spx_word32_t *noise; /**< Noise estimate */
- spx_word32_t *reverb_estimate; /**< Estimate of reverb energy */
- spx_word32_t *old_ps; /**< Power spectrum for last frame */
- spx_word16_t *gain; /**< Ephraim Malah gain */
- spx_word16_t *prior; /**< A-priori SNR */
- spx_word16_t *post; /**< A-posteriori SNR */
-
- spx_word32_t *S; /**< Smoothed power spectrum */
- spx_word32_t *Smin; /**< See Cohen paper */
- spx_word32_t *Stmp; /**< See Cohen paper */
- int *update_prob; /**< Probability of speech presence for noise update */
-
- spx_word16_t *zeta; /**< Smoothed a priori SNR */
- spx_word32_t *echo_noise;
- spx_word32_t *residual_echo;
-
- /* Misc */
- spx_word16_t *inbuf; /**< Input buffer (overlapped analysis) */
- spx_word16_t *outbuf; /**< Output buffer (for overlap and add) */
-
- /* AGC stuff, only for floating point for now */
-#ifndef FIXED_POINT
- int agc_enabled;
- float agc_level;
- float loudness_accum;
- float *loudness_weight; /**< Perceptual loudness curve */
- float loudness; /**< Loudness estimate */
- float agc_gain; /**< Current AGC gain */
- float max_gain; /**< Maximum gain allowed */
- float max_increase_step; /**< Maximum increase in gain from one frame to another */
- float max_decrease_step; /**< Maximum decrease in gain from one frame to another */
- float prev_loudness; /**< Loudness of previous frame */
- float init_max; /**< Current gain limit during initialisation */
-#endif
- int nb_adapt; /**< Number of frames used for adaptation so far */
- int was_speech;
- int min_count; /**< Number of frames processed so far */
- void *fft_lookup; /**< Lookup table for the FFT */
-#ifdef FIXED_POINT
- int frame_shift;
-#endif
-};
-
-
-static void conj_window(spx_word16_t *w, int len)
-{
- int i;
- for (i=0;i<len;i++)
- {
- spx_word16_t tmp;
-#ifdef FIXED_POINT
- spx_word16_t x = DIV32_16(MULT16_16(32767,i),len);
-#else
- spx_word16_t x = DIV32_16(MULT16_16(QCONST16(4.f,13),i),len);
-#endif
- int inv=0;
- if (x<QCONST16(1.f,13))
- {
- } else if (x<QCONST16(2.f,13))
- {
- x=QCONST16(2.f,13)-x;
- inv=1;
- } else if (x<QCONST16(3.f,13))
- {
- x=x-QCONST16(2.f,13);
- inv=1;
- } else {
- x=QCONST16(2.f,13)-x+QCONST16(2.f,13); /* 4 - x */
- }
- x = MULT16_16_Q14(QCONST16(1.271903f,14), x);
- tmp = SQR16_Q15(QCONST16(.5f,15)-MULT16_16_P15(QCONST16(.5f,15),spx_cos_norm(SHL32(EXTEND32(x),2))));
- if (inv)
- tmp=SUB16(Q15_ONE,tmp);
- w[i]=spx_sqrt(SHL32(EXTEND32(tmp),15));
- }
-}
-
-
-#ifdef FIXED_POINT
-/* This function approximates the gain function
- y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x)
- which multiplied by xi/(1+xi) is the optimal gain
- in the loudness domain ( sqrt[amplitude] )
- Input in Q11 format, output in Q15
-*/
-static SPEEX_INLINE spx_word32_t hypergeom_gain(spx_word32_t xx)
-{
- int ind;
- spx_word16_t frac;
- /* Q13 table */
- static const spx_word16_t table[21] = {
- 6730, 8357, 9868, 11267, 12563, 13770, 14898,
- 15959, 16961, 17911, 18816, 19682, 20512, 21311,
- 22082, 22827, 23549, 24250, 24931, 25594, 26241};
- ind = SHR32(xx,10);
- if (ind<0)
- return Q15_ONE;
- if (ind>19)
- return ADD32(EXTEND32(Q15_ONE),EXTEND32(DIV32_16(QCONST32(.1296,23), SHR32(xx,EXPIN_SHIFT-SNR_SHIFT))));
- frac = SHL32(xx-SHL32(ind,10),5);
- return SHL32(DIV32_16(PSHR32(MULT16_16(Q15_ONE-frac,table[ind]) + MULT16_16(frac,table[ind+1]),7),(spx_sqrt(SHL32(xx,15)+6711))),7);
-}
-
-static SPEEX_INLINE spx_word16_t qcurve(spx_word16_t x)
-{
- x = MAX16(x, 1);
- return DIV32_16(SHL32(EXTEND32(32767),9),ADD16(512,MULT16_16_Q15(QCONST16(.60f,15),DIV32_16(32767,x))));
-}
-
-/* Compute the gain floor based on different floors for the background noise and residual echo */
-static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, spx_word32_t *noise, spx_word32_t *echo, spx_word16_t *gain_floor, int len)
-{
- int i;
-
- if (noise_suppress > effective_echo_suppress)
- {
- spx_word16_t noise_gain, gain_ratio;
- noise_gain = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(0.11513,11),noise_suppress)),1)));
- gain_ratio = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(.2302585f,11),effective_echo_suppress-noise_suppress)),1)));
-
- /* gain_floor = sqrt [ (noise*noise_floor + echo*echo_floor) / (noise+echo) ] */
- for (i=0;i<len;i++)
- gain_floor[i] = MULT16_16_Q15(noise_gain,
- spx_sqrt(SHL32(EXTEND32(DIV32_16_Q15(PSHR32(noise[i],NOISE_SHIFT) + MULT16_32_Q15(gain_ratio,echo[i]),
- (1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]) )),15)));
- } else {
- spx_word16_t echo_gain, gain_ratio;
- echo_gain = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(0.11513,11),effective_echo_suppress)),1)));
- gain_ratio = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(.2302585f,11),noise_suppress-effective_echo_suppress)),1)));
-
- /* gain_floor = sqrt [ (noise*noise_floor + echo*echo_floor) / (noise+echo) ] */
- for (i=0;i<len;i++)
- gain_floor[i] = MULT16_16_Q15(echo_gain,
- spx_sqrt(SHL32(EXTEND32(DIV32_16_Q15(MULT16_32_Q15(gain_ratio,PSHR32(noise[i],NOISE_SHIFT)) + echo[i],
- (1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]) )),15)));
- }
-}
-
-#else
-/* This function approximates the gain function
- y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x)
- which multiplied by xi/(1+xi) is the optimal gain
- in the loudness domain ( sqrt[amplitude] )
-*/
-static SPEEX_INLINE spx_word32_t hypergeom_gain(spx_word32_t xx)
-{
- int ind;
- float integer, frac;
- float x;
- static const float table[21] = {
- 0.82157f, 1.02017f, 1.20461f, 1.37534f, 1.53363f, 1.68092f, 1.81865f,
- 1.94811f, 2.07038f, 2.18638f, 2.29688f, 2.40255f, 2.50391f, 2.60144f,
- 2.69551f, 2.78647f, 2.87458f, 2.96015f, 3.04333f, 3.12431f, 3.20326f};
- x = EXPIN_SCALING_1*xx;
- integer = floor(2*x);
- ind = (int)integer;
- if (ind<0)
- return FRAC_SCALING;
- if (ind>19)
- return FRAC_SCALING*(1+.1296/x);
- frac = 2*x-integer;
- return FRAC_SCALING*((1-frac)*table[ind] + frac*table[ind+1])/sqrt(x+.0001f);
-}
-
-static SPEEX_INLINE spx_word16_t qcurve(spx_word16_t x)
-{
- return 1.f/(1.f+.15f/(SNR_SCALING_1*x));
-}
-
-static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, spx_word32_t *noise, spx_word32_t *echo, spx_word16_t *gain_floor, int len)
-{
- int i;
- float echo_floor;
- float noise_floor;
-
- noise_floor = exp(.2302585f*noise_suppress);
- echo_floor = exp(.2302585f*effective_echo_suppress);
-
- /* Compute the gain floor based on different floors for the background noise and residual echo */
- for (i=0;i<len;i++)
- gain_floor[i] = FRAC_SCALING*sqrt(noise_floor*PSHR32(noise[i],NOISE_SHIFT) + echo_floor*echo[i])/sqrt(1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]);
-}
-
-#endif
-EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate)
-{
- int i;
- int N, N3, N4, M;
-
- SpeexPreprocessState *st = (SpeexPreprocessState *)speex_alloc(sizeof(SpeexPreprocessState));
- st->frame_size = frame_size;
-
- /* Round ps_size down to the nearest power of two */
-#if 0
- i=1;
- st->ps_size = st->frame_size;
- while(1)
- {
- if (st->ps_size & ~i)
- {
- st->ps_size &= ~i;
- i<<=1;
- } else {
- break;
- }
- }
-
-
- if (st->ps_size < 3*st->frame_size/4)
- st->ps_size = st->ps_size * 3 / 2;
-#else
- st->ps_size = st->frame_size;
-#endif
-
- N = st->ps_size;
- N3 = 2*N - st->frame_size;
- N4 = st->frame_size - N3;
-
- st->sampling_rate = sampling_rate;
- st->denoise_enabled = 1;
- st->vad_enabled = 0;
- st->dereverb_enabled = 0;
- st->reverb_decay = 0;
- st->reverb_level = 0;
- st->noise_suppress = NOISE_SUPPRESS_DEFAULT;
- st->echo_suppress = ECHO_SUPPRESS_DEFAULT;
- st->echo_suppress_active = ECHO_SUPPRESS_ACTIVE_DEFAULT;
-
- st->speech_prob_start = SPEECH_PROB_START_DEFAULT;
- st->speech_prob_continue = SPEECH_PROB_CONTINUE_DEFAULT;
-
- st->echo_state = NULL;
-
- st->nbands = NB_BANDS;
- M = st->nbands;
- st->bank = filterbank_new(M, sampling_rate, N, 1);
-
- st->frame = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
- st->window = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
- st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
-
- st->ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
- st->noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
- st->echo_noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
- st->residual_echo = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
- st->reverb_estimate = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
- st->old_ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
- st->prior = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
- st->post = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
- st->gain = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
- st->gain2 = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
- st->gain_floor = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
- st->zeta = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
-
- st->S = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
- st->Smin = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
- st->Stmp = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
- st->update_prob = (int*)speex_alloc(N*sizeof(int));
-
- st->inbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t));
- st->outbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t));
-
- conj_window(st->window, 2*N3);
- for (i=2*N3;i<2*st->ps_size;i++)
- st->window[i]=Q15_ONE;
-
- if (N4>0)
- {
- for (i=N3-1;i>=0;i--)
- {
- st->window[i+N3+N4]=st->window[i+N3];
- st->window[i+N3]=1;
- }
- }
- for (i=0;i<N+M;i++)
- {
- st->noise[i]=QCONST32(1.f,NOISE_SHIFT);
- st->reverb_estimate[i]=0;
- st->old_ps[i]=1;
- st->gain[i]=Q15_ONE;
- st->post[i]=SHL16(1, SNR_SHIFT);
- st->prior[i]=SHL16(1, SNR_SHIFT);
- }
-
- for (i=0;i<N;i++)
- st->update_prob[i] = 1;
- for (i=0;i<N3;i++)
- {
- st->inbuf[i]=0;
- st->outbuf[i]=0;
- }
-#ifndef FIXED_POINT
- st->agc_enabled = 0;
- st->agc_level = 8000;
- st->loudness_weight = (float*)speex_alloc(N*sizeof(float));
- for (i=0;i<N;i++)
- {
- float ff=((float)i)*.5*sampling_rate/((float)N);
- /*st->loudness_weight[i] = .5f*(1.f/(1.f+ff/8000.f))+1.f*exp(-.5f*(ff-3800.f)*(ff-3800.f)/9e5f);*/
- st->loudness_weight[i] = .35f-.35f*ff/16000.f+.73f*exp(-.5f*(ff-3800)*(ff-3800)/9e5f);
- if (st->loudness_weight[i]<.01f)
- st->loudness_weight[i]=.01f;
- st->loudness_weight[i] *= st->loudness_weight[i];
- }
- /*st->loudness = pow(AMP_SCALE*st->agc_level,LOUDNESS_EXP);*/
- st->loudness = 1e-15;
- st->agc_gain = 1;
- st->max_gain = 30;
- st->max_increase_step = exp(0.11513f * 12.*st->frame_size / st->sampling_rate);
- st->max_decrease_step = exp(-0.11513f * 40.*st->frame_size / st->sampling_rate);
- st->prev_loudness = 1;
- st->init_max = 1;
-#endif
- st->was_speech = 0;
-
- st->fft_lookup = spx_fft_init(2*N);
-
- st->nb_adapt=0;
- st->min_count=0;
- return st;
-}
-
-EXPORT void speex_preprocess_state_destroy(SpeexPreprocessState *st)
-{
- speex_free(st->frame);
- speex_free(st->ft);
- speex_free(st->ps);
- speex_free(st->gain2);
- speex_free(st->gain_floor);
- speex_free(st->window);
- speex_free(st->noise);
- speex_free(st->reverb_estimate);
- speex_free(st->old_ps);
- speex_free(st->gain);
- speex_free(st->prior);
- speex_free(st->post);
-#ifndef FIXED_POINT
- speex_free(st->loudness_weight);
-#endif
- speex_free(st->echo_noise);
- speex_free(st->residual_echo);
-
- speex_free(st->S);
- speex_free(st->Smin);
- speex_free(st->Stmp);
- speex_free(st->update_prob);
- speex_free(st->zeta);
-
- speex_free(st->inbuf);
- speex_free(st->outbuf);
-
- spx_fft_destroy(st->fft_lookup);
- filterbank_destroy(st->bank);
- speex_free(st);
-}
-
-/* FIXME: The AGC doesn't work yet with fixed-point*/
-#ifndef FIXED_POINT
-static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx_word16_t *ft)
-{
- int i;
- int N = st->ps_size;
- float target_gain;
- float loudness=1.f;
- float rate;
-
- for (i=2;i<N;i++)
- {
- loudness += 2.f*N*st->ps[i]* st->loudness_weight[i];
- }
- loudness=sqrt(loudness);
- /*if (loudness < 2*pow(st->loudness, 1.0/LOUDNESS_EXP) &&
- loudness*2 > pow(st->loudness, 1.0/LOUDNESS_EXP))*/
- if (Pframe>.3f)
- {
- /*rate=2.0f*Pframe*Pframe/(1+st->nb_loudness_adapt);*/
- rate = .03*Pframe*Pframe;
- st->loudness = (1-rate)*st->loudness + (rate)*pow(AMP_SCALE*loudness, LOUDNESS_EXP);
- st->loudness_accum = (1-rate)*st->loudness_accum + rate;
- if (st->init_max < st->max_gain && st->nb_adapt > 20)
- st->init_max *= 1.f + .1f*Pframe*Pframe;
- }
- /*printf ("%f %f %f %f\n", Pframe, loudness, pow(st->loudness, 1.0f/LOUDNESS_EXP), st->loudness2);*/
-
- target_gain = AMP_SCALE*st->agc_level*pow(st->loudness/(1e-4+st->loudness_accum), -1.0f/LOUDNESS_EXP);
-
- if ((Pframe>.5 && st->nb_adapt > 20) || target_gain < st->agc_gain)
- {
- if (target_gain > st->max_increase_step*st->agc_gain)
- target_gain = st->max_increase_step*st->agc_gain;
- if (target_gain < st->max_decrease_step*st->agc_gain && loudness < 10*st->prev_loudness)
- target_gain = st->max_decrease_step*st->agc_gain;
- if (target_gain > st->max_gain)
- target_gain = st->max_gain;
- if (target_gain > st->init_max)
- target_gain = st->init_max;
-
- st->agc_gain = target_gain;
- }
- /*fprintf (stderr, "%f %f %f\n", loudness, (float)AMP_SCALE_1*pow(st->loudness, 1.0f/LOUDNESS_EXP), st->agc_gain);*/
-
- for (i=0;i<2*N;i++)
- ft[i] *= st->agc_gain;
- st->prev_loudness = loudness;
-}
-#endif
-
-static void preprocess_analysis(SpeexPreprocessState *st, spx_int16_t *x)
-{
- int i;
- int N = st->ps_size;
- int N3 = 2*N - st->frame_size;
- int N4 = st->frame_size - N3;
- spx_word32_t *ps=st->ps;
-
- /* 'Build' input frame */
- for (i=0;i<N3;i++)
- st->frame[i]=st->inbuf[i];
- for (i=0;i<st->frame_size;i++)
- st->frame[N3+i]=x[i];
-
- /* Update inbuf */
- for (i=0;i<N3;i++)
- st->inbuf[i]=x[N4+i];
-
- /* Windowing */
- for (i=0;i<2*N;i++)
- st->frame[i] = MULT16_16_Q15(st->frame[i], st->window[i]);
-
-#ifdef FIXED_POINT
- {
- spx_word16_t max_val=0;
- for (i=0;i<2*N;i++)
- max_val = MAX16(max_val, ABS16(st->frame[i]));
- st->frame_shift = 14-spx_ilog2(EXTEND32(max_val));
- for (i=0;i<2*N;i++)
- st->frame[i] = SHL16(st->frame[i], st->frame_shift);
- }
-#endif
-
- /* Perform FFT */
- spx_fft(st->fft_lookup, st->frame, st->ft);
-
- /* Power spectrum */
- ps[0]=MULT16_16(st->ft[0],st->ft[0]);
- for (i=1;i<N;i++)
- ps[i]=MULT16_16(st->ft[2*i-1],st->ft[2*i-1]) + MULT16_16(st->ft[2*i],st->ft[2*i]);
- for (i=0;i<N;i++)
- st->ps[i] = PSHR32(st->ps[i], 2*st->frame_shift);
-
- filterbank_compute_bank32(st->bank, ps, ps+N);
-}
-
-static void update_noise_prob(SpeexPreprocessState *st)
-{
- int i;
- int min_range;
- int N = st->ps_size;
-
- for (i=1;i<N-1;i++)
- st->S[i] = MULT16_32_Q15(QCONST16(.8f,15),st->S[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i-1])
- + MULT16_32_Q15(QCONST16(.1f,15),st->ps[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i+1]);
- st->S[0] = MULT16_32_Q15(QCONST16(.8f,15),st->S[0]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[0]);
- st->S[N-1] = MULT16_32_Q15(QCONST16(.8f,15),st->S[N-1]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[N-1]);
-
- if (st->nb_adapt==1)
- {
- for (i=0;i<N;i++)
- st->Smin[i] = st->Stmp[i] = 0;
- }
-
- if (st->nb_adapt < 100)
- min_range = 15;
- else if (st->nb_adapt < 1000)
- min_range = 50;
- else if (st->nb_adapt < 10000)
- min_range = 150;
- else
- min_range = 300;
- if (st->min_count > min_range)
- {
- st->min_count = 0;
- for (i=0;i<N;i++)
- {
- st->Smin[i] = MIN32(st->Stmp[i], st->S[i]);
- st->Stmp[i] = st->S[i];
- }
- } else {
- for (i=0;i<N;i++)
- {
- st->Smin[i] = MIN32(st->Smin[i], st->S[i]);
- st->Stmp[i] = MIN32(st->Stmp[i], st->S[i]);
- }
- }
- for (i=0;i<N;i++)
- {
- if (MULT16_32_Q15(QCONST16(.4f,15),st->S[i]) > st->Smin[i])
- st->update_prob[i] = 1;
- else
- st->update_prob[i] = 0;
- /*fprintf (stderr, "%f ", st->S[i]/st->Smin[i]);*/
- /*fprintf (stderr, "%f ", st->update_prob[i]);*/
- }
-
-}
-
-#define NOISE_OVERCOMPENS 1.
-
-void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *Yout, int len);
-
-EXPORT int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo)
-{
- return speex_preprocess_run(st, x);
-}
-
-EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
-{
- int i;
- int M;
- int N = st->ps_size;
- int N3 = 2*N - st->frame_size;
- int N4 = st->frame_size - N3;
- spx_word32_t *ps=st->ps;
- spx_word32_t Zframe;
- spx_word16_t Pframe;
- spx_word16_t beta, beta_1;
- spx_word16_t effective_echo_suppress;
-
- st->nb_adapt++;
- if (st->nb_adapt>20000)
- st->nb_adapt = 20000;
- st->min_count++;
-
- beta = MAX16(QCONST16(.03,15),DIV32_16(Q15_ONE,st->nb_adapt));
- beta_1 = Q15_ONE-beta;
- M = st->nbands;
- /* Deal with residual echo if provided */
- if (st->echo_state)
- {
- speex_echo_get_residual(st->echo_state, st->residual_echo, N);
-#ifndef FIXED_POINT
- /* If there are NaNs or ridiculous values, it'll show up in the DC and we just reset everything to zero */
- if (!(st->residual_echo[0] >=0 && st->residual_echo[0]<N*1e9f))
- {
- for (i=0;i<N;i++)
- st->residual_echo[i] = 0;
- }
-#endif
- for (i=0;i<N;i++)
- st->echo_noise[i] = MAX32(MULT16_32_Q15(QCONST16(.6f,15),st->echo_noise[i]), st->residual_echo[i]);
- filterbank_compute_bank32(st->bank, st->echo_noise, st->echo_noise+N);
- } else {
- for (i=0;i<N+M;i++)
- st->echo_noise[i] = 0;
- }
- preprocess_analysis(st, x);
-
- update_noise_prob(st);
-
- /* Noise estimation always updated for the 10 first frames */
- /*if (st->nb_adapt<10)
- {
- for (i=1;i<N-1;i++)
- st->update_prob[i] = 0;
- }
- */
-
- /* Update the noise estimate for the frequencies where it can be */
- for (i=0;i<N;i++)
- {
- if (!st->update_prob[i] || st->ps[i] < PSHR32(st->noise[i], NOISE_SHIFT))
- st->noise[i] = MAX32(EXTEND32(0),MULT16_32_Q15(beta_1,st->noise[i]) + MULT16_32_Q15(beta,SHL32(st->ps[i],NOISE_SHIFT)));
- }
- filterbank_compute_bank32(st->bank, st->noise, st->noise+N);
-
- /* Special case for first frame */
- if (st->nb_adapt==1)
- for (i=0;i<N+M;i++)
- st->old_ps[i] = ps[i];
-
- /* Compute a posteriori SNR */
- for (i=0;i<N+M;i++)
- {
- spx_word16_t gamma;
-
- /* Total noise estimate including residual echo and reverberation */
- spx_word32_t tot_noise = ADD32(ADD32(ADD32(EXTEND32(1), PSHR32(st->noise[i],NOISE_SHIFT)) , st->echo_noise[i]) , st->reverb_estimate[i]);
-
- /* A posteriori SNR = ps/noise - 1*/
- st->post[i] = SUB16(DIV32_16_Q8(ps[i],tot_noise), QCONST16(1.f,SNR_SHIFT));
- st->post[i]=MIN16(st->post[i], QCONST16(100.f,SNR_SHIFT));
-
- /* Computing update gamma = .1 + .9*(old/(old+noise))^2 */
- gamma = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.89f,15),SQR16_Q15(DIV32_16_Q15(st->old_ps[i],ADD32(st->old_ps[i],tot_noise))));
-
- /* A priori SNR update = gamma*max(0,post) + (1-gamma)*old/noise */
- st->prior[i] = EXTRACT16(PSHR32(ADD32(MULT16_16(gamma,MAX16(0,st->post[i])), MULT16_16(Q15_ONE-gamma,DIV32_16_Q8(st->old_ps[i],tot_noise))), 15));
- st->prior[i]=MIN16(st->prior[i], QCONST16(100.f,SNR_SHIFT));
- }
-
- /*print_vec(st->post, N+M, "");*/
-
- /* Recursive average of the a priori SNR. A bit smoothed for the psd components */
- st->zeta[0] = PSHR32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[0]), MULT16_16(QCONST16(.3f,15),st->prior[0])),15);
- for (i=1;i<N-1;i++)
- st->zeta[i] = PSHR32(ADD32(ADD32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[i]), MULT16_16(QCONST16(.15f,15),st->prior[i])),
- MULT16_16(QCONST16(.075f,15),st->prior[i-1])), MULT16_16(QCONST16(.075f,15),st->prior[i+1])),15);
- for (i=N-1;i<N+M;i++)
- st->zeta[i] = PSHR32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[i]), MULT16_16(QCONST16(.3f,15),st->prior[i])),15);
-
- /* Speech probability of presence for the entire frame is based on the average filterbank a priori SNR */
- Zframe = 0;
- for (i=N;i<N+M;i++)
- Zframe = ADD32(Zframe, EXTEND32(st->zeta[i]));
- Pframe = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.899f,15),qcurve(DIV32_16(Zframe,st->nbands)));
-
- effective_echo_suppress = EXTRACT16(PSHR32(ADD32(MULT16_16(SUB16(Q15_ONE,Pframe), st->echo_suppress), MULT16_16(Pframe, st->echo_suppress_active)),15));
-
- compute_gain_floor(st->noise_suppress, effective_echo_suppress, st->noise+N, st->echo_noise+N, st->gain_floor+N, M);
-
- /* Compute Ephraim & Malah gain speech probability of presence for each critical band (Bark scale)
- Technically this is actually wrong because the EM gaim assumes a slightly different probability
- distribution */
- for (i=N;i<N+M;i++)
- {
- /* See EM and Cohen papers*/
- spx_word32_t theta;
- /* Gain from hypergeometric function */
- spx_word32_t MM;
- /* Weiner filter gain */
- spx_word16_t prior_ratio;
- /* a priority probability of speech presence based on Bark sub-band alone */
- spx_word16_t P1;
- /* Speech absence a priori probability (considering sub-band and frame) */
- spx_word16_t q;
-#ifdef FIXED_POINT
- spx_word16_t tmp;
-#endif
-
- prior_ratio = PDIV32_16(SHL32(EXTEND32(st->prior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT)));
- theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT));
-
- MM = hypergeom_gain(theta);
- /* Gain with bound */
- st->gain[i] = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM)));
- /* Save old Bark power spectrum */
- st->old_ps[i] = MULT16_32_P15(QCONST16(.2f,15),st->old_ps[i]) + MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(st->gain[i])),ps[i]);
-
- P1 = QCONST16(.199f,15)+MULT16_16_Q15(QCONST16(.8f,15),qcurve (st->zeta[i]));
- q = Q15_ONE-MULT16_16_Q15(Pframe,P1);
-#ifdef FIXED_POINT
- theta = MIN32(theta, EXTEND32(32767));
-/*Q8*/tmp = MULT16_16_Q15((SHL32(1,SNR_SHIFT)+st->prior[i]),EXTRACT16(MIN32(Q15ONE,SHR32(spx_exp(-EXTRACT16(theta)),1))));
- tmp = MIN16(QCONST16(3.,SNR_SHIFT), tmp); /* Prevent overflows in the next line*/
-/*Q8*/tmp = EXTRACT16(PSHR32(MULT16_16(PDIV32_16(SHL32(EXTEND32(q),8),(Q15_ONE-q)),tmp),8));
- st->gain2[i]=DIV32_16(SHL32(EXTEND32(32767),SNR_SHIFT), ADD16(256,tmp));
-#else
- st->gain2[i]=1/(1.f + (q/(1.f-q))*(1+st->prior[i])*exp(-theta));
-#endif
- }
- /* Convert the EM gains and speech prob to linear frequency */
- filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2);
- filterbank_compute_psd16(st->bank,st->gain+N, st->gain);
-
- /* Use 1 for linear gain resolution (best) or 0 for Bark gain resolution (faster) */
- if (1)
- {
- filterbank_compute_psd16(st->bank,st->gain_floor+N, st->gain_floor);
-
- /* Compute gain according to the Ephraim-Malah algorithm -- linear frequency */
- for (i=0;i<N;i++)
- {
- spx_word32_t MM;
- spx_word32_t theta;
- spx_word16_t prior_ratio;
- spx_word16_t tmp;
- spx_word16_t p;
- spx_word16_t g;
-
- /* Wiener filter gain */
- prior_ratio = PDIV32_16(SHL32(EXTEND32(st->prior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT)));
- theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT));
-
- /* Optimal estimator for loudness domain */
- MM = hypergeom_gain(theta);
- /* EM gain with bound */
- g = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM)));
- /* Interpolated speech probability of presence */
- p = st->gain2[i];
-
- /* Constrain the gain to be close to the Bark scale gain */
- if (MULT16_16_Q15(QCONST16(.333f,15),g) > st->gain[i])
- g = MULT16_16(3,st->gain[i]);
- st->gain[i] = g;
-
- /* Save old power spectrum */
- st->old_ps[i] = MULT16_32_P15(QCONST16(.2f,15),st->old_ps[i]) + MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(st->gain[i])),ps[i]);
-
- /* Apply gain floor */
- if (st->gain[i] < st->gain_floor[i])
- st->gain[i] = st->gain_floor[i];
-
- /* Exponential decay model for reverberation (unused) */
- /*st->reverb_estimate[i] = st->reverb_decay*st->reverb_estimate[i] + st->reverb_decay*st->reverb_level*st->gain[i]*st->gain[i]*st->ps[i];*/
-
- /* Take into account speech probability of presence (loudness domain MMSE estimator) */
- /* gain2 = [p*sqrt(gain)+(1-p)*sqrt(gain _floor) ]^2 */
- tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15)));
- st->gain2[i]=SQR16_Q15(tmp);
-
- /* Use this if you want a log-domain MMSE estimator instead */
- /*st->gain2[i] = pow(st->gain[i], p) * pow(st->gain_floor[i],1.f-p);*/
- }
- } else {
- for (i=N;i<N+M;i++)
- {
- spx_word16_t tmp;
- spx_word16_t p = st->gain2[i];
- st->gain[i] = MAX16(st->gain[i], st->gain_floor[i]);
- tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15)));
- st->gain2[i]=SQR16_Q15(tmp);
- }
- filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2);
- }
-
- /* If noise suppression is off, don't apply the gain (but then why call this in the first place!) */
- if (!st->denoise_enabled)
- {
- for (i=0;i<N+M;i++)
- st->gain2[i]=Q15_ONE;
- }
-
- /* Apply computed gain */
- for (i=1;i<N;i++)
- {
- st->ft[2*i-1] = MULT16_16_P15(st->gain2[i],st->ft[2*i-1]);
- st->ft[2*i] = MULT16_16_P15(st->gain2[i],st->ft[2*i]);
- }
- st->ft[0] = MULT16_16_P15(st->gain2[0],st->ft[0]);
- st->ft[2*N-1] = MULT16_16_P15(st->gain2[N-1],st->ft[2*N-1]);
-
- /*FIXME: This *will* not work for fixed-point */
-#ifndef FIXED_POINT
- if (st->agc_enabled)
- speex_compute_agc(st, Pframe, st->ft);
-#endif
-
- /* Inverse FFT with 1/N scaling */
- spx_ifft(st->fft_lookup, st->ft, st->frame);
- /* Scale back to original (lower) amplitude */
- for (i=0;i<2*N;i++)
- st->frame[i] = PSHR16(st->frame[i], st->frame_shift);
-
- /*FIXME: This *will* not work for fixed-point */
-#ifndef FIXED_POINT
- if (st->agc_enabled)
- {
- float max_sample=0;
- for (i=0;i<2*N;i++)
- if (fabs(st->frame[i])>max_sample)
- max_sample = fabs(st->frame[i]);
- if (max_sample>28000.f)
- {
- float damp = 28000.f/max_sample;
- for (i=0;i<2*N;i++)
- st->frame[i] *= damp;
- }
- }
-#endif
-
- /* Synthesis window (for WOLA) */
- for (i=0;i<2*N;i++)
- st->frame[i] = MULT16_16_Q15(st->frame[i], st->window[i]);
-
- /* Perform overlap and add */
- for (i=0;i<N3;i++)
- x[i] = st->outbuf[i] + st->frame[i];
- for (i=0;i<N4;i++)
- x[N3+i] = st->frame[N3+i];
-
- /* Update outbuf */
- for (i=0;i<N3;i++)
- st->outbuf[i] = st->frame[st->frame_size+i];
-
- /* FIXME: This VAD is a kludge */
- st->speech_prob = Pframe;
- if (st->vad_enabled)
- {
- if (st->speech_prob > st->speech_prob_start || (st->was_speech && st->speech_prob > st->speech_prob_continue))
- {
- st->was_speech=1;
- return 1;
- } else
- {
- st->was_speech=0;
- return 0;
- }
- } else {
- return 1;
- }
-}
-
-EXPORT void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x)
-{
- int i;
- int N = st->ps_size;
- int N3 = 2*N - st->frame_size;
- int M;
- spx_word32_t *ps=st->ps;
-
- M = st->nbands;
- st->min_count++;
-
- preprocess_analysis(st, x);
-
- update_noise_prob(st);
-
- for (i=1;i<N-1;i++)
- {
- if (!st->update_prob[i] || st->ps[i] < PSHR32(st->noise[i],NOISE_SHIFT))
- {
- st->noise[i] = MULT16_32_Q15(QCONST16(.95f,15),st->noise[i]) + MULT16_32_Q15(QCONST16(.05f,15),SHL32(st->ps[i],NOISE_SHIFT));
- }
- }
-
- for (i=0;i<N3;i++)
- st->outbuf[i] = MULT16_16_Q15(x[st->frame_size-N3+i],st->window[st->frame_size+i]);
-
- /* Save old power spectrum */
- for (i=0;i<N+M;i++)
- st->old_ps[i] = ps[i];
-
- for (i=0;i<N;i++)
- st->reverb_estimate[i] = MULT16_32_Q15(st->reverb_decay, st->reverb_estimate[i]);
-}
-
-
-EXPORT int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *ptr)
-{
- int i;
- SpeexPreprocessState *st;
- st=(SpeexPreprocessState*)state;
- switch(request)
- {
- case SPEEX_PREPROCESS_SET_DENOISE:
- st->denoise_enabled = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_PREPROCESS_GET_DENOISE:
- (*(spx_int32_t*)ptr) = st->denoise_enabled;
- break;
-#ifndef FIXED_POINT
- case SPEEX_PREPROCESS_SET_AGC:
- st->agc_enabled = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_PREPROCESS_GET_AGC:
- (*(spx_int32_t*)ptr) = st->agc_enabled;
- break;
-#ifndef DISABLE_FLOAT_API
- case SPEEX_PREPROCESS_SET_AGC_LEVEL:
- st->agc_level = (*(float*)ptr);
- if (st->agc_level<1)
- st->agc_level=1;
- if (st->agc_level>32768)
- st->agc_level=32768;
- break;
- case SPEEX_PREPROCESS_GET_AGC_LEVEL:
- (*(float*)ptr) = st->agc_level;
- break;
-#endif /* #ifndef DISABLE_FLOAT_API */
- case SPEEX_PREPROCESS_SET_AGC_INCREMENT:
- st->max_increase_step = exp(0.11513f * (*(spx_int32_t*)ptr)*st->frame_size / st->sampling_rate);
- break;
- case SPEEX_PREPROCESS_GET_AGC_INCREMENT:
- (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_increase_step)*st->sampling_rate/st->frame_size);
- break;
- case SPEEX_PREPROCESS_SET_AGC_DECREMENT:
- st->max_decrease_step = exp(0.11513f * (*(spx_int32_t*)ptr)*st->frame_size / st->sampling_rate);
- break;
- case SPEEX_PREPROCESS_GET_AGC_DECREMENT:
- (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_decrease_step)*st->sampling_rate/st->frame_size);
- break;
- case SPEEX_PREPROCESS_SET_AGC_MAX_GAIN:
- st->max_gain = exp(0.11513f * (*(spx_int32_t*)ptr));
- break;
- case SPEEX_PREPROCESS_GET_AGC_MAX_GAIN:
- (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_gain));
- break;
-#endif
- case SPEEX_PREPROCESS_SET_VAD:
- speex_warning("The VAD has been replaced by a hack pending a complete rewrite");
- st->vad_enabled = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_PREPROCESS_GET_VAD:
- (*(spx_int32_t*)ptr) = st->vad_enabled;
- break;
-
- case SPEEX_PREPROCESS_SET_DEREVERB:
- st->dereverb_enabled = (*(spx_int32_t*)ptr);
- for (i=0;i<st->ps_size;i++)
- st->reverb_estimate[i]=0;
- break;
- case SPEEX_PREPROCESS_GET_DEREVERB:
- (*(spx_int32_t*)ptr) = st->dereverb_enabled;
- break;
-
- case SPEEX_PREPROCESS_SET_DEREVERB_LEVEL:
- /* FIXME: Re-enable when de-reverberation is actually enabled again */
- /*st->reverb_level = (*(float*)ptr);*/
- break;
- case SPEEX_PREPROCESS_GET_DEREVERB_LEVEL:
- /* FIXME: Re-enable when de-reverberation is actually enabled again */
- /*(*(float*)ptr) = st->reverb_level;*/
- break;
-
- case SPEEX_PREPROCESS_SET_DEREVERB_DECAY:
- /* FIXME: Re-enable when de-reverberation is actually enabled again */
- /*st->reverb_decay = (*(float*)ptr);*/
- break;
- case SPEEX_PREPROCESS_GET_DEREVERB_DECAY:
- /* FIXME: Re-enable when de-reverberation is actually enabled again */
- /*(*(float*)ptr) = st->reverb_decay;*/
- break;
-
- case SPEEX_PREPROCESS_SET_PROB_START:
- *(spx_int32_t*)ptr = MIN32(100,MAX32(0, *(spx_int32_t*)ptr));
- st->speech_prob_start = DIV32_16(MULT16_16(Q15ONE,*(spx_int32_t*)ptr), 100);
- break;
- case SPEEX_PREPROCESS_GET_PROB_START:
- (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob_start, 100);
- break;
-
- case SPEEX_PREPROCESS_SET_PROB_CONTINUE:
- *(spx_int32_t*)ptr = MIN32(100,MAX32(0, *(spx_int32_t*)ptr));
- st->speech_prob_continue = DIV32_16(MULT16_16(Q15ONE,*(spx_int32_t*)ptr), 100);
- break;
- case SPEEX_PREPROCESS_GET_PROB_CONTINUE:
- (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob_continue, 100);
- break;
-
- case SPEEX_PREPROCESS_SET_NOISE_SUPPRESS:
- st->noise_suppress = -ABS(*(spx_int32_t*)ptr);
- break;
- case SPEEX_PREPROCESS_GET_NOISE_SUPPRESS:
- (*(spx_int32_t*)ptr) = st->noise_suppress;
- break;
- case SPEEX_PREPROCESS_SET_ECHO_SUPPRESS:
- st->echo_suppress = -ABS(*(spx_int32_t*)ptr);
- break;
- case SPEEX_PREPROCESS_GET_ECHO_SUPPRESS:
- (*(spx_int32_t*)ptr) = st->echo_suppress;
- break;
- case SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE:
- st->echo_suppress_active = -ABS(*(spx_int32_t*)ptr);
- break;
- case SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE:
- (*(spx_int32_t*)ptr) = st->echo_suppress_active;
- break;
- case SPEEX_PREPROCESS_SET_ECHO_STATE:
- st->echo_state = (SpeexEchoState*)ptr;
- break;
- case SPEEX_PREPROCESS_GET_ECHO_STATE:
- (*(SpeexEchoState**)ptr) = (SpeexEchoState*)st->echo_state;
- break;
-#ifndef FIXED_POINT
- case SPEEX_PREPROCESS_GET_AGC_LOUDNESS:
- (*(spx_int32_t*)ptr) = pow(st->loudness, 1.0/LOUDNESS_EXP);
- break;
- case SPEEX_PREPROCESS_GET_AGC_GAIN:
- (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->agc_gain));
- break;
-#endif
- case SPEEX_PREPROCESS_GET_PSD_SIZE:
- case SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE:
- (*(spx_int32_t*)ptr) = st->ps_size;
- break;
- case SPEEX_PREPROCESS_GET_PSD:
- for(i=0;i<st->ps_size;i++)
- ((spx_int32_t *)ptr)[i] = (spx_int32_t) st->ps[i];
- break;
- case SPEEX_PREPROCESS_GET_NOISE_PSD:
- for(i=0;i<st->ps_size;i++)
- ((spx_int32_t *)ptr)[i] = (spx_int32_t) PSHR32(st->noise[i], NOISE_SHIFT);
- break;
- case SPEEX_PREPROCESS_GET_PROB:
- (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob, 100);
- break;
-#ifndef FIXED_POINT
- case SPEEX_PREPROCESS_SET_AGC_TARGET:
- st->agc_level = (*(spx_int32_t*)ptr);
- if (st->agc_level<1)
- st->agc_level=1;
- if (st->agc_level>32768)
- st->agc_level=32768;
- break;
- case SPEEX_PREPROCESS_GET_AGC_TARGET:
- (*(spx_int32_t*)ptr) = st->agc_level;
- break;
-#endif
- default:
- speex_warning_int("Unknown speex_preprocess_ctl request: ", request);
- return -1;
- }
- return 0;
-}
-
-#ifdef FIXED_DEBUG
-long long spx_mips=0;
-#endif
-
diff --git a/drivers/speex/pseudofloat.h b/drivers/speex/pseudofloat.h
deleted file mode 100644
index fa841a010..000000000
--- a/drivers/speex/pseudofloat.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/* Copyright (C) 2005 Jean-Marc Valin */
-/**
- @file pseudofloat.h
- @brief Pseudo-floating point
- * This header file provides a lightweight floating point type for
- * use on fixed-point platforms when a large dynamic range is
- * required. The new type is not compatible with the 32-bit IEEE format,
- * it is not even remotely as accurate as 32-bit floats, and is not
- * even guaranteed to produce even remotely correct results for code
- * other than Speex. It makes all kinds of shortcuts that are acceptable
- * for Speex, but may not be acceptable for your application. You're
- * quite welcome to reuse this code and improve it, but don't assume
- * it works out of the box. Most likely, it doesn't.
- */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef PSEUDOFLOAT_H
-#define PSEUDOFLOAT_H
-
-#include "arch.h"
-#include "os_support.h"
-#include "math_approx.h"
-#include <math.h>
-
-#ifdef FIXED_POINT
-
-typedef struct {
- spx_int16_t m;
- spx_int16_t e;
-} spx_float_t;
-
-static const spx_float_t FLOAT_ZERO = {0,0};
-static const spx_float_t FLOAT_ONE = {16384,-14};
-static const spx_float_t FLOAT_HALF = {16384,-15};
-
-#define MIN(a,b) ((a)<(b)?(a):(b))
-static inline spx_float_t PSEUDOFLOAT(spx_int32_t x)
-{
- int e=0;
- int sign=0;
- if (x<0)
- {
- sign = 1;
- x = -x;
- }
- if (x==0)
- {
- spx_float_t r = {0,0};
- return r;
- }
- e = spx_ilog2(ABS32(x))-14;
- x = VSHR32(x, e);
- if (sign)
- {
- spx_float_t r;
- r.m = -x;
- r.e = e;
- return r;
- }
- else
- {
- spx_float_t r;
- r.m = x;
- r.e = e;
- return r;
- }
-}
-
-
-static inline spx_float_t FLOAT_ADD(spx_float_t a, spx_float_t b)
-{
- spx_float_t r;
- if (a.m==0)
- return b;
- else if (b.m==0)
- return a;
- if ((a).e > (b).e)
- {
- r.m = ((a).m>>1) + ((b).m>>MIN(15,(a).e-(b).e+1));
- r.e = (a).e+1;
- }
- else
- {
- r.m = ((b).m>>1) + ((a).m>>MIN(15,(b).e-(a).e+1));
- r.e = (b).e+1;
- }
- if (r.m>0)
- {
- if (r.m<16384)
- {
- r.m<<=1;
- r.e-=1;
- }
- } else {
- if (r.m>-16384)
- {
- r.m<<=1;
- r.e-=1;
- }
- }
- /*printf ("%f + %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
- return r;
-}
-
-static inline spx_float_t FLOAT_SUB(spx_float_t a, spx_float_t b)
-{
- spx_float_t r;
- if (a.m==0)
- return b;
- else if (b.m==0)
- return a;
- if ((a).e > (b).e)
- {
- r.m = ((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1));
- r.e = (a).e+1;
- }
- else
- {
- r.m = ((a).m>>MIN(15,(b).e-(a).e+1)) - ((b).m>>1);
- r.e = (b).e+1;
- }
- if (r.m>0)
- {
- if (r.m<16384)
- {
- r.m<<=1;
- r.e-=1;
- }
- } else {
- if (r.m>-16384)
- {
- r.m<<=1;
- r.e-=1;
- }
- }
- /*printf ("%f + %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
- return r;
-}
-
-static inline int FLOAT_LT(spx_float_t a, spx_float_t b)
-{
- if (a.m==0)
- return b.m>0;
- else if (b.m==0)
- return a.m<0;
- if ((a).e > (b).e)
- return ((a).m>>1) < ((b).m>>MIN(15,(a).e-(b).e+1));
- else
- return ((b).m>>1) > ((a).m>>MIN(15,(b).e-(a).e+1));
-
-}
-
-static inline int FLOAT_GT(spx_float_t a, spx_float_t b)
-{
- return FLOAT_LT(b,a);
-}
-
-static inline spx_float_t FLOAT_MULT(spx_float_t a, spx_float_t b)
-{
- spx_float_t r;
- r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15);
- r.e = (a).e+(b).e+15;
- if (r.m>0)
- {
- if (r.m<16384)
- {
- r.m<<=1;
- r.e-=1;
- }
- } else {
- if (r.m>-16384)
- {
- r.m<<=1;
- r.e-=1;
- }
- }
- /*printf ("%f * %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
- return r;
-}
-
-static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b)
-{
- spx_float_t r;
- r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15);
- r.e = (a).e+(b).e+15;
- return r;
-}
-
-
-static inline spx_float_t FLOAT_SHL(spx_float_t a, int b)
-{
- spx_float_t r;
- r.m = a.m;
- r.e = a.e+b;
- return r;
-}
-
-static inline spx_int16_t FLOAT_EXTRACT16(spx_float_t a)
-{
- if (a.e<0)
- return EXTRACT16((EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e);
- else
- return a.m<<a.e;
-}
-
-static inline spx_int32_t FLOAT_EXTRACT32(spx_float_t a)
-{
- if (a.e<0)
- return (EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e;
- else
- return EXTEND32(a.m)<<a.e;
-}
-
-static inline spx_int32_t FLOAT_MUL32(spx_float_t a, spx_word32_t b)
-{
- return VSHR32(MULT16_32_Q15(a.m, b),-a.e-15);
-}
-
-static inline spx_float_t FLOAT_MUL32U(spx_word32_t a, spx_word32_t b)
-{
- int e1, e2;
- spx_float_t r;
- if (a==0 || b==0)
- {
- return FLOAT_ZERO;
- }
- e1 = spx_ilog2(ABS32(a));
- a = VSHR32(a, e1-14);
- e2 = spx_ilog2(ABS32(b));
- b = VSHR32(b, e2-14);
- r.m = MULT16_16_Q15(a,b);
- r.e = e1+e2-13;
- return r;
-}
-
-/* Do NOT attempt to divide by a negative number */
-static inline spx_float_t FLOAT_DIV32_FLOAT(spx_word32_t a, spx_float_t b)
-{
- int e=0;
- spx_float_t r;
- if (a==0)
- {
- return FLOAT_ZERO;
- }
- e = spx_ilog2(ABS32(a))-spx_ilog2(b.m-1)-15;
- a = VSHR32(a, e);
- if (ABS32(a)>=SHL32(EXTEND32(b.m-1),15))
- {
- a >>= 1;
- e++;
- }
- r.m = DIV32_16(a,b.m);
- r.e = e-b.e;
- return r;
-}
-
-
-/* Do NOT attempt to divide by a negative number */
-static inline spx_float_t FLOAT_DIV32(spx_word32_t a, spx_word32_t b)
-{
- int e0=0,e=0;
- spx_float_t r;
- if (a==0)
- {
- return FLOAT_ZERO;
- }
- if (b>32767)
- {
- e0 = spx_ilog2(b)-14;
- b = VSHR32(b, e0);
- e0 = -e0;
- }
- e = spx_ilog2(ABS32(a))-spx_ilog2(b-1)-15;
- a = VSHR32(a, e);
- if (ABS32(a)>=SHL32(EXTEND32(b-1),15))
- {
- a >>= 1;
- e++;
- }
- e += e0;
- r.m = DIV32_16(a,b);
- r.e = e;
- return r;
-}
-
-/* Do NOT attempt to divide by a negative number */
-static inline spx_float_t FLOAT_DIVU(spx_float_t a, spx_float_t b)
-{
- int e=0;
- spx_int32_t num;
- spx_float_t r;
- if (b.m<=0)
- {
- speex_warning_int("Attempted to divide by", b.m);
- return FLOAT_ONE;
- }
- num = a.m;
- a.m = ABS16(a.m);
- while (a.m >= b.m)
- {
- e++;
- a.m >>= 1;
- }
- num = num << (15-e);
- r.m = DIV32_16(num,b.m);
- r.e = a.e-b.e-15+e;
- return r;
-}
-
-static inline spx_float_t FLOAT_SQRT(spx_float_t a)
-{
- spx_float_t r;
- spx_int32_t m;
- m = SHL32(EXTEND32(a.m), 14);
- r.e = a.e - 14;
- if (r.e & 1)
- {
- r.e -= 1;
- m <<= 1;
- }
- r.e >>= 1;
- r.m = spx_sqrt(m);
- return r;
-}
-
-#else
-
-#define spx_float_t float
-#define FLOAT_ZERO 0.f
-#define FLOAT_ONE 1.f
-#define FLOAT_HALF 0.5f
-#define PSEUDOFLOAT(x) (x)
-#define FLOAT_MULT(a,b) ((a)*(b))
-#define FLOAT_AMULT(a,b) ((a)*(b))
-#define FLOAT_MUL32(a,b) ((a)*(b))
-#define FLOAT_DIV32(a,b) ((a)/(b))
-#define FLOAT_EXTRACT16(a) (a)
-#define FLOAT_EXTRACT32(a) (a)
-#define FLOAT_ADD(a,b) ((a)+(b))
-#define FLOAT_SUB(a,b) ((a)-(b))
-#define REALFLOAT(x) (x)
-#define FLOAT_DIV32_FLOAT(a,b) ((a)/(b))
-#define FLOAT_MUL32U(a,b) ((a)*(b))
-#define FLOAT_SHL(a,b) (a)
-#define FLOAT_LT(a,b) ((a)<(b))
-#define FLOAT_GT(a,b) ((a)>(b))
-#define FLOAT_DIVU(a,b) ((a)/(b))
-#define FLOAT_SQRT(a) (spx_sqrt(a))
-
-#endif
-
-#endif
diff --git a/drivers/speex/quant_lsp.c b/drivers/speex/quant_lsp.c
deleted file mode 100644
index a09e370ef..000000000
--- a/drivers/speex/quant_lsp.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: quant_lsp.c
- LSP vector quantization
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include "quant_lsp.h"
-#include "os_support.h"
-#include <math.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#include "arch.h"
-
-#ifdef BFIN_ASM
-#include "quant_lsp_bfin.h"
-#endif
-
-#ifdef FIXED_POINT
-
-#define LSP_LINEAR(i) (SHL16(i+1,11))
-#define LSP_LINEAR_HIGH(i) (ADD16(MULT16_16_16(i,2560),6144))
-#define LSP_DIV_256(x) (SHL16((spx_word16_t)x, 5))
-#define LSP_DIV_512(x) (SHL16((spx_word16_t)x, 4))
-#define LSP_DIV_1024(x) (SHL16((spx_word16_t)x, 3))
-#define LSP_PI 25736
-
-#else
-
-#define LSP_LINEAR(i) (.25*(i)+.25)
-#define LSP_LINEAR_HIGH(i) (.3125*(i)+.75)
-#define LSP_SCALE 256.
-#define LSP_DIV_256(x) (0.0039062*(x))
-#define LSP_DIV_512(x) (0.0019531*(x))
-#define LSP_DIV_1024(x) (0.00097656*(x))
-#define LSP_PI M_PI
-
-#endif
-
-static void compute_quant_weights(spx_lsp_t *qlsp, spx_word16_t *quant_weight, int order)
-{
- int i;
- spx_word16_t tmp1, tmp2;
- for (i=0;i<order;i++)
- {
- if (i==0)
- tmp1 = qlsp[i];
- else
- tmp1 = qlsp[i]-qlsp[i-1];
- if (i==order-1)
- tmp2 = LSP_PI-qlsp[i];
- else
- tmp2 = qlsp[i+1]-qlsp[i];
- if (tmp2<tmp1)
- tmp1 = tmp2;
-#ifdef FIXED_POINT
- quant_weight[i] = DIV32_16(81920,ADD16(300,tmp1));
-#else
- quant_weight[i] = 10/(.04+tmp1);
-#endif
- }
-
-}
-
-/* Note: x is modified*/
-#ifndef OVERRIDE_LSP_QUANT
-static int lsp_quant(spx_word16_t *x, const signed char *cdbk, int nbVec, int nbDim)
-{
- int i,j;
- spx_word32_t dist;
- spx_word16_t tmp;
- spx_word32_t best_dist=VERY_LARGE32;
- int best_id=0;
- const signed char *ptr=cdbk;
- for (i=0;i<nbVec;i++)
- {
- dist=0;
- for (j=0;j<nbDim;j++)
- {
- tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5));
- dist=MAC16_16(dist,tmp,tmp);
- }
- if (dist<best_dist)
- {
- best_dist=dist;
- best_id=i;
- }
- }
-
- for (j=0;j<nbDim;j++)
- x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
-
- return best_id;
-}
-#endif
-
-/* Note: x is modified*/
-#ifndef OVERRIDE_LSP_WEIGHT_QUANT
-static int lsp_weight_quant(spx_word16_t *x, spx_word16_t *weight, const signed char *cdbk, int nbVec, int nbDim)
-{
- int i,j;
- spx_word32_t dist;
- spx_word16_t tmp;
- spx_word32_t best_dist=VERY_LARGE32;
- int best_id=0;
- const signed char *ptr=cdbk;
- for (i=0;i<nbVec;i++)
- {
- dist=0;
- for (j=0;j<nbDim;j++)
- {
- tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5));
- dist=MAC16_32_Q15(dist,weight[j],MULT16_16(tmp,tmp));
- }
- if (dist<best_dist)
- {
- best_dist=dist;
- best_id=i;
- }
- }
-
- for (j=0;j<nbDim;j++)
- x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
- return best_id;
-}
-#endif
-
-void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
- int i;
- int id;
- spx_word16_t quant_weight[10];
-
- for (i=0;i<order;i++)
- qlsp[i]=lsp[i];
-
- compute_quant_weights(qlsp, quant_weight, order);
-
- for (i=0;i<order;i++)
- qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));
-
-#ifndef FIXED_POINT
- for (i=0;i<order;i++)
- qlsp[i] = LSP_SCALE*qlsp[i];
-#endif
- id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);
- speex_bits_pack(bits, id, 6);
-
- for (i=0;i<order;i++)
- qlsp[i]*=2;
-
- id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
- speex_bits_pack(bits, id, 6);
-
- for (i=0;i<5;i++)
- qlsp[i]*=2;
-
- id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low2, NB_CDBK_SIZE_LOW2, 5);
- speex_bits_pack(bits, id, 6);
-
- id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);
- speex_bits_pack(bits, id, 6);
-
- for (i=5;i<10;i++)
- qlsp[i]*=2;
-
- id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high2, NB_CDBK_SIZE_HIGH2, 5);
- speex_bits_pack(bits, id, 6);
-
-#ifdef FIXED_POINT
- for (i=0;i<order;i++)
- qlsp[i]=PSHR16(qlsp[i],2);
-#else
- for (i=0;i<order;i++)
- qlsp[i]=qlsp[i] * .00097656;
-#endif
-
- for (i=0;i<order;i++)
- qlsp[i]=lsp[i]-qlsp[i];
-}
-
-void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
- int i, id;
- for (i=0;i<order;i++)
- lsp[i]=LSP_LINEAR(i);
-
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<10;i++)
- lsp[i] = ADD32(lsp[i], LSP_DIV_256(cdbk_nb[id*10+i]));
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<5;i++)
- lsp[i] = ADD16(lsp[i], LSP_DIV_512(cdbk_nb_low1[id*5+i]));
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<5;i++)
- lsp[i] = ADD32(lsp[i], LSP_DIV_1024(cdbk_nb_low2[id*5+i]));
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<5;i++)
- lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_512(cdbk_nb_high1[id*5+i]));
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<5;i++)
- lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_1024(cdbk_nb_high2[id*5+i]));
-}
-
-
-void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
- int i;
- int id;
- spx_word16_t quant_weight[10];
-
- for (i=0;i<order;i++)
- qlsp[i]=lsp[i];
-
- compute_quant_weights(qlsp, quant_weight, order);
-
- for (i=0;i<order;i++)
- qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));
-#ifndef FIXED_POINT
- for (i=0;i<order;i++)
- qlsp[i]=qlsp[i]*LSP_SCALE;
-#endif
- id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);
- speex_bits_pack(bits, id, 6);
-
- for (i=0;i<order;i++)
- qlsp[i]*=2;
-
- id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
- speex_bits_pack(bits, id, 6);
-
- id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);
- speex_bits_pack(bits, id, 6);
-
-#ifdef FIXED_POINT
- for (i=0;i<order;i++)
- qlsp[i] = PSHR16(qlsp[i],1);
-#else
- for (i=0;i<order;i++)
- qlsp[i] = qlsp[i]*0.0019531;
-#endif
-
- for (i=0;i<order;i++)
- qlsp[i]=lsp[i]-qlsp[i];
-}
-
-void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
- int i, id;
- for (i=0;i<order;i++)
- lsp[i]=LSP_LINEAR(i);
-
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<10;i++)
- lsp[i] += LSP_DIV_256(cdbk_nb[id*10+i]);
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<5;i++)
- lsp[i] += LSP_DIV_512(cdbk_nb_low1[id*5+i]);
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<5;i++)
- lsp[i+5] += LSP_DIV_512(cdbk_nb_high1[id*5+i]);
-
-}
-
-
-#ifdef DISABLE_WIDEBAND
-void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
-}
-void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
-}
-#else
-extern const signed char high_lsp_cdbk[];
-extern const signed char high_lsp_cdbk2[];
-
-
-void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
- int i;
- int id;
- spx_word16_t quant_weight[10];
-
- for (i=0;i<order;i++)
- qlsp[i]=lsp[i];
-
- compute_quant_weights(qlsp, quant_weight, order);
-
- /* quant_weight[0] = 10/(qlsp[1]-qlsp[0]);
- quant_weight[order-1] = 10/(qlsp[order-1]-qlsp[order-2]);
- for (i=1;i<order-1;i++)
- {
- tmp1 = 10/(qlsp[i]-qlsp[i-1]);
- tmp2 = 10/(qlsp[i+1]-qlsp[i]);
- quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2;
- }*/
-
- for (i=0;i<order;i++)
- qlsp[i]=SUB16(qlsp[i],LSP_LINEAR_HIGH(i));
-#ifndef FIXED_POINT
- for (i=0;i<order;i++)
- qlsp[i] = qlsp[i]*LSP_SCALE;
-#endif
- id = lsp_quant(qlsp, high_lsp_cdbk, 64, order);
- speex_bits_pack(bits, id, 6);
-
- for (i=0;i<order;i++)
- qlsp[i]*=2;
-
- id = lsp_weight_quant(qlsp, quant_weight, high_lsp_cdbk2, 64, order);
- speex_bits_pack(bits, id, 6);
-
-#ifdef FIXED_POINT
- for (i=0;i<order;i++)
- qlsp[i] = PSHR16(qlsp[i],1);
-#else
- for (i=0;i<order;i++)
- qlsp[i] = qlsp[i]*0.0019531;
-#endif
-
- for (i=0;i<order;i++)
- qlsp[i]=lsp[i]-qlsp[i];
-}
-
-void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
-
- int i, id;
- for (i=0;i<order;i++)
- lsp[i]=LSP_LINEAR_HIGH(i);
-
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<order;i++)
- lsp[i] += LSP_DIV_256(high_lsp_cdbk[id*order+i]);
-
-
- id=speex_bits_unpack_unsigned(bits, 6);
- for (i=0;i<order;i++)
- lsp[i] += LSP_DIV_512(high_lsp_cdbk2[id*order+i]);
-}
-
-#endif
-
diff --git a/drivers/speex/quant_lsp.h b/drivers/speex/quant_lsp.h
deleted file mode 100644
index 3bf4d4021..000000000
--- a/drivers/speex/quant_lsp.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file quant_lsp.h
- @brief LSP vector quantization
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef QUANT_LSP_H
-#define QUANT_LSP_H
-
-#include <speex/speex_bits.h>
-#include "arch.h"
-
-#define MAX_LSP_SIZE 20
-
-#define NB_CDBK_SIZE 64
-#define NB_CDBK_SIZE_LOW1 64
-#define NB_CDBK_SIZE_LOW2 64
-#define NB_CDBK_SIZE_HIGH1 64
-#define NB_CDBK_SIZE_HIGH2 64
-
-/*Narrowband codebooks*/
-extern const signed char cdbk_nb[];
-extern const signed char cdbk_nb_low1[];
-extern const signed char cdbk_nb_low2[];
-extern const signed char cdbk_nb_high1[];
-extern const signed char cdbk_nb_high2[];
-
-/* Quantizes narrowband LSPs with 30 bits */
-void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
-
-/* Decodes quantized narrowband LSPs */
-void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits);
-
-/* Quantizes low bit-rate narrowband LSPs with 18 bits */
-void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
-
-/* Decodes quantized low bit-rate narrowband LSPs */
-void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits);
-
-/* Quantizes high-band LSPs with 12 bits */
-void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
-
-/* Decodes high-band LSPs */
-void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits);
-
-#endif
diff --git a/drivers/speex/quant_lsp_bfin.h b/drivers/speex/quant_lsp_bfin.h
deleted file mode 100644
index 087b466b7..000000000
--- a/drivers/speex/quant_lsp_bfin.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* Copyright (C) 2006 David Rowe */
-/**
- @file quant_lsp_bfin.h
- @author David Rowe
- @brief Various compatibility routines for Speex (Blackfin version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_LSP_QUANT
-#ifdef OVERRIDE_LSP_QUANT
-
-/*
- Note http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
- well tell you all the magic resgister constraints used below
- for gcc in-line asm.
-*/
-
-static int lsp_quant(
- spx_word16_t *x,
- const signed char *cdbk,
- int nbVec,
- int nbDim
-)
-{
- int j;
- spx_word32_t best_dist=1<<30;
- int best_id=0;
-
- __asm__ __volatile__
- (
-" %0 = 1 (X);\n\t" /* %0: best_dist */
-" %0 <<= 30;\n\t"
-" %1 = 0 (X);\n\t" /* %1: best_i */
-" P2 = %3\n\t" /* P2: ptr to cdbk */
-" R5 = 0;\n\t" /* R5: best cb entry */
-
-" R0 = %5;\n\t" /* set up circ addr */
-" R0 <<= 1;\n\t"
-" L0 = R0;\n\t"
-" I0 = %2;\n\t" /* %2: &x[0] */
-" B0 = %2;\n\t"
-
-" R2.L = W [I0++];\n\t"
-" LSETUP (1f, 2f) LC0 = %4;\n\t"
-"1: R3 = 0;\n\t" /* R3: dist */
-" LSETUP (3f, 4f) LC1 = %5;\n\t"
-"3: R1 = B [P2++] (X);\n\t"
-" R1 <<= 5;\n\t"
-" R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t"
-" R0 = R0.L*R0.L;\n\t"
-"4: R3 = R3 + R0;\n\t"
-
-" cc =R3<%0;\n\t"
-" if cc %0=R3;\n\t"
-" if cc %1=R5;\n\t"
-"2: R5 += 1;\n\t"
-" L0 = 0;\n\t"
- : "=&d" (best_dist), "=&d" (best_id)
- : "a" (x), "b" (cdbk), "a" (nbVec), "a" (nbDim)
- : "I0", "P2", "R0", "R1", "R2", "R3", "R5", "L0", "B0", "A0"
- );
-
- for (j=0;j<nbDim;j++) {
- x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
- }
- return best_id;
-}
-#endif
-
-#define OVERRIDE_LSP_WEIGHT_QUANT
-#ifdef OVERRIDE_LSP_WEIGHT_QUANT
-
-/*
- Note http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
- well tell you all the magic resgister constraints used below
- for gcc in-line asm.
-*/
-
-static int lsp_weight_quant(
- spx_word16_t *x,
- spx_word16_t *weight,
- const signed char *cdbk,
- int nbVec,
- int nbDim
-)
-{
- int j;
- spx_word32_t best_dist=1<<30;
- int best_id=0;
-
- __asm__ __volatile__
- (
-" %0 = 1 (X);\n\t" /* %0: best_dist */
-" %0 <<= 30;\n\t"
-" %1 = 0 (X);\n\t" /* %1: best_i */
-" P2 = %4\n\t" /* P2: ptr to cdbk */
-" R5 = 0;\n\t" /* R5: best cb entry */
-
-" R0 = %6;\n\t" /* set up circ addr */
-" R0 <<= 1;\n\t"
-" L0 = R0;\n\t"
-" L1 = R0;\n\t"
-" I0 = %2;\n\t" /* %2: &x[0] */
-" I1 = %3;\n\t" /* %3: &weight[0] */
-" B0 = %2;\n\t"
-" B1 = %3;\n\t"
-
-" LSETUP (1f, 2f) LC0 = %5;\n\t"
-"1: R3 = 0 (X);\n\t" /* R3: dist */
-" LSETUP (3f, 4f) LC1 = %6;\n\t"
-"3: R0.L = W [I0++] || R2.L = W [I1++];\n\t"
-" R1 = B [P2++] (X);\n\t"
-" R1 <<= 5;\n\t"
-" R0.L = R0.L - R1.L;\n\t"
-" R0 = R0.L*R0.L;\n\t"
-" A1 = R2.L*R0.L (M,IS);\n\t"
-" A1 = A1 >>> 16;\n\t"
-" R1 = (A1 += R2.L*R0.H) (IS);\n\t"
-"4: R3 = R3 + R1;\n\t"
-
-" cc =R3<%0;\n\t"
-" if cc %0=R3;\n\t"
-" if cc %1=R5;\n\t"
-"2: R5 += 1;\n\t"
-" L0 = 0;\n\t"
-" L1 = 0;\n\t"
- : "=&d" (best_dist), "=&d" (best_id)
- : "a" (x), "a" (weight), "b" (cdbk), "a" (nbVec), "a" (nbDim)
- : "I0", "I1", "P2", "R0", "R1", "R2", "R3", "R5", "A1",
- "L0", "L1", "B0", "B1"
- );
-
- for (j=0;j<nbDim;j++) {
- x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
- }
- return best_id;
-}
-#endif
diff --git a/drivers/speex/resample.c b/drivers/speex/resample.c
deleted file mode 100644
index be02e5ef4..000000000
--- a/drivers/speex/resample.c
+++ /dev/null
@@ -1,1131 +0,0 @@
-/* Copyright (C) 2007-2008 Jean-Marc Valin
- Copyright (C) 2008 Thorvald Natvig
-
- File: resample.c
- Arbitrary resampling code
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- The design goals of this code are:
- - Very fast algorithm
- - SIMD-friendly algorithm
- - Low memory requirement
- - Good *perceptual* quality (and not best SNR)
-
- Warning: This resampler is relatively new. Although I think I got rid of
- all the major bugs and I don't expect the API to change anymore, there
- may be something I've missed. So use with caution.
-
- This algorithm is based on this original resampling algorithm:
- Smith, Julius O. Digital Audio Resampling Home Page
- Center for Computer Research in Music and Acoustics (CCRMA),
- Stanford University, 2007.
- Web published at http://www-ccrma.stanford.edu/~jos/resample/.
-
- There is one main difference, though. This resampler uses cubic
- interpolation instead of linear interpolation in the above paper. This
- makes the table much smaller and makes it possible to compute that table
- on a per-stream basis. In turn, being able to tweak the table for each
- stream makes it possible to both reduce complexity on simple ratios
- (e.g. 2/3), and get rid of the rounding operations in the inner loop.
- The latter both reduces CPU time and makes the algorithm more SIMD-friendly.
-*/
-
-
-#include "config.h"
-
-
-#ifdef OUTSIDE_SPEEX
-#include <stdlib.h>
-static void *speex_alloc (int size) {return calloc(size,1);}
-static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);}
-static void speex_free (void *ptr) {free(ptr);}
-#include "speex_resampler.h"
-#include "arch.h"
-#else /* OUTSIDE_SPEEX */
-
-#include "speex/speex_resampler.h"
-#include "arch.h"
-#include "os_support.h"
-#endif /* OUTSIDE_SPEEX */
-
-#include "stack_alloc.h"
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.14159263
-#endif
-
-#ifdef FIXED_POINT
-#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
-#else
-#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))
-#endif
-
-#define IMAX(a,b) ((a) > (b) ? (a) : (b))
-#define IMIN(a,b) ((a) < (b) ? (a) : (b))
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef _USE_SSE
-#include "resample_sse.h"
-#endif
-
-/* Numer of elements to allocate on the stack */
-#ifdef VAR_ARRAYS
-#define FIXED_STACK_ALLOC 8192
-#else
-#define FIXED_STACK_ALLOC 1024
-#endif
-
-typedef int (*resampler_basic_func)(SpeexResamplerState *, spx_uint32_t , const spx_word16_t *, spx_uint32_t *, spx_word16_t *, spx_uint32_t *);
-
-struct SpeexResamplerState_ {
- spx_uint32_t in_rate;
- spx_uint32_t out_rate;
- spx_uint32_t num_rate;
- spx_uint32_t den_rate;
-
- int quality;
- spx_uint32_t nb_channels;
- spx_uint32_t filt_len;
- spx_uint32_t mem_alloc_size;
- spx_uint32_t buffer_size;
- int int_advance;
- int frac_advance;
- float cutoff;
- spx_uint32_t oversample;
- int initialised;
- int started;
-
- /* These are per-channel */
- spx_int32_t *last_sample;
- spx_uint32_t *samp_frac_num;
- spx_uint32_t *magic_samples;
-
- spx_word16_t *mem;
- spx_word16_t *sinc_table;
- spx_uint32_t sinc_table_length;
- resampler_basic_func resampler_ptr;
-
- int in_stride;
- int out_stride;
-} ;
-
-static double kaiser12_table[68] = {
- 0.99859849, 1.00000000, 0.99859849, 0.99440475, 0.98745105, 0.97779076,
- 0.96549770, 0.95066529, 0.93340547, 0.91384741, 0.89213598, 0.86843014,
- 0.84290116, 0.81573067, 0.78710866, 0.75723148, 0.72629970, 0.69451601,
- 0.66208321, 0.62920216, 0.59606986, 0.56287762, 0.52980938, 0.49704014,
- 0.46473455, 0.43304576, 0.40211431, 0.37206735, 0.34301800, 0.31506490,
- 0.28829195, 0.26276832, 0.23854851, 0.21567274, 0.19416736, 0.17404546,
- 0.15530766, 0.13794294, 0.12192957, 0.10723616, 0.09382272, 0.08164178,
- 0.07063950, 0.06075685, 0.05193064, 0.04409466, 0.03718069, 0.03111947,
- 0.02584161, 0.02127838, 0.01736250, 0.01402878, 0.01121463, 0.00886058,
- 0.00691064, 0.00531256, 0.00401805, 0.00298291, 0.00216702, 0.00153438,
- 0.00105297, 0.00069463, 0.00043489, 0.00025272, 0.00013031, 0.0000527734,
- 0.00001000, 0.00000000};
-/*
-static double kaiser12_table[36] = {
- 0.99440475, 1.00000000, 0.99440475, 0.97779076, 0.95066529, 0.91384741,
- 0.86843014, 0.81573067, 0.75723148, 0.69451601, 0.62920216, 0.56287762,
- 0.49704014, 0.43304576, 0.37206735, 0.31506490, 0.26276832, 0.21567274,
- 0.17404546, 0.13794294, 0.10723616, 0.08164178, 0.06075685, 0.04409466,
- 0.03111947, 0.02127838, 0.01402878, 0.00886058, 0.00531256, 0.00298291,
- 0.00153438, 0.00069463, 0.00025272, 0.0000527734, 0.00000500, 0.00000000};
-*/
-static double kaiser10_table[36] = {
- 0.99537781, 1.00000000, 0.99537781, 0.98162644, 0.95908712, 0.92831446,
- 0.89005583, 0.84522401, 0.79486424, 0.74011713, 0.68217934, 0.62226347,
- 0.56155915, 0.50119680, 0.44221549, 0.38553619, 0.33194107, 0.28205962,
- 0.23636152, 0.19515633, 0.15859932, 0.12670280, 0.09935205, 0.07632451,
- 0.05731132, 0.04193980, 0.02979584, 0.02044510, 0.01345224, 0.00839739,
- 0.00488951, 0.00257636, 0.00115101, 0.00035515, 0.00000000, 0.00000000};
-
-static double kaiser8_table[36] = {
- 0.99635258, 1.00000000, 0.99635258, 0.98548012, 0.96759014, 0.94302200,
- 0.91223751, 0.87580811, 0.83439927, 0.78875245, 0.73966538, 0.68797126,
- 0.63451750, 0.58014482, 0.52566725, 0.47185369, 0.41941150, 0.36897272,
- 0.32108304, 0.27619388, 0.23465776, 0.19672670, 0.16255380, 0.13219758,
- 0.10562887, 0.08273982, 0.06335451, 0.04724088, 0.03412321, 0.02369490,
- 0.01563093, 0.00959968, 0.00527363, 0.00233883, 0.00050000, 0.00000000};
-
-static double kaiser6_table[36] = {
- 0.99733006, 1.00000000, 0.99733006, 0.98935595, 0.97618418, 0.95799003,
- 0.93501423, 0.90755855, 0.87598009, 0.84068475, 0.80211977, 0.76076565,
- 0.71712752, 0.67172623, 0.62508937, 0.57774224, 0.53019925, 0.48295561,
- 0.43647969, 0.39120616, 0.34752997, 0.30580127, 0.26632152, 0.22934058,
- 0.19505503, 0.16360756, 0.13508755, 0.10953262, 0.08693120, 0.06722600,
- 0.05031820, 0.03607231, 0.02432151, 0.01487334, 0.00752000, 0.00000000};
-
-struct FuncDef {
- double *table;
- int oversample;
-};
-
-static struct FuncDef _KAISER12 = {kaiser12_table, 64};
-#define KAISER12 (&_KAISER12)
-/*static struct FuncDef _KAISER12 = {kaiser12_table, 32};
-#define KAISER12 (&_KAISER12)*/
-static struct FuncDef _KAISER10 = {kaiser10_table, 32};
-#define KAISER10 (&_KAISER10)
-static struct FuncDef _KAISER8 = {kaiser8_table, 32};
-#define KAISER8 (&_KAISER8)
-static struct FuncDef _KAISER6 = {kaiser6_table, 32};
-#define KAISER6 (&_KAISER6)
-
-struct QualityMapping {
- int base_length;
- int oversample;
- float downsample_bandwidth;
- float upsample_bandwidth;
- struct FuncDef *window_func;
-};
-
-
-/* This table maps conversion quality to internal parameters. There are two
- reasons that explain why the up-sampling bandwidth is larger than the
- down-sampling bandwidth:
- 1) When up-sampling, we can assume that the spectrum is already attenuated
- close to the Nyquist rate (from an A/D or a previous resampling filter)
- 2) Any aliasing that occurs very close to the Nyquist rate will be masked
- by the sinusoids/noise just below the Nyquist rate (guaranteed only for
- up-sampling).
-*/
-static const struct QualityMapping quality_map[11] = {
- { 8, 4, 0.830f, 0.860f, KAISER6 }, /* Q0 */
- { 16, 4, 0.850f, 0.880f, KAISER6 }, /* Q1 */
- { 32, 4, 0.882f, 0.910f, KAISER6 }, /* Q2 */ /* 82.3% cutoff ( ~60 dB stop) 6 */
- { 48, 8, 0.895f, 0.917f, KAISER8 }, /* Q3 */ /* 84.9% cutoff ( ~80 dB stop) 8 */
- { 64, 8, 0.921f, 0.940f, KAISER8 }, /* Q4 */ /* 88.7% cutoff ( ~80 dB stop) 8 */
- { 80, 16, 0.922f, 0.940f, KAISER10}, /* Q5 */ /* 89.1% cutoff (~100 dB stop) 10 */
- { 96, 16, 0.940f, 0.945f, KAISER10}, /* Q6 */ /* 91.5% cutoff (~100 dB stop) 10 */
- {128, 16, 0.950f, 0.950f, KAISER10}, /* Q7 */ /* 93.1% cutoff (~100 dB stop) 10 */
- {160, 16, 0.960f, 0.960f, KAISER10}, /* Q8 */ /* 94.5% cutoff (~100 dB stop) 10 */
- {192, 32, 0.968f, 0.968f, KAISER12}, /* Q9 */ /* 95.5% cutoff (~100 dB stop) 10 */
- {256, 32, 0.975f, 0.975f, KAISER12}, /* Q10 */ /* 96.6% cutoff (~100 dB stop) 10 */
-};
-/*8,24,40,56,80,104,128,160,200,256,320*/
-static double compute_func(float x, struct FuncDef *func)
-{
- float y, frac;
- double interp[4];
- int ind;
- y = x*func->oversample;
- ind = (int)floor(y);
- frac = (y-ind);
- /* CSE with handle the repeated powers */
- interp[3] = -0.1666666667*frac + 0.1666666667*(frac*frac*frac);
- interp[2] = frac + 0.5*(frac*frac) - 0.5*(frac*frac*frac);
- /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/
- interp[0] = -0.3333333333*frac + 0.5*(frac*frac) - 0.1666666667*(frac*frac*frac);
- /* Just to make sure we don't have rounding problems */
- interp[1] = 1.f-interp[3]-interp[2]-interp[0];
-
- /*sum = frac*accum[1] + (1-frac)*accum[2];*/
- return interp[0]*func->table[ind] + interp[1]*func->table[ind+1] + interp[2]*func->table[ind+2] + interp[3]*func->table[ind+3];
-}
-
-#if 0
-#include <stdio.h>
-int main(int argc, char **argv)
-{
- int i;
- for (i=0;i<256;i++)
- {
- printf ("%f\n", compute_func(i/256., KAISER12));
- }
- return 0;
-}
-#endif
-
-#ifdef FIXED_POINT
-/* The slow way of computing a sinc for the table. Should improve that some day */
-static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func)
-{
- /*fprintf (stderr, "%f ", x);*/
- float xx = x * cutoff;
- if (fabs(x)<1e-6f)
- return WORD2INT(32768.*cutoff);
- else if (fabs(x) > .5f*N)
- return 0;
- /*FIXME: Can it really be any slower than this? */
- return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func));
-}
-#else
-/* The slow way of computing a sinc for the table. Should improve that some day */
-static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func)
-{
- /*fprintf (stderr, "%f ", x);*/
- float xx = x * cutoff;
- if (fabs(x)<1e-6)
- return cutoff;
- else if (fabs(x) > .5*N)
- return 0;
- /*FIXME: Can it really be any slower than this? */
- return cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func);
-}
-#endif
-
-#ifdef FIXED_POINT
-static void cubic_coef(spx_word16_t x, spx_word16_t interp[4])
-{
- /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation
- but I know it's MMSE-optimal on a sinc */
- spx_word16_t x2, x3;
- x2 = MULT16_16_P15(x, x);
- x3 = MULT16_16_P15(x, x2);
- interp[0] = PSHR32(MULT16_16(QCONST16(-0.16667f, 15),x) + MULT16_16(QCONST16(0.16667f, 15),x3),15);
- interp[1] = EXTRACT16(EXTEND32(x) + SHR32(SUB32(EXTEND32(x2),EXTEND32(x3)),1));
- interp[3] = PSHR32(MULT16_16(QCONST16(-0.33333f, 15),x) + MULT16_16(QCONST16(.5f,15),x2) - MULT16_16(QCONST16(0.16667f, 15),x3),15);
- /* Just to make sure we don't have rounding problems */
- interp[2] = Q15_ONE-interp[0]-interp[1]-interp[3];
- if (interp[2]<32767)
- interp[2]+=1;
-}
-#else
-static void cubic_coef(spx_word16_t frac, spx_word16_t interp[4])
-{
- /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation
- but I know it's MMSE-optimal on a sinc */
- interp[0] = -0.16667f*frac + 0.16667f*frac*frac*frac;
- interp[1] = frac + 0.5f*frac*frac - 0.5f*frac*frac*frac;
- /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/
- interp[3] = -0.33333f*frac + 0.5f*frac*frac - 0.16667f*frac*frac*frac;
- /* Just to make sure we don't have rounding problems */
- interp[2] = 1.-interp[0]-interp[1]-interp[3];
-}
-#endif
-
-static int resampler_basic_direct_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
- const int N = st->filt_len;
- int out_sample = 0;
- int last_sample = st->last_sample[channel_index];
- spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- const spx_word16_t *sinc_table = st->sinc_table;
- const int out_stride = st->out_stride;
- const int int_advance = st->int_advance;
- const int frac_advance = st->frac_advance;
- const spx_uint32_t den_rate = st->den_rate;
- spx_word32_t sum;
- int j;
-
- while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
- {
- const spx_word16_t *sinc = & sinc_table[samp_frac_num*N];
- const spx_word16_t *iptr = & in[last_sample];
-
-#ifndef OVERRIDE_INNER_PRODUCT_SINGLE
- float accum[4] = {0,0,0,0};
-
- for(j=0;j<N;j+=4) {
- accum[0] += sinc[j]*iptr[j];
- accum[1] += sinc[j+1]*iptr[j+1];
- accum[2] += sinc[j+2]*iptr[j+2];
- accum[3] += sinc[j+3]*iptr[j+3];
- }
- sum = accum[0] + accum[1] + accum[2] + accum[3];
-#else
- sum = inner_product_single(sinc, iptr, N);
-#endif
-
- out[out_stride * out_sample++] = PSHR32(sum, 15);
- last_sample += int_advance;
- samp_frac_num += frac_advance;
- if (samp_frac_num >= den_rate)
- {
- samp_frac_num -= den_rate;
- last_sample++;
- }
- }
-
- st->last_sample[channel_index] = last_sample;
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
-}
-
-#ifdef FIXED_POINT
-#else
-/* This is the same as the previous function, except with a double-precision accumulator */
-static int resampler_basic_direct_double(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
- const int N = st->filt_len;
- int out_sample = 0;
- int last_sample = st->last_sample[channel_index];
- spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- const spx_word16_t *sinc_table = st->sinc_table;
- const int out_stride = st->out_stride;
- const int int_advance = st->int_advance;
- const int frac_advance = st->frac_advance;
- const spx_uint32_t den_rate = st->den_rate;
- double sum;
- int j;
-
- while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
- {
- const spx_word16_t *sinc = & sinc_table[samp_frac_num*N];
- const spx_word16_t *iptr = & in[last_sample];
-
-#ifndef OVERRIDE_INNER_PRODUCT_DOUBLE
- double accum[4] = {0,0,0,0};
-
- for(j=0;j<N;j+=4) {
- accum[0] += sinc[j]*iptr[j];
- accum[1] += sinc[j+1]*iptr[j+1];
- accum[2] += sinc[j+2]*iptr[j+2];
- accum[3] += sinc[j+3]*iptr[j+3];
- }
- sum = accum[0] + accum[1] + accum[2] + accum[3];
-#else
- sum = inner_product_double(sinc, iptr, N);
-#endif
-
- out[out_stride * out_sample++] = PSHR32(sum, 15);
- last_sample += int_advance;
- samp_frac_num += frac_advance;
- if (samp_frac_num >= den_rate)
- {
- samp_frac_num -= den_rate;
- last_sample++;
- }
- }
-
- st->last_sample[channel_index] = last_sample;
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
-}
-#endif
-
-static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
- const int N = st->filt_len;
- int out_sample = 0;
- int last_sample = st->last_sample[channel_index];
- spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- const int out_stride = st->out_stride;
- const int int_advance = st->int_advance;
- const int frac_advance = st->frac_advance;
- const spx_uint32_t den_rate = st->den_rate;
- int j;
- spx_word32_t sum;
-
- while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
- {
- const spx_word16_t *iptr = & in[last_sample];
-
- const int offset = samp_frac_num*st->oversample/st->den_rate;
-#ifdef FIXED_POINT
- const spx_word16_t frac = PDIV32(SHL32((samp_frac_num*st->oversample) % st->den_rate,15),st->den_rate);
-#else
- const spx_word16_t frac = ((float)((samp_frac_num*st->oversample) % st->den_rate))/st->den_rate;
-#endif
- spx_word16_t interp[4];
-
-
-#ifndef OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
- spx_word32_t accum[4] = {0,0,0,0};
-
- for(j=0;j<N;j++) {
- const spx_word16_t curr_in=iptr[j];
- accum[0] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-2]);
- accum[1] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-1]);
- accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]);
- accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]);
- }
-
- cubic_coef(frac, interp);
- sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]);
-#else
- cubic_coef(frac, interp);
- sum = interpolate_product_single(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
-#endif
-
- out[out_stride * out_sample++] = PSHR32(sum,15);
- last_sample += int_advance;
- samp_frac_num += frac_advance;
- if (samp_frac_num >= den_rate)
- {
- samp_frac_num -= den_rate;
- last_sample++;
- }
- }
-
- st->last_sample[channel_index] = last_sample;
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
-}
-
-#ifdef FIXED_POINT
-#else
-/* This is the same as the previous function, except with a double-precision accumulator */
-static int resampler_basic_interpolate_double(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
- const int N = st->filt_len;
- int out_sample = 0;
- int last_sample = st->last_sample[channel_index];
- spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- const int out_stride = st->out_stride;
- const int int_advance = st->int_advance;
- const int frac_advance = st->frac_advance;
- const spx_uint32_t den_rate = st->den_rate;
- int j;
- spx_word32_t sum;
-
- while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
- {
- const spx_word16_t *iptr = & in[last_sample];
-
- const int offset = samp_frac_num*st->oversample/st->den_rate;
-#ifdef FIXED_POINT
- const spx_word16_t frac = PDIV32(SHL32((samp_frac_num*st->oversample) % st->den_rate,15),st->den_rate);
-#else
- const spx_word16_t frac = ((float)((samp_frac_num*st->oversample) % st->den_rate))/st->den_rate;
-#endif
- spx_word16_t interp[4];
-
-
-#ifndef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
- double accum[4] = {0,0,0,0};
-
- for(j=0;j<N;j++) {
- const double curr_in=iptr[j];
- accum[0] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-2]);
- accum[1] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-1]);
- accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]);
- accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]);
- }
-
- cubic_coef(frac, interp);
- sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]);
-#else
- cubic_coef(frac, interp);
- sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
-#endif
-
- out[out_stride * out_sample++] = PSHR32(sum,15);
- last_sample += int_advance;
- samp_frac_num += frac_advance;
- if (samp_frac_num >= den_rate)
- {
- samp_frac_num -= den_rate;
- last_sample++;
- }
- }
-
- st->last_sample[channel_index] = last_sample;
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
-}
-#endif
-
-static void update_filter(SpeexResamplerState *st)
-{
- spx_uint32_t old_length;
-
- old_length = st->filt_len;
- st->oversample = quality_map[st->quality].oversample;
- st->filt_len = quality_map[st->quality].base_length;
-
- if (st->num_rate > st->den_rate)
- {
- /* down-sampling */
- st->cutoff = quality_map[st->quality].downsample_bandwidth * st->den_rate / st->num_rate;
- /* FIXME: divide the numerator and denominator by a certain amount if they're too large */
- st->filt_len = st->filt_len*st->num_rate / st->den_rate;
- /* Round down to make sure we have a multiple of 4 */
- st->filt_len &= (~0x3);
- if (2*st->den_rate < st->num_rate)
- st->oversample >>= 1;
- if (4*st->den_rate < st->num_rate)
- st->oversample >>= 1;
- if (8*st->den_rate < st->num_rate)
- st->oversample >>= 1;
- if (16*st->den_rate < st->num_rate)
- st->oversample >>= 1;
- if (st->oversample < 1)
- st->oversample = 1;
- } else {
- /* up-sampling */
- st->cutoff = quality_map[st->quality].upsample_bandwidth;
- }
-
- /* Choose the resampling type that requires the least amount of memory */
- if (st->den_rate <= st->oversample)
- {
- spx_uint32_t i;
- if (!st->sinc_table)
- st->sinc_table = (spx_word16_t *)speex_alloc(st->filt_len*st->den_rate*sizeof(spx_word16_t));
- else if (st->sinc_table_length < st->filt_len*st->den_rate)
- {
- st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,st->filt_len*st->den_rate*sizeof(spx_word16_t));
- st->sinc_table_length = st->filt_len*st->den_rate;
- }
- for (i=0;i<st->den_rate;i++)
- {
- spx_int32_t j;
- for (j=0;j<st->filt_len;j++)
- {
- st->sinc_table[i*st->filt_len+j] = sinc(st->cutoff,((j-(spx_int32_t)st->filt_len/2+1)-((float)i)/st->den_rate), st->filt_len, quality_map[st->quality].window_func);
- }
- }
-#ifdef FIXED_POINT
- st->resampler_ptr = resampler_basic_direct_single;
-#else
- if (st->quality>8)
- st->resampler_ptr = resampler_basic_direct_double;
- else
- st->resampler_ptr = resampler_basic_direct_single;
-#endif
- /*fprintf (stderr, "resampler uses direct sinc table and normalised cutoff %f\n", cutoff);*/
- } else {
- spx_int32_t i;
- if (!st->sinc_table)
- st->sinc_table = (spx_word16_t *)speex_alloc((st->filt_len*st->oversample+8)*sizeof(spx_word16_t));
- else if (st->sinc_table_length < st->filt_len*st->oversample+8)
- {
- st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,(st->filt_len*st->oversample+8)*sizeof(spx_word16_t));
- st->sinc_table_length = st->filt_len*st->oversample+8;
- }
- for (i=-4;i<(spx_int32_t)(st->oversample*st->filt_len+4);i++)
- st->sinc_table[i+4] = sinc(st->cutoff,(i/(float)st->oversample - st->filt_len/2), st->filt_len, quality_map[st->quality].window_func);
-#ifdef FIXED_POINT
- st->resampler_ptr = resampler_basic_interpolate_single;
-#else
- if (st->quality>8)
- st->resampler_ptr = resampler_basic_interpolate_double;
- else
- st->resampler_ptr = resampler_basic_interpolate_single;
-#endif
- /*fprintf (stderr, "resampler uses interpolated sinc table and normalised cutoff %f\n", cutoff);*/
- }
- st->int_advance = st->num_rate/st->den_rate;
- st->frac_advance = st->num_rate%st->den_rate;
-
-
- /* Here's the place where we update the filter memory to take into account
- the change in filter length. It's probably the messiest part of the code
- due to handling of lots of corner cases. */
- if (!st->mem)
- {
- spx_uint32_t i;
- st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
- st->mem = (spx_word16_t*)speex_alloc(st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
- for (i=0;i<st->nb_channels*st->mem_alloc_size;i++)
- st->mem[i] = 0;
- /*speex_warning("init filter");*/
- } else if (!st->started)
- {
- spx_uint32_t i;
- st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
- st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
- for (i=0;i<st->nb_channels*st->mem_alloc_size;i++)
- st->mem[i] = 0;
- /*speex_warning("reinit filter");*/
- } else if (st->filt_len > old_length)
- {
- spx_int32_t i;
- /* Increase the filter length */
- /*speex_warning("increase filter size");*/
- int old_alloc_size = st->mem_alloc_size;
- if ((st->filt_len-1 + st->buffer_size) > st->mem_alloc_size)
- {
- st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
- st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
- }
- for (i=st->nb_channels-1;i>=0;i--)
- {
- spx_int32_t j;
- spx_uint32_t olen = old_length;
- /*if (st->magic_samples[i])*/
- {
- /* Try and remove the magic samples as if nothing had happened */
-
- /* FIXME: This is wrong but for now we need it to avoid going over the array bounds */
- olen = old_length + 2*st->magic_samples[i];
- for (j=old_length-2+st->magic_samples[i];j>=0;j--)
- st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]] = st->mem[i*old_alloc_size+j];
- for (j=0;j<st->magic_samples[i];j++)
- st->mem[i*st->mem_alloc_size+j] = 0;
- st->magic_samples[i] = 0;
- }
- if (st->filt_len > olen)
- {
- /* If the new filter length is still bigger than the "augmented" length */
- /* Copy data going backward */
- for (j=0;j<olen-1;j++)
- st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = st->mem[i*st->mem_alloc_size+(olen-2-j)];
- /* Then put zeros for lack of anything better */
- for (;j<st->filt_len-1;j++)
- st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = 0;
- /* Adjust last_sample */
- st->last_sample[i] += (st->filt_len - olen)/2;
- } else {
- /* Put back some of the magic! */
- st->magic_samples[i] = (olen - st->filt_len)/2;
- for (j=0;j<st->filt_len-1+st->magic_samples[i];j++)
- st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]];
- }
- }
- } else if (st->filt_len < old_length)
- {
- spx_uint32_t i;
- /* Reduce filter length, this a bit tricky. We need to store some of the memory as "magic"
- samples so they can be used directly as input the next time(s) */
- for (i=0;i<st->nb_channels;i++)
- {
- spx_uint32_t j;
- spx_uint32_t old_magic = st->magic_samples[i];
- st->magic_samples[i] = (old_length - st->filt_len)/2;
- /* We must copy some of the memory that's no longer used */
- /* Copy data going backward */
- for (j=0;j<st->filt_len-1+st->magic_samples[i]+old_magic;j++)
- st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]];
- st->magic_samples[i] += old_magic;
- }
- }
-
-}
-
-EXPORT SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
-{
- return speex_resampler_init_frac(nb_channels, in_rate, out_rate, in_rate, out_rate, quality, err);
-}
-
-EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
-{
- spx_uint32_t i;
- SpeexResamplerState *st;
- if (quality > 10 || quality < 0)
- {
- if (err)
- *err = RESAMPLER_ERR_INVALID_ARG;
- return NULL;
- }
- st = (SpeexResamplerState *)speex_alloc(sizeof(SpeexResamplerState));
- st->initialised = 0;
- st->started = 0;
- st->in_rate = 0;
- st->out_rate = 0;
- st->num_rate = 0;
- st->den_rate = 0;
- st->quality = -1;
- st->sinc_table_length = 0;
- st->mem_alloc_size = 0;
- st->filt_len = 0;
- st->mem = 0;
- st->resampler_ptr = 0;
-
- st->cutoff = 1.f;
- st->nb_channels = nb_channels;
- st->in_stride = 1;
- st->out_stride = 1;
-
-#ifdef FIXED_POINT
- st->buffer_size = 160;
-#else
- st->buffer_size = 160;
-#endif
-
- /* Per channel data */
- st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(int));
- st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int));
- st->samp_frac_num = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int));
- for (i=0;i<nb_channels;i++)
- {
- st->last_sample[i] = 0;
- st->magic_samples[i] = 0;
- st->samp_frac_num[i] = 0;
- }
-
- speex_resampler_set_quality(st, quality);
- speex_resampler_set_rate_frac(st, ratio_num, ratio_den, in_rate, out_rate);
-
-
- update_filter(st);
-
- st->initialised = 1;
- if (err)
- *err = RESAMPLER_ERR_SUCCESS;
-
- return st;
-}
-
-EXPORT void speex_resampler_destroy(SpeexResamplerState *st)
-{
- speex_free(st->mem);
- speex_free(st->sinc_table);
- speex_free(st->last_sample);
- speex_free(st->magic_samples);
- speex_free(st->samp_frac_num);
- speex_free(st);
-}
-
-static int speex_resampler_process_native(SpeexResamplerState *st, spx_uint32_t channel_index, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
- int j=0;
- const int N = st->filt_len;
- int out_sample = 0;
- spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
- spx_uint32_t ilen;
-
- st->started = 1;
-
- /* Call the right resampler through the function ptr */
- out_sample = st->resampler_ptr(st, channel_index, mem, in_len, out, out_len);
-
- if (st->last_sample[channel_index] < (spx_int32_t)*in_len)
- *in_len = st->last_sample[channel_index];
- *out_len = out_sample;
- st->last_sample[channel_index] -= *in_len;
-
- ilen = *in_len;
-
- for(j=0;j<N-1;++j)
- mem[j] = mem[j+ilen];
-
- return RESAMPLER_ERR_SUCCESS;
-}
-
-static int speex_resampler_magic(SpeexResamplerState *st, spx_uint32_t channel_index, spx_word16_t **out, spx_uint32_t out_len) {
- spx_uint32_t tmp_in_len = st->magic_samples[channel_index];
- spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
- const int N = st->filt_len;
-
- speex_resampler_process_native(st, channel_index, &tmp_in_len, *out, &out_len);
-
- st->magic_samples[channel_index] -= tmp_in_len;
-
- /* If we couldn't process all "magic" input samples, save the rest for next time */
- if (st->magic_samples[channel_index])
- {
- spx_uint32_t i;
- for (i=0;i<st->magic_samples[channel_index];i++)
- mem[N-1+i]=mem[N-1+i+tmp_in_len];
- }
- *out += out_len*st->out_stride;
- return out_len;
-}
-
-#ifdef FIXED_POINT
-EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
-#else
-EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
-#endif
-{
- int j;
- spx_uint32_t ilen = *in_len;
- spx_uint32_t olen = *out_len;
- spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size;
- const int filt_offs = st->filt_len - 1;
- const spx_uint32_t xlen = st->mem_alloc_size - filt_offs;
- const int istride = st->in_stride;
-
- if (st->magic_samples[channel_index])
- olen -= speex_resampler_magic(st, channel_index, &out, olen);
- if (! st->magic_samples[channel_index]) {
- while (ilen && olen) {
- spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
- spx_uint32_t ochunk = olen;
-
- if (in) {
- for(j=0;j<ichunk;++j)
- x[j+filt_offs]=in[j*istride];
- } else {
- for(j=0;j<ichunk;++j)
- x[j+filt_offs]=0;
- }
- speex_resampler_process_native(st, channel_index, &ichunk, out, &ochunk);
- ilen -= ichunk;
- olen -= ochunk;
- out += ochunk * st->out_stride;
- if (in)
- in += ichunk * istride;
- }
- }
- *in_len -= ilen;
- *out_len -= olen;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-#ifdef FIXED_POINT
-EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
-#else
-EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
-#endif
-{
- int j;
- const int istride_save = st->in_stride;
- const int ostride_save = st->out_stride;
- spx_uint32_t ilen = *in_len;
- spx_uint32_t olen = *out_len;
- spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size;
- const spx_uint32_t xlen = st->mem_alloc_size - (st->filt_len - 1);
-#ifdef VAR_ARRAYS
- const unsigned int ylen = (olen < FIXED_STACK_ALLOC) ? olen : FIXED_STACK_ALLOC;
- VARDECL(spx_word16_t *ystack);
- ALLOC(ystack, ylen, spx_word16_t);
-#else
- const unsigned int ylen = FIXED_STACK_ALLOC;
- spx_word16_t ystack[FIXED_STACK_ALLOC];
-#endif
-
- st->out_stride = 1;
-
- while (ilen && olen) {
- spx_word16_t *y = ystack;
- spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
- spx_uint32_t ochunk = (olen > ylen) ? ylen : olen;
- spx_uint32_t omagic = 0;
-
- if (st->magic_samples[channel_index]) {
- omagic = speex_resampler_magic(st, channel_index, &y, ochunk);
- ochunk -= omagic;
- olen -= omagic;
- }
- if (! st->magic_samples[channel_index]) {
- if (in) {
- for(j=0;j<ichunk;++j)
-#ifdef FIXED_POINT
- x[j+st->filt_len-1]=WORD2INT(in[j*istride_save]);
-#else
- x[j+st->filt_len-1]=in[j*istride_save];
-#endif
- } else {
- for(j=0;j<ichunk;++j)
- x[j+st->filt_len-1]=0;
- }
-
- speex_resampler_process_native(st, channel_index, &ichunk, y, &ochunk);
- } else {
- ichunk = 0;
- ochunk = 0;
- }
-
- for (j=0;j<ochunk+omagic;++j)
-#ifdef FIXED_POINT
- out[j*ostride_save] = ystack[j];
-#else
- out[j*ostride_save] = WORD2INT(ystack[j]);
-#endif
-
- ilen -= ichunk;
- olen -= ochunk;
- out += (ochunk+omagic) * ostride_save;
- if (in)
- in += ichunk * istride_save;
- }
- st->out_stride = ostride_save;
- *in_len -= ilen;
- *out_len -= olen;
-
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
-{
- spx_uint32_t i;
- int istride_save, ostride_save;
- spx_uint32_t bak_len = *out_len;
- istride_save = st->in_stride;
- ostride_save = st->out_stride;
- st->in_stride = st->out_stride = st->nb_channels;
- for (i=0;i<st->nb_channels;i++)
- {
- *out_len = bak_len;
- if (in != NULL)
- speex_resampler_process_float(st, i, in+i, in_len, out+i, out_len);
- else
- speex_resampler_process_float(st, i, NULL, in_len, out+i, out_len);
- }
- st->in_stride = istride_save;
- st->out_stride = ostride_save;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
-{
- spx_uint32_t i;
- int istride_save, ostride_save;
- spx_uint32_t bak_len = *out_len;
- istride_save = st->in_stride;
- ostride_save = st->out_stride;
- st->in_stride = st->out_stride = st->nb_channels;
- for (i=0;i<st->nb_channels;i++)
- {
- *out_len = bak_len;
- if (in != NULL)
- speex_resampler_process_int(st, i, in+i, in_len, out+i, out_len);
- else
- speex_resampler_process_int(st, i, NULL, in_len, out+i, out_len);
- }
- st->in_stride = istride_save;
- st->out_stride = ostride_save;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate)
-{
- return speex_resampler_set_rate_frac(st, in_rate, out_rate, in_rate, out_rate);
-}
-
-EXPORT void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_rate, spx_uint32_t *out_rate)
-{
- *in_rate = st->in_rate;
- *out_rate = st->out_rate;
-}
-
-EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate)
-{
- spx_uint32_t fact;
- spx_uint32_t old_den;
- spx_uint32_t i;
- if (st->in_rate == in_rate && st->out_rate == out_rate && st->num_rate == ratio_num && st->den_rate == ratio_den)
- return RESAMPLER_ERR_SUCCESS;
-
- old_den = st->den_rate;
- st->in_rate = in_rate;
- st->out_rate = out_rate;
- st->num_rate = ratio_num;
- st->den_rate = ratio_den;
- /* FIXME: This is terribly inefficient, but who cares (at least for now)? */
- for (fact=2;fact<=IMIN(st->num_rate, st->den_rate);fact++)
- {
- while ((st->num_rate % fact == 0) && (st->den_rate % fact == 0))
- {
- st->num_rate /= fact;
- st->den_rate /= fact;
- }
- }
-
- if (old_den > 0)
- {
- for (i=0;i<st->nb_channels;i++)
- {
- st->samp_frac_num[i]=st->samp_frac_num[i]*st->den_rate/old_den;
- /* Safety net */
- if (st->samp_frac_num[i] >= st->den_rate)
- st->samp_frac_num[i] = st->den_rate-1;
- }
- }
-
- if (st->initialised)
- update_filter(st);
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT void speex_resampler_get_ratio(SpeexResamplerState *st, spx_uint32_t *ratio_num, spx_uint32_t *ratio_den)
-{
- *ratio_num = st->num_rate;
- *ratio_den = st->den_rate;
-}
-
-EXPORT int speex_resampler_set_quality(SpeexResamplerState *st, int quality)
-{
- if (quality > 10 || quality < 0)
- return RESAMPLER_ERR_INVALID_ARG;
- if (st->quality == quality)
- return RESAMPLER_ERR_SUCCESS;
- st->quality = quality;
- if (st->initialised)
- update_filter(st);
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT void speex_resampler_get_quality(SpeexResamplerState *st, int *quality)
-{
- *quality = st->quality;
-}
-
-EXPORT void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride)
-{
- st->in_stride = stride;
-}
-
-EXPORT void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride)
-{
- *stride = st->in_stride;
-}
-
-EXPORT void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride)
-{
- st->out_stride = stride;
-}
-
-EXPORT void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride)
-{
- *stride = st->out_stride;
-}
-
-EXPORT int speex_resampler_get_input_latency(SpeexResamplerState *st)
-{
- return st->filt_len / 2;
-}
-
-EXPORT int speex_resampler_get_output_latency(SpeexResamplerState *st)
-{
- return ((st->filt_len / 2) * st->den_rate + (st->num_rate >> 1)) / st->num_rate;
-}
-
-EXPORT int speex_resampler_skip_zeros(SpeexResamplerState *st)
-{
- spx_uint32_t i;
- for (i=0;i<st->nb_channels;i++)
- st->last_sample[i] = st->filt_len/2;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int speex_resampler_reset_mem(SpeexResamplerState *st)
-{
- spx_uint32_t i;
- for (i=0;i<st->nb_channels*(st->filt_len-1);i++)
- st->mem[i] = 0;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT const char *speex_resampler_strerror(int err)
-{
- switch (err)
- {
- case RESAMPLER_ERR_SUCCESS:
- return "Success.";
- case RESAMPLER_ERR_ALLOC_FAILED:
- return "Memory allocation failed.";
- case RESAMPLER_ERR_BAD_STATE:
- return "Bad resampler state.";
- case RESAMPLER_ERR_INVALID_ARG:
- return "Invalid argument.";
- case RESAMPLER_ERR_PTR_OVERLAP:
- return "Input and output buffers overlap.";
- default:
- return "Unknown error. Bad error code or strange version mismatch.";
- }
-}
diff --git a/drivers/speex/resample_sse.h b/drivers/speex/resample_sse.h
deleted file mode 100644
index 4bd35a2d0..000000000
--- a/drivers/speex/resample_sse.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright (C) 2007-2008 Jean-Marc Valin
- * Copyright (C) 2008 Thorvald Natvig
- */
-/**
- @file resample_sse.h
- @brief Resampler functions (SSE version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <xmmintrin.h>
-
-#define OVERRIDE_INNER_PRODUCT_SINGLE
-static inline float inner_product_single(const float *a, const float *b, unsigned int len)
-{
- int i;
- float ret;
- __m128 sum = _mm_setzero_ps();
- for (i=0;i<len;i+=8)
- {
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i)));
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4)));
- }
- sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
- sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
- _mm_store_ss(&ret, sum);
- return ret;
-}
-
-#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
-static inline float interpolate_product_single(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
- int i;
- float ret;
- __m128 sum = _mm_setzero_ps();
- __m128 f = _mm_loadu_ps(frac);
- for(i=0;i<len;i+=2)
- {
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample)));
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample)));
- }
- sum = _mm_mul_ps(f, sum);
- sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
- sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
- _mm_store_ss(&ret, sum);
- return ret;
-}
-
-#ifdef _USE_SSE2
-#include <emmintrin.h>
-#define OVERRIDE_INNER_PRODUCT_DOUBLE
-
-static inline double inner_product_double(const float *a, const float *b, unsigned int len)
-{
- int i;
- double ret;
- __m128d sum = _mm_setzero_pd();
- __m128 t;
- for (i=0;i<len;i+=8)
- {
- t = _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i));
- sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
- sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
-
- t = _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4));
- sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
- sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
- }
- sum = _mm_add_sd(sum, (__m128d) _mm_movehl_ps((__m128) sum, (__m128) sum));
- _mm_store_sd(&ret, sum);
- return ret;
-}
-
-#define OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
-static inline double interpolate_product_double(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
- int i;
- double ret;
- __m128d sum;
- __m128d sum1 = _mm_setzero_pd();
- __m128d sum2 = _mm_setzero_pd();
- __m128 f = _mm_loadu_ps(frac);
- __m128d f1 = _mm_cvtps_pd(f);
- __m128d f2 = _mm_cvtps_pd(_mm_movehl_ps(f,f));
- __m128 t;
- for(i=0;i<len;i+=2)
- {
- t = _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample));
- sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
- sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
-
- t = _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample));
- sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
- sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
- }
- sum1 = _mm_mul_pd(f1, sum1);
- sum2 = _mm_mul_pd(f2, sum2);
- sum = _mm_add_pd(sum1, sum2);
- sum = _mm_add_sd(sum, (__m128d) _mm_movehl_ps((__m128) sum, (__m128) sum));
- _mm_store_sd(&ret, sum);
- return ret;
-}
-
-#endif
diff --git a/drivers/speex/sb_celp.c b/drivers/speex/sb_celp.c
deleted file mode 100644
index fe8bfca72..000000000
--- a/drivers/speex/sb_celp.c
+++ /dev/null
@@ -1,1488 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
- File: sb_celp.c
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include <math.h>
-#include "sb_celp.h"
-#include "filters.h"
-#include "lpc.h"
-#include "lsp.h"
-#include "stack_alloc.h"
-#include "cb_search.h"
-#include "quant_lsp.h"
-#include "vq.h"
-#include "ltp.h"
-#include "arch.h"
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Default size for the encoder and decoder stack (can be changed at compile time).
- This does not apply when using variable-size arrays or alloca. */
-#ifndef SB_ENC_STACK
-#define SB_ENC_STACK (10000*sizeof(spx_sig_t))
-#endif
-
-#ifndef SB_DEC_STACK
-#define SB_DEC_STACK (6000*sizeof(spx_sig_t))
-#endif
-
-
-#ifdef DISABLE_WIDEBAND
-void *sb_encoder_init(const SpeexMode *m)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
- return NULL;
-}
-void sb_encoder_destroy(void *state)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
-}
-int sb_encode(void *state, void *vin, SpeexBits *bits)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
- return -2;
-}
-void *sb_decoder_init(const SpeexMode *m)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
- return NULL;
-}
-void sb_decoder_destroy(void *state)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
-}
-int sb_decode(void *state, SpeexBits *bits, void *vout)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
- return -2;
-}
-int sb_encoder_ctl(void *state, int request, void *ptr)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
- return -2;
-}
-int sb_decoder_ctl(void *state, int request, void *ptr)
-{
- speex_fatal("Wideband and Ultra-wideband are disabled");
- return -2;
-}
-#else
-
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif
-
-#define sqr(x) ((x)*(x))
-
-#define SUBMODE(x) st->submodes[st->submodeID]->x
-
-#ifdef FIXED_POINT
-static const spx_word16_t gc_quant_bound[16] = {125, 164, 215, 282, 370, 484, 635, 832, 1090, 1428, 1871, 2452, 3213, 4210, 5516, 7228};
-static const spx_word16_t fold_quant_bound[32] = {
- 39, 44, 50, 57, 64, 73, 83, 94,
- 106, 120, 136, 154, 175, 198, 225, 255,
- 288, 327, 370, 420, 476, 539, 611, 692,
- 784, 889, 1007, 1141, 1293, 1465, 1660, 1881};
-#define LSP_MARGIN 410
-#define LSP_DELTA1 6553
-#define LSP_DELTA2 1638
-
-#else
-
-static const spx_word16_t gc_quant_bound[16] = {
- 0.97979, 1.28384, 1.68223, 2.20426, 2.88829, 3.78458, 4.95900, 6.49787,
- 8.51428, 11.15642, 14.61846, 19.15484, 25.09895, 32.88761, 43.09325, 56.46588};
-static const spx_word16_t fold_quant_bound[32] = {
- 0.30498, 0.34559, 0.39161, 0.44375, 0.50283, 0.56979, 0.64565, 0.73162,
- 0.82903, 0.93942, 1.06450, 1.20624, 1.36685, 1.54884, 1.75506, 1.98875,
- 2.25355, 2.55360, 2.89361, 3.27889, 3.71547, 4.21018, 4.77076, 5.40598,
- 6.12577, 6.94141, 7.86565, 8.91295, 10.09969, 11.44445, 12.96826, 14.69497};
-
-#define LSP_MARGIN .05
-#define LSP_DELTA1 .2
-#define LSP_DELTA2 .05
-
-#endif
-
-#define QMF_ORDER 64
-
-#ifdef FIXED_POINT
-static const spx_word16_t h0[64] = {2, -7, -7, 18, 15, -39, -25, 75, 35, -130, -41, 212, 38, -327, -17, 483, -32, -689, 124, 956, -283, -1307, 543, 1780, -973, -2467, 1733, 3633, -3339, -6409, 9059, 30153, 30153, 9059, -6409, -3339, 3633, 1733, -2467, -973, 1780, 543, -1307, -283, 956, 124, -689, -32, 483, -17, -327, 38, 212, -41, -130, 35, 75, -25, -39, 15, 18, -7, -7, 2};
-
-#else
-static const float h0[64] = {
- 3.596189e-05f, -0.0001123515f,
- -0.0001104587f, 0.0002790277f,
- 0.0002298438f, -0.0005953563f,
- -0.0003823631f, 0.00113826f,
- 0.0005308539f, -0.001986177f,
- -0.0006243724f, 0.003235877f,
- 0.0005743159f, -0.004989147f,
- -0.0002584767f, 0.007367171f,
- -0.0004857935f, -0.01050689f,
- 0.001894714f, 0.01459396f,
- -0.004313674f, -0.01994365f,
- 0.00828756f, 0.02716055f,
- -0.01485397f, -0.03764973f,
- 0.026447f, 0.05543245f,
- -0.05095487f, -0.09779096f,
- 0.1382363f, 0.4600981f,
- 0.4600981f, 0.1382363f,
- -0.09779096f, -0.05095487f,
- 0.05543245f, 0.026447f,
- -0.03764973f, -0.01485397f,
- 0.02716055f, 0.00828756f,
- -0.01994365f, -0.004313674f,
- 0.01459396f, 0.001894714f,
- -0.01050689f, -0.0004857935f,
- 0.007367171f, -0.0002584767f,
- -0.004989147f, 0.0005743159f,
- 0.003235877f, -0.0006243724f,
- -0.001986177f, 0.0005308539f,
- 0.00113826f, -0.0003823631f,
- -0.0005953563f, 0.0002298438f,
- 0.0002790277f, -0.0001104587f,
- -0.0001123515f, 3.596189e-05f
-};
-
-#endif
-
-extern const spx_word16_t lag_window[];
-extern const spx_word16_t lpc_window[];
-
-
-void *sb_encoder_init(const SpeexMode *m)
-{
- int i;
- spx_int32_t tmp;
- SBEncState *st;
- const SpeexSBMode *mode;
-
- st = (SBEncState*)speex_alloc(sizeof(SBEncState));
- if (!st)
- return NULL;
- st->mode = m;
- mode = (const SpeexSBMode*)m->mode;
-
-
- st->st_low = speex_encoder_init(mode->nb_mode);
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
- st->stack = NULL;
-#else
- /*st->stack = (char*)speex_alloc_scratch(SB_ENC_STACK);*/
- speex_encoder_ctl(st->st_low, SPEEX_GET_STACK, &st->stack);
-#endif
-
- st->full_frame_size = 2*mode->frameSize;
- st->frame_size = mode->frameSize;
- st->subframeSize = mode->subframeSize;
- st->nbSubframes = mode->frameSize/mode->subframeSize;
- st->windowSize = st->frame_size+st->subframeSize;
- st->lpcSize=mode->lpcSize;
-
- st->encode_submode = 1;
- st->submodes=mode->submodes;
- st->submodeSelect = st->submodeID=mode->defaultSubmode;
-
- tmp=9;
- speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &tmp);
- tmp=1;
- speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp);
-
- st->lpc_floor = mode->lpc_floor;
- st->gamma1=mode->gamma1;
- st->gamma2=mode->gamma2;
- st->first=1;
-
- st->high=(spx_word16_t*)speex_alloc((st->windowSize-st->frame_size)*sizeof(spx_word16_t));
-
- st->h0_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
- st->h1_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
-
- st->window= lpc_window;
-
- st->lagWindow = lag_window;
-
- st->old_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
- st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
- st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
- st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
- st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t));
- st->innov_rms_save = NULL;
-
- st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
- st->mem_sp2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
- st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-
- for (i=0;i<st->lpcSize;i++)
- st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
-
-#ifndef DISABLE_VBR
- st->vbr_quality = 8;
- st->vbr_enabled = 0;
- st->vbr_max = 0;
- st->vbr_max_high = 20000; /* We just need a big value here */
- st->vad_enabled = 0;
- st->abr_enabled = 0;
- st->relative_quality=0;
-#endif /* #ifndef DISABLE_VBR */
-
- st->complexity=2;
- speex_encoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate);
- st->sampling_rate*=2;
-#ifdef ENABLE_VALGRIND
- VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
-#endif
- return st;
-}
-
-void sb_encoder_destroy(void *state)
-{
- SBEncState *st=(SBEncState*)state;
-
- speex_encoder_destroy(st->st_low);
-#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
- /*speex_free_scratch(st->stack);*/
-#endif
-
- speex_free(st->high);
-
- speex_free(st->h0_mem);
- speex_free(st->h1_mem);
-
- speex_free(st->old_lsp);
- speex_free(st->old_qlsp);
- speex_free(st->interp_qlpc);
- speex_free(st->pi_gain);
- speex_free(st->exc_rms);
-
- speex_free(st->mem_sp);
- speex_free(st->mem_sp2);
- speex_free(st->mem_sw);
-
-
- speex_free(st);
-}
-
-
-int sb_encode(void *state, void *vin, SpeexBits *bits)
-{
- SBEncState *st;
- int i, roots, sub;
- char *stack;
- VARDECL(spx_mem_t *mem);
- VARDECL(spx_sig_t *innov);
- VARDECL(spx_word16_t *target);
- VARDECL(spx_word16_t *syn_resp);
- VARDECL(spx_word32_t *low_pi_gain);
- spx_word16_t *low;
- spx_word16_t *high;
- VARDECL(spx_word16_t *low_exc_rms);
- VARDECL(spx_word16_t *low_innov_rms);
- const SpeexSBMode *mode;
- spx_int32_t dtx;
- spx_word16_t *in = (spx_word16_t*)vin;
- spx_word16_t e_low=0, e_high=0;
- VARDECL(spx_coef_t *lpc);
- VARDECL(spx_coef_t *interp_lpc);
- VARDECL(spx_coef_t *bw_lpc1);
- VARDECL(spx_coef_t *bw_lpc2);
- VARDECL(spx_lsp_t *lsp);
- VARDECL(spx_lsp_t *qlsp);
- VARDECL(spx_lsp_t *interp_lsp);
- VARDECL(spx_lsp_t *interp_qlsp);
-
- st = (SBEncState*)state;
- stack=st->stack;
- mode = (const SpeexSBMode*)(st->mode->mode);
- low = in;
- high = in+st->frame_size;
-
- /* High-band buffering / sync with low band */
- /* Compute the two sub-bands by filtering with QMF h0*/
- qmf_decomp(in, h0, low, high, st->full_frame_size, QMF_ORDER, st->h0_mem, stack);
-
-#ifndef DISABLE_VBR
- if (st->vbr_enabled || st->vad_enabled)
- {
- /* Need to compute things here before the signal is trashed by the encoder */
- /*FIXME: Are the two signals (low, high) in sync? */
- e_low = compute_rms16(low, st->frame_size);
- e_high = compute_rms16(high, st->frame_size);
- }
-#endif /* #ifndef DISABLE_VBR */
-
- ALLOC(low_innov_rms, st->nbSubframes, spx_word16_t);
- speex_encoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, low_innov_rms);
- /* Encode the narrowband part*/
- speex_encode_native(st->st_low, low, bits);
-
- high = high - (st->windowSize-st->frame_size);
- SPEEX_COPY(high, st->high, st->windowSize-st->frame_size);
- SPEEX_COPY(st->high, &high[st->frame_size], st->windowSize-st->frame_size);
-
-
- ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t);
- ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t);
- speex_encoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain);
- speex_encoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms);
-
- speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, &dtx);
-
- if (dtx==0)
- dtx=1;
- else
- dtx=0;
-
- ALLOC(lpc, st->lpcSize, spx_coef_t);
- ALLOC(interp_lpc, st->lpcSize, spx_coef_t);
- ALLOC(bw_lpc1, st->lpcSize, spx_coef_t);
- ALLOC(bw_lpc2, st->lpcSize, spx_coef_t);
-
- ALLOC(lsp, st->lpcSize, spx_lsp_t);
- ALLOC(qlsp, st->lpcSize, spx_lsp_t);
- ALLOC(interp_lsp, st->lpcSize, spx_lsp_t);
- ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
-
- {
- VARDECL(spx_word16_t *autocorr);
- VARDECL(spx_word16_t *w_sig);
- ALLOC(autocorr, st->lpcSize+1, spx_word16_t);
- ALLOC(w_sig, st->windowSize, spx_word16_t);
- /* Window for analysis */
- /* FIXME: This is a kludge */
- if (st->subframeSize==80)
- {
- for (i=0;i<st->windowSize;i++)
- w_sig[i] = EXTRACT16(SHR32(MULT16_16(high[i],st->window[i>>1]),SIG_SHIFT));
- } else {
- for (i=0;i<st->windowSize;i++)
- w_sig[i] = EXTRACT16(SHR32(MULT16_16(high[i],st->window[i]),SIG_SHIFT));
- }
- /* Compute auto-correlation */
- _spx_autocorr(w_sig, autocorr, st->lpcSize+1, st->windowSize);
- autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
-
- /* Lag windowing: equivalent to filtering in the power-spectrum domain */
- for (i=0;i<st->lpcSize+1;i++)
- autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]);
-
- /* Levinson-Durbin */
- _spx_lpc(lpc, autocorr, st->lpcSize);
- }
-
- /* LPC to LSPs (x-domain) transform */
- roots=lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA1, stack);
- if (roots!=st->lpcSize)
- {
- roots = lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA2, stack);
- if (roots!=st->lpcSize) {
- /*If we can't find all LSP's, do some damage control and use a flat filter*/
- for (i=0;i<st->lpcSize;i++)
- {
- lsp[i]=st->old_lsp[i];
- }
- }
- }
-
-#ifndef DISABLE_VBR
- /* VBR code */
- if ((st->vbr_enabled || st->vad_enabled) && !dtx)
- {
- float ratio;
- if (st->abr_enabled)
- {
- float qual_change=0;
- if (st->abr_drift2 * st->abr_drift > 0)
- {
- /* Only adapt if long-term and short-term drift are the same sign */
- qual_change = -.00001*st->abr_drift/(1+st->abr_count);
- if (qual_change>.1)
- qual_change=.1;
- if (qual_change<-.1)
- qual_change=-.1;
- }
- st->vbr_quality += qual_change;
- if (st->vbr_quality>10)
- st->vbr_quality=10;
- if (st->vbr_quality<0)
- st->vbr_quality=0;
- }
-
-
- ratio = 2*log((1.f+e_high)/(1.f+e_low));
-
- speex_encoder_ctl(st->st_low, SPEEX_GET_RELATIVE_QUALITY, &st->relative_quality);
- if (ratio<-4)
- ratio=-4;
- if (ratio>2)
- ratio=2;
- /*if (ratio>-2)*/
- if (st->vbr_enabled)
- {
- spx_int32_t modeid;
- modeid = mode->nb_modes-1;
- st->relative_quality+=1.0*(ratio+2);
- if (st->relative_quality<-1)
- st->relative_quality=-1;
- while (modeid)
- {
- int v1;
- float thresh;
- v1=(int)floor(st->vbr_quality);
- if (v1==10)
- thresh = mode->vbr_thresh[modeid][v1];
- else
- thresh = (st->vbr_quality-v1) * mode->vbr_thresh[modeid][v1+1] +
- (1+v1-st->vbr_quality) * mode->vbr_thresh[modeid][v1];
- if (st->relative_quality >= thresh && st->sampling_rate*st->submodes[modeid]->bits_per_frame/st->full_frame_size <= st->vbr_max_high)
- break;
- modeid--;
- }
- speex_encoder_ctl(state, SPEEX_SET_HIGH_MODE, &modeid);
- if (st->abr_enabled)
- {
- spx_int32_t bitrate;
- speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate);
- st->abr_drift+=(bitrate-st->abr_enabled);
- st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled);
- st->abr_count += 1.0;
- }
-
- } else {
- /* VAD only */
- int modeid;
- if (st->relative_quality<2.0)
- modeid=1;
- else
- modeid=st->submodeSelect;
- /*speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);*/
- st->submodeID=modeid;
-
- }
- /*fprintf (stderr, "%f %f\n", ratio, low_qual);*/
- }
-#endif /* #ifndef DISABLE_VBR */
-
- if (st->encode_submode)
- {
- speex_bits_pack(bits, 1, 1);
- if (dtx)
- speex_bits_pack(bits, 0, SB_SUBMODE_BITS);
- else
- speex_bits_pack(bits, st->submodeID, SB_SUBMODE_BITS);
- }
-
- /* If null mode (no transmission), just set a couple things to zero*/
- if (dtx || st->submodes[st->submodeID] == NULL)
- {
- for (i=0;i<st->frame_size;i++)
- high[i]=VERY_SMALL;
-
- for (i=0;i<st->lpcSize;i++)
- st->mem_sw[i]=0;
- st->first=1;
-
- /* Final signal synthesis from excitation */
- iir_mem16(high, st->interp_qlpc, high, st->frame_size, st->lpcSize, st->mem_sp, stack);
-
- if (dtx)
- return 0;
- else
- return 1;
- }
-
-
- /* LSP quantization */
- SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits);
-
- if (st->first)
- {
- for (i=0;i<st->lpcSize;i++)
- st->old_lsp[i] = lsp[i];
- for (i=0;i<st->lpcSize;i++)
- st->old_qlsp[i] = qlsp[i];
- }
-
- ALLOC(mem, st->lpcSize, spx_mem_t);
- ALLOC(syn_resp, st->subframeSize, spx_word16_t);
- ALLOC(innov, st->subframeSize, spx_sig_t);
- ALLOC(target, st->subframeSize, spx_word16_t);
-
- for (sub=0;sub<st->nbSubframes;sub++)
- {
- VARDECL(spx_word16_t *exc);
- VARDECL(spx_word16_t *res);
- VARDECL(spx_word16_t *sw);
- spx_word16_t *sp;
- spx_word16_t filter_ratio; /*Q7*/
- int offset;
- spx_word32_t rl, rh; /*Q13*/
- spx_word16_t eh=0;
-
- offset = st->subframeSize*sub;
- sp=high+offset;
- ALLOC(exc, st->subframeSize, spx_word16_t);
- ALLOC(res, st->subframeSize, spx_word16_t);
- ALLOC(sw, st->subframeSize, spx_word16_t);
-
- /* LSP interpolation (quantized and unquantized) */
- lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes);
- lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
-
- lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN);
- lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
-
- lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack);
- lsp_to_lpc(interp_qlsp, st->interp_qlpc, st->lpcSize, stack);
-
- bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize);
- bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
-
- /* Compute mid-band (4000 Hz for wideband) response of low-band and high-band
- filters */
- st->pi_gain[sub]=LPC_SCALING;
- rh = LPC_SCALING;
- for (i=0;i<st->lpcSize;i+=2)
- {
- rh += st->interp_qlpc[i+1] - st->interp_qlpc[i];
- st->pi_gain[sub] += st->interp_qlpc[i] + st->interp_qlpc[i+1];
- }
-
- rl = low_pi_gain[sub];
-#ifdef FIXED_POINT
- filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767));
-#else
- filter_ratio=(rl+.01)/(rh+.01);
-#endif
-
- /* Compute "real excitation" */
- fir_mem16(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp2, stack);
- /* Compute energy of low-band and high-band excitation */
-
- eh = compute_rms16(exc, st->subframeSize);
-
- if (!SUBMODE(innovation_quant)) {/* 1 for spectral folding excitation, 0 for stochastic */
- spx_word32_t g; /*Q7*/
- spx_word16_t el; /*Q0*/
- el = low_innov_rms[sub];
-
- /* Gain to use if we want to use the low-band excitation for high-band */
- g=PDIV32(MULT16_16(filter_ratio,eh),EXTEND32(ADD16(1,el)));
-
-#if 0
- {
- char *tmp_stack=stack;
- float *tmp_sig;
- float g2;
- ALLOC(tmp_sig, st->subframeSize, spx_sig_t);
- for (i=0;i<st->lpcSize;i++)
- mem[i]=st->mem_sp[i];
- iir_mem2(st->low_innov+offset, st->interp_qlpc, tmp_sig, st->subframeSize, st->lpcSize, mem);
- g2 = compute_rms(sp, st->subframeSize)/(.01+compute_rms(tmp_sig, st->subframeSize));
- /*fprintf (stderr, "gains: %f %f\n", g, g2);*/
- g = g2;
- stack = tmp_stack;
- }
-#endif
-
- /*print_vec(&g, 1, "gain factor");*/
- /* Gain quantization */
- {
- int quant = scal_quant(g, fold_quant_bound, 32);
- /*speex_warning_int("tata", quant);*/
- if (quant<0)
- quant=0;
- if (quant>31)
- quant=31;
- speex_bits_pack(bits, quant, 5);
- }
- if (st->innov_rms_save)
- {
- st->innov_rms_save[sub] = eh;
- }
- st->exc_rms[sub] = eh;
- } else {
- spx_word16_t gc; /*Q7*/
- spx_word32_t scale; /*Q14*/
- spx_word16_t el; /*Q0*/
- el = low_exc_rms[sub]; /*Q0*/
-
- gc = PDIV32_16(MULT16_16(filter_ratio,1+eh),1+el);
-
- /* This is a kludge that cleans up a historical bug */
- if (st->subframeSize==80)
- gc = MULT16_16_P15(QCONST16(0.70711f,15),gc);
- /*printf ("%f %f %f %f\n", el, eh, filter_ratio, gc);*/
- {
- int qgc = scal_quant(gc, gc_quant_bound, 16);
- speex_bits_pack(bits, qgc, 4);
- gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]);
- }
- if (st->subframeSize==80)
- gc = MULT16_16_P14(QCONST16(1.4142f,14), gc);
-
- scale = SHL32(MULT16_16(PDIV32_16(SHL32(EXTEND32(gc),SIG_SHIFT-6),filter_ratio),(1+el)),6);
-
- compute_impulse_response(st->interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);
-
-
- /* Reset excitation */
- for (i=0;i<st->subframeSize;i++)
- res[i]=VERY_SMALL;
-
- /* Compute zero response (ringing) of A(z/g1) / ( A(z/g2) * Aq(z) ) */
- for (i=0;i<st->lpcSize;i++)
- mem[i]=st->mem_sp[i];
- iir_mem16(res, st->interp_qlpc, res, st->subframeSize, st->lpcSize, mem, stack);
-
- for (i=0;i<st->lpcSize;i++)
- mem[i]=st->mem_sw[i];
- filter_mem16(res, bw_lpc1, bw_lpc2, res, st->subframeSize, st->lpcSize, mem, stack);
-
- /* Compute weighted signal */
- for (i=0;i<st->lpcSize;i++)
- mem[i]=st->mem_sw[i];
- filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, mem, stack);
-
- /* Compute target signal */
- for (i=0;i<st->subframeSize;i++)
- target[i]=SUB16(sw[i],res[i]);
-
- signal_div(target, target, scale, st->subframeSize);
-
- /* Reset excitation */
- SPEEX_MEMSET(innov, 0, st->subframeSize);
-
- /*print_vec(target, st->subframeSize, "\ntarget");*/
- SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2,
- SUBMODE(innovation_params), st->lpcSize, st->subframeSize,
- innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
- /*print_vec(target, st->subframeSize, "after");*/
-
- signal_mul(innov, innov, scale, st->subframeSize);
-
- if (SUBMODE(double_codebook)) {
- char *tmp_stack=stack;
- VARDECL(spx_sig_t *innov2);
- ALLOC(innov2, st->subframeSize, spx_sig_t);
- SPEEX_MEMSET(innov2, 0, st->subframeSize);
- for (i=0;i<st->subframeSize;i++)
- target[i]=MULT16_16_P13(QCONST16(2.5f,13), target[i]);
-
- SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2,
- SUBMODE(innovation_params), st->lpcSize, st->subframeSize,
- innov2, syn_resp, bits, stack, st->complexity, 0);
- signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize);
-
- for (i=0;i<st->subframeSize;i++)
- innov[i] = ADD32(innov[i],innov2[i]);
- stack = tmp_stack;
- }
- for (i=0;i<st->subframeSize;i++)
- exc[i] = PSHR32(innov[i],SIG_SHIFT);
-
- if (st->innov_rms_save)
- {
- st->innov_rms_save[sub] = MULT16_16_Q15(QCONST16(.70711f, 15), compute_rms(innov, st->subframeSize));
- }
- st->exc_rms[sub] = compute_rms16(exc, st->subframeSize);
-
-
- }
-
-
- /*Keep the previous memory*/
- for (i=0;i<st->lpcSize;i++)
- mem[i]=st->mem_sp[i];
- /* Final signal synthesis from excitation */
- iir_mem16(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp, stack);
-
- /* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
- filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack);
- }
-
- for (i=0;i<st->lpcSize;i++)
- st->old_lsp[i] = lsp[i];
- for (i=0;i<st->lpcSize;i++)
- st->old_qlsp[i] = qlsp[i];
-
- st->first=0;
-
- return 1;
-}
-
-
-
-
-
-void *sb_decoder_init(const SpeexMode *m)
-{
- spx_int32_t tmp;
- SBDecState *st;
- const SpeexSBMode *mode;
- st = (SBDecState*)speex_alloc(sizeof(SBDecState));
- if (!st)
- return NULL;
- st->mode = m;
- mode=(const SpeexSBMode*)m->mode;
- st->encode_submode = 1;
-
- st->st_low = speex_decoder_init(mode->nb_mode);
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
- st->stack = NULL;
-#else
- /*st->stack = (char*)speex_alloc_scratch(SB_DEC_STACK);*/
- speex_decoder_ctl(st->st_low, SPEEX_GET_STACK, &st->stack);
-#endif
-
- st->full_frame_size = 2*mode->frameSize;
- st->frame_size = mode->frameSize;
- st->subframeSize = mode->subframeSize;
- st->nbSubframes = mode->frameSize/mode->subframeSize;
- st->lpcSize=mode->lpcSize;
- speex_decoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate);
- st->sampling_rate*=2;
- tmp=1;
- speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp);
-
- st->submodes=mode->submodes;
- st->submodeID=mode->defaultSubmode;
-
- st->first=1;
-
- st->g0_mem = (spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
- st->g1_mem = (spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
-
- st->excBuf = (spx_word16_t*)speex_alloc((st->subframeSize)*sizeof(spx_word16_t));
-
- st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
- st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
-
- st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
- st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t));
- st->mem_sp = (spx_mem_t*)speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t));
-
- st->innov_save = NULL;
-
-
- st->lpc_enh_enabled=0;
- st->seed = 1000;
-
-#ifdef ENABLE_VALGRIND
- VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
-#endif
- return st;
-}
-
-void sb_decoder_destroy(void *state)
-{
- SBDecState *st;
- st = (SBDecState*)state;
- speex_decoder_destroy(st->st_low);
-#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
- /*speex_free_scratch(st->stack);*/
-#endif
-
- speex_free(st->g0_mem);
- speex_free(st->g1_mem);
- speex_free(st->excBuf);
- speex_free(st->old_qlsp);
- speex_free(st->interp_qlpc);
- speex_free(st->pi_gain);
- speex_free(st->exc_rms);
- speex_free(st->mem_sp);
-
- speex_free(state);
-}
-
-static void sb_decode_lost(SBDecState *st, spx_word16_t *out, int dtx, char *stack)
-{
- int i;
- int saved_modeid=0;
-
- if (dtx)
- {
- saved_modeid=st->submodeID;
- st->submodeID=1;
- } else {
- bw_lpc(QCONST16(0.99f,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize);
- }
-
- st->first=1;
-
-
- /* Final signal synthesis from excitation */
- if (!dtx)
- {
- st->last_ener = MULT16_16_Q15(QCONST16(.9f,15),st->last_ener);
- }
- for (i=0;i<st->frame_size;i++)
- out[i+st->frame_size] = speex_rand(st->last_ener, &st->seed);
-
- iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize,
- st->mem_sp, stack);
-
-
- /* Reconstruct the original */
- qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
- if (dtx)
- {
- st->submodeID=saved_modeid;
- }
-
- return;
-}
-
-int sb_decode(void *state, SpeexBits *bits, void *vout)
-{
- int i, sub;
- SBDecState *st;
- int wideband;
- int ret;
- char *stack;
- VARDECL(spx_word32_t *low_pi_gain);
- VARDECL(spx_word16_t *low_exc_rms);
- VARDECL(spx_coef_t *ak);
- VARDECL(spx_lsp_t *qlsp);
- VARDECL(spx_lsp_t *interp_qlsp);
- spx_int32_t dtx;
- const SpeexSBMode *mode;
- spx_word16_t *out = (spx_word16_t*)vout;
- spx_word16_t *low_innov_alias;
- spx_word32_t exc_ener_sum = 0;
-
- st = (SBDecState*)state;
- stack=st->stack;
- mode = (const SpeexSBMode*)(st->mode->mode);
-
- low_innov_alias = out+st->frame_size;
- speex_decoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, low_innov_alias);
- /* Decode the low-band */
- ret = speex_decode_native(st->st_low, bits, out);
-
- speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, &dtx);
-
- /* If error decoding the narrowband part, propagate error */
- if (ret!=0)
- {
- return ret;
- }
-
- if (!bits)
- {
- sb_decode_lost(st, out, dtx, stack);
- return 0;
- }
-
- if (st->encode_submode)
- {
-
- /*Check "wideband bit"*/
- if (speex_bits_remaining(bits)>0)
- wideband = speex_bits_peek(bits);
- else
- wideband = 0;
- if (wideband)
- {
- /*Regular wideband frame, read the submode*/
- wideband = speex_bits_unpack_unsigned(bits, 1);
- st->submodeID = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
- } else
- {
- /*Was a narrowband frame, set "null submode"*/
- st->submodeID = 0;
- }
- if (st->submodeID != 0 && st->submodes[st->submodeID] == NULL)
- {
- speex_notify("Invalid mode encountered. The stream is corrupted.");
- return -2;
- }
- }
-
- /* If null mode (no transmission), just set a couple things to zero*/
- if (st->submodes[st->submodeID] == NULL)
- {
- if (dtx)
- {
- sb_decode_lost(st, out, 1, stack);
- return 0;
- }
-
- for (i=0;i<st->frame_size;i++)
- out[st->frame_size+i]=VERY_SMALL;
-
- st->first=1;
-
- /* Final signal synthesis from excitation */
- iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize, st->mem_sp, stack);
-
- qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
-
- return 0;
-
- }
-
- ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t);
- ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t);
- speex_decoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain);
- speex_decoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms);
-
- ALLOC(qlsp, st->lpcSize, spx_lsp_t);
- ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
- SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits);
-
- if (st->first)
- {
- for (i=0;i<st->lpcSize;i++)
- st->old_qlsp[i] = qlsp[i];
- }
-
- ALLOC(ak, st->lpcSize, spx_coef_t);
-
- for (sub=0;sub<st->nbSubframes;sub++)
- {
- VARDECL(spx_word32_t *exc);
- spx_word16_t *innov_save=NULL;
- spx_word16_t *sp;
- spx_word16_t filter_ratio;
- spx_word16_t el=0;
- int offset;
- spx_word32_t rl=0,rh=0;
-
- offset = st->subframeSize*sub;
- sp=out+st->frame_size+offset;
- ALLOC(exc, st->subframeSize, spx_word32_t);
- /* Pointer for saving innovation */
- if (st->innov_save)
- {
- innov_save = st->innov_save+2*offset;
- SPEEX_MEMSET(innov_save, 0, 2*st->subframeSize);
- }
-
- /* LSP interpolation */
- lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
-
- lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
-
- /* LSP to LPC */
- lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack);
-
- /* Calculate reponse ratio between the low and high filter in the middle
- of the band (4000 Hz) */
-
- st->pi_gain[sub]=LPC_SCALING;
- rh = LPC_SCALING;
- for (i=0;i<st->lpcSize;i+=2)
- {
- rh += ak[i+1] - ak[i];
- st->pi_gain[sub] += ak[i] + ak[i+1];
- }
-
- rl = low_pi_gain[sub];
-#ifdef FIXED_POINT
- filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767));
-#else
- filter_ratio=(rl+.01)/(rh+.01);
-#endif
-
- SPEEX_MEMSET(exc, 0, st->subframeSize);
- if (!SUBMODE(innovation_unquant))
- {
- spx_word32_t g;
- int quant;
-
- quant = speex_bits_unpack_unsigned(bits, 5);
- g= spx_exp(MULT16_16(QCONST16(.125f,11),(quant-10)));
-
- g = PDIV32(g, filter_ratio);
-
- for (i=0;i<st->subframeSize;i+=2)
- {
- exc[i]=SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i]),SHL32(g,6)),SIG_SHIFT);
- exc[i+1]=NEG32(SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i+1]),SHL32(g,6)),SIG_SHIFT));
- }
-
- } else {
- spx_word16_t gc;
- spx_word32_t scale;
- int qgc = speex_bits_unpack_unsigned(bits, 4);
-
- el = low_exc_rms[sub];
- gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]);
-
- if (st->subframeSize==80)
- gc = MULT16_16_P14(QCONST16(1.4142f,14),gc);
-
- scale = SHL32(PDIV32(SHL32(MULT16_16(gc, el),3), filter_ratio),SIG_SHIFT-3);
- SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize,
- bits, stack, &st->seed);
-
- signal_mul(exc,exc,scale,st->subframeSize);
-
- if (SUBMODE(double_codebook)) {
- char *tmp_stack=stack;
- VARDECL(spx_sig_t *innov2);
- ALLOC(innov2, st->subframeSize, spx_sig_t);
- SPEEX_MEMSET(innov2, 0, st->subframeSize);
- SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize,
- bits, stack, &st->seed);
- signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize);
- for (i=0;i<st->subframeSize;i++)
- exc[i] = ADD32(exc[i],innov2[i]);
- stack = tmp_stack;
- }
-
- }
-
- if (st->innov_save)
- {
- for (i=0;i<st->subframeSize;i++)
- innov_save[2*i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT));
- }
-
- iir_mem16(st->excBuf, st->interp_qlpc, sp, st->subframeSize, st->lpcSize,
- st->mem_sp, stack);
- for (i=0;i<st->subframeSize;i++)
- st->excBuf[i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT));
- for (i=0;i<st->lpcSize;i++)
- st->interp_qlpc[i] = ak[i];
- st->exc_rms[sub] = compute_rms16(st->excBuf, st->subframeSize);
- exc_ener_sum = ADD32(exc_ener_sum, DIV32(MULT16_16(st->exc_rms[sub],st->exc_rms[sub]), st->nbSubframes));
- }
- st->last_ener = spx_sqrt(exc_ener_sum);
-
- qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
- for (i=0;i<st->lpcSize;i++)
- st->old_qlsp[i] = qlsp[i];
-
- st->first=0;
-
- return 0;
-}
-
-
-int sb_encoder_ctl(void *state, int request, void *ptr)
-{
- SBEncState *st;
- st=(SBEncState*)state;
- switch(request)
- {
- case SPEEX_GET_FRAME_SIZE:
- (*(spx_int32_t*)ptr) = st->full_frame_size;
- break;
- case SPEEX_SET_HIGH_MODE:
- st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_SET_LOW_MODE:
- speex_encoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr);
- break;
- case SPEEX_SET_DTX:
- speex_encoder_ctl(st->st_low, SPEEX_SET_DTX, ptr);
- break;
- case SPEEX_GET_DTX:
- speex_encoder_ctl(st->st_low, SPEEX_GET_DTX, ptr);
- break;
- case SPEEX_GET_LOW_MODE:
- speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr);
- break;
- case SPEEX_SET_MODE:
- speex_encoder_ctl(st, SPEEX_SET_QUALITY, ptr);
- break;
-#ifndef DISABLE_VBR
- case SPEEX_SET_VBR:
- st->vbr_enabled = (*(spx_int32_t*)ptr);
- speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr);
- break;
- case SPEEX_GET_VBR:
- (*(spx_int32_t*)ptr) = st->vbr_enabled;
- break;
- case SPEEX_SET_VAD:
- st->vad_enabled = (*(spx_int32_t*)ptr);
- speex_encoder_ctl(st->st_low, SPEEX_SET_VAD, ptr);
- break;
- case SPEEX_GET_VAD:
- (*(spx_int32_t*)ptr) = st->vad_enabled;
- break;
-#endif /* #ifndef DISABLE_VBR */
-#if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API)
- case SPEEX_SET_VBR_QUALITY:
- {
- spx_int32_t q;
- float qual = (*(float*)ptr)+.6;
- st->vbr_quality = (*(float*)ptr);
- if (qual>10)
- qual=10;
- q=(int)floor(.5+*(float*)ptr);
- if (q>10)
- q=10;
- speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_QUALITY, &qual);
- speex_encoder_ctl(state, SPEEX_SET_QUALITY, &q);
- break;
- }
- case SPEEX_GET_VBR_QUALITY:
- (*(float*)ptr) = st->vbr_quality;
- break;
-#endif /* #if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) */
-#ifndef DISABLE_VBR
- case SPEEX_SET_ABR:
- st->abr_enabled = (*(spx_int32_t*)ptr);
- st->vbr_enabled = st->abr_enabled!=0;
- speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, &st->vbr_enabled);
- if (st->vbr_enabled)
- {
- spx_int32_t i=10, rate, target;
- float vbr_qual;
- target = (*(spx_int32_t*)ptr);
- while (i>=0)
- {
- speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
- speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
- if (rate <= target)
- break;
- i--;
- }
- vbr_qual=i;
- if (vbr_qual<0)
- vbr_qual=0;
- speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_qual);
- st->abr_count=0;
- st->abr_drift=0;
- st->abr_drift2=0;
- }
-
- break;
- case SPEEX_GET_ABR:
- (*(spx_int32_t*)ptr) = st->abr_enabled;
- break;
-#endif /* #ifndef DISABLE_VBR */
-
- case SPEEX_SET_QUALITY:
- {
- spx_int32_t nb_qual;
- int quality = (*(spx_int32_t*)ptr);
- if (quality < 0)
- quality = 0;
- if (quality > 10)
- quality = 10;
- st->submodeSelect = st->submodeID = ((const SpeexSBMode*)(st->mode->mode))->quality_map[quality];
- nb_qual = ((const SpeexSBMode*)(st->mode->mode))->low_quality_map[quality];
- speex_encoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual);
- }
- break;
- case SPEEX_SET_COMPLEXITY:
- speex_encoder_ctl(st->st_low, SPEEX_SET_COMPLEXITY, ptr);
- st->complexity = (*(spx_int32_t*)ptr);
- if (st->complexity<1)
- st->complexity=1;
- break;
- case SPEEX_GET_COMPLEXITY:
- (*(spx_int32_t*)ptr) = st->complexity;
- break;
- case SPEEX_SET_BITRATE:
- {
- spx_int32_t i=10;
- spx_int32_t rate, target;
- target = (*(spx_int32_t*)ptr);
- while (i>=0)
- {
- speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
- speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
- if (rate <= target)
- break;
- i--;
- }
- }
- break;
- case SPEEX_GET_BITRATE:
- speex_encoder_ctl(st->st_low, request, ptr);
- /*fprintf (stderr, "before: %d\n", (*(int*)ptr));*/
- if (st->submodes[st->submodeID])
- (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;
- else
- (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;
- /*fprintf (stderr, "after: %d\n", (*(int*)ptr));*/
- break;
- case SPEEX_SET_SAMPLING_RATE:
- {
- spx_int32_t tmp=(*(spx_int32_t*)ptr);
- st->sampling_rate = tmp;
- tmp>>=1;
- speex_encoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp);
- }
- break;
- case SPEEX_GET_SAMPLING_RATE:
- (*(spx_int32_t*)ptr)=st->sampling_rate;
- break;
- case SPEEX_RESET_STATE:
- {
- int i;
- st->first = 1;
- for (i=0;i<st->lpcSize;i++)
- st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
- for (i=0;i<st->lpcSize;i++)
- st->mem_sw[i]=st->mem_sp[i]=st->mem_sp2[i]=0;
- for (i=0;i<QMF_ORDER;i++)
- st->h0_mem[i]=st->h1_mem[i]=0;
- }
- break;
- case SPEEX_SET_SUBMODE_ENCODING:
- st->encode_submode = (*(spx_int32_t*)ptr);
- speex_encoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, ptr);
- break;
- case SPEEX_GET_SUBMODE_ENCODING:
- (*(spx_int32_t*)ptr) = st->encode_submode;
- break;
- case SPEEX_GET_LOOKAHEAD:
- speex_encoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr);
- (*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr) + QMF_ORDER - 1;
- break;
- case SPEEX_SET_PLC_TUNING:
- speex_encoder_ctl(st->st_low, SPEEX_SET_PLC_TUNING, ptr);
- break;
- case SPEEX_GET_PLC_TUNING:
- speex_encoder_ctl(st->st_low, SPEEX_GET_PLC_TUNING, ptr);
- break;
-#ifndef DISABLE_VBR
- case SPEEX_SET_VBR_MAX_BITRATE:
- {
- st->vbr_max = (*(spx_int32_t*)ptr);
- if (SPEEX_SET_VBR_MAX_BITRATE<1)
- {
- speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &st->vbr_max);
- st->vbr_max_high = 17600;
- } else {
- spx_int32_t low_rate;
- if (st->vbr_max >= 42200)
- {
- st->vbr_max_high = 17600;
- } else if (st->vbr_max >= 27800)
- {
- st->vbr_max_high = 9600;
- } else if (st->vbr_max > 20600)
- {
- st->vbr_max_high = 5600;
- } else {
- st->vbr_max_high = 1800;
- }
- if (st->subframeSize==80)
- st->vbr_max_high = 1800;
- low_rate = st->vbr_max - st->vbr_max_high;
- speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &low_rate);
- }
- }
- break;
- case SPEEX_GET_VBR_MAX_BITRATE:
- (*(spx_int32_t*)ptr) = st->vbr_max;
- break;
-#endif /* #ifndef DISABLE_VBR */
- case SPEEX_SET_HIGHPASS:
- speex_encoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr);
- break;
- case SPEEX_GET_HIGHPASS:
- speex_encoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr);
- break;
-
-
- /* This is all internal stuff past this point */
- case SPEEX_GET_PI_GAIN:
- {
- int i;
- spx_word32_t *g = (spx_word32_t*)ptr;
- for (i=0;i<st->nbSubframes;i++)
- g[i]=st->pi_gain[i];
- }
- break;
- case SPEEX_GET_EXC:
- {
- int i;
- for (i=0;i<st->nbSubframes;i++)
- ((spx_word16_t*)ptr)[i] = st->exc_rms[i];
- }
- break;
-#ifndef DISABLE_VBR
- case SPEEX_GET_RELATIVE_QUALITY:
- (*(float*)ptr)=st->relative_quality;
- break;
-#endif /* #ifndef DISABLE_VBR */
- case SPEEX_SET_INNOVATION_SAVE:
- st->innov_rms_save = (spx_word16_t*)ptr;
- break;
- case SPEEX_SET_WIDEBAND:
- speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr);
- break;
- case SPEEX_GET_STACK:
- *((char**)ptr) = st->stack;
- break;
- default:
- speex_warning_int("Unknown nb_ctl request: ", request);
- return -1;
- }
- return 0;
-}
-
-int sb_decoder_ctl(void *state, int request, void *ptr)
-{
- SBDecState *st;
- st=(SBDecState*)state;
- switch(request)
- {
- case SPEEX_SET_HIGH_MODE:
- st->submodeID = (*(spx_int32_t*)ptr);
- break;
- case SPEEX_SET_LOW_MODE:
- speex_decoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr);
- break;
- case SPEEX_GET_LOW_MODE:
- speex_decoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr);
- break;
- case SPEEX_GET_FRAME_SIZE:
- (*(spx_int32_t*)ptr) = st->full_frame_size;
- break;
- case SPEEX_SET_ENH:
- speex_decoder_ctl(st->st_low, request, ptr);
- st->lpc_enh_enabled = *((spx_int32_t*)ptr);
- break;
- case SPEEX_GET_ENH:
- *((spx_int32_t*)ptr) = st->lpc_enh_enabled;
- break;
- case SPEEX_SET_MODE:
- case SPEEX_SET_QUALITY:
- {
- spx_int32_t nb_qual;
- int quality = (*(spx_int32_t*)ptr);
- if (quality < 0)
- quality = 0;
- if (quality > 10)
- quality = 10;
- st->submodeID = ((const SpeexSBMode*)(st->mode->mode))->quality_map[quality];
- nb_qual = ((const SpeexSBMode*)(st->mode->mode))->low_quality_map[quality];
- speex_decoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual);
- }
- break;
- case SPEEX_GET_BITRATE:
- speex_decoder_ctl(st->st_low, request, ptr);
- if (st->submodes[st->submodeID])
- (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;
- else
- (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;
- break;
- case SPEEX_SET_SAMPLING_RATE:
- {
- spx_int32_t tmp=(*(spx_int32_t*)ptr);
- st->sampling_rate = tmp;
- tmp>>=1;
- speex_decoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp);
- }
- break;
- case SPEEX_GET_SAMPLING_RATE:
- (*(spx_int32_t*)ptr)=st->sampling_rate;
- break;
- case SPEEX_SET_HANDLER:
- speex_decoder_ctl(st->st_low, SPEEX_SET_HANDLER, ptr);
- break;
- case SPEEX_SET_USER_HANDLER:
- speex_decoder_ctl(st->st_low, SPEEX_SET_USER_HANDLER, ptr);
- break;
- case SPEEX_RESET_STATE:
- {
- int i;
- for (i=0;i<2*st->lpcSize;i++)
- st->mem_sp[i]=0;
- for (i=0;i<QMF_ORDER;i++)
- st->g0_mem[i]=st->g1_mem[i]=0;
- st->last_ener=0;
- }
- break;
- case SPEEX_SET_SUBMODE_ENCODING:
- st->encode_submode = (*(spx_int32_t*)ptr);
- speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, ptr);
- break;
- case SPEEX_GET_SUBMODE_ENCODING:
- (*(spx_int32_t*)ptr) = st->encode_submode;
- break;
- case SPEEX_GET_LOOKAHEAD:
- speex_decoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr);
- (*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr);
- break;
- case SPEEX_SET_HIGHPASS:
- speex_decoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr);
- break;
- case SPEEX_GET_HIGHPASS:
- speex_decoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr);
- break;
- case SPEEX_GET_ACTIVITY:
- speex_decoder_ctl(st->st_low, SPEEX_GET_ACTIVITY, ptr);
- break;
- case SPEEX_GET_PI_GAIN:
- {
- int i;
- spx_word32_t *g = (spx_word32_t*)ptr;
- for (i=0;i<st->nbSubframes;i++)
- g[i]=st->pi_gain[i];
- }
- break;
- case SPEEX_GET_EXC:
- {
- int i;
- for (i=0;i<st->nbSubframes;i++)
- ((spx_word16_t*)ptr)[i] = st->exc_rms[i];
- }
- break;
- case SPEEX_GET_DTX_STATUS:
- speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, ptr);
- break;
- case SPEEX_SET_INNOVATION_SAVE:
- st->innov_save = (spx_word16_t*)ptr;
- break;
- case SPEEX_SET_WIDEBAND:
- speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr);
- break;
- case SPEEX_GET_STACK:
- *((char**)ptr) = st->stack;
- break;
- default:
- speex_warning_int("Unknown nb_ctl request: ", request);
- return -1;
- }
- return 0;
-}
-
-#endif
-
diff --git a/drivers/speex/sb_celp.h b/drivers/speex/sb_celp.h
deleted file mode 100644
index e8c376123..000000000
--- a/drivers/speex/sb_celp.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin */
-/**
- @file sb_celp.h
- @brief Sub-band CELP mode used for wideband encoding
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef SB_CELP_H
-#define SB_CELP_H
-
-#include "modes.h"
-#include <speex/speex_bits.h>
-#include "nb_celp.h"
-
-/**Structure representing the full state of the sub-band encoder*/
-typedef struct SBEncState {
- const SpeexMode *mode; /**< Pointer to the mode (containing for vtable info) */
- void *st_low; /**< State of the low-band (narrowband) encoder */
- int full_frame_size; /**< Length of full-band frames*/
- int frame_size; /**< Length of high-band frames*/
- int subframeSize; /**< Length of high-band sub-frames*/
- int nbSubframes; /**< Number of high-band sub-frames*/
- int windowSize; /**< Length of high-band LPC window*/
- int lpcSize; /**< Order of high-band LPC analysis */
- int first; /**< First frame? */
- spx_word16_t lpc_floor; /**< Controls LPC analysis noise floor */
- spx_word16_t gamma1; /**< Perceptual weighting coef 1 */
- spx_word16_t gamma2; /**< Perceptual weighting coef 2 */
-
- char *stack; /**< Temporary allocation stack */
- spx_word16_t *high; /**< High-band signal (buffer) */
- spx_word16_t *h0_mem, *h1_mem;
-
- const spx_word16_t *window; /**< LPC analysis window */
- const spx_word16_t *lagWindow; /**< Auto-correlation window */
- spx_lsp_t *old_lsp; /**< LSPs of previous frame */
- spx_lsp_t *old_qlsp; /**< Quantized LSPs of previous frame */
- spx_coef_t *interp_qlpc; /**< Interpolated quantized LPCs for current sub-frame */
-
- spx_mem_t *mem_sp; /**< Synthesis signal memory */
- spx_mem_t *mem_sp2;
- spx_mem_t *mem_sw; /**< Perceptual signal memory */
- spx_word32_t *pi_gain;
- spx_word16_t *exc_rms;
- spx_word16_t *innov_rms_save; /**< If non-NULL, innovation is copied here */
-
-#ifndef DISABLE_VBR
- float vbr_quality; /**< Quality setting for VBR encoding */
- int vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
- spx_int32_t vbr_max; /**< Max bit-rate allowed in VBR mode (total) */
- spx_int32_t vbr_max_high; /**< Max bit-rate allowed in VBR mode for the high-band */
- spx_int32_t abr_enabled; /**< ABR setting (in bps), 0 if off */
- float abr_drift;
- float abr_drift2;
- float abr_count;
- int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */
- float relative_quality;
-#endif /* #ifndef DISABLE_VBR */
-
- int encode_submode;
- const SpeexSubmode * const *submodes;
- int submodeID;
- int submodeSelect;
- int complexity;
- spx_int32_t sampling_rate;
-
-} SBEncState;
-
-
-/**Structure representing the full state of the sub-band decoder*/
-typedef struct SBDecState {
- const SpeexMode *mode; /**< Pointer to the mode (containing for vtable info) */
- void *st_low; /**< State of the low-band (narrowband) encoder */
- int full_frame_size;
- int frame_size;
- int subframeSize;
- int nbSubframes;
- int lpcSize;
- int first;
- spx_int32_t sampling_rate;
- int lpc_enh_enabled;
-
- char *stack;
- spx_word16_t *g0_mem, *g1_mem;
-
- spx_word16_t *excBuf;
- spx_lsp_t *old_qlsp;
- spx_coef_t *interp_qlpc;
-
- spx_mem_t *mem_sp;
- spx_word32_t *pi_gain;
- spx_word16_t *exc_rms;
- spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */
-
- spx_word16_t last_ener;
- spx_int32_t seed;
-
- int encode_submode;
- const SpeexSubmode * const *submodes;
- int submodeID;
-} SBDecState;
-
-
-/**Initializes encoder state*/
-void *sb_encoder_init(const SpeexMode *m);
-
-/**De-allocates encoder state resources*/
-void sb_encoder_destroy(void *state);
-
-/**Encodes one frame*/
-int sb_encode(void *state, void *in, SpeexBits *bits);
-
-
-/**Initializes decoder state*/
-void *sb_decoder_init(const SpeexMode *m);
-
-/**De-allocates decoder state resources*/
-void sb_decoder_destroy(void *state);
-
-/**Decodes one frame*/
-int sb_decode(void *state, SpeexBits *bits, void *out);
-
-int sb_encoder_ctl(void *state, int request, void *ptr);
-
-int sb_decoder_ctl(void *state, int request, void *ptr);
-
-#endif
diff --git a/drivers/speex/scal.c b/drivers/speex/scal.c
deleted file mode 100644
index 056aa62b5..000000000
--- a/drivers/speex/scal.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/* Copyright (C) 2006-2008 CSIRO, Jean-Marc Valin, Xiph.Org Foundation
-
- File: scal.c
- Shaped comb-allpass filter for channel decorrelation
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
-The algorithm implemented here is described in:
-
-* J.-M. Valin, Perceptually-Motivated Nonlinear Channel Decorrelation For
- Stereo Acoustic Echo Cancellation, Accepted for Joint Workshop on
- Hands­free Speech Communication and Microphone Arrays (HSCMA), 2008.
- http://people.xiph.org/~jm/papers/valin_hscma2008.pdf
-
-*/
-
-
-#include "config.h"
-
-
-#include "speex/speex_echo.h"
-#include "vorbis_psy.h"
-#include "arch.h"
-#include "os_support.h"
-#include "smallft.h"
-#include <math.h>
-#include <stdlib.h>
-
-#define ALLPASS_ORDER 20
-
-struct SpeexDecorrState_ {
- int rate;
- int channels;
- int frame_size;
-#ifdef VORBIS_PSYCHO
- VorbisPsy *psy;
- struct drft_lookup lookup;
- float *wola_mem;
- float *curve;
-#endif
- float *vorbis_win;
- int seed;
- float *y;
-
- /* Per-channel stuff */
- float *buff;
- float (*ring)[ALLPASS_ORDER];
- int *ringID;
- int *order;
- float *alpha;
-};
-
-
-
-EXPORT SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size)
-{
- int i, ch;
- SpeexDecorrState *st = speex_alloc(sizeof(SpeexDecorrState));
- st->rate = rate;
- st->channels = channels;
- st->frame_size = frame_size;
-#ifdef VORBIS_PSYCHO
- st->psy = vorbis_psy_init(rate, 2*frame_size);
- spx_drft_init(&st->lookup, 2*frame_size);
- st->wola_mem = speex_alloc(frame_size*sizeof(float));
- st->curve = speex_alloc(frame_size*sizeof(float));
-#endif
- st->y = speex_alloc(frame_size*sizeof(float));
-
- st->buff = speex_alloc(channels*2*frame_size*sizeof(float));
- st->ringID = speex_alloc(channels*sizeof(int));
- st->order = speex_alloc(channels*sizeof(int));
- st->alpha = speex_alloc(channels*sizeof(float));
- st->ring = speex_alloc(channels*ALLPASS_ORDER*sizeof(float));
-
- /*FIXME: The +20 is there only as a kludge for ALL_PASS_OLA*/
- st->vorbis_win = speex_alloc((2*frame_size+20)*sizeof(float));
- for (i=0;i<2*frame_size;i++)
- st->vorbis_win[i] = sin(.5*SPEEX_PI* sin(SPEEX_PI*i/(2*frame_size))*sin(SPEEX_PI*i/(2*frame_size)) );
- st->seed = rand();
-
- for (ch=0;ch<channels;ch++)
- {
- for (i=0;i<ALLPASS_ORDER;i++)
- st->ring[ch][i] = 0;
- st->ringID[ch] = 0;
- st->alpha[ch] = 0;
- st->order[ch] = 10;
- }
- return st;
-}
-
-static float uni_rand(int *seed)
-{
- const unsigned int jflone = 0x3f800000;
- const unsigned int jflmsk = 0x007fffff;
- union {int i; float f;} ran;
- *seed = 1664525 * *seed + 1013904223;
- ran.i = jflone | (jflmsk & *seed);
- ran.f -= 1.5;
- return 2*ran.f;
-}
-
-static unsigned int irand(int *seed)
-{
- *seed = 1664525 * *seed + 1013904223;
- return ((unsigned int)*seed)>>16;
-}
-
-
-EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength)
-{
- int ch;
- float amount;
-
- if (strength<0)
- strength = 0;
- if (strength>100)
- strength = 100;
-
- amount = .01*strength;
- for (ch=0;ch<st->channels;ch++)
- {
- int i;
- int N=2*st->frame_size;
- float beta, beta2;
- float *x;
- float max_alpha = 0;
-
- float *buff;
- float *ring;
- int ringID;
- int order;
- float alpha;
-
- buff = st->buff+ch*2*st->frame_size;
- ring = st->ring[ch];
- ringID = st->ringID[ch];
- order = st->order[ch];
- alpha = st->alpha[ch];
-
- for (i=0;i<st->frame_size;i++)
- buff[i] = buff[i+st->frame_size];
- for (i=0;i<st->frame_size;i++)
- buff[i+st->frame_size] = in[i*st->channels+ch];
-
- x = buff+st->frame_size;
- beta = 1.-.3*amount*amount;
- if (amount>1)
- beta = 1-sqrt(.4*amount);
- else
- beta = 1-0.63246*amount;
- if (beta<0)
- beta = 0;
-
- beta2 = beta;
- for (i=0;i<st->frame_size;i++)
- {
- st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->frame_size+i+order]
- + x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i]
- - alpha*(ring[ringID]
- - beta*ring[ringID+1>=order?0:ringID+1]);
- ring[ringID++]=st->y[i];
- st->y[i] *= st->vorbis_win[st->frame_size+i];
- if (ringID>=order)
- ringID=0;
- }
- order = order+(irand(&st->seed)%3)-1;
- if (order < 5)
- order = 5;
- if (order > 10)
- order = 10;
- /*order = 5+(irand(&st->seed)%6);*/
- max_alpha = pow(.96+.04*(amount-1),order);
- if (max_alpha > .98/(1.+beta2))
- max_alpha = .98/(1.+beta2);
-
- alpha = alpha + .4*uni_rand(&st->seed);
- if (alpha > max_alpha)
- alpha = max_alpha;
- if (alpha < -max_alpha)
- alpha = -max_alpha;
- for (i=0;i<ALLPASS_ORDER;i++)
- ring[i] = 0;
- ringID = 0;
- for (i=0;i<st->frame_size;i++)
- {
- float tmp = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+order]
- + x[i-ALLPASS_ORDER]*st->vorbis_win[i]
- - alpha*(ring[ringID]
- - beta*ring[ringID+1>=order?0:ringID+1]);
- ring[ringID++]=tmp;
- tmp *= st->vorbis_win[i];
- if (ringID>=order)
- ringID=0;
- st->y[i] += tmp;
- }
-
-#ifdef VORBIS_PSYCHO
- float frame[N];
- float scale = 1./N;
- for (i=0;i<2*st->frame_size;i++)
- frame[i] = buff[i];
- //float coef = .5*0.78130;
- float coef = SPEEX_PI*0.075063 * 0.93763 * amount * .8 * 0.707;
- compute_curve(st->psy, buff, st->curve);
- for (i=1;i<st->frame_size;i++)
- {
- float x1,x2;
- float gain;
- do {
- x1 = uni_rand(&st->seed);
- x2 = uni_rand(&st->seed);
- } while (x1*x1+x2*x2 > 1.);
- gain = coef*sqrt(.1+st->curve[i]);
- frame[2*i-1] = gain*x1;
- frame[2*i] = gain*x2;
- }
- frame[0] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[0]);
- frame[2*st->frame_size-1] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[st->frame_size-1]);
- spx_drft_backward(&st->lookup,frame);
- for (i=0;i<2*st->frame_size;i++)
- frame[i] *= st->vorbis_win[i];
-#endif
-
- for (i=0;i<st->frame_size;i++)
- {
-#ifdef VORBIS_PSYCHO
- float tmp = st->y[i] + frame[i] + st->wola_mem[i];
- st->wola_mem[i] = frame[i+st->frame_size];
-#else
- float tmp = st->y[i];
-#endif
- if (tmp>32767)
- tmp = 32767;
- if (tmp < -32767)
- tmp = -32767;
- out[i*st->channels+ch] = tmp;
- }
-
- st->ringID[ch] = ringID;
- st->order[ch] = order;
- st->alpha[ch] = alpha;
-
- }
-}
-
-EXPORT void speex_decorrelate_destroy(SpeexDecorrState *st)
-{
-#ifdef VORBIS_PSYCHO
- vorbis_psy_destroy(st->psy);
- speex_free(st->wola_mem);
- speex_free(st->curve);
-#endif
- speex_free(st->buff);
- speex_free(st->ring);
- speex_free(st->ringID);
- speex_free(st->alpha);
- speex_free(st->vorbis_win);
- speex_free(st->order);
- speex_free(st->y);
- speex_free(st);
-}
diff --git a/drivers/speex/smallft.c b/drivers/speex/smallft.c
deleted file mode 100644
index bf87ec4d0..000000000
--- a/drivers/speex/smallft.c
+++ /dev/null
@@ -1,1261 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the XIPHOPHORUS Company http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: *unnormalized* fft transform
- last mod: $Id: smallft.c,v 1.19 2003/10/08 05:12:37 jm Exp $
-
- ********************************************************************/
-
-/* FFT implementation from OggSquish, minus cosine transforms,
- * minus all but radix 2/4 case. In Vorbis we only need this
- * cut-down version.
- *
- * To do more than just power-of-two sized vectors, see the full
- * version I wrote for NetLib.
- *
- * Note that the packing is a little strange; rather than the FFT r/i
- * packing following R_0, I_n, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1,
- * it follows R_0, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, I_n like the
- * FORTRAN version
- */
-
-
-#include "config.h"
-
-
-#include <math.h>
-#include "smallft.h"
-#include "arch.h"
-#include "os_support.h"
-
-static void drfti1(int n, float *wa, int *ifac){
- static int ntryh[4] = { 4,2,3,5 };
- static float tpi = 6.28318530717958648f;
- float arg,argh,argld,fi;
- int ntry=0,i,j=-1;
- int k1, l1, l2, ib;
- int ld, ii, ip, is, nq, nr;
- int ido, ipm, nfm1;
- int nl=n;
- int nf=0;
-
- L101:
- j++;
- if (j < 4)
- ntry=ntryh[j];
- else
- ntry+=2;
-
- L104:
- nq=nl/ntry;
- nr=nl-ntry*nq;
- if (nr!=0) goto L101;
-
- nf++;
- ifac[nf+1]=ntry;
- nl=nq;
- if(ntry!=2)goto L107;
- if(nf==1)goto L107;
-
- for (i=1;i<nf;i++){
- ib=nf-i+1;
- ifac[ib+1]=ifac[ib];
- }
- ifac[2] = 2;
-
- L107:
- if(nl!=1)goto L104;
- ifac[0]=n;
- ifac[1]=nf;
- argh=tpi/n;
- is=0;
- nfm1=nf-1;
- l1=1;
-
- if(nfm1==0)return;
-
- for (k1=0;k1<nfm1;k1++){
- ip=ifac[k1+2];
- ld=0;
- l2=l1*ip;
- ido=n/l2;
- ipm=ip-1;
-
- for (j=0;j<ipm;j++){
- ld+=l1;
- i=is;
- argld=(float)ld*argh;
- fi=0.f;
- for (ii=2;ii<ido;ii+=2){
- fi+=1.f;
- arg=fi*argld;
- wa[i++]=cos(arg);
- wa[i++]=sin(arg);
- }
- is+=ido;
- }
- l1=l2;
- }
-}
-
-static void fdrffti(int n, float *wsave, int *ifac){
-
- if (n == 1) return;
- drfti1(n, wsave+n, ifac);
-}
-
-static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
- int i,k;
- float ti2,tr2;
- int t0,t1,t2,t3,t4,t5,t6;
-
- t1=0;
- t0=(t2=l1*ido);
- t3=ido<<1;
- for(k=0;k<l1;k++){
- ch[t1<<1]=cc[t1]+cc[t2];
- ch[(t1<<1)+t3-1]=cc[t1]-cc[t2];
- t1+=ido;
- t2+=ido;
- }
-
- if(ido<2)return;
- if(ido==2)goto L105;
-
- t1=0;
- t2=t0;
- for(k=0;k<l1;k++){
- t3=t2;
- t4=(t1<<1)+(ido<<1);
- t5=t1;
- t6=t1+t1;
- for(i=2;i<ido;i+=2){
- t3+=2;
- t4-=2;
- t5+=2;
- t6+=2;
- tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
- ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
- ch[t6]=cc[t5]+ti2;
- ch[t4]=ti2-cc[t5];
- ch[t6-1]=cc[t5-1]+tr2;
- ch[t4-1]=cc[t5-1]-tr2;
- }
- t1+=ido;
- t2+=ido;
- }
-
- if(ido%2==1)return;
-
- L105:
- t3=(t2=(t1=ido)-1);
- t2+=t0;
- for(k=0;k<l1;k++){
- ch[t1]=-cc[t2];
- ch[t1-1]=cc[t3];
- t1+=ido<<1;
- t2+=ido;
- t3+=ido;
- }
-}
-
-static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
- float *wa2,float *wa3){
- static float hsqt2 = .70710678118654752f;
- int i,k,t0,t1,t2,t3,t4,t5,t6;
- float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
- t0=l1*ido;
-
- t1=t0;
- t4=t1<<1;
- t2=t1+(t1<<1);
- t3=0;
-
- for(k=0;k<l1;k++){
- tr1=cc[t1]+cc[t2];
- tr2=cc[t3]+cc[t4];
-
- ch[t5=t3<<2]=tr1+tr2;
- ch[(ido<<2)+t5-1]=tr2-tr1;
- ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4];
- ch[t5]=cc[t2]-cc[t1];
-
- t1+=ido;
- t2+=ido;
- t3+=ido;
- t4+=ido;
- }
-
- if(ido<2)return;
- if(ido==2)goto L105;
-
-
- t1=0;
- for(k=0;k<l1;k++){
- t2=t1;
- t4=t1<<2;
- t5=(t6=ido<<1)+t4;
- for(i=2;i<ido;i+=2){
- t3=(t2+=2);
- t4+=2;
- t5-=2;
-
- t3+=t0;
- cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
- ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
- t3+=t0;
- cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3];
- ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1];
- t3+=t0;
- cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3];
- ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1];
-
- tr1=cr2+cr4;
- tr4=cr4-cr2;
- ti1=ci2+ci4;
- ti4=ci2-ci4;
-
- ti2=cc[t2]+ci3;
- ti3=cc[t2]-ci3;
- tr2=cc[t2-1]+cr3;
- tr3=cc[t2-1]-cr3;
-
- ch[t4-1]=tr1+tr2;
- ch[t4]=ti1+ti2;
-
- ch[t5-1]=tr3-ti4;
- ch[t5]=tr4-ti3;
-
- ch[t4+t6-1]=ti4+tr3;
- ch[t4+t6]=tr4+ti3;
-
- ch[t5+t6-1]=tr2-tr1;
- ch[t5+t6]=ti1-ti2;
- }
- t1+=ido;
- }
- if(ido&1)return;
-
- L105:
-
- t2=(t1=t0+ido-1)+(t0<<1);
- t3=ido<<2;
- t4=ido;
- t5=ido<<1;
- t6=ido;
-
- for(k=0;k<l1;k++){
- ti1=-hsqt2*(cc[t1]+cc[t2]);
- tr1=hsqt2*(cc[t1]-cc[t2]);
-
- ch[t4-1]=tr1+cc[t6-1];
- ch[t4+t5-1]=cc[t6-1]-tr1;
-
- ch[t4]=ti1-cc[t1+t0];
- ch[t4+t5]=ti1+cc[t1+t0];
-
- t1+=ido;
- t2+=ido;
- t4+=t3;
- t6+=ido;
- }
-}
-
-static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
- float *c2,float *ch,float *ch2,float *wa){
-
- static float tpi=6.283185307179586f;
- int idij,ipph,i,j,k,l,ic,ik,is;
- int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
- float dc2,ai1,ai2,ar1,ar2,ds2;
- int nbd;
- float dcp,arg,dsp,ar1h,ar2h;
- int idp2,ipp2;
-
- arg=tpi/(float)ip;
- dcp=cos(arg);
- dsp=sin(arg);
- ipph=(ip+1)>>1;
- ipp2=ip;
- idp2=ido;
- nbd=(ido-1)>>1;
- t0=l1*ido;
- t10=ip*ido;
-
- if(ido==1)goto L119;
- for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik];
-
- t1=0;
- for(j=1;j<ip;j++){
- t1+=t0;
- t2=t1;
- for(k=0;k<l1;k++){
- ch[t2]=c1[t2];
- t2+=ido;
- }
- }
-
- is=-ido;
- t1=0;
- if(nbd>l1){
- for(j=1;j<ip;j++){
- t1+=t0;
- is+=ido;
- t2= -ido+t1;
- for(k=0;k<l1;k++){
- idij=is-1;
- t2+=ido;
- t3=t2;
- for(i=2;i<ido;i+=2){
- idij+=2;
- t3+=2;
- ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
- ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
- }
- }
- }
- }else{
-
- for(j=1;j<ip;j++){
- is+=ido;
- idij=is-1;
- t1+=t0;
- t2=t1;
- for(i=2;i<ido;i+=2){
- idij+=2;
- t2+=2;
- t3=t2;
- for(k=0;k<l1;k++){
- ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
- ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
- t3+=ido;
- }
- }
- }
- }
-
- t1=0;
- t2=ipp2*t0;
- if(nbd<l1){
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1;
- t4=t2;
- for(i=2;i<ido;i+=2){
- t3+=2;
- t4+=2;
- t5=t3-ido;
- t6=t4-ido;
- for(k=0;k<l1;k++){
- t5+=ido;
- t6+=ido;
- c1[t5-1]=ch[t5-1]+ch[t6-1];
- c1[t6-1]=ch[t5]-ch[t6];
- c1[t5]=ch[t5]+ch[t6];
- c1[t6]=ch[t6-1]-ch[t5-1];
- }
- }
- }
- }else{
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1;
- t4=t2;
- for(k=0;k<l1;k++){
- t5=t3;
- t6=t4;
- for(i=2;i<ido;i+=2){
- t5+=2;
- t6+=2;
- c1[t5-1]=ch[t5-1]+ch[t6-1];
- c1[t6-1]=ch[t5]-ch[t6];
- c1[t5]=ch[t5]+ch[t6];
- c1[t6]=ch[t6-1]-ch[t5-1];
- }
- t3+=ido;
- t4+=ido;
- }
- }
- }
-
-L119:
- for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
-
- t1=0;
- t2=ipp2*idl1;
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1-ido;
- t4=t2-ido;
- for(k=0;k<l1;k++){
- t3+=ido;
- t4+=ido;
- c1[t3]=ch[t3]+ch[t4];
- c1[t4]=ch[t4]-ch[t3];
- }
- }
-
- ar1=1.f;
- ai1=0.f;
- t1=0;
- t2=ipp2*idl1;
- t3=(ip-1)*idl1;
- for(l=1;l<ipph;l++){
- t1+=idl1;
- t2-=idl1;
- ar1h=dcp*ar1-dsp*ai1;
- ai1=dcp*ai1+dsp*ar1;
- ar1=ar1h;
- t4=t1;
- t5=t2;
- t6=t3;
- t7=idl1;
-
- for(ik=0;ik<idl1;ik++){
- ch2[t4++]=c2[ik]+ar1*c2[t7++];
- ch2[t5++]=ai1*c2[t6++];
- }
-
- dc2=ar1;
- ds2=ai1;
- ar2=ar1;
- ai2=ai1;
-
- t4=idl1;
- t5=(ipp2-1)*idl1;
- for(j=2;j<ipph;j++){
- t4+=idl1;
- t5-=idl1;
-
- ar2h=dc2*ar2-ds2*ai2;
- ai2=dc2*ai2+ds2*ar2;
- ar2=ar2h;
-
- t6=t1;
- t7=t2;
- t8=t4;
- t9=t5;
- for(ik=0;ik<idl1;ik++){
- ch2[t6++]+=ar2*c2[t8++];
- ch2[t7++]+=ai2*c2[t9++];
- }
- }
- }
-
- t1=0;
- for(j=1;j<ipph;j++){
- t1+=idl1;
- t2=t1;
- for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++];
- }
-
- if(ido<l1)goto L132;
-
- t1=0;
- t2=0;
- for(k=0;k<l1;k++){
- t3=t1;
- t4=t2;
- for(i=0;i<ido;i++)cc[t4++]=ch[t3++];
- t1+=ido;
- t2+=t10;
- }
-
- goto L135;
-
- L132:
- for(i=0;i<ido;i++){
- t1=i;
- t2=i;
- for(k=0;k<l1;k++){
- cc[t2]=ch[t1];
- t1+=ido;
- t2+=t10;
- }
- }
-
- L135:
- t1=0;
- t2=ido<<1;
- t3=0;
- t4=ipp2*t0;
- for(j=1;j<ipph;j++){
-
- t1+=t2;
- t3+=t0;
- t4-=t0;
-
- t5=t1;
- t6=t3;
- t7=t4;
-
- for(k=0;k<l1;k++){
- cc[t5-1]=ch[t6];
- cc[t5]=ch[t7];
- t5+=t10;
- t6+=ido;
- t7+=ido;
- }
- }
-
- if(ido==1)return;
- if(nbd<l1)goto L141;
-
- t1=-ido;
- t3=0;
- t4=0;
- t5=ipp2*t0;
- for(j=1;j<ipph;j++){
- t1+=t2;
- t3+=t2;
- t4+=t0;
- t5-=t0;
- t6=t1;
- t7=t3;
- t8=t4;
- t9=t5;
- for(k=0;k<l1;k++){
- for(i=2;i<ido;i+=2){
- ic=idp2-i;
- cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1];
- cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1];
- cc[i+t7]=ch[i+t8]+ch[i+t9];
- cc[ic+t6]=ch[i+t9]-ch[i+t8];
- }
- t6+=t10;
- t7+=t10;
- t8+=ido;
- t9+=ido;
- }
- }
- return;
-
- L141:
-
- t1=-ido;
- t3=0;
- t4=0;
- t5=ipp2*t0;
- for(j=1;j<ipph;j++){
- t1+=t2;
- t3+=t2;
- t4+=t0;
- t5-=t0;
- for(i=2;i<ido;i+=2){
- t6=idp2+t1-i;
- t7=i+t3;
- t8=i+t4;
- t9=i+t5;
- for(k=0;k<l1;k++){
- cc[t7-1]=ch[t8-1]+ch[t9-1];
- cc[t6-1]=ch[t8-1]-ch[t9-1];
- cc[t7]=ch[t8]+ch[t9];
- cc[t6]=ch[t9]-ch[t8];
- t6+=t10;
- t7+=t10;
- t8+=ido;
- t9+=ido;
- }
- }
- }
-}
-
-static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){
- int i,k1,l1,l2;
- int na,kh,nf;
- int ip,iw,ido,idl1,ix2,ix3;
-
- nf=ifac[1];
- na=1;
- l2=n;
- iw=n;
-
- for(k1=0;k1<nf;k1++){
- kh=nf-k1;
- ip=ifac[kh+1];
- l1=l2/ip;
- ido=n/l2;
- idl1=ido*l1;
- iw-=(ip-1)*ido;
- na=1-na;
-
- if(ip!=4)goto L102;
-
- ix2=iw+ido;
- ix3=ix2+ido;
- if(na!=0)
- dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
- else
- dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
- goto L110;
-
- L102:
- if(ip!=2)goto L104;
- if(na!=0)goto L103;
-
- dradf2(ido,l1,c,ch,wa+iw-1);
- goto L110;
-
- L103:
- dradf2(ido,l1,ch,c,wa+iw-1);
- goto L110;
-
- L104:
- if(ido==1)na=1-na;
- if(na!=0)goto L109;
-
- dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
- na=1;
- goto L110;
-
- L109:
- dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
- na=0;
-
- L110:
- l2=l1;
- }
-
- if(na==1)return;
-
- for(i=0;i<n;i++)c[i]=ch[i];
-}
-
-static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
- int i,k,t0,t1,t2,t3,t4,t5,t6;
- float ti2,tr2;
-
- t0=l1*ido;
-
- t1=0;
- t2=0;
- t3=(ido<<1)-1;
- for(k=0;k<l1;k++){
- ch[t1]=cc[t2]+cc[t3+t2];
- ch[t1+t0]=cc[t2]-cc[t3+t2];
- t2=(t1+=ido)<<1;
- }
-
- if(ido<2)return;
- if(ido==2)goto L105;
-
- t1=0;
- t2=0;
- for(k=0;k<l1;k++){
- t3=t1;
- t5=(t4=t2)+(ido<<1);
- t6=t0+t1;
- for(i=2;i<ido;i+=2){
- t3+=2;
- t4+=2;
- t5-=2;
- t6+=2;
- ch[t3-1]=cc[t4-1]+cc[t5-1];
- tr2=cc[t4-1]-cc[t5-1];
- ch[t3]=cc[t4]-cc[t5];
- ti2=cc[t4]+cc[t5];
- ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2;
- ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2;
- }
- t2=(t1+=ido)<<1;
- }
-
- if(ido%2==1)return;
-
-L105:
- t1=ido-1;
- t2=ido-1;
- for(k=0;k<l1;k++){
- ch[t1]=cc[t2]+cc[t2];
- ch[t1+t0]=-(cc[t2+1]+cc[t2+1]);
- t1+=ido;
- t2+=ido<<1;
- }
-}
-
-static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1,
- float *wa2){
- static float taur = -.5f;
- static float taui = .8660254037844386f;
- int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
- float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2;
- t0=l1*ido;
-
- t1=0;
- t2=t0<<1;
- t3=ido<<1;
- t4=ido+(ido<<1);
- t5=0;
- for(k=0;k<l1;k++){
- tr2=cc[t3-1]+cc[t3-1];
- cr2=cc[t5]+(taur*tr2);
- ch[t1]=cc[t5]+tr2;
- ci3=taui*(cc[t3]+cc[t3]);
- ch[t1+t0]=cr2-ci3;
- ch[t1+t2]=cr2+ci3;
- t1+=ido;
- t3+=t4;
- t5+=t4;
- }
-
- if(ido==1)return;
-
- t1=0;
- t3=ido<<1;
- for(k=0;k<l1;k++){
- t7=t1+(t1<<1);
- t6=(t5=t7+t3);
- t8=t1;
- t10=(t9=t1+t0)+t0;
-
- for(i=2;i<ido;i+=2){
- t5+=2;
- t6-=2;
- t7+=2;
- t8+=2;
- t9+=2;
- t10+=2;
- tr2=cc[t5-1]+cc[t6-1];
- cr2=cc[t7-1]+(taur*tr2);
- ch[t8-1]=cc[t7-1]+tr2;
- ti2=cc[t5]-cc[t6];
- ci2=cc[t7]+(taur*ti2);
- ch[t8]=cc[t7]+ti2;
- cr3=taui*(cc[t5-1]-cc[t6-1]);
- ci3=taui*(cc[t5]+cc[t6]);
- dr2=cr2-ci3;
- dr3=cr2+ci3;
- di2=ci2+cr3;
- di3=ci2-cr3;
- ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2;
- ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2;
- ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3;
- ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3;
- }
- t1+=ido;
- }
-}
-
-static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
- float *wa2,float *wa3){
- static float sqrt2=1.414213562373095f;
- int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
- float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
- t0=l1*ido;
-
- t1=0;
- t2=ido<<2;
- t3=0;
- t6=ido<<1;
- for(k=0;k<l1;k++){
- t4=t3+t6;
- t5=t1;
- tr3=cc[t4-1]+cc[t4-1];
- tr4=cc[t4]+cc[t4];
- tr1=cc[t3]-cc[(t4+=t6)-1];
- tr2=cc[t3]+cc[t4-1];
- ch[t5]=tr2+tr3;
- ch[t5+=t0]=tr1-tr4;
- ch[t5+=t0]=tr2-tr3;
- ch[t5+=t0]=tr1+tr4;
- t1+=ido;
- t3+=t2;
- }
-
- if(ido<2)return;
- if(ido==2)goto L105;
-
- t1=0;
- for(k=0;k<l1;k++){
- t5=(t4=(t3=(t2=t1<<2)+t6))+t6;
- t7=t1;
- for(i=2;i<ido;i+=2){
- t2+=2;
- t3+=2;
- t4-=2;
- t5-=2;
- t7+=2;
- ti1=cc[t2]+cc[t5];
- ti2=cc[t2]-cc[t5];
- ti3=cc[t3]-cc[t4];
- tr4=cc[t3]+cc[t4];
- tr1=cc[t2-1]-cc[t5-1];
- tr2=cc[t2-1]+cc[t5-1];
- ti4=cc[t3-1]-cc[t4-1];
- tr3=cc[t3-1]+cc[t4-1];
- ch[t7-1]=tr2+tr3;
- cr3=tr2-tr3;
- ch[t7]=ti2+ti3;
- ci3=ti2-ti3;
- cr2=tr1-tr4;
- cr4=tr1+tr4;
- ci2=ti1+ti4;
- ci4=ti1-ti4;
-
- ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2;
- ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2;
- ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3;
- ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3;
- ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4;
- ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4;
- }
- t1+=ido;
- }
-
- if(ido%2 == 1)return;
-
- L105:
-
- t1=ido;
- t2=ido<<2;
- t3=ido-1;
- t4=ido+(ido<<1);
- for(k=0;k<l1;k++){
- t5=t3;
- ti1=cc[t1]+cc[t4];
- ti2=cc[t4]-cc[t1];
- tr1=cc[t1-1]-cc[t4-1];
- tr2=cc[t1-1]+cc[t4-1];
- ch[t5]=tr2+tr2;
- ch[t5+=t0]=sqrt2*(tr1-ti1);
- ch[t5+=t0]=ti2+ti2;
- ch[t5+=t0]=-sqrt2*(tr1+ti1);
-
- t3+=ido;
- t1+=t2;
- t4+=t2;
- }
-}
-
-static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
- float *c2,float *ch,float *ch2,float *wa){
- static float tpi=6.283185307179586f;
- int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,
- t11,t12;
- float dc2,ai1,ai2,ar1,ar2,ds2;
- int nbd;
- float dcp,arg,dsp,ar1h,ar2h;
- int ipp2;
-
- t10=ip*ido;
- t0=l1*ido;
- arg=tpi/(float)ip;
- dcp=cos(arg);
- dsp=sin(arg);
- nbd=(ido-1)>>1;
- ipp2=ip;
- ipph=(ip+1)>>1;
- if(ido<l1)goto L103;
-
- t1=0;
- t2=0;
- for(k=0;k<l1;k++){
- t3=t1;
- t4=t2;
- for(i=0;i<ido;i++){
- ch[t3]=cc[t4];
- t3++;
- t4++;
- }
- t1+=ido;
- t2+=t10;
- }
- goto L106;
-
- L103:
- t1=0;
- for(i=0;i<ido;i++){
- t2=t1;
- t3=t1;
- for(k=0;k<l1;k++){
- ch[t2]=cc[t3];
- t2+=ido;
- t3+=t10;
- }
- t1++;
- }
-
- L106:
- t1=0;
- t2=ipp2*t0;
- t7=(t5=ido<<1);
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1;
- t4=t2;
- t6=t5;
- for(k=0;k<l1;k++){
- ch[t3]=cc[t6-1]+cc[t6-1];
- ch[t4]=cc[t6]+cc[t6];
- t3+=ido;
- t4+=ido;
- t6+=t10;
- }
- t5+=t7;
- }
-
- if (ido == 1)goto L116;
- if(nbd<l1)goto L112;
-
- t1=0;
- t2=ipp2*t0;
- t7=0;
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1;
- t4=t2;
-
- t7+=(ido<<1);
- t8=t7;
- for(k=0;k<l1;k++){
- t5=t3;
- t6=t4;
- t9=t8;
- t11=t8;
- for(i=2;i<ido;i+=2){
- t5+=2;
- t6+=2;
- t9+=2;
- t11-=2;
- ch[t5-1]=cc[t9-1]+cc[t11-1];
- ch[t6-1]=cc[t9-1]-cc[t11-1];
- ch[t5]=cc[t9]-cc[t11];
- ch[t6]=cc[t9]+cc[t11];
- }
- t3+=ido;
- t4+=ido;
- t8+=t10;
- }
- }
- goto L116;
-
- L112:
- t1=0;
- t2=ipp2*t0;
- t7=0;
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1;
- t4=t2;
- t7+=(ido<<1);
- t8=t7;
- t9=t7;
- for(i=2;i<ido;i+=2){
- t3+=2;
- t4+=2;
- t8+=2;
- t9-=2;
- t5=t3;
- t6=t4;
- t11=t8;
- t12=t9;
- for(k=0;k<l1;k++){
- ch[t5-1]=cc[t11-1]+cc[t12-1];
- ch[t6-1]=cc[t11-1]-cc[t12-1];
- ch[t5]=cc[t11]-cc[t12];
- ch[t6]=cc[t11]+cc[t12];
- t5+=ido;
- t6+=ido;
- t11+=t10;
- t12+=t10;
- }
- }
- }
-
-L116:
- ar1=1.f;
- ai1=0.f;
- t1=0;
- t9=(t2=ipp2*idl1);
- t3=(ip-1)*idl1;
- for(l=1;l<ipph;l++){
- t1+=idl1;
- t2-=idl1;
-
- ar1h=dcp*ar1-dsp*ai1;
- ai1=dcp*ai1+dsp*ar1;
- ar1=ar1h;
- t4=t1;
- t5=t2;
- t6=0;
- t7=idl1;
- t8=t3;
- for(ik=0;ik<idl1;ik++){
- c2[t4++]=ch2[t6++]+ar1*ch2[t7++];
- c2[t5++]=ai1*ch2[t8++];
- }
- dc2=ar1;
- ds2=ai1;
- ar2=ar1;
- ai2=ai1;
-
- t6=idl1;
- t7=t9-idl1;
- for(j=2;j<ipph;j++){
- t6+=idl1;
- t7-=idl1;
- ar2h=dc2*ar2-ds2*ai2;
- ai2=dc2*ai2+ds2*ar2;
- ar2=ar2h;
- t4=t1;
- t5=t2;
- t11=t6;
- t12=t7;
- for(ik=0;ik<idl1;ik++){
- c2[t4++]+=ar2*ch2[t11++];
- c2[t5++]+=ai2*ch2[t12++];
- }
- }
- }
-
- t1=0;
- for(j=1;j<ipph;j++){
- t1+=idl1;
- t2=t1;
- for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++];
- }
-
- t1=0;
- t2=ipp2*t0;
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1;
- t4=t2;
- for(k=0;k<l1;k++){
- ch[t3]=c1[t3]-c1[t4];
- ch[t4]=c1[t3]+c1[t4];
- t3+=ido;
- t4+=ido;
- }
- }
-
- if(ido==1)goto L132;
- if(nbd<l1)goto L128;
-
- t1=0;
- t2=ipp2*t0;
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1;
- t4=t2;
- for(k=0;k<l1;k++){
- t5=t3;
- t6=t4;
- for(i=2;i<ido;i+=2){
- t5+=2;
- t6+=2;
- ch[t5-1]=c1[t5-1]-c1[t6];
- ch[t6-1]=c1[t5-1]+c1[t6];
- ch[t5]=c1[t5]+c1[t6-1];
- ch[t6]=c1[t5]-c1[t6-1];
- }
- t3+=ido;
- t4+=ido;
- }
- }
- goto L132;
-
- L128:
- t1=0;
- t2=ipp2*t0;
- for(j=1;j<ipph;j++){
- t1+=t0;
- t2-=t0;
- t3=t1;
- t4=t2;
- for(i=2;i<ido;i+=2){
- t3+=2;
- t4+=2;
- t5=t3;
- t6=t4;
- for(k=0;k<l1;k++){
- ch[t5-1]=c1[t5-1]-c1[t6];
- ch[t6-1]=c1[t5-1]+c1[t6];
- ch[t5]=c1[t5]+c1[t6-1];
- ch[t6]=c1[t5]-c1[t6-1];
- t5+=ido;
- t6+=ido;
- }
- }
- }
-
-L132:
- if(ido==1)return;
-
- for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
-
- t1=0;
- for(j=1;j<ip;j++){
- t2=(t1+=t0);
- for(k=0;k<l1;k++){
- c1[t2]=ch[t2];
- t2+=ido;
- }
- }
-
- if(nbd>l1)goto L139;
-
- is= -ido-1;
- t1=0;
- for(j=1;j<ip;j++){
- is+=ido;
- t1+=t0;
- idij=is;
- t2=t1;
- for(i=2;i<ido;i+=2){
- t2+=2;
- idij+=2;
- t3=t2;
- for(k=0;k<l1;k++){
- c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
- c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
- t3+=ido;
- }
- }
- }
- return;
-
- L139:
- is= -ido-1;
- t1=0;
- for(j=1;j<ip;j++){
- is+=ido;
- t1+=t0;
- t2=t1;
- for(k=0;k<l1;k++){
- idij=is;
- t3=t2;
- for(i=2;i<ido;i+=2){
- idij+=2;
- t3+=2;
- c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
- c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
- }
- t2+=ido;
- }
- }
-}
-
-static void drftb1(int n, float *c, float *ch, float *wa, int *ifac){
- int i,k1,l1,l2;
- int na;
- int nf,ip,iw,ix2,ix3,ido,idl1;
-
- nf=ifac[1];
- na=0;
- l1=1;
- iw=1;
-
- for(k1=0;k1<nf;k1++){
- ip=ifac[k1 + 2];
- l2=ip*l1;
- ido=n/l2;
- idl1=ido*l1;
- if(ip!=4)goto L103;
- ix2=iw+ido;
- ix3=ix2+ido;
-
- if(na!=0)
- dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
- else
- dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
- na=1-na;
- goto L115;
-
- L103:
- if(ip!=2)goto L106;
-
- if(na!=0)
- dradb2(ido,l1,ch,c,wa+iw-1);
- else
- dradb2(ido,l1,c,ch,wa+iw-1);
- na=1-na;
- goto L115;
-
- L106:
- if(ip!=3)goto L109;
-
- ix2=iw+ido;
- if(na!=0)
- dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1);
- else
- dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1);
- na=1-na;
- goto L115;
-
- L109:
-/* The radix five case can be translated later..... */
-/* if(ip!=5)goto L112;
-
- ix2=iw+ido;
- ix3=ix2+ido;
- ix4=ix3+ido;
- if(na!=0)
- dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
- else
- dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
- na=1-na;
- goto L115;
-
- L112:*/
- if(na!=0)
- dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
- else
- dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
- if(ido==1)na=1-na;
-
- L115:
- l1=l2;
- iw+=(ip-1)*ido;
- }
-
- if(na==0)return;
-
- for(i=0;i<n;i++)c[i]=ch[i];
-}
-
-void spx_drft_forward(struct drft_lookup *l,float *data){
- if(l->n==1)return;
- drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache);
-}
-
-void spx_drft_backward(struct drft_lookup *l,float *data){
- if (l->n==1)return;
- drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache);
-}
-
-void spx_drft_init(struct drft_lookup *l,int n)
-{
- l->n=n;
- l->trigcache=(float*)speex_alloc(3*n*sizeof(*l->trigcache));
- l->splitcache=(int*)speex_alloc(32*sizeof(*l->splitcache));
- fdrffti(n, l->trigcache, l->splitcache);
-}
-
-void spx_drft_clear(struct drft_lookup *l)
-{
- if(l)
- {
- if(l->trigcache)
- speex_free(l->trigcache);
- if(l->splitcache)
- speex_free(l->splitcache);
- }
-}
diff --git a/drivers/speex/smallft.h b/drivers/speex/smallft.h
deleted file mode 100644
index 446e2f65b..000000000
--- a/drivers/speex/smallft.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the XIPHOPHORUS Company http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: fft transform
- last mod: $Id: smallft.h,v 1.3 2003/09/16 18:35:45 jm Exp $
-
- ********************************************************************/
-/**
- @file smallft.h
- @brief Discrete Rotational Fourier Transform (DRFT)
-*/
-
-#ifndef _V_SMFT_H_
-#define _V_SMFT_H_
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Discrete Rotational Fourier Transform lookup */
-struct drft_lookup{
- int n;
- float *trigcache;
- int *splitcache;
-};
-
-extern void spx_drft_forward(struct drft_lookup *l,float *data);
-extern void spx_drft_backward(struct drft_lookup *l,float *data);
-extern void spx_drft_init(struct drft_lookup *l,int n);
-extern void spx_drft_clear(struct drft_lookup *l);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/drivers/speex/speex.c b/drivers/speex/speex.c
deleted file mode 100644
index a695728c8..000000000
--- a/drivers/speex/speex.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: speex.c
-
- Basic Speex functions
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#include "config.h"
-
-
-#include "modes.h"
-#include <math.h>
-#include "os_support.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define MAX_IN_SAMPLES 640
-
-
-
-EXPORT void *speex_encoder_init(const SpeexMode *mode)
-{
- return mode->enc_init(mode);
-}
-
-EXPORT void *speex_decoder_init(const SpeexMode *mode)
-{
- return mode->dec_init(mode);
-}
-
-EXPORT void speex_encoder_destroy(void *state)
-{
- (*((SpeexMode**)state))->enc_destroy(state);
-}
-
-EXPORT void speex_decoder_destroy(void *state)
-{
- (*((SpeexMode**)state))->dec_destroy(state);
-}
-
-
-
-int speex_encode_native(void *state, spx_word16_t *in, SpeexBits *bits)
-{
- return (*((SpeexMode**)state))->enc(state, in, bits);
-}
-
-int speex_decode_native(void *state, SpeexBits *bits, spx_word16_t *out)
-{
- return (*((SpeexMode**)state))->dec(state, bits, out);
-}
-
-
-
-#ifdef FIXED_POINT
-
-#ifndef DISABLE_FLOAT_API
-EXPORT int speex_encode(void *state, float *in, SpeexBits *bits)
-{
- int i;
- spx_int32_t N;
- spx_int16_t short_in[MAX_IN_SAMPLES];
- speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N);
- for (i=0;i<N;i++)
- {
- if (in[i]>32767.f)
- short_in[i] = 32767;
- else if (in[i]<-32768.f)
- short_in[i] = -32768;
- else
- short_in[i] = (spx_int16_t)floor(.5+in[i]);
- }
- return (*((SpeexMode**)state))->enc(state, short_in, bits);
-}
-#endif /* #ifndef DISABLE_FLOAT_API */
-
-EXPORT int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
-{
- SpeexMode *mode;
- mode = *(SpeexMode**)state;
- return (mode)->enc(state, in, bits);
-}
-
-#ifndef DISABLE_FLOAT_API
-EXPORT int speex_decode(void *state, SpeexBits *bits, float *out)
-{
- int i, ret;
- spx_int32_t N;
- spx_int16_t short_out[MAX_IN_SAMPLES];
- speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N);
- ret = (*((SpeexMode**)state))->dec(state, bits, short_out);
- for (i=0;i<N;i++)
- out[i] = short_out[i];
- return ret;
-}
-#endif /* #ifndef DISABLE_FLOAT_API */
-
-EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
-{
- SpeexMode *mode = *(SpeexMode**)state;
- return (mode)->dec(state, bits, out);
-}
-
-#else
-
-EXPORT int speex_encode(void *state, float *in, SpeexBits *bits)
-{
- return (*((SpeexMode**)state))->enc(state, in, bits);
-}
-
-EXPORT int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
-{
- int i;
- spx_int32_t N;
- float float_in[MAX_IN_SAMPLES];
- speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N);
- for (i=0;i<N;i++)
- float_in[i] = in[i];
- return (*((SpeexMode**)state))->enc(state, float_in, bits);
-}
-
-EXPORT int speex_decode(void *state, SpeexBits *bits, float *out)
-{
- return (*((SpeexMode**)state))->dec(state, bits, out);
-}
-
-EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
-{
- int i;
- spx_int32_t N;
- float float_out[MAX_IN_SAMPLES];
- int ret;
- speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N);
- ret = (*((SpeexMode**)state))->dec(state, bits, float_out);
- for (i=0;i<N;i++)
- {
- if (float_out[i]>32767.f)
- out[i] = 32767;
- else if (float_out[i]<-32768.f)
- out[i] = -32768;
- else
- out[i] = (spx_int16_t)floor(.5+float_out[i]);
- }
- return ret;
-}
-#endif
-
-
-
-EXPORT int speex_encoder_ctl(void *state, int request, void *ptr)
-{
- return (*((SpeexMode**)state))->enc_ctl(state, request, ptr);
-}
-
-EXPORT int speex_decoder_ctl(void *state, int request, void *ptr)
-{
- return (*((SpeexMode**)state))->dec_ctl(state, request, ptr);
-}
-
-
-
-int nb_mode_query(const void *mode, int request, void *ptr)
-{
- const SpeexNBMode *m = (const SpeexNBMode*)mode;
-
- switch (request)
- {
- case SPEEX_MODE_FRAME_SIZE:
- *((int*)ptr)=m->frameSize;
- break;
- case SPEEX_SUBMODE_BITS_PER_FRAME:
- if (*((int*)ptr)==0)
- *((int*)ptr) = NB_SUBMODE_BITS+1;
- else if (m->submodes[*((int*)ptr)]==NULL)
- *((int*)ptr) = -1;
- else
- *((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
- break;
- default:
- speex_warning_int("Unknown nb_mode_query request: ", request);
- return -1;
- }
- return 0;
-}
-
-
-
-EXPORT int speex_lib_ctl(int request, void *ptr)
-{
- switch (request)
- {
- case SPEEX_LIB_GET_MAJOR_VERSION:
- *((int*)ptr) = SPEEX_MAJOR_VERSION;
- break;
- case SPEEX_LIB_GET_MINOR_VERSION:
- *((int*)ptr) = SPEEX_MINOR_VERSION;
- break;
- case SPEEX_LIB_GET_MICRO_VERSION:
- *((int*)ptr) = SPEEX_MICRO_VERSION;
- break;
- case SPEEX_LIB_GET_EXTRA_VERSION:
- *((const char**)ptr) = SPEEX_EXTRA_VERSION;
- break;
- case SPEEX_LIB_GET_VERSION_STRING:
- *((const char**)ptr) = SPEEX_VERSION;
- break;
- /*case SPEEX_LIB_SET_ALLOC_FUNC:
- break;
- case SPEEX_LIB_GET_ALLOC_FUNC:
- break;
- case SPEEX_LIB_SET_FREE_FUNC:
- break;
- case SPEEX_LIB_GET_FREE_FUNC:
- break;*/
- default:
- speex_warning_int("Unknown wb_mode_query request: ", request);
- return -1;
- }
- return 0;
-}
diff --git a/drivers/speex/speex.h b/drivers/speex/speex.h
deleted file mode 100644
index 82ba01623..000000000
--- a/drivers/speex/speex.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin*/
-/**
- @file speex.h
- @brief Describes the different modes of the codec
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef SPEEX_H
-#define SPEEX_H
-/** @defgroup Codec Speex encoder and decoder
- * This is the Speex codec itself.
- * @{
- */
-
-#include "speex/speex_bits.h"
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Values allowed for *ctl() requests */
-
-/** Set enhancement on/off (decoder only) */
-#define SPEEX_SET_ENH 0
-/** Get enhancement state (decoder only) */
-#define SPEEX_GET_ENH 1
-
-/*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/
-/** Obtain frame size used by encoder/decoder */
-#define SPEEX_GET_FRAME_SIZE 3
-
-/** Set quality value */
-#define SPEEX_SET_QUALITY 4
-/** Get current quality setting */
-/* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */
-
-/** Set sub-mode to use */
-#define SPEEX_SET_MODE 6
-/** Get current sub-mode in use */
-#define SPEEX_GET_MODE 7
-
-/** Set low-band sub-mode to use (wideband only)*/
-#define SPEEX_SET_LOW_MODE 8
-/** Get current low-band mode in use (wideband only)*/
-#define SPEEX_GET_LOW_MODE 9
-
-/** Set high-band sub-mode to use (wideband only)*/
-#define SPEEX_SET_HIGH_MODE 10
-/** Get current high-band mode in use (wideband only)*/
-#define SPEEX_GET_HIGH_MODE 11
-
-/** Set VBR on (1) or off (0) */
-#define SPEEX_SET_VBR 12
-/** Get VBR status (1 for on, 0 for off) */
-#define SPEEX_GET_VBR 13
-
-/** Set quality value for VBR encoding (0-10) */
-#define SPEEX_SET_VBR_QUALITY 14
-/** Get current quality value for VBR encoding (0-10) */
-#define SPEEX_GET_VBR_QUALITY 15
-
-/** Set complexity of the encoder (0-10) */
-#define SPEEX_SET_COMPLEXITY 16
-/** Get current complexity of the encoder (0-10) */
-#define SPEEX_GET_COMPLEXITY 17
-
-/** Set bit-rate used by the encoder (or lower) */
-#define SPEEX_SET_BITRATE 18
-/** Get current bit-rate used by the encoder or decoder */
-#define SPEEX_GET_BITRATE 19
-
-/** Define a handler function for in-band Speex request*/
-#define SPEEX_SET_HANDLER 20
-
-/** Define a handler function for in-band user-defined request*/
-#define SPEEX_SET_USER_HANDLER 22
-
-/** Set sampling rate used in bit-rate computation */
-#define SPEEX_SET_SAMPLING_RATE 24
-/** Get sampling rate used in bit-rate computation */
-#define SPEEX_GET_SAMPLING_RATE 25
-
-/** Reset the encoder/decoder memories to zero*/
-#define SPEEX_RESET_STATE 26
-
-/** Get VBR info (mostly used internally) */
-#define SPEEX_GET_RELATIVE_QUALITY 29
-
-/** Set VAD status (1 for on, 0 for off) */
-#define SPEEX_SET_VAD 30
-
-/** Get VAD status (1 for on, 0 for off) */
-#define SPEEX_GET_VAD 31
-
-/** Set Average Bit-Rate (ABR) to n bits per seconds */
-#define SPEEX_SET_ABR 32
-/** Get Average Bit-Rate (ABR) setting (in bps) */
-#define SPEEX_GET_ABR 33
-
-/** Set DTX status (1 for on, 0 for off) */
-#define SPEEX_SET_DTX 34
-/** Get DTX status (1 for on, 0 for off) */
-#define SPEEX_GET_DTX 35
-
-/** Set submode encoding in each frame (1 for yes, 0 for no, setting to no breaks the standard) */
-#define SPEEX_SET_SUBMODE_ENCODING 36
-/** Get submode encoding in each frame */
-#define SPEEX_GET_SUBMODE_ENCODING 37
-
-/*#define SPEEX_SET_LOOKAHEAD 38*/
-/** Returns the lookahead used by Speex */
-#define SPEEX_GET_LOOKAHEAD 39
-
-/** Sets tuning for packet-loss concealment (expected loss rate) */
-#define SPEEX_SET_PLC_TUNING 40
-/** Gets tuning for PLC */
-#define SPEEX_GET_PLC_TUNING 41
-
-/** Sets the max bit-rate allowed in VBR mode */
-#define SPEEX_SET_VBR_MAX_BITRATE 42
-/** Gets the max bit-rate allowed in VBR mode */
-#define SPEEX_GET_VBR_MAX_BITRATE 43
-
-/** Turn on/off input/output high-pass filtering */
-#define SPEEX_SET_HIGHPASS 44
-/** Get status of input/output high-pass filtering */
-#define SPEEX_GET_HIGHPASS 45
-
-/** Get "activity level" of the last decoded frame, i.e.
- how much damage we cause if we remove the frame */
-#define SPEEX_GET_ACTIVITY 47
-
-
-/* Preserving compatibility:*/
-/** Equivalent to SPEEX_SET_ENH */
-#define SPEEX_SET_PF 0
-/** Equivalent to SPEEX_GET_ENH */
-#define SPEEX_GET_PF 1
-
-
-
-
-/* Values allowed for mode queries */
-/** Query the frame size of a mode */
-#define SPEEX_MODE_FRAME_SIZE 0
-
-/** Query the size of an encoded frame for a particular sub-mode */
-#define SPEEX_SUBMODE_BITS_PER_FRAME 1
-
-
-
-/** Get major Speex version */
-#define SPEEX_LIB_GET_MAJOR_VERSION 1
-/** Get minor Speex version */
-#define SPEEX_LIB_GET_MINOR_VERSION 3
-/** Get micro Speex version */
-#define SPEEX_LIB_GET_MICRO_VERSION 5
-/** Get extra Speex version */
-#define SPEEX_LIB_GET_EXTRA_VERSION 7
-/** Get Speex version string */
-#define SPEEX_LIB_GET_VERSION_STRING 9
-
-/*#define SPEEX_LIB_SET_ALLOC_FUNC 10
-#define SPEEX_LIB_GET_ALLOC_FUNC 11
-#define SPEEX_LIB_SET_FREE_FUNC 12
-#define SPEEX_LIB_GET_FREE_FUNC 13
-
-#define SPEEX_LIB_SET_WARNING_FUNC 14
-#define SPEEX_LIB_GET_WARNING_FUNC 15
-#define SPEEX_LIB_SET_ERROR_FUNC 16
-#define SPEEX_LIB_GET_ERROR_FUNC 17
-*/
-
-/** Number of defined modes in Speex */
-#define SPEEX_NB_MODES 3
-
-/** modeID for the defined narrowband mode */
-#define SPEEX_MODEID_NB 0
-
-/** modeID for the defined wideband mode */
-#define SPEEX_MODEID_WB 1
-
-/** modeID for the defined ultra-wideband mode */
-#define SPEEX_MODEID_UWB 2
-
-struct SpeexMode;
-
-
-/* Prototypes for mode function pointers */
-
-/** Encoder state initialization function */
-typedef void *(*encoder_init_func)(const struct SpeexMode *mode);
-
-/** Encoder state destruction function */
-typedef void (*encoder_destroy_func)(void *st);
-
-/** Main encoding function */
-typedef int (*encode_func)(void *state, void *in, SpeexBits *bits);
-
-/** Function for controlling the encoder options */
-typedef int (*encoder_ctl_func)(void *state, int request, void *ptr);
-
-/** Decoder state initialization function */
-typedef void *(*decoder_init_func)(const struct SpeexMode *mode);
-
-/** Decoder state destruction function */
-typedef void (*decoder_destroy_func)(void *st);
-
-/** Main decoding function */
-typedef int (*decode_func)(void *state, SpeexBits *bits, void *out);
-
-/** Function for controlling the decoder options */
-typedef int (*decoder_ctl_func)(void *state, int request, void *ptr);
-
-
-/** Query function for a mode */
-typedef int (*mode_query_func)(const void *mode, int request, void *ptr);
-
-/** Struct defining a Speex mode */
-typedef struct SpeexMode {
- /** Pointer to the low-level mode data */
- const void *mode;
-
- /** Pointer to the mode query function */
- mode_query_func query;
-
- /** The name of the mode (you should not rely on this to identify the mode)*/
- const char *modeName;
-
- /**ID of the mode*/
- int modeID;
-
- /**Version number of the bitstream (incremented every time we break
- bitstream compatibility*/
- int bitstream_version;
-
- /** Pointer to encoder initialization function */
- encoder_init_func enc_init;
-
- /** Pointer to encoder destruction function */
- encoder_destroy_func enc_destroy;
-
- /** Pointer to frame encoding function */
- encode_func enc;
-
- /** Pointer to decoder initialization function */
- decoder_init_func dec_init;
-
- /** Pointer to decoder destruction function */
- decoder_destroy_func dec_destroy;
-
- /** Pointer to frame decoding function */
- decode_func dec;
-
- /** ioctl-like requests for encoder */
- encoder_ctl_func enc_ctl;
-
- /** ioctl-like requests for decoder */
- decoder_ctl_func dec_ctl;
-
-} SpeexMode;
-
-/**
- * Returns a handle to a newly created Speex encoder state structure. For now,
- * the "mode" argument can be &nb_mode or &wb_mode . In the future, more modes
- * may be added. Note that for now if you have more than one channels to
- * encode, you need one state per channel.
- *
- * @param mode The mode to use (either speex_nb_mode or speex_wb.mode)
- * @return A newly created encoder state or NULL if state allocation fails
- */
-void *speex_encoder_init(const SpeexMode *mode);
-
-/** Frees all resources associated to an existing Speex encoder state.
- * @param state Encoder state to be destroyed */
-void speex_encoder_destroy(void *state);
-
-/** Uses an existing encoder state to encode one frame of speech pointed to by
- "in". The encoded bit-stream is saved in "bits".
- @param state Encoder state
- @param in Frame that will be encoded with a +-2^15 range. This data MAY be
- overwritten by the encoder and should be considered uninitialised
- after the call.
- @param bits Bit-stream where the data will be written
- @return 0 if frame needs not be transmitted (DTX only), 1 otherwise
- */
-int speex_encode(void *state, float *in, SpeexBits *bits);
-
-/** Uses an existing encoder state to encode one frame of speech pointed to by
- "in". The encoded bit-stream is saved in "bits".
- @param state Encoder state
- @param in Frame that will be encoded with a +-2^15 range
- @param bits Bit-stream where the data will be written
- @return 0 if frame needs not be transmitted (DTX only), 1 otherwise
- */
-int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits);
-
-/** Used like the ioctl function to control the encoder parameters
- *
- * @param state Encoder state
- * @param request ioctl-type request (one of the SPEEX_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
- */
-int speex_encoder_ctl(void *state, int request, void *ptr);
-
-
-/** Returns a handle to a newly created decoder state structure. For now,
- * the mode argument can be &nb_mode or &wb_mode . In the future, more modes
- * may be added. Note that for now if you have more than one channels to
- * decode, you need one state per channel.
- *
- * @param mode Speex mode (one of speex_nb_mode or speex_wb_mode)
- * @return A newly created decoder state or NULL if state allocation fails
- */
-void *speex_decoder_init(const SpeexMode *mode);
-
-/** Frees all resources associated to an existing decoder state.
- *
- * @param state State to be destroyed
- */
-void speex_decoder_destroy(void *state);
-
-/** Uses an existing decoder state to decode one frame of speech from
- * bit-stream bits. The output speech is saved written to out.
- *
- * @param state Decoder state
- * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
- * @param out Where to write the decoded frame
- * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
- */
-int speex_decode(void *state, SpeexBits *bits, float *out);
-
-/** Uses an existing decoder state to decode one frame of speech from
- * bit-stream bits. The output speech is saved written to out.
- *
- * @param state Decoder state
- * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
- * @param out Where to write the decoded frame
- * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
- */
-int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out);
-
-/** Used like the ioctl function to control the encoder parameters
- *
- * @param state Decoder state
- * @param request ioctl-type request (one of the SPEEX_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
- */
-int speex_decoder_ctl(void *state, int request, void *ptr);
-
-
-/** Query function for mode information
- *
- * @param mode Speex mode
- * @param request ioctl-type request (one of the SPEEX_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
- */
-int speex_mode_query(const SpeexMode *mode, int request, void *ptr);
-
-/** Functions for controlling the behavior of libspeex
- * @param request ioctl-type request (one of the SPEEX_LIB_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
- */
-int speex_lib_ctl(int request, void *ptr);
-
-/** Default narrowband mode */
-extern const SpeexMode speex_nb_mode;
-
-/** Default wideband mode */
-extern const SpeexMode speex_wb_mode;
-
-/** Default "ultra-wideband" mode */
-extern const SpeexMode speex_uwb_mode;
-
-/** List of all modes available */
-extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES];
-
-/** Obtain one of the modes available */
-const SpeexMode * speex_lib_get_mode (int mode);
-
-#ifndef WIN32
-/* We actually override the function in the narrowband case so that we can avoid linking in the wideband stuff */
-#define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode))
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-#endif
diff --git a/drivers/speex/speex_bind.cpp b/drivers/speex/speex_bind.cpp
deleted file mode 100644
index d15bb3da8..000000000
--- a/drivers/speex/speex_bind.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-#include "memory.h"
-#include "speex_bind.h"
-#include
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void *speex_alloc (int size) {
-
- uint8_t * mem = (uint8_t*)memalloc(size);
- for(int i=0;i<size;i++)
- mem[i]=0;
- return mem;
-}
-
-void *speex_alloc_scratch (int size) {
-
- return memalloc(size);
-}
-
-void *speex_realloc (void *ptr, int size) {
-
- return memrealloc(ptr,size);
-}
-
-void speex_free (void *ptr) {
-
- memfree(ptr);
-}
-
-void speex_free_scratch (void *ptr) {
-
- memfree(ptr);
-}
-
-void _speex_fatal(const char *str, const char *file, int line) {
-
- _err_print_error("SPEEX ERROR",p_file,p_line,str);
-}
-
-void speex_warning(const char *str) {
-
- _err_print_error("SPEEX WARNING","",0,str);
-}
-
-void speex_warning_int(const char *str, int val) {
-
- _err_print_error("SPEEX WARNING INT","Value",val,str);
-}
-
-void speex_notify(const char *str) {
-
- print_line(str);
-}
-
-void _speex_putc(int ch, void *file) {
-
- // will not putc, no.
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/drivers/speex/speex_bind.h b/drivers/speex/speex_bind.h
deleted file mode 100644
index c928430a3..000000000
--- a/drivers/speex/speex_bind.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef SPEEX_BIND_H
-#define SPEEX_BIND_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-#define OVERRIDE_SPEEX_ALLOC
-#define OVERRIDE_SPEEX_ALLOC_SCRATCH
-#define OVERRIDE_SPEEX_REALLOC
-#define OVERRIDE_SPEEX_FREE
-#define OVERRIDE_SPEEX_FREE_SCRATCH
-#define OVERRIDE_SPEEX_FATAL
-#define OVERRIDE_SPEEX_WARNING
-#define OVERRIDE_SPEEX_WARNING_INT
-#define OVERRIDE_SPEEX_NOTIFY
-#define OVERRIDE_SPEEX_PUTC
-
-void *speex_alloc (int size);
-void *speex_alloc_scratch (int size);
-void *speex_realloc (void *ptr, int size);
-void speex_free (void *ptr);
-void speex_free_scratch (void *ptr);
-void _speex_fatal(const char *str, const char *file, int line);
-void speex_warning(const char *str);
-void speex_warning_int(const char *str, int val);
-void speex_notify(const char *str);
-void _speex_putc(int ch, void *file);
-
-
-*/
-#define RELEASE
-#define SPEEX_PI 3.14159265358979323846
-
-#ifdef _MSC_VER
-#define SPEEX_INLINE __inline
-#else
-#define SPEEX_INLINE inline
-#endif
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SPEEX_BIND_H
diff --git a/drivers/speex/speex_bits.h b/drivers/speex/speex_bits.h
deleted file mode 100644
index a26fb4ce0..000000000
--- a/drivers/speex/speex_bits.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file speex_bits.h
- @brief Handles bit packing/unpacking
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef BITS_H
-#define BITS_H
-/** @defgroup SpeexBits SpeexBits: Bit-stream manipulations
- * This is the structure that holds the bit-stream when encoding or decoding
- * with Speex. It allows some manipulations as well.
- * @{
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Bit-packing data structure representing (part of) a bit-stream. */
-typedef struct SpeexBits {
- char *chars; /**< "raw" data */
- int nbBits; /**< Total number of bits stored in the stream*/
- int charPtr; /**< Position of the byte "cursor" */
- int bitPtr; /**< Position of the bit "cursor" within the current char */
- int owner; /**< Does the struct "own" the "raw" buffer (member "chars") */
- int overflow;/**< Set to one if we try to read past the valid data */
- int buf_size;/**< Allocated size for buffer */
- int reserved1; /**< Reserved for future use */
- void *reserved2; /**< Reserved for future use */
-} SpeexBits;
-
-/** Initializes and allocates resources for a SpeexBits struct */
-void speex_bits_init(SpeexBits *bits);
-
-/** Initializes SpeexBits struct using a pre-allocated buffer*/
-void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size);
-
-/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */
-void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size);
-
-/** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/
-void speex_bits_destroy(SpeexBits *bits);
-
-/** Resets bits to initial value (just after initialization, erasing content)*/
-void speex_bits_reset(SpeexBits *bits);
-
-/** Rewind the bit-stream to the beginning (ready for read) without erasing the content */
-void speex_bits_rewind(SpeexBits *bits);
-
-/** Initializes the bit-stream from the data in an area of memory */
-void speex_bits_read_from(SpeexBits *bits, char *bytes, int len);
-
-/** Append bytes to the bit-stream
- *
- * @param bits Bit-stream to operate on
- * @param bytes pointer to the bytes what will be appended
- * @param len Number of bytes of append
- */
-void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len);
-
-/** Write the content of a bit-stream to an area of memory
- *
- * @param bits Bit-stream to operate on
- * @param bytes Memory location where to write the bits
- * @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer)
- * @return Number of bytes written to the "bytes" buffer
-*/
-int speex_bits_write(SpeexBits *bits, char *bytes, int max_len);
-
-/** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream */
-int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len);
-
-/** Append bits to the bit-stream
- * @param bits Bit-stream to operate on
- * @param data Value to append as integer
- * @param nbBits number of bits to consider in "data"
- */
-void speex_bits_pack(SpeexBits *bits, int data, int nbBits);
-
-/** Interpret the next bits in the bit-stream as a signed integer
- *
- * @param bits Bit-stream to operate on
- * @param nbBits Number of bits to interpret
- * @return A signed integer represented by the bits read
- */
-int speex_bits_unpack_signed(SpeexBits *bits, int nbBits);
-
-/** Interpret the next bits in the bit-stream as an unsigned integer
- *
- * @param bits Bit-stream to operate on
- * @param nbBits Number of bits to interpret
- * @return An unsigned integer represented by the bits read
- */
-unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits);
-
-/** Returns the number of bytes in the bit-stream, including the last one even if it is not "full"
- *
- * @param bits Bit-stream to operate on
- * @return Number of bytes in the stream
- */
-int speex_bits_nbytes(SpeexBits *bits);
-
-/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position
- *
- * @param bits Bit-stream to operate on
- * @param nbBits Number of bits to look for
- * @return Value of the bits peeked, interpreted as unsigned
- */
-unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits);
-
-/** Get the value of the next bit in the stream, without modifying the
- * "cursor" position
- *
- * @param bits Bit-stream to operate on
- * @return Value of the bit peeked (one bit only)
- */
-int speex_bits_peek(SpeexBits *bits);
-
-/** Advances the position of the "bit cursor" in the stream
- *
- * @param bits Bit-stream to operate on
- * @param n Number of bits to advance
- */
-void speex_bits_advance(SpeexBits *bits, int n);
-
-/** Returns the number of bits remaining to be read in a stream
- *
- * @param bits Bit-stream to operate on
- * @return Number of bits that can still be read from the stream
- */
-int speex_bits_remaining(SpeexBits *bits);
-
-/** Insert a terminator so that the data can be sent as a packet while auto-detecting
- * the number of frames in each packet
- *
- * @param bits Bit-stream to operate on
- */
-void speex_bits_insert_terminator(SpeexBits *bits);
-
-#ifdef __cplusplus
-}
-#endif
-
-/* @} */
-#endif
diff --git a/drivers/speex/speex_buffer.h b/drivers/speex/speex_buffer.h
deleted file mode 100644
index df56f5f18..000000000
--- a/drivers/speex/speex_buffer.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-
- File: speex_buffer.h
- This is a very simple ring buffer implementation. It is not thread-safe
- so you need to do your own locking.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SPEEX_BUFFER_H
-#define SPEEX_BUFFER_H
-
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct SpeexBuffer_;
-typedef struct SpeexBuffer_ SpeexBuffer;
-
-SpeexBuffer *speex_buffer_init(int size);
-
-void speex_buffer_destroy(SpeexBuffer *st);
-
-int speex_buffer_write(SpeexBuffer *st, void *data, int len);
-
-int speex_buffer_writezeros(SpeexBuffer *st, int len);
-
-int speex_buffer_read(SpeexBuffer *st, void *data, int len);
-
-int speex_buffer_get_available(SpeexBuffer *st);
-
-int speex_buffer_resize(SpeexBuffer *st, int len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
-
diff --git a/drivers/speex/speex_callbacks.c b/drivers/speex/speex_callbacks.c
deleted file mode 100644
index 0b5eaaae6..000000000
--- a/drivers/speex/speex_callbacks.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File speex_callbacks.c
- Callback handling and in-band signalling
-
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#include "config.h"
-
-
-#include <speex/speex_callbacks.h>
-#include "arch.h"
-#include "os_support.h"
-
-EXPORT int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
-{
- int id;
- SpeexCallback *callback;
- /*speex_bits_advance(bits, 5);*/
- id=speex_bits_unpack_unsigned(bits, 4);
- callback = callback_list+id;
-
- if (callback->func)
- {
- return callback->func(bits, state, callback->data);
- } else
- /*If callback is not registered, skip the right number of bits*/
- {
- int adv;
- if (id<2)
- adv = 1;
- else if (id<8)
- adv = 4;
- else if (id<10)
- adv = 8;
- else if (id<12)
- adv = 16;
- else if (id<14)
- adv = 32;
- else
- adv = 64;
- speex_bits_advance(bits, adv);
- }
- return 0;
-}
-
-EXPORT int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
-{
- spx_int32_t m;
- m = speex_bits_unpack_unsigned(bits, 4);
- speex_encoder_ctl(data, SPEEX_SET_MODE, &m);
- return 0;
-}
-
-EXPORT int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
-{
- spx_int32_t m;
- m = speex_bits_unpack_unsigned(bits, 4);
- speex_encoder_ctl(data, SPEEX_SET_LOW_MODE, &m);
- return 0;
-}
-
-EXPORT int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data)
-{
- spx_int32_t m;
- m = speex_bits_unpack_unsigned(bits, 4);
- speex_encoder_ctl(data, SPEEX_SET_HIGH_MODE, &m);
- return 0;
-}
-
-#ifndef DISABLE_VBR
-EXPORT int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
-{
- spx_int32_t vbr;
- vbr = speex_bits_unpack_unsigned(bits, 1);
- speex_encoder_ctl(data, SPEEX_SET_VBR, &vbr);
- return 0;
-}
-#endif /* #ifndef DISABLE_VBR */
-
-EXPORT int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
-{
- spx_int32_t enh;
- enh = speex_bits_unpack_unsigned(bits, 1);
- speex_decoder_ctl(data, SPEEX_SET_ENH, &enh);
- return 0;
-}
-
-#ifndef DISABLE_VBR
-EXPORT int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data)
-{
- float qual;
- qual = speex_bits_unpack_unsigned(bits, 4);
- speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual);
- return 0;
-}
-#endif /* #ifndef DISABLE_VBR */
-
-EXPORT int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
-{
- unsigned char ch;
- ch = speex_bits_unpack_unsigned(bits, 8);
- _speex_putc(ch, data);
- /*printf("speex_std_char_handler ch=%x\n", ch);*/
- return 0;
-}
-
-
-
-/* Default handler for user callbacks: skip it */
-EXPORT int speex_default_user_handler(SpeexBits *bits, void *state, void *data)
-{
- int req_size = speex_bits_unpack_unsigned(bits, 4);
- speex_bits_advance(bits, 5+8*req_size);
- return 0;
-}
diff --git a/drivers/speex/speex_callbacks.h b/drivers/speex/speex_callbacks.h
deleted file mode 100644
index 6f450b3a3..000000000
--- a/drivers/speex/speex_callbacks.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin*/
-/**
- @file speex_callbacks.h
- @brief Describes callback handling and in-band signalling
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef SPEEX_CALLBACKS_H
-#define SPEEX_CALLBACKS_H
-/** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder.
- * @{
- */
-
-#include "speex.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Total number of callbacks */
-#define SPEEX_MAX_CALLBACKS 16
-
-/* Describes all the in-band requests */
-
-/*These are 1-bit requests*/
-/** Request for perceptual enhancement (1 for on, 0 for off) */
-#define SPEEX_INBAND_ENH_REQUEST 0
-/** Reserved */
-#define SPEEX_INBAND_RESERVED1 1
-
-/*These are 4-bit requests*/
-/** Request for a mode change */
-#define SPEEX_INBAND_MODE_REQUEST 2
-/** Request for a low mode change */
-#define SPEEX_INBAND_LOW_MODE_REQUEST 3
-/** Request for a high mode change */
-#define SPEEX_INBAND_HIGH_MODE_REQUEST 4
-/** Request for VBR (1 on, 0 off) */
-#define SPEEX_INBAND_VBR_QUALITY_REQUEST 5
-/** Request to be sent acknowledge */
-#define SPEEX_INBAND_ACKNOWLEDGE_REQUEST 6
-/** Request for VBR (1 for on, 0 for off) */
-#define SPEEX_INBAND_VBR_REQUEST 7
-
-/*These are 8-bit requests*/
-/** Send a character in-band */
-#define SPEEX_INBAND_CHAR 8
-/** Intensity stereo information */
-#define SPEEX_INBAND_STEREO 9
-
-/*These are 16-bit requests*/
-/** Transmit max bit-rate allowed */
-#define SPEEX_INBAND_MAX_BITRATE 10
-
-/*These are 32-bit requests*/
-/** Acknowledge packet reception */
-#define SPEEX_INBAND_ACKNOWLEDGE 12
-
-/** Callback function type */
-typedef int (*speex_callback_func)(SpeexBits *bits, void *state, void *data);
-
-/** Callback information */
-typedef struct SpeexCallback {
- int callback_id; /**< ID associated to the callback */
- speex_callback_func func; /**< Callback handler function */
- void *data; /**< Data that will be sent to the handler */
- void *reserved1; /**< Reserved for future use */
- int reserved2; /**< Reserved for future use */
-} SpeexCallback;
-
-/** Handle in-band request */
-int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state);
-
-/** Standard handler for mode request (change mode, no questions asked) */
-int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for high mode request (change high mode, no questions asked) */
-int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for in-band characters (write to stderr) */
-int speex_std_char_handler(SpeexBits *bits, void *state, void *data);
-
-/** Default handler for user-defined requests: in this case, just ignore */
-int speex_default_user_handler(SpeexBits *bits, void *state, void *data);
-
-
-
-/** Standard handler for low mode request (change low mode, no questions asked) */
-int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for VBR request (Set VBR, no questions asked) */
-int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for enhancer request (Turn enhancer on/off, no questions asked) */
-int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for VBR quality request (Set VBR quality, no questions asked) */
-int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @} */
-#endif
diff --git a/drivers/speex/speex_config_types.h b/drivers/speex/speex_config_types.h
deleted file mode 100644
index bd548546b..000000000
--- a/drivers/speex/speex_config_types.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __SPEEX_TYPES_H__
-#define __SPEEX_TYPES_H__
-
-/* these are filled in by configure */
-typedef short spx_int16_t;
-typedef unsigned short spx_uint16_t;
-typedef int spx_int32_t;
-typedef unsigned int spx_uint32_t;
-
-#endif
-
diff --git a/drivers/speex/speex_echo.h b/drivers/speex/speex_echo.h
deleted file mode 100644
index 53bcd28a1..000000000
--- a/drivers/speex/speex_echo.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Copyright (C) Jean-Marc Valin */
-/**
- @file speex_echo.h
- @brief Echo cancellation
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SPEEX_ECHO_H
-#define SPEEX_ECHO_H
-/** @defgroup SpeexEchoState SpeexEchoState: Acoustic echo canceller
- * This is the acoustic echo canceller module.
- * @{
- */
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Obtain frame size used by the AEC */
-#define SPEEX_ECHO_GET_FRAME_SIZE 3
-
-/** Set sampling rate */
-#define SPEEX_ECHO_SET_SAMPLING_RATE 24
-/** Get sampling rate */
-#define SPEEX_ECHO_GET_SAMPLING_RATE 25
-
-/* Can't set window sizes */
-/** Get size of impulse response (int32) */
-#define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27
-
-/* Can't set window content */
-/** Get impulse response (int32[]) */
-#define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29
-
-/** Internal echo canceller state. Should never be accessed directly. */
-struct SpeexEchoState_;
-
-/** @class SpeexEchoState
- * This holds the state of the echo canceller. You need one per channel.
-*/
-
-/** Internal echo canceller state. Should never be accessed directly. */
-typedef struct SpeexEchoState_ SpeexEchoState;
-
-/** Creates a new echo canceller state
- * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
- * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
- * @return Newly-created echo canceller state
- */
-SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
-
-/** Creates a new multi-channel echo canceller state
- * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
- * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
- * @param nb_mic Number of microphone channels
- * @param nb_speakers Number of speaker channels
- * @return Newly-created echo canceller state
- */
-SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers);
-
-/** Destroys an echo canceller state
- * @param st Echo canceller state
-*/
-void speex_echo_state_destroy(SpeexEchoState *st);
-
-/** Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added
- * to playback in this form)
- *
- * @param st Echo canceller state
- * @param rec Signal from the microphone (near end + far end echo)
- * @param play Signal played to the speaker (received from far end)
- * @param out Returns near-end signal with echo removed
- */
-void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out);
-
-/** Performs echo cancellation a frame (deprecated) */
-void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout);
-
-/** Perform echo cancellation using internal playback buffer, which is delayed by two frames
- * to account for the delay introduced by most soundcards (but it could be off!)
- * @param st Echo canceller state
- * @param rec Signal from the microphone (near end + far end echo)
- * @param out Returns near-end signal with echo removed
-*/
-void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out);
-
-/** Let the echo canceller know that a frame was just queued to the soundcard
- * @param st Echo canceller state
- * @param play Signal played to the speaker (received from far end)
-*/
-void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
-
-/** Reset the echo canceller to its original state
- * @param st Echo canceller state
- */
-void speex_echo_state_reset(SpeexEchoState *st);
-
-/** Used like the ioctl function to control the echo canceller parameters
- *
- * @param st Echo canceller state
- * @param request ioctl-type request (one of the SPEEX_ECHO_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown
- */
-int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
-
-
-
-struct SpeexDecorrState_;
-
-typedef struct SpeexDecorrState_ SpeexDecorrState;
-
-
-/** Create a state for the channel decorrelation algorithm
- This is useful for multi-channel echo cancellation only
- * @param rate Sampling rate
- * @param channels Number of channels (it's a bit pointless if you don't have at least 2)
- * @param frame_size Size of the frame to process at ones (counting samples *per* channel)
-*/
-SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size);
-
-/** Remove correlation between the channels by modifying the phase and possibly
- adding noise in a way that is not (or little) perceptible.
- * @param st Decorrelator state
- * @param in Input audio in interleaved format
- * @param out Result of the decorrelation (out *may* alias in)
- * @param strength How much alteration of the audio to apply from 0 to 100.
-*/
-void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength);
-
-/** Destroy a Decorrelation state
- * @param st State to destroy
-*/
-void speex_decorrelate_destroy(SpeexDecorrState *st);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/** @}*/
-#endif
diff --git a/drivers/speex/speex_header.c b/drivers/speex/speex_header.c
deleted file mode 100644
index 279262398..000000000
--- a/drivers/speex/speex_header.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: speex_header.c
- Describes the Speex header
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#include "config.h"
-
-
-#include "arch.h"
-#include <speex/speex_header.h>
-#include <speex/speex.h>
-#include "os_support.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/** Convert little endian */
-static SPEEX_INLINE spx_int32_t le_int(spx_int32_t i)
-{
-#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) /* || defined(BIG_ENDIAN_ENABLED) */ )
- spx_uint32_t ui, ret;
- ui = i;
- ret = ui>>24;
- ret |= (ui>>8)&0x0000ff00;
- ret |= (ui<<8)&0x00ff0000;
- ret |= (ui<<24);
- return ret;
-#else
- return i;
-#endif
-}
-
-#define ENDIAN_SWITCH(x) {x=le_int(x);}
-
-
-/*
-typedef struct SpeexHeader {
- char speex_string[8];
- char speex_version[SPEEX_HEADER_VERSION_LENGTH];
- int speex_version_id;
- int header_size;
- int rate;
- int mode;
- int mode_bitstream_version;
- int nb_channels;
- int bitrate;
- int frame_size;
- int vbr;
- int frames_per_packet;
- int extra_headers;
- int reserved1;
- int reserved2;
-} SpeexHeader;
-*/
-
-EXPORT void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m)
-{
- int i;
- const char *h="Speex ";
- /*
- strncpy(header->speex_string, "Speex ", 8);
- strncpy(header->speex_version, SPEEX_VERSION, SPEEX_HEADER_VERSION_LENGTH-1);
- header->speex_version[SPEEX_HEADER_VERSION_LENGTH-1]=0;
- */
- for (i=0;i<8;i++)
- header->speex_string[i]=h[i];
- for (i=0;i<SPEEX_HEADER_VERSION_LENGTH-1 && SPEEX_VERSION[i];i++)
- header->speex_version[i]=SPEEX_VERSION[i];
- for (;i<SPEEX_HEADER_VERSION_LENGTH;i++)
- header->speex_version[i]=0;
-
- header->speex_version_id = 1;
- header->header_size = sizeof(SpeexHeader);
-
- header->rate = rate;
- header->mode = m->modeID;
- header->mode_bitstream_version = m->bitstream_version;
- if (m->modeID<0)
- speex_warning("This mode is meant to be used alone");
- header->nb_channels = nb_channels;
- header->bitrate = -1;
- speex_mode_query(m, SPEEX_MODE_FRAME_SIZE, &header->frame_size);
- header->vbr = 0;
-
- header->frames_per_packet = 0;
- header->extra_headers = 0;
- header->reserved1 = 0;
- header->reserved2 = 0;
-}
-
-EXPORT char *speex_header_to_packet(SpeexHeader *header, int *size)
-{
- SpeexHeader *le_header;
- le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
-
- SPEEX_COPY(le_header, header, 1);
-
- /*Make sure everything is now little-endian*/
- ENDIAN_SWITCH(le_header->speex_version_id);
- ENDIAN_SWITCH(le_header->header_size);
- ENDIAN_SWITCH(le_header->rate);
- ENDIAN_SWITCH(le_header->mode);
- ENDIAN_SWITCH(le_header->mode_bitstream_version);
- ENDIAN_SWITCH(le_header->nb_channels);
- ENDIAN_SWITCH(le_header->bitrate);
- ENDIAN_SWITCH(le_header->frame_size);
- ENDIAN_SWITCH(le_header->vbr);
- ENDIAN_SWITCH(le_header->frames_per_packet);
- ENDIAN_SWITCH(le_header->extra_headers);
-
- *size = sizeof(SpeexHeader);
- return (char *)le_header;
-}
-
-EXPORT SpeexHeader *speex_packet_to_header(char *packet, int size)
-{
- int i;
- SpeexHeader *le_header;
- const char *h = "Speex ";
- for (i=0;i<8;i++)
- if (packet[i]!=h[i])
- {
- speex_notify("This doesn't look like a Speex file");
- return NULL;
- }
-
- /*FIXME: Do we allow larger headers?*/
- if (size < (int)sizeof(SpeexHeader))
- {
- speex_notify("Speex header too small");
- return NULL;
- }
-
- le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
-
- SPEEX_COPY(le_header, (SpeexHeader*)packet, 1);
-
- /*Make sure everything is converted correctly from little-endian*/
- ENDIAN_SWITCH(le_header->speex_version_id);
- ENDIAN_SWITCH(le_header->header_size);
- ENDIAN_SWITCH(le_header->rate);
- ENDIAN_SWITCH(le_header->mode);
- ENDIAN_SWITCH(le_header->mode_bitstream_version);
- ENDIAN_SWITCH(le_header->nb_channels);
- ENDIAN_SWITCH(le_header->bitrate);
- ENDIAN_SWITCH(le_header->frame_size);
- ENDIAN_SWITCH(le_header->vbr);
- ENDIAN_SWITCH(le_header->frames_per_packet);
- ENDIAN_SWITCH(le_header->extra_headers);
-
- if (le_header->mode >= SPEEX_NB_MODES || le_header->mode < 0)
- {
- speex_notify("Invalid mode specified in Speex header");
- speex_free (le_header);
- return NULL;
- }
-
- if (le_header->nb_channels>2)
- le_header->nb_channels = 2;
- if (le_header->nb_channels<1)
- le_header->nb_channels = 1;
-
- return le_header;
-
-}
-
-EXPORT void speex_header_free(void *ptr)
-{
- speex_free(ptr);
-}
diff --git a/drivers/speex/speex_header.h b/drivers/speex/speex_header.h
deleted file mode 100644
index f85b2496a..000000000
--- a/drivers/speex/speex_header.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file speex_header.h
- @brief Describes the Speex header
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#ifndef SPEEX_HEADER_H
-#define SPEEX_HEADER_H
-/** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header
- * This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP.
- * @{
- */
-
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct SpeexMode;
-
-/** Length of the Speex header identifier */
-#define SPEEX_HEADER_STRING_LENGTH 8
-
-/** Maximum number of characters for encoding the Speex version number in the header */
-#define SPEEX_HEADER_VERSION_LENGTH 20
-
-/** Speex header info for file-based formats */
-typedef struct SpeexHeader {
- char speex_string[SPEEX_HEADER_STRING_LENGTH]; /**< Identifies a Speex bit-stream, always set to "Speex " */
- char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */
- spx_int32_t speex_version_id; /**< Version for Speex (for checking compatibility) */
- spx_int32_t header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
- spx_int32_t rate; /**< Sampling rate used */
- spx_int32_t mode; /**< Mode used (0 for narrowband, 1 for wideband) */
- spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */
- spx_int32_t nb_channels; /**< Number of channels encoded */
- spx_int32_t bitrate; /**< Bit-rate used */
- spx_int32_t frame_size; /**< Size of frames */
- spx_int32_t vbr; /**< 1 for a VBR encoding, 0 otherwise */
- spx_int32_t frames_per_packet; /**< Number of frames stored per Ogg packet */
- spx_int32_t extra_headers; /**< Number of additional headers after the comments */
- spx_int32_t reserved1; /**< Reserved for future use, must be zero */
- spx_int32_t reserved2; /**< Reserved for future use, must be zero */
-} SpeexHeader;
-
-/** Initializes a SpeexHeader using basic information */
-void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m);
-
-/** Creates the header packet from the header itself (mostly involves endianness conversion) */
-char *speex_header_to_packet(SpeexHeader *header, int *size);
-
-/** Creates a SpeexHeader from a packet */
-SpeexHeader *speex_packet_to_header(char *packet, int size);
-
-/** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */
-void speex_header_free(void *ptr);
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @} */
-#endif
diff --git a/drivers/speex/speex_jitter.h b/drivers/speex/speex_jitter.h
deleted file mode 100644
index d68674b13..000000000
--- a/drivers/speex/speex_jitter.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file speex_jitter.h
- @brief Adaptive jitter buffer for Speex
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef SPEEX_JITTER_H
-#define SPEEX_JITTER_H
-/** @defgroup JitterBuffer JitterBuffer: Adaptive jitter buffer
- * This is the jitter buffer that reorders UDP/RTP packets and adjusts the buffer size
- * to maintain good quality and low latency.
- * @{
- */
-
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Generic adaptive jitter buffer state */
-struct JitterBuffer_;
-
-/** Generic adaptive jitter buffer state */
-typedef struct JitterBuffer_ JitterBuffer;
-
-/** Definition of an incoming packet */
-typedef struct _JitterBufferPacket JitterBufferPacket;
-
-/** Definition of an incoming packet */
-struct _JitterBufferPacket {
- char *data; /**< Data bytes contained in the packet */
- spx_uint32_t len; /**< Length of the packet in bytes */
- spx_uint32_t timestamp; /**< Timestamp for the packet */
- spx_uint32_t span; /**< Time covered by the packet (same units as timestamp) */
- spx_uint16_t sequence; /**< RTP Sequence number if available (0 otherwise) */
- spx_uint32_t user_data; /**< Put whatever data you like here (it's ignored by the jitter buffer) */
-};
-
-/** Packet has been retrieved */
-#define JITTER_BUFFER_OK 0
-/** Packet is lost or is late */
-#define JITTER_BUFFER_MISSING 1
-/** A "fake" packet is meant to be inserted here to increase buffering */
-#define JITTER_BUFFER_INSERTION 2
-/** There was an error in the jitter buffer */
-#define JITTER_BUFFER_INTERNAL_ERROR -1
-/** Invalid argument */
-#define JITTER_BUFFER_BAD_ARGUMENT -2
-
-
-/** Set minimum amount of extra buffering required (margin) */
-#define JITTER_BUFFER_SET_MARGIN 0
-/** Get minimum amount of extra buffering required (margin) */
-#define JITTER_BUFFER_GET_MARGIN 1
-/* JITTER_BUFFER_SET_AVAILABLE_COUNT wouldn't make sense */
-
-/** Get the amount of available packets currently buffered */
-#define JITTER_BUFFER_GET_AVAILABLE_COUNT 3
-/** Included because of an early misspelling (will remove in next release) */
-#define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
-
-/** Assign a function to destroy unused packet. When setting that, the jitter
- buffer no longer copies packet data. */
-#define JITTER_BUFFER_SET_DESTROY_CALLBACK 4
-/** */
-#define JITTER_BUFFER_GET_DESTROY_CALLBACK 5
-
-/** Tell the jitter buffer to only adjust the delay in multiples of the step parameter provided */
-#define JITTER_BUFFER_SET_DELAY_STEP 6
-/** */
-#define JITTER_BUFFER_GET_DELAY_STEP 7
-
-/** Tell the jitter buffer to only do concealment in multiples of the size parameter provided */
-#define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8
-#define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9
-
-/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss
- should be half of that or less. */
-#define JITTER_BUFFER_SET_MAX_LATE_RATE 10
-#define JITTER_BUFFER_GET_MAX_LATE_RATE 11
-
-/** Equivalent cost of one percent late packet in timestamp units */
-#define JITTER_BUFFER_SET_LATE_COST 12
-#define JITTER_BUFFER_GET_LATE_COST 13
-
-
-/** Initialises jitter buffer
- *
- * @param step_size Starting value for the size of concleanment packets and delay
- adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP
- and JITTER_BUFFER_GET_CONCEALMENT_SIZE.
- * @return Newly created jitter buffer state
- */
-JitterBuffer *jitter_buffer_init(int step_size);
-
-/** Restores jitter buffer to its original state
- *
- * @param jitter Jitter buffer state
- */
-void jitter_buffer_reset(JitterBuffer *jitter);
-
-/** Destroys jitter buffer
- *
- * @param jitter Jitter buffer state
- */
-void jitter_buffer_destroy(JitterBuffer *jitter);
-
-/** Put one packet into the jitter buffer
- *
- * @param jitter Jitter buffer state
- * @param packet Incoming packet
-*/
-void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet);
-
-/** Get one packet from the jitter buffer
- *
- * @param jitter Jitter buffer state
- * @param packet Returned packet
- * @param desired_span Number of samples (or units) we wish to get from the buffer (no guarantee)
- * @param current_timestamp Timestamp for the returned packet
-*/
-int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset);
-
-/** Used right after jitter_buffer_get() to obtain another packet that would have the same timestamp.
- * This is mainly useful for media where a single "frame" can be split into several packets.
- *
- * @param jitter Jitter buffer state
- * @param packet Returned packet
- */
-int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet);
-
-/** Get pointer timestamp of jitter buffer
- *
- * @param jitter Jitter buffer state
-*/
-int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter);
-
-/** Advance by one tick
- *
- * @param jitter Jitter buffer state
-*/
-void jitter_buffer_tick(JitterBuffer *jitter);
-
-/** Telling the jitter buffer about the remaining data in the application buffer
- * @param jitter Jitter buffer state
- * @param rem Amount of data buffered by the application (timestamp units)
- */
-void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem);
-
-/** Used like the ioctl function to control the jitter buffer parameters
- *
- * @param jitter Jitter buffer state
- * @param request ioctl-type request (one of the JITTER_BUFFER_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown
-*/
-int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr);
-
-int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset);
-
-/* @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/drivers/speex/speex_preprocess.h b/drivers/speex/speex_preprocess.h
deleted file mode 100644
index f8eef2cd9..000000000
--- a/drivers/speex/speex_preprocess.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* Copyright (C) 2003 Epic Games
- Written by Jean-Marc Valin */
-/**
- * @file speex_preprocess.h
- * @brief Speex preprocessor. The preprocess can do noise suppression,
- * residual echo suppression (after using the echo canceller), automatic
- * gain control (AGC) and voice activity detection (VAD).
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SPEEX_PREPROCESS_H
-#define SPEEX_PREPROCESS_H
-/** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor
- * This is the Speex preprocessor. The preprocess can do noise suppression,
- * residual echo suppression (after using the echo canceller), automatic
- * gain control (AGC) and voice activity detection (VAD).
- * @{
- */
-
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** State of the preprocessor (one per channel). Should never be accessed directly. */
-struct SpeexPreprocessState_;
-
-/** State of the preprocessor (one per channel). Should never be accessed directly. */
-typedef struct SpeexPreprocessState_ SpeexPreprocessState;
-
-
-/** Creates a new preprocessing state. You MUST create one state per channel processed.
- * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms). Must be
- * the same value as that used for the echo canceller for residual echo cancellation to work.
- * @param sampling_rate Sampling rate used for the input.
- * @return Newly created preprocessor state
-*/
-SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
-
-/** Destroys a preprocessor state
- * @param st Preprocessor state to destroy
-*/
-void speex_preprocess_state_destroy(SpeexPreprocessState *st);
-
-/** Preprocess a frame
- * @param st Preprocessor state
- * @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init().
- * @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on.
-*/
-int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x);
-
-/** Preprocess a frame (deprecated, use speex_preprocess_run() instead)*/
-int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo);
-
-/** Update preprocessor state, but do not compute the output
- * @param st Preprocessor state
- * @param x Audio sample vector (in only). Must be same size as specified in speex_preprocess_state_init().
-*/
-void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x);
-
-/** Used like the ioctl function to control the preprocessor parameters
- * @param st Preprocessor state
- * @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown
-*/
-int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
-
-
-
-/** Set preprocessor denoiser state */
-#define SPEEX_PREPROCESS_SET_DENOISE 0
-/** Get preprocessor denoiser state */
-#define SPEEX_PREPROCESS_GET_DENOISE 1
-
-/** Set preprocessor Automatic Gain Control state */
-#define SPEEX_PREPROCESS_SET_AGC 2
-/** Get preprocessor Automatic Gain Control state */
-#define SPEEX_PREPROCESS_GET_AGC 3
-
-/** Set preprocessor Voice Activity Detection state */
-#define SPEEX_PREPROCESS_SET_VAD 4
-/** Get preprocessor Voice Activity Detection state */
-#define SPEEX_PREPROCESS_GET_VAD 5
-
-/** Set preprocessor Automatic Gain Control level (float) */
-#define SPEEX_PREPROCESS_SET_AGC_LEVEL 6
-/** Get preprocessor Automatic Gain Control level (float) */
-#define SPEEX_PREPROCESS_GET_AGC_LEVEL 7
-
-/** Set preprocessor dereverb state */
-#define SPEEX_PREPROCESS_SET_DEREVERB 8
-/** Get preprocessor dereverb state */
-#define SPEEX_PREPROCESS_GET_DEREVERB 9
-
-/** Set preprocessor dereverb level */
-#define SPEEX_PREPROCESS_SET_DEREVERB_LEVEL 10
-/** Get preprocessor dereverb level */
-#define SPEEX_PREPROCESS_GET_DEREVERB_LEVEL 11
-
-/** Set preprocessor dereverb decay */
-#define SPEEX_PREPROCESS_SET_DEREVERB_DECAY 12
-/** Get preprocessor dereverb decay */
-#define SPEEX_PREPROCESS_GET_DEREVERB_DECAY 13
-
-/** Set probability required for the VAD to go from silence to voice */
-#define SPEEX_PREPROCESS_SET_PROB_START 14
-/** Get probability required for the VAD to go from silence to voice */
-#define SPEEX_PREPROCESS_GET_PROB_START 15
-
-/** Set probability required for the VAD to stay in the voice state (integer percent) */
-#define SPEEX_PREPROCESS_SET_PROB_CONTINUE 16
-/** Get probability required for the VAD to stay in the voice state (integer percent) */
-#define SPEEX_PREPROCESS_GET_PROB_CONTINUE 17
-
-/** Set maximum attenuation of the noise in dB (negative number) */
-#define SPEEX_PREPROCESS_SET_NOISE_SUPPRESS 18
-/** Get maximum attenuation of the noise in dB (negative number) */
-#define SPEEX_PREPROCESS_GET_NOISE_SUPPRESS 19
-
-/** Set maximum attenuation of the residual echo in dB (negative number) */
-#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS 20
-/** Get maximum attenuation of the residual echo in dB (negative number) */
-#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS 21
-
-/** Set maximum attenuation of the residual echo in dB when near end is active (negative number) */
-#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE 22
-/** Get maximum attenuation of the residual echo in dB when near end is active (negative number) */
-#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE 23
-
-/** Set the corresponding echo canceller state so that residual echo suppression can be performed (NULL for no residual echo suppression) */
-#define SPEEX_PREPROCESS_SET_ECHO_STATE 24
-/** Get the corresponding echo canceller state */
-#define SPEEX_PREPROCESS_GET_ECHO_STATE 25
-
-/** Set maximal gain increase in dB/second (int32) */
-#define SPEEX_PREPROCESS_SET_AGC_INCREMENT 26
-
-/** Get maximal gain increase in dB/second (int32) */
-#define SPEEX_PREPROCESS_GET_AGC_INCREMENT 27
-
-/** Set maximal gain decrease in dB/second (int32) */
-#define SPEEX_PREPROCESS_SET_AGC_DECREMENT 28
-
-/** Get maximal gain decrease in dB/second (int32) */
-#define SPEEX_PREPROCESS_GET_AGC_DECREMENT 29
-
-/** Set maximal gain in dB (int32) */
-#define SPEEX_PREPROCESS_SET_AGC_MAX_GAIN 30
-
-/** Get maximal gain in dB (int32) */
-#define SPEEX_PREPROCESS_GET_AGC_MAX_GAIN 31
-
-/* Can't set loudness */
-/** Get loudness */
-#define SPEEX_PREPROCESS_GET_AGC_LOUDNESS 33
-
-/* Can't set gain */
-/** Get current gain (int32 percent) */
-#define SPEEX_PREPROCESS_GET_AGC_GAIN 35
-
-/* Can't set spectrum size */
-/** Get spectrum size for power spectrum (int32) */
-#define SPEEX_PREPROCESS_GET_PSD_SIZE 37
-
-/* Can't set power spectrum */
-/** Get power spectrum (int32[] of squared values) */
-#define SPEEX_PREPROCESS_GET_PSD 39
-
-/* Can't set noise size */
-/** Get spectrum size for noise estimate (int32) */
-#define SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE 41
-
-/* Can't set noise estimate */
-/** Get noise estimate (int32[] of squared values) */
-#define SPEEX_PREPROCESS_GET_NOISE_PSD 43
-
-/* Can't set speech probability */
-/** Get speech probability in last frame (int32). */
-#define SPEEX_PREPROCESS_GET_PROB 45
-
-/** Set preprocessor Automatic Gain Control level (int32) */
-#define SPEEX_PREPROCESS_SET_AGC_TARGET 46
-/** Get preprocessor Automatic Gain Control level (int32) */
-#define SPEEX_PREPROCESS_GET_AGC_TARGET 47
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-#endif
diff --git a/drivers/speex/speex_resampler.h b/drivers/speex/speex_resampler.h
deleted file mode 100644
index 54eef8d7b..000000000
--- a/drivers/speex/speex_resampler.h
+++ /dev/null
@@ -1,340 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-
- File: speex_resampler.h
- Resampling code
-
- The design goals of this code are:
- - Very fast algorithm
- - Low memory requirement
- - Good *perceptual* quality (and not best SNR)
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#ifndef SPEEX_RESAMPLER_H
-#define SPEEX_RESAMPLER_H
-
-#ifdef OUTSIDE_SPEEX
-
-/********* WARNING: MENTAL SANITY ENDS HERE *************/
-
-/* If the resampler is defined outside of Speex, we change the symbol names so that
- there won't be any clash if linking with Speex later on. */
-
-/* #define RANDOM_PREFIX your software name here */
-#ifndef RANDOM_PREFIX
-#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
-#endif
-
-#define CAT_PREFIX2(a,b) a ## b
-#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
-
-#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
-#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
-#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
-#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
-#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
-#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
-#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
-#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
-#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
-#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
-#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
-#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
-#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
-#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
-#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
-#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
-#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
-#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
-#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
-#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
-#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
-#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
-
-#define spx_int16_t short
-#define spx_int32_t int
-#define spx_uint16_t unsigned short
-#define spx_uint32_t unsigned int
-
-#else /* OUTSIDE_SPEEX */
-
-#include "speex/speex_types.h"
-
-#endif /* OUTSIDE_SPEEX */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SPEEX_RESAMPLER_QUALITY_MAX 10
-#define SPEEX_RESAMPLER_QUALITY_MIN 0
-#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
-#define SPEEX_RESAMPLER_QUALITY_VOIP 3
-#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
-
-enum {
- RESAMPLER_ERR_SUCCESS = 0,
- RESAMPLER_ERR_ALLOC_FAILED = 1,
- RESAMPLER_ERR_BAD_STATE = 2,
- RESAMPLER_ERR_INVALID_ARG = 3,
- RESAMPLER_ERR_PTR_OVERLAP = 4,
-
- RESAMPLER_ERR_MAX_ERROR
-};
-
-struct SpeexResamplerState_;
-typedef struct SpeexResamplerState_ SpeexResamplerState;
-
-/** Create a new resampler with integer input and output rates.
- * @param nb_channels Number of channels to be processed
- * @param in_rate Input sampling rate (integer number of Hz).
- * @param out_rate Output sampling rate (integer number of Hz).
- * @param quality Resampling quality between 0 and 10, where 0 has poor quality
- * and 10 has very high quality.
- * @return Newly created resampler state
- * @retval NULL Error: not enough memory
- */
-SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate,
- int quality,
- int *err);
-
-/** Create a new resampler with fractional input/output rates. The sampling
- * rate ratio is an arbitrary rational number with both the numerator and
- * denominator being 32-bit integers.
- * @param nb_channels Number of channels to be processed
- * @param ratio_num Numerator of the sampling rate ratio
- * @param ratio_den Denominator of the sampling rate ratio
- * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
- * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
- * @param quality Resampling quality between 0 and 10, where 0 has poor quality
- * and 10 has very high quality.
- * @return Newly created resampler state
- * @retval NULL Error: not enough memory
- */
-SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
- spx_uint32_t ratio_num,
- spx_uint32_t ratio_den,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate,
- int quality,
- int *err);
-
-/** Destroy a resampler state.
- * @param st Resampler state
- */
-void speex_resampler_destroy(SpeexResamplerState *st);
-
-/** Resample a float array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param channel_index Index of the channel to process for the multi-channel
- * base (0 otherwise)
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the
- * number of samples processed
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written
- */
-int speex_resampler_process_float(SpeexResamplerState *st,
- spx_uint32_t channel_index,
- const float *in,
- spx_uint32_t *in_len,
- float *out,
- spx_uint32_t *out_len);
-
-/** Resample an int array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param channel_index Index of the channel to process for the multi-channel
- * base (0 otherwise)
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written
- */
-int speex_resampler_process_int(SpeexResamplerState *st,
- spx_uint32_t channel_index,
- const spx_int16_t *in,
- spx_uint32_t *in_len,
- spx_int16_t *out,
- spx_uint32_t *out_len);
-
-/** Resample an interleaved float array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed. This is all per-channel.
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written.
- * This is all per-channel.
- */
-int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
- const float *in,
- spx_uint32_t *in_len,
- float *out,
- spx_uint32_t *out_len);
-
-/** Resample an interleaved int array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed. This is all per-channel.
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written.
- * This is all per-channel.
- */
-int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
- const spx_int16_t *in,
- spx_uint32_t *in_len,
- spx_int16_t *out,
- spx_uint32_t *out_len);
-
-/** Set (change) the input/output sampling rates (integer value).
- * @param st Resampler state
- * @param in_rate Input sampling rate (integer number of Hz).
- * @param out_rate Output sampling rate (integer number of Hz).
- */
-int speex_resampler_set_rate(SpeexResamplerState *st,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate);
-
-/** Get the current input/output sampling rates (integer value).
- * @param st Resampler state
- * @param in_rate Input sampling rate (integer number of Hz) copied.
- * @param out_rate Output sampling rate (integer number of Hz) copied.
- */
-void speex_resampler_get_rate(SpeexResamplerState *st,
- spx_uint32_t *in_rate,
- spx_uint32_t *out_rate);
-
-/** Set (change) the input/output sampling rates and resampling ratio
- * (fractional values in Hz supported).
- * @param st Resampler state
- * @param ratio_num Numerator of the sampling rate ratio
- * @param ratio_den Denominator of the sampling rate ratio
- * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
- * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
- */
-int speex_resampler_set_rate_frac(SpeexResamplerState *st,
- spx_uint32_t ratio_num,
- spx_uint32_t ratio_den,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate);
-
-/** Get the current resampling ratio. This will be reduced to the least
- * common denominator.
- * @param st Resampler state
- * @param ratio_num Numerator of the sampling rate ratio copied
- * @param ratio_den Denominator of the sampling rate ratio copied
- */
-void speex_resampler_get_ratio(SpeexResamplerState *st,
- spx_uint32_t *ratio_num,
- spx_uint32_t *ratio_den);
-
-/** Set (change) the conversion quality.
- * @param st Resampler state
- * @param quality Resampling quality between 0 and 10, where 0 has poor
- * quality and 10 has very high quality.
- */
-int speex_resampler_set_quality(SpeexResamplerState *st,
- int quality);
-
-/** Get the conversion quality.
- * @param st Resampler state
- * @param quality Resampling quality between 0 and 10, where 0 has poor
- * quality and 10 has very high quality.
- */
-void speex_resampler_get_quality(SpeexResamplerState *st,
- int *quality);
-
-/** Set (change) the input stride.
- * @param st Resampler state
- * @param stride Input stride
- */
-void speex_resampler_set_input_stride(SpeexResamplerState *st,
- spx_uint32_t stride);
-
-/** Get the input stride.
- * @param st Resampler state
- * @param stride Input stride copied
- */
-void speex_resampler_get_input_stride(SpeexResamplerState *st,
- spx_uint32_t *stride);
-
-/** Set (change) the output stride.
- * @param st Resampler state
- * @param stride Output stride
- */
-void speex_resampler_set_output_stride(SpeexResamplerState *st,
- spx_uint32_t stride);
-
-/** Get the output stride.
- * @param st Resampler state copied
- * @param stride Output stride
- */
-void speex_resampler_get_output_stride(SpeexResamplerState *st,
- spx_uint32_t *stride);
-
-/** Get the latency in input samples introduced by the resampler.
- * @param st Resampler state
- */
-int speex_resampler_get_input_latency(SpeexResamplerState *st);
-
-/** Get the latency in output samples introduced by the resampler.
- * @param st Resampler state
- */
-int speex_resampler_get_output_latency(SpeexResamplerState *st);
-
-/** Make sure that the first samples to go out of the resamplers don't have
- * leading zeros. This is only useful before starting to use a newly created
- * resampler. It is recommended to use that when resampling an audio file, as
- * it will generate a file with the same length. For real-time processing,
- * it is probably easier not to use this call (so that the output duration
- * is the same for the first frame).
- * @param st Resampler state
- */
-int speex_resampler_skip_zeros(SpeexResamplerState *st);
-
-/** Reset a resampler so a new (unrelated) stream can be processed.
- * @param st Resampler state
- */
-int speex_resampler_reset_mem(SpeexResamplerState *st);
-
-/** Returns the English meaning for an error code
- * @param err Error code
- * @return English string
- */
-const char *speex_resampler_strerror(int err);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/drivers/speex/speex_stereo.h b/drivers/speex/speex_stereo.h
deleted file mode 100644
index a259713b8..000000000
--- a/drivers/speex/speex_stereo.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin*/
-/**
- @file speex_stereo.h
- @brief Describes the handling for intensity stereo
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef STEREO_H
-#define STEREO_H
-/** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files
- * This describes the Speex intensity stereo encoding/decoding
- * @{
- */
-
-#include "speex/speex_types.h"
-#include "speex/speex_bits.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** If you access any of these fields directly, I'll personally come and bite you */
-typedef struct SpeexStereoState {
- float balance; /**< Left/right balance info */
- float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */
- float smooth_left; /**< Smoothed left channel gain */
- float smooth_right; /**< Smoothed right channel gain */
- float reserved1; /**< Reserved for future use */
- float reserved2; /**< Reserved for future use */
-} SpeexStereoState;
-
-/** Deprecated. Use speex_stereo_state_init() instead. */
-#define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0}
-
-/** Initialise/create a stereo stereo state */
-SpeexStereoState *speex_stereo_state_init();
-
-/** Reset/re-initialise an already allocated stereo state */
-void speex_stereo_state_reset(SpeexStereoState *stereo);
-
-/** Destroy a stereo stereo state */
-void speex_stereo_state_destroy(SpeexStereoState *stereo);
-
-/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
-void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
-
-/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
-void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits);
-
-/** Transforms a mono frame into a stereo frame using intensity stereo info */
-void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo);
-
-/** Transforms a mono frame into a stereo frame using intensity stereo info */
-void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo);
-
-/** Callback handler for intensity stereo info */
-int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data);
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @} */
-#endif
diff --git a/drivers/speex/speex_types.h b/drivers/speex/speex_types.h
deleted file mode 100644
index 852fed801..000000000
--- a/drivers/speex/speex_types.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* speex_types.h taken from libogg */
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
-
- ********************************************************************/
-/**
- @file speex_types.h
- @brief Speex types
-*/
-#ifndef _SPEEX_TYPES_H
-#define _SPEEX_TYPES_H
-
-#if defined(_WIN32)
-
-# if defined(__CYGWIN__)
-# include <_G_config.h>
- typedef _G_int32_t spx_int32_t;
- typedef _G_uint32_t spx_uint32_t;
- typedef _G_int16_t spx_int16_t;
- typedef _G_uint16_t spx_uint16_t;
-# elif defined(__MINGW32__)
- typedef short spx_int16_t;
- typedef unsigned short spx_uint16_t;
- typedef int spx_int32_t;
- typedef unsigned int spx_uint32_t;
-# elif defined(__MWERKS__)
- typedef int spx_int32_t;
- typedef unsigned int spx_uint32_t;
- typedef short spx_int16_t;
- typedef unsigned short spx_uint16_t;
-# else
- /* MSVC/Borland */
- typedef __int32 spx_int32_t;
- typedef unsigned __int32 spx_uint32_t;
- typedef __int16 spx_int16_t;
- typedef unsigned __int16 spx_uint16_t;
-# endif
-
-#elif defined(__MACOS__)
-
-# include <sys/types.h>
- typedef SInt16 spx_int16_t;
- typedef UInt16 spx_uint16_t;
- typedef SInt32 spx_int32_t;
- typedef UInt32 spx_uint32_t;
-
-#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
-
-# include <sys/types.h>
- typedef int16_t spx_int16_t;
- typedef u_int16_t spx_uint16_t;
- typedef int32_t spx_int32_t;
- typedef u_int32_t spx_uint32_t;
-
-#elif defined(__BEOS__)
-
- /* Be */
-# include <inttypes.h>
- typedef int16_t spx_int16_t;
- typedef u_int16_t spx_uint16_t;
- typedef int32_t spx_int32_t;
- typedef u_int32_t spx_uint32_t;
-
-#elif defined (__EMX__)
-
- /* OS/2 GCC */
- typedef short spx_int16_t;
- typedef unsigned short spx_uint16_t;
- typedef int spx_int32_t;
- typedef unsigned int spx_uint32_t;
-
-#elif defined (DJGPP)
-
- /* DJGPP */
- typedef short spx_int16_t;
- typedef int spx_int32_t;
- typedef unsigned int spx_uint32_t;
-
-#elif defined(R5900)
-
- /* PS2 EE */
- typedef int spx_int32_t;
- typedef unsigned spx_uint32_t;
- typedef short spx_int16_t;
-
-#elif defined(__SYMBIAN32__)
-
- /* Symbian GCC */
- typedef signed short spx_int16_t;
- typedef unsigned short spx_uint16_t;
- typedef signed int spx_int32_t;
- typedef unsigned int spx_uint32_t;
-
-#elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
-
- typedef short spx_int16_t;
- typedef unsigned short spx_uint16_t;
- typedef long spx_int32_t;
- typedef unsigned long spx_uint32_t;
-
-#elif defined(CONFIG_TI_C6X)
-
- typedef short spx_int16_t;
- typedef unsigned short spx_uint16_t;
- typedef int spx_int32_t;
- typedef unsigned int spx_uint32_t;
-
-#else
-
-# include <speex/speex_config_types.h>
-
-#endif
-
-#endif /* _SPEEX_TYPES_H */
diff --git a/drivers/speex/stack_alloc.h b/drivers/speex/stack_alloc.h
deleted file mode 100644
index 5264e666b..000000000
--- a/drivers/speex/stack_alloc.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file stack_alloc.h
- @brief Temporary memory allocation on stack
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef STACK_ALLOC_H
-#define STACK_ALLOC_H
-
-#ifdef USE_ALLOCA
-# ifdef WIN32
-# include <malloc.h>
-# else
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# include <stdlib.h>
-# endif
-# endif
-#endif
-
-/**
- * @def ALIGN(stack, size)
- *
- * Aligns the stack to a 'size' boundary
- *
- * @param stack Stack
- * @param size New size boundary
- */
-
-/**
- * @def PUSH(stack, size, type)
- *
- * Allocates 'size' elements of type 'type' on the stack
- *
- * @param stack Stack
- * @param size Number of elements
- * @param type Type of element
- */
-
-/**
- * @def VARDECL(var)
- *
- * Declare variable on stack
- *
- * @param var Variable to declare
- */
-
-/**
- * @def ALLOC(var, size, type)
- *
- * Allocate 'size' elements of 'type' on stack
- *
- * @param var Name of variable to allocate
- * @param size Number of elements
- * @param type Type of element
- */
-
-#ifdef ENABLE_VALGRIND
-
-#include <valgrind/memcheck.h>
-
-#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
-
-#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
-
-#else
-
-#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
-
-#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
-
-#endif
-
-#if defined(VAR_ARRAYS)
-#define VARDECL(var)
-#define ALLOC(var, size, type) type var[size]
-#elif defined(USE_ALLOCA)
-#define VARDECL(var) var
-#define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
-#else
-#define VARDECL(var) var
-#define ALLOC(var, size, type) var = PUSH(stack, size, type)
-#endif
-
-
-#endif
diff --git a/drivers/speex/stereo.c b/drivers/speex/stereo.c
deleted file mode 100644
index 50eab222f..000000000
--- a/drivers/speex/stereo.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: stereo.c
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include <speex/speex_stereo.h>
-#include <speex/speex_callbacks.h>
-#include "math_approx.h"
-#include "vq.h"
-#include <math.h>
-#include "os_support.h"
-
-typedef struct RealSpeexStereoState {
- spx_word32_t balance; /**< Left/right balance info */
- spx_word32_t e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */
- spx_word32_t smooth_left; /**< Smoothed left channel gain */
- spx_word32_t smooth_right; /**< Smoothed right channel gain */
- spx_uint32_t reserved1; /**< Reserved for future use */
- spx_int32_t reserved2; /**< Reserved for future use */
-} RealSpeexStereoState;
-
-
-/*float e_ratio_quant[4] = {1, 1.26, 1.587, 2};*/
-#ifndef FIXED_POINT
-static const float e_ratio_quant[4] = {.25f, .315f, .397f, .5f};
-static const float e_ratio_quant_bounds[3] = {0.2825f, 0.356f, 0.4485f};
-#else
-static const spx_word16_t e_ratio_quant[4] = {8192, 10332, 13009, 16384};
-static const spx_word16_t e_ratio_quant_bounds[3] = {9257, 11665, 14696};
-static const spx_word16_t balance_bounds[31] = {18, 23, 30, 38, 49, 63, 81, 104,
- 134, 172, 221, 284, 364, 468, 600, 771,
- 990, 1271, 1632, 2096, 2691, 3455, 4436, 5696,
- 7314, 9392, 12059, 15484, 19882, 25529, 32766};
-#endif
-
-/* This is an ugly compatibility hack that properly resets the stereo state
- In case it it compiled in fixed-point, but initialised with the deprecated
- floating point static initialiser */
-#ifdef FIXED_POINT
-#define COMPATIBILITY_HACK(s) do {if ((s)->reserved1 != 0xdeadbeef) speex_stereo_state_reset((SpeexStereoState*)s); } while (0);
-#else
-#define COMPATIBILITY_HACK(s)
-#endif
-
-EXPORT SpeexStereoState *speex_stereo_state_init()
-{
- SpeexStereoState *stereo = speex_alloc(sizeof(SpeexStereoState));
- speex_stereo_state_reset(stereo);
- return stereo;
-}
-
-EXPORT void speex_stereo_state_reset(SpeexStereoState *_stereo)
-{
- RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
-#ifdef FIXED_POINT
- stereo->balance = 65536;
- stereo->e_ratio = 16384;
- stereo->smooth_left = 16384;
- stereo->smooth_right = 16384;
- stereo->reserved1 = 0xdeadbeef;
- stereo->reserved2 = 0;
-#else
- stereo->balance = 1.0f;
- stereo->e_ratio = .5f;
- stereo->smooth_left = 1.f;
- stereo->smooth_right = 1.f;
- stereo->reserved1 = 0;
- stereo->reserved2 = 0;
-#endif
-}
-
-EXPORT void speex_stereo_state_destroy(SpeexStereoState *stereo)
-{
- speex_free(stereo);
-}
-
-#ifndef DISABLE_FLOAT_API
-EXPORT void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
-{
- int i, tmp;
- float e_left=0, e_right=0, e_tot=0;
- float balance, e_ratio;
- for (i=0;i<frame_size;i++)
- {
- e_left += ((float)data[2*i])*data[2*i];
- e_right += ((float)data[2*i+1])*data[2*i+1];
- data[i] = .5*(((float)data[2*i])+data[2*i+1]);
- e_tot += ((float)data[i])*data[i];
- }
- balance=(e_left+1)/(e_right+1);
- e_ratio = e_tot/(1+e_left+e_right);
-
- /*Quantization*/
- speex_bits_pack(bits, 14, 5);
- speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4);
-
- balance=4*log(balance);
-
- /*Pack sign*/
- if (balance>0)
- speex_bits_pack(bits, 0, 1);
- else
- speex_bits_pack(bits, 1, 1);
- balance=floor(.5+fabs(balance));
- if (balance>30)
- balance=31;
-
- speex_bits_pack(bits, (int)balance, 5);
-
- /* FIXME: this is a hack */
- tmp=scal_quant(e_ratio*Q15_ONE, e_ratio_quant_bounds, 4);
- speex_bits_pack(bits, tmp, 2);
-}
-#endif /* #ifndef DISABLE_FLOAT_API */
-
-EXPORT void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits)
-{
- int i, tmp;
- spx_word32_t e_left=0, e_right=0, e_tot=0;
- spx_word32_t balance, e_ratio;
- spx_word32_t largest, smallest;
- int balance_id;
-#ifdef FIXED_POINT
- int shift;
-#endif
-
- /* In band marker */
- speex_bits_pack(bits, 14, 5);
- /* Stereo marker */
- speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4);
-
- for (i=0;i<frame_size;i++)
- {
- e_left += SHR32(MULT16_16(data[2*i],data[2*i]),8);
- e_right += SHR32(MULT16_16(data[2*i+1],data[2*i+1]),8);
-#ifdef FIXED_POINT
- /* I think this is actually unbiased */
- data[i] = SHR16(data[2*i],1)+PSHR16(data[2*i+1],1);
-#else
- data[i] = .5*(((float)data[2*i])+data[2*i+1]);
-#endif
- e_tot += SHR32(MULT16_16(data[i],data[i]),8);
- }
- if (e_left > e_right)
- {
- speex_bits_pack(bits, 0, 1);
- largest = e_left;
- smallest = e_right;
- } else {
- speex_bits_pack(bits, 1, 1);
- largest = e_right;
- smallest = e_left;
- }
-
- /* Balance quantization */
-#ifdef FIXED_POINT
- shift = spx_ilog2(largest)-15;
- largest = VSHR32(largest, shift-4);
- smallest = VSHR32(smallest, shift);
- balance = DIV32(largest, ADD32(smallest, 1));
- if (balance > 32767)
- balance = 32767;
- balance_id = scal_quant(EXTRACT16(balance), balance_bounds, 32);
-#else
- balance=(largest+1.)/(smallest+1.);
- balance=4*log(balance);
- balance_id=floor(.5+fabs(balance));
- if (balance_id>30)
- balance_id=31;
-#endif
-
- speex_bits_pack(bits, balance_id, 5);
-
- /* "coherence" quantisation */
-#ifdef FIXED_POINT
- shift = spx_ilog2(e_tot);
- e_tot = VSHR32(e_tot, shift-25);
- e_left = VSHR32(e_left, shift-10);
- e_right = VSHR32(e_right, shift-10);
- e_ratio = DIV32(e_tot, e_left+e_right+1);
-#else
- e_ratio = e_tot/(1.+e_left+e_right);
-#endif
-
- tmp=scal_quant(EXTRACT16(e_ratio), e_ratio_quant_bounds, 4);
- /*fprintf (stderr, "%d %d %d %d\n", largest, smallest, balance_id, e_ratio);*/
- speex_bits_pack(bits, tmp, 2);
-}
-
-#ifndef DISABLE_FLOAT_API
-EXPORT void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *_stereo)
-{
- int i;
- spx_word32_t balance;
- spx_word16_t e_left, e_right, e_ratio;
- RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
-
- COMPATIBILITY_HACK(stereo);
-
- balance=stereo->balance;
- e_ratio=stereo->e_ratio;
-
- /* These two are Q14, with max value just below 2. */
- e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance))));
- e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8);
-
- for (i=frame_size-1;i>=0;i--)
- {
- spx_word16_t tmp=data[i];
- stereo->smooth_left = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_left, QCONST16(0.98, 15)), e_left, QCONST16(0.02, 15)), 15));
- stereo->smooth_right = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_right, QCONST16(0.98, 15)), e_right, QCONST16(0.02, 15)), 15));
- data[2*i] = (float)MULT16_16_P14(stereo->smooth_left, tmp);
- data[2*i+1] = (float)MULT16_16_P14(stereo->smooth_right, tmp);
- }
-}
-#endif /* #ifndef DISABLE_FLOAT_API */
-
-EXPORT void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *_stereo)
-{
- int i;
- spx_word32_t balance;
- spx_word16_t e_left, e_right, e_ratio;
- RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
-
- COMPATIBILITY_HACK(stereo);
-
- balance=stereo->balance;
- e_ratio=stereo->e_ratio;
-
- /* These two are Q14, with max value just below 2. */
- e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance))));
- e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8);
-
- for (i=frame_size-1;i>=0;i--)
- {
- spx_int16_t tmp=data[i];
- stereo->smooth_left = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_left, QCONST16(0.98, 15)), e_left, QCONST16(0.02, 15)), 15));
- stereo->smooth_right = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_right, QCONST16(0.98, 15)), e_right, QCONST16(0.02, 15)), 15));
- data[2*i] = (spx_int16_t)MULT16_16_P14(stereo->smooth_left, tmp);
- data[2*i+1] = (spx_int16_t)MULT16_16_P14(stereo->smooth_right, tmp);
- }
-}
-
-EXPORT int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data)
-{
- RealSpeexStereoState *stereo;
- spx_word16_t sign=1, dexp;
- int tmp;
-
- stereo = (RealSpeexStereoState*)data;
-
- COMPATIBILITY_HACK(stereo);
-
- if (speex_bits_unpack_unsigned(bits, 1))
- sign=-1;
- dexp = speex_bits_unpack_unsigned(bits, 5);
-#ifndef FIXED_POINT
- stereo->balance = exp(sign*.25*dexp);
-#else
- stereo->balance = spx_exp(MULT16_16(sign, SHL16(dexp, 9)));
-#endif
- tmp = speex_bits_unpack_unsigned(bits, 2);
- stereo->e_ratio = e_ratio_quant[tmp];
-
- return 0;
-}
diff --git a/drivers/speex/vbr.c b/drivers/speex/vbr.c
deleted file mode 100644
index 16100e3d4..000000000
--- a/drivers/speex/vbr.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: vbr.c
-
- VBR-related routines
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#include "config.h"
-
-
-#include "vbr.h"
-#include <math.h>
-
-
-#define sqr(x) ((x)*(x))
-
-#define MIN_ENERGY 6000
-#define NOISE_POW .3
-
-#ifndef DISABLE_VBR
-
-const float vbr_nb_thresh[9][11]={
- {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* CNG */
- { 4.0f, 2.5f, 2.0f, 1.2f, 0.5f, 0.0f, -0.5f, -0.7f, -0.8f, -0.9f, -1.0f}, /* 2 kbps */
- {10.0f, 6.5f, 5.2f, 4.5f, 3.9f, 3.5f, 3.0f, 2.5f, 2.3f, 1.8f, 1.0f}, /* 6 kbps */
- {11.0f, 8.8f, 7.5f, 6.5f, 5.0f, 3.9f, 3.9f, 3.9f, 3.5f, 3.0f, 1.0f}, /* 8 kbps */
- {11.0f, 11.0f, 9.9f, 8.5f, 7.0f, 6.0f, 4.5f, 4.0f, 4.0f, 4.0f, 2.0f}, /* 11 kbps */
- {11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 8.5f, 8.0f, 7.0f, 6.0f, 5.0f, 3.0f}, /* 15 kbps */
- {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 8.5f, 7.0f, 6.0f, 5.0f}, /* 18 kbps */
- {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.8f, 9.5f, 7.5f}, /* 24 kbps */
- { 7.0f, 4.5f, 3.7f, 3.0f, 2.5f, 2.0f, 1.8f, 1.5f, 1.0f, 0.0f, 0.0f} /* 4 kbps */
-};
-
-
-const float vbr_hb_thresh[5][11]={
- {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* silence */
- {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* 2 kbps */
- {11.0f, 11.0f, 9.5f, 8.5f, 7.5f, 6.0f, 5.0f, 3.9f, 3.0f, 2.0f, 1.0f}, /* 6 kbps */
- {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 8.7f, 7.8f, 7.0f, 6.5f, 4.0f}, /* 10 kbps */
- {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.8f, 7.5f, 5.5f} /* 18 kbps */
-};
-
-const float vbr_uhb_thresh[2][11]={
- {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* silence */
- { 3.9f, 2.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f} /* 2 kbps */
-};
-
-void vbr_init(VBRState *vbr)
-{
- int i;
-
- vbr->average_energy=0;
- vbr->last_energy=1;
- vbr->accum_sum=0;
- vbr->energy_alpha=.1;
- vbr->soft_pitch=0;
- vbr->last_pitch_coef=0;
- vbr->last_quality=0;
-
- vbr->noise_accum = .05*pow(MIN_ENERGY, NOISE_POW);
- vbr->noise_accum_count=.05;
- vbr->noise_level=vbr->noise_accum/vbr->noise_accum_count;
- vbr->consec_noise=0;
-
-
- for (i=0;i<VBR_MEMORY_SIZE;i++)
- vbr->last_log_energy[i] = log(MIN_ENERGY);
-}
-
-
-/*
- This function should analyse the signal and decide how critical the
- coding error will be perceptually. The following factors should be
- taken into account:
-
- -Attacks (positive energy derivative) should be coded with more bits
-
- -Stationary voiced segments should receive more bits
-
- -Segments with (very) low absolute energy should receive less bits (maybe
- only shaped noise?)
-
- -DTX for near-zero energy?
-
- -Stationary fricative segments should have less bits
-
- -Temporal masking: when energy slope is decreasing, decrease the bit-rate
-
- -Decrease bit-rate for males (low pitch)?
-
- -(wideband only) less bits in the high-band when signal is very
- non-stationary (harder to notice high-frequency noise)???
-
-*/
-
-float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float pitch_coef)
-{
- int i;
- float ener=0, ener1=0, ener2=0;
- float qual=7;
- int va;
- float log_energy;
- float non_st=0;
- float voicing;
- float pow_ener;
-
- for (i=0;i<len>>1;i++)
- ener1 += ((float)sig[i])*sig[i];
-
- for (i=len>>1;i<len;i++)
- ener2 += ((float)sig[i])*sig[i];
- ener=ener1+ener2;
-
- log_energy = log(ener+MIN_ENERGY);
- for (i=0;i<VBR_MEMORY_SIZE;i++)
- non_st += sqr(log_energy-vbr->last_log_energy[i]);
- non_st = non_st/(30*VBR_MEMORY_SIZE);
- if (non_st>1)
- non_st=1;
-
- voicing = 3*(pitch_coef-.4)*fabs(pitch_coef-.4);
- vbr->average_energy = (1-vbr->energy_alpha)*vbr->average_energy + vbr->energy_alpha*ener;
- vbr->noise_level=vbr->noise_accum/vbr->noise_accum_count;
- pow_ener = pow(ener,NOISE_POW);
- if (vbr->noise_accum_count<.06 && ener>MIN_ENERGY)
- vbr->noise_accum = .05*pow_ener;
-
- if ((voicing<.3 && non_st < .2 && pow_ener < 1.2*vbr->noise_level)
- || (voicing<.3 && non_st < .05 && pow_ener < 1.5*vbr->noise_level)
- || (voicing<.4 && non_st < .05 && pow_ener < 1.2*vbr->noise_level)
- || (voicing<0 && non_st < .05))
- {
- float tmp;
- va = 0;
- vbr->consec_noise++;
- if (pow_ener > 3*vbr->noise_level)
- tmp = 3*vbr->noise_level;
- else
- tmp = pow_ener;
- if (vbr->consec_noise>=4)
- {
- vbr->noise_accum = .95*vbr->noise_accum + .05*tmp;
- vbr->noise_accum_count = .95*vbr->noise_accum_count + .05;
- }
- } else {
- va = 1;
- vbr->consec_noise=0;
- }
-
- if (pow_ener < vbr->noise_level && ener>MIN_ENERGY)
- {
- vbr->noise_accum = .95*vbr->noise_accum + .05*pow_ener;
- vbr->noise_accum_count = .95*vbr->noise_accum_count + .05;
- }
-
- /* Checking for very low absolute energy */
- if (ener < 30000)
- {
- qual -= .7;
- if (ener < 10000)
- qual-=.7;
- if (ener < 3000)
- qual-=.7;
- } else {
- float short_diff, long_diff;
- short_diff = log((ener+1)/(1+vbr->last_energy));
- long_diff = log((ener+1)/(1+vbr->average_energy));
- /*fprintf (stderr, "%f %f\n", short_diff, long_diff);*/
-
- if (long_diff<-5)
- long_diff=-5;
- if (long_diff>2)
- long_diff=2;
-
- if (long_diff>0)
- qual += .6*long_diff;
- if (long_diff<0)
- qual += .5*long_diff;
- if (short_diff>0)
- {
- if (short_diff>5)
- short_diff=5;
- qual += .5*short_diff;
- }
- /* Checking for energy increases */
- if (ener2 > 1.6*ener1)
- qual += .5;
- }
- vbr->last_energy = ener;
- vbr->soft_pitch = .6*vbr->soft_pitch + .4*pitch_coef;
- qual += 2.2*((pitch_coef-.4) + (vbr->soft_pitch-.4));
-
- if (qual < vbr->last_quality)
- qual = .5*qual + .5*vbr->last_quality;
- if (qual<4)
- qual=4;
- if (qual>10)
- qual=10;
-
- /*
- if (vbr->consec_noise>=2)
- qual-=1.3;
- if (vbr->consec_noise>=5)
- qual-=1.3;
- if (vbr->consec_noise>=12)
- qual-=1.3;
- */
- if (vbr->consec_noise>=3)
- qual=4;
-
- if (vbr->consec_noise)
- qual -= 1.0 * (log(3.0 + vbr->consec_noise)-log(3));
- if (qual<0)
- qual=0;
-
- if (ener<60000)
- {
- if (vbr->consec_noise>2)
- qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3));
- if (ener<10000&&vbr->consec_noise>2)
- qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3));
- if (qual<0)
- qual=0;
- qual += .3*log(.0001+ener/60000.0);
- }
- if (qual<-1)
- qual=-1;
-
- /*printf ("%f %f %f %f %d\n", qual, voicing, non_st, pow_ener/(.01+vbr->noise_level), va);*/
-
- vbr->last_pitch_coef = pitch_coef;
- vbr->last_quality = qual;
-
- for (i=VBR_MEMORY_SIZE-1;i>0;i--)
- vbr->last_log_energy[i] = vbr->last_log_energy[i-1];
- vbr->last_log_energy[0] = log_energy;
-
- /*printf ("VBR: %f %f %f %d %f\n", (float)(log_energy-log(vbr->average_energy+MIN_ENERGY)), non_st, voicing, va, vbr->noise_level);*/
-
- return qual;
-}
-
-void vbr_destroy(VBRState *vbr)
-{
-}
-
-#endif /* #ifndef DISABLE_VBR */
diff --git a/drivers/speex/vbr.h b/drivers/speex/vbr.h
deleted file mode 100644
index ff1e3e46f..000000000
--- a/drivers/speex/vbr.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file vbr.h
- @brief Variable Bit-Rate (VBR) related routines
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#ifndef VBR_H
-#define VBR_H
-
-#include "arch.h"
-
-#define VBR_MEMORY_SIZE 5
-
-extern const float vbr_nb_thresh[9][11];
-extern const float vbr_hb_thresh[5][11];
-extern const float vbr_uhb_thresh[2][11];
-
-/** VBR state. */
-typedef struct VBRState {
- float energy_alpha;
- float average_energy;
- float last_energy;
- float last_log_energy[VBR_MEMORY_SIZE];
- float accum_sum;
- float last_pitch_coef;
- float soft_pitch;
- float last_quality;
- float noise_level;
- float noise_accum;
- float noise_accum_count;
- int consec_noise;
-} VBRState;
-
-void vbr_init(VBRState *vbr);
-
-float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float pitch_coef);
-
-void vbr_destroy(VBRState *vbr);
-
-#endif
diff --git a/drivers/speex/vorbis_psy.h b/drivers/speex/vorbis_psy.h
deleted file mode 100644
index 687105775..000000000
--- a/drivers/speex/vorbis_psy.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Copyright (C) 2005 Jean-Marc Valin, CSIRO, Christopher Montgomery
- File: vorbis_psy.h
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef VORBIS_PSY_H
-#define VORBIS_PSY_H
-
-#ifdef VORBIS_PSYCHO
-
-#include "smallft.h"
-#define P_BANDS 17 /* 62Hz to 16kHz */
-#define NOISE_COMPAND_LEVELS 40
-
-
-#define todB(x) ((x)>1e-13?log((x)*(x))*4.34294480f:-30)
-#define fromdB(x) (exp((x)*.11512925f))
-
-/* The bark scale equations are approximations, since the original
- table was somewhat hand rolled. The below are chosen to have the
- best possible fit to the rolled tables, thus their somewhat odd
- appearance (these are more accurate and over a longer range than
- the oft-quoted bark equations found in the texts I have). The
- approximations are valid from 0 - 30kHz (nyquist) or so.
-
- all f in Hz, z in Bark */
-
-#define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
-#define fromBARK(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f)
-
-/* Frequency to octave. We arbitrarily declare 63.5 Hz to be octave
- 0.0 */
-
-#define toOC(n) (log(n)*1.442695f-5.965784f)
-#define fromOC(o) (exp(((o)+5.965784f)*.693147f))
-
-
-typedef struct {
-
- float noisewindowlo;
- float noisewindowhi;
- int noisewindowlomin;
- int noisewindowhimin;
- int noisewindowfixed;
- float noiseoff[P_BANDS];
- float noisecompand[NOISE_COMPAND_LEVELS];
-
-} VorbisPsyInfo;
-
-
-
-typedef struct {
- int n;
- int rate;
- struct drft_lookup lookup;
- VorbisPsyInfo *vi;
-
- float *window;
- float *noiseoffset;
- long *bark;
-
-} VorbisPsy;
-
-
-VorbisPsy *vorbis_psy_init(int rate, int size);
-void vorbis_psy_destroy(VorbisPsy *psy);
-void compute_curve(VorbisPsy *psy, float *audio, float *curve);
-void curve_to_lpc(VorbisPsy *psy, float *curve, float *awk1, float *awk2, int ord);
-
-#endif
-#endif
diff --git a/drivers/speex/vq.c b/drivers/speex/vq.c
deleted file mode 100644
index 049e68169..000000000
--- a/drivers/speex/vq.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin
- File: vq.c
- Vector quantization
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include "vq.h"
-#include "stack_alloc.h"
-#include "arch.h"
-
-#ifdef _USE_SSE
-#include <xmmintrin.h>
-#include "vq_sse.h"
-#elif defined(SHORTCUTS) && (defined(ARM4_ASM) || defined(ARM5E_ASM))
-#include "vq_arm4.h"
-#elif defined(BFIN_ASM)
-#include "vq_bfin.h"
-#endif
-
-
-int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries)
-{
- int i=0;
- while (i<entries-1 && in>boundary[0])
- {
- boundary++;
- i++;
- }
- return i;
-}
-
-int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries)
-{
- int i=0;
- while (i<entries-1 && in>boundary[0])
- {
- boundary++;
- i++;
- }
- return i;
-}
-
-
-#ifndef OVERRIDE_VQ_NBEST
-/*Finds the indices of the n-best entries in a codebook*/
-void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
-{
- int i,j,k,used;
- used = 0;
- for (i=0;i<entries;i++)
- {
- spx_word32_t dist=0;
- for (j=0;j<len;j++)
- dist = MAC16_16(dist,in[j],*codebook++);
-#ifdef FIXED_POINT
- dist=SUB32(SHR32(E[i],1),dist);
-#else
- dist=.5f*E[i]-dist;
-#endif
- if (i<N || dist<best_dist[N-1])
- {
- for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--)
- {
- best_dist[k]=best_dist[k-1];
- nbest[k] = nbest[k-1];
- }
- best_dist[k]=dist;
- nbest[k]=i;
- used++;
- }
- }
-}
-#endif
-
-
-
-
-#ifndef OVERRIDE_VQ_NBEST_SIGN
-/*Finds the indices of the n-best entries in a codebook with sign*/
-void vq_nbest_sign(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
-{
- int i,j,k, sign, used;
- used=0;
- for (i=0;i<entries;i++)
- {
- spx_word32_t dist=0;
- for (j=0;j<len;j++)
- dist = MAC16_16(dist,in[j],*codebook++);
- if (dist>0)
- {
- sign=0;
- dist=-dist;
- } else
- {
- sign=1;
- }
-#ifdef FIXED_POINT
- dist = ADD32(dist,SHR32(E[i],1));
-#else
- dist = ADD32(dist,.5f*E[i]);
-#endif
- if (i<N || dist<best_dist[N-1])
- {
- for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--)
- {
- best_dist[k]=best_dist[k-1];
- nbest[k] = nbest[k-1];
- }
- best_dist[k]=dist;
- nbest[k]=i;
- used++;
- if (sign)
- nbest[k]+=entries;
- }
- }
-}
-#endif
diff --git a/drivers/speex/vq.h b/drivers/speex/vq.h
deleted file mode 100644
index 5a4ced249..000000000
--- a/drivers/speex/vq.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file vq.h
- @brief Vector quantization
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef VQ_H
-#define VQ_H
-
-#include "arch.h"
-
-int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries);
-int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries);
-
-#ifdef _USE_SSE
-#include <xmmintrin.h>
-void vq_nbest(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
-
-void vq_nbest_sign(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
-#else
-void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
-
-void vq_nbest_sign(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
-#endif
-
-#endif
diff --git a/drivers/speex/vq_arm4.h b/drivers/speex/vq_arm4.h
deleted file mode 100644
index 585b8613c..000000000
--- a/drivers/speex/vq_arm4.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Copyright (C) 2004 Jean-Marc Valin */
-/**
- @file vq_arm4.h
- @brief ARM4-optimized vq routine
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_VQ_NBEST
-void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
-{
- int i,j;
- for (i=0;i<entries;i+=4)
- {
-#if 1
- spx_word32_t dist1, dist2, dist3, dist4;
- int dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8;
- __asm__ __volatile__ (
- "mov %0, #0 \n\t"
- "mov %1, #0 \n\t"
- "mov %2, #0 \n\t"
- "mov %3, #0 \n\t"
- "mov %10, %4 \n\t"
- "add %4, %4, %4\n\t"
- ".vqloop%=:\n\t"
- "ldrsh %7, [%5], #2 \n\t"
- "ldrsh %8, [%6] \n\t"
- "mov %9, %6 \n\t"
- "mla %0, %7, %8, %0 \n\t"
- "ldrsh %8, [%9, %4]! \n\t"
- "mla %1, %7, %8, %1 \n\t"
- "ldrsh %8, [%9, %4]!\n\t"
- "mla %2, %7, %8, %2 \n\t"
- "ldrsh %8, [%9, %4]! \n\t"
- "mla %3, %7, %8, %3 \n\t"
- "subs %10, %10, #1 \n\t"
- "add %6, %6, #2 \n\t"
- "bne .vqloop%="
- : "=r" (dist1), "=r" (dist2), "=r" (dist3), "=r" (dist4),
- "=r" (dead1), "=r" (dead2), "=r" (codebook), "=r" (dead4),
- "=r" (dead5), "=r" (dead6), "=r" (dead7)
- : "4" (len), "5" (in), "6" (codebook)
- : "cc");
-#else
-dist1=dist2=dist3=dist4=0;
- /* spx_word32_t dist1=0;
- spx_word32_t dist2=0;
- spx_word32_t dist3=0;
- spx_word32_t dist4=0;*/
- for (j=0;j<2;j++)
- {
- const spx_word16_t *code = codebook;
- dist1 = MAC16_16(dist1,in[j],*code);
- code += len;
- dist2 = MAC16_16(dist2,in[j],*code);
- code += len;
- dist3 = MAC16_16(dist3,in[j],*code);
- code += len;
- dist4 = MAC16_16(dist4,in[j],*code);
- codebook++;
- }
-#endif
- dist1=SUB32(SHR(*E++,1),dist1);
- if (dist1<*best_dist || i==0)
- {
- *best_dist=dist1;
- *nbest=i;
- }
- dist2=SUB32(SHR(*E++,1),dist2);
- if (dist2<*best_dist)
- {
- *best_dist=dist2;
- *nbest=i+1;
- }
- dist3=SUB32(SHR(*E++,1),dist3);
- if (dist3<*best_dist)
- {
- *best_dist=dist3;
- *nbest=i+2;
- }
- dist4=SUB32(SHR(*E++,1),dist4);
- if (dist4<*best_dist)
- {
- *best_dist=dist4;
- *nbest=i+3;
- }
- codebook += 3*len;
- }
-}
diff --git a/drivers/speex/vq_bfin.h b/drivers/speex/vq_bfin.h
deleted file mode 100644
index 2cc9ea5f1..000000000
--- a/drivers/speex/vq_bfin.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright (C) 2005 Analog Devices */
-/**
- @file vq_bfin.h
- @author Jean-Marc Valin
- @brief Blackfin-optimized vq routine
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_VQ_NBEST
-void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
-{
- if (N==1)
- {
- best_dist[0] = 2147483647;
- {
- spx_word32_t dist;
- __asm__ __volatile__
- (
- "LC0 = %8;\n\t"
- "R2 = 0;\n\t"
- "I0 = %6;\n\t"
- "B0 = %6;\n\t"
- "L0 = %9;\n\t"
- "LOOP entries_loop%= LC0;\n\t"
- "LOOP_BEGIN entries_loop%=;\n\t"
- "%0 = [%4++];\n\t"
- "%0 >>= 1;\n\t"
- "A0 = %0;\n\t"
- "R0.L = W[%1++%7] || R1.L = W[I0++];\n\t"
- "LOOP vq_loop%= LC1 = %5;\n\t"
- "LOOP_BEGIN vq_loop%=;\n\t"
- "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%7] || R1.L = W[I0++];\n\t"
- "LOOP_END vq_loop%=;\n\t"
- "%0 = (A0 -= R0.L*R1.L) (IS);\n\t"
- "cc = %0 < %2;\n\t"
- "if cc %2 = %0;\n\t"
- "if cc %3 = R2;\n\t"
- "R2 += 1;\n\t"
- "LOOP_END entries_loop%=;\n\t"
- : "=&D" (dist), "=&a" (codebook), "=&d" (best_dist[0]), "=&d" (nbest[0]), "=&a" (E)
- : "a" (len-1), "a" (in), "a" (2), "d" (entries), "d" (len<<1), "1" (codebook), "4" (E), "2" (best_dist[0]), "3" (nbest[0])
- : "R0", "R1", "R2", "I0", "L0", "B0", "A0", "cc", "memory"
- );
- }
- } else {
- int i,k,used;
- used = 0;
- for (i=0;i<entries;i++)
- {
- spx_word32_t dist;
- __asm__
- (
- "%0 >>= 1;\n\t"
- "A0 = %0;\n\t"
- "I0 = %3;\n\t"
- "L0 = 0;\n\t"
- "R0.L = W[%1++%4] || R1.L = W[I0++];\n\t"
- "LOOP vq_loop%= LC0 = %2;\n\t"
- "LOOP_BEGIN vq_loop%=;\n\t"
- "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%4] || R1.L = W[I0++];\n\t"
- "LOOP_END vq_loop%=;\n\t"
- "%0 = (A0 -= R0.L*R1.L) (IS);\n\t"
- : "=D" (dist), "=a" (codebook)
- : "a" (len-1), "a" (in), "a" (2), "1" (codebook), "0" (E[i])
- : "R0", "R1", "I0", "L0", "A0"
- );
- if (i<N || dist<best_dist[N-1])
- {
- for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--)
- {
- best_dist[k]=best_dist[k-1];
- nbest[k] = nbest[k-1];
- }
- best_dist[k]=dist;
- nbest[k]=i;
- used++;
- }
- }
- }
-}
diff --git a/drivers/speex/vq_sse.h b/drivers/speex/vq_sse.h
deleted file mode 100644
index 00a42ce35..000000000
--- a/drivers/speex/vq_sse.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Copyright (C) 2004 Jean-Marc Valin */
-/**
- @file vq_sse.h
- @brief SSE-optimized vq routine
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define OVERRIDE_VQ_NBEST
-void vq_nbest(spx_word16_t *_in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
-{
- int i,j,k,used;
- VARDECL(float *dist);
- VARDECL(__m128 *in);
- __m128 half;
- used = 0;
- ALLOC(dist, entries, float);
- half = _mm_set_ps1(.5f);
- ALLOC(in, len, __m128);
- for (i=0;i<len;i++)
- in[i] = _mm_set_ps1(_in[i]);
- for (i=0;i<entries>>2;i++)
- {
- __m128 d = _mm_mul_ps(E[i], half);
- for (j=0;j<len;j++)
- d = _mm_sub_ps(d, _mm_mul_ps(in[j], *codebook++));
- _mm_storeu_ps(dist+4*i, d);
- }
- for (i=0;i<entries;i++)
- {
- if (i<N || dist[i]<best_dist[N-1])
- {
- for (k=N-1; (k >= 1) && (k > used || dist[i] < best_dist[k-1]); k--)
- {
- best_dist[k]=best_dist[k-1];
- nbest[k] = nbest[k-1];
- }
- best_dist[k]=dist[i];
- nbest[k]=i;
- used++;
- }
- }
-}
-
-
-
-
-#define OVERRIDE_VQ_NBEST_SIGN
-void vq_nbest_sign(spx_word16_t *_in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
-{
- int i,j,k,used;
- VARDECL(float *dist);
- VARDECL(__m128 *in);
- __m128 half;
- used = 0;
- ALLOC(dist, entries, float);
- half = _mm_set_ps1(.5f);
- ALLOC(in, len, __m128);
- for (i=0;i<len;i++)
- in[i] = _mm_set_ps1(_in[i]);
- for (i=0;i<entries>>2;i++)
- {
- __m128 d = _mm_setzero_ps();
- for (j=0;j<len;j++)
- d = _mm_add_ps(d, _mm_mul_ps(in[j], *codebook++));
- _mm_storeu_ps(dist+4*i, d);
- }
- for (i=0;i<entries;i++)
- {
- int sign;
- if (dist[i]>0)
- {
- sign=0;
- dist[i]=-dist[i];
- } else
- {
- sign=1;
- }
- dist[i] += .5f*((float*)E)[i];
- if (i<N || dist[i]<best_dist[N-1])
- {
- for (k=N-1; (k >= 1) && (k > used || dist[i] < best_dist[k-1]); k--)
- {
- best_dist[k]=best_dist[k-1];
- nbest[k] = nbest[k-1];
- }
- best_dist[k]=dist[i];
- nbest[k]=i;
- used++;
- if (sign)
- nbest[k]+=entries;
- }
- }
-}
diff --git a/drivers/speex/window.c b/drivers/speex/window.c
deleted file mode 100644
index 3376415ff..000000000
--- a/drivers/speex/window.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright (C) 2006 Jean-Marc Valin
- File: window.c
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "config.h"
-
-
-#include "arch.h"
-
-#ifdef FIXED_POINT
-const spx_word16_t lag_window[11] = {
- 16384, 16337, 16199, 15970, 15656, 15260, 14790, 14254, 13659, 13015, 12330
-};
-
-const spx_word16_t lpc_window[200] = {
-1310, 1313, 1321, 1333, 1352, 1375, 1403, 1436,
-1475, 1518, 1567, 1621, 1679, 1743, 1811, 1884,
-1962, 2044, 2132, 2224, 2320, 2421, 2526, 2636,
-2750, 2868, 2990, 3116, 3246, 3380, 3518, 3659,
-3804, 3952, 4104, 4259, 4417, 4578, 4742, 4909,
-5079, 5251, 5425, 5602, 5781, 5963, 6146, 6331,
-6518, 6706, 6896, 7087, 7280, 7473, 7668, 7863,
-8059, 8256, 8452, 8650, 8847, 9044, 9241, 9438,
-9635, 9831, 10026, 10220, 10414, 10606, 10797, 10987,
-11176, 11363, 11548, 11731, 11912, 12091, 12268, 12443,
-12615, 12785, 12952, 13116, 13277, 13435, 13590, 13742,
-13890, 14035, 14176, 14314, 14448, 14578, 14704, 14826,
-14944, 15058, 15168, 15273, 15374, 15470, 15562, 15649,
-15732, 15810, 15883, 15951, 16015, 16073, 16127, 16175,
-16219, 16257, 16291, 16319, 16342, 16360, 16373, 16381,
-16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
-16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
-16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
-16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
-16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
-16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
-16384, 16384, 16384, 16361, 16294, 16183, 16028, 15830,
-15588, 15304, 14979, 14613, 14207, 13763, 13282, 12766,
-12215, 11631, 11016, 10373, 9702, 9007, 8289, 7551,
-6797, 6028, 5251, 4470, 3695, 2943, 2248, 1696
-};
-#else
-const spx_word16_t lag_window[11] = {
- 1.00000, 0.99716, 0.98869, 0.97474, 0.95554, 0.93140, 0.90273, 0.86998, 0.83367, 0.79434, 0.75258
-};
-
-const spx_word16_t lpc_window[200] = {
- 0.080000f, 0.080158f, 0.080630f, 0.081418f, 0.082520f, 0.083935f, 0.085663f, 0.087703f,
- 0.090052f, 0.092710f, 0.095674f, 0.098943f, 0.102514f, 0.106385f, 0.110553f, 0.115015f,
- 0.119769f, 0.124811f, 0.130137f, 0.135744f, 0.141628f, 0.147786f, 0.154212f, 0.160902f,
- 0.167852f, 0.175057f, 0.182513f, 0.190213f, 0.198153f, 0.206328f, 0.214731f, 0.223357f,
- 0.232200f, 0.241254f, 0.250513f, 0.259970f, 0.269619f, 0.279453f, 0.289466f, 0.299651f,
- 0.310000f, 0.320507f, 0.331164f, 0.341965f, 0.352901f, 0.363966f, 0.375151f, 0.386449f,
- 0.397852f, 0.409353f, 0.420943f, 0.432615f, 0.444361f, 0.456172f, 0.468040f, 0.479958f,
- 0.491917f, 0.503909f, 0.515925f, 0.527959f, 0.540000f, 0.552041f, 0.564075f, 0.576091f,
- 0.588083f, 0.600042f, 0.611960f, 0.623828f, 0.635639f, 0.647385f, 0.659057f, 0.670647f,
- 0.682148f, 0.693551f, 0.704849f, 0.716034f, 0.727099f, 0.738035f, 0.748836f, 0.759493f,
- 0.770000f, 0.780349f, 0.790534f, 0.800547f, 0.810381f, 0.820030f, 0.829487f, 0.838746f,
- 0.847800f, 0.856643f, 0.865269f, 0.873672f, 0.881847f, 0.889787f, 0.897487f, 0.904943f,
- 0.912148f, 0.919098f, 0.925788f, 0.932214f, 0.938372f, 0.944256f, 0.949863f, 0.955189f,
- 0.960231f, 0.964985f, 0.969447f, 0.973615f, 0.977486f, 0.981057f, 0.984326f, 0.987290f,
- 0.989948f, 0.992297f, 0.994337f, 0.996065f, 0.997480f, 0.998582f, 0.999370f, 0.999842f,
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
- 1.000000f, 1.000000f, 1.000000f, 0.998640f, 0.994566f, 0.987787f, 0.978324f, 0.966203f,
- 0.951458f, 0.934131f, 0.914270f, 0.891931f, 0.867179f, 0.840084f, 0.810723f, 0.779182f,
- 0.745551f, 0.709930f, 0.672424f, 0.633148f, 0.592223f, 0.549781f, 0.505964f, 0.460932f,
- 0.414863f, 0.367968f, 0.320511f, 0.272858f, 0.225569f, 0.179655f, 0.137254f, 0.103524f
-};
-#endif
diff --git a/drivers/squish/SCsub b/drivers/squish/SCsub
deleted file mode 100644
index da39dc1eb..000000000
--- a/drivers/squish/SCsub
+++ /dev/null
@@ -1,23 +0,0 @@
-Import('env')
-
-
-squish_sources=[
-'squish/alpha.cpp',
-'squish/clusterfit.cpp',
-'squish/colourblock.cpp',
-'squish/colourfit.cpp',
-'squish/colourset.cpp',
-'squish/maths.cpp',
-'squish/rangefit.cpp',
-'squish/singlecolourfit.cpp',
-'squish/squish.cpp',
-'squish/image_compress_squish.cpp',
-]
-
-
-if (env["tools"]=="yes"):
- env.drivers_sources+=squish_sources
-
-#env.add_source_files(env.drivers_sources, squish_sources)
-
-Export('env')
diff --git a/drivers/squish/alpha.cpp b/drivers/squish/alpha.cpp
deleted file mode 100644
index 2ddb7dc28..000000000
--- a/drivers/squish/alpha.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "alpha.h"
-#include <algorithm>
-
-namespace squish {
-
-static int FloatToInt( float a, int limit )
-{
- // use ANSI round-to-zero behaviour to get round-to-nearest
- int i = ( int )( a + 0.5f );
-
- // clamp to the limit
- if( i < 0 )
- i = 0;
- else if( i > limit )
- i = limit;
-
- // done
- return i;
-}
-
-void CompressAlphaDxt3( u8 const* rgba, int mask, void* block )
-{
- u8* bytes = reinterpret_cast< u8* >( block );
-
- // quantise and pack the alpha values pairwise
- for( int i = 0; i < 8; ++i )
- {
- // quantise down to 4 bits
- float alpha1 = ( float )rgba[8*i + 3] * ( 15.0f/255.0f );
- float alpha2 = ( float )rgba[8*i + 7] * ( 15.0f/255.0f );
- int quant1 = FloatToInt( alpha1, 15 );
- int quant2 = FloatToInt( alpha2, 15 );
-
- // set alpha to zero where masked
- int bit1 = 1 << ( 2*i );
- int bit2 = 1 << ( 2*i + 1 );
- if( ( mask & bit1 ) == 0 )
- quant1 = 0;
- if( ( mask & bit2 ) == 0 )
- quant2 = 0;
-
- // pack into the byte
- bytes[i] = ( u8 )( quant1 | ( quant2 << 4 ) );
- }
-}
-
-void DecompressAlphaDxt3( u8* rgba, void const* block )
-{
- u8 const* bytes = reinterpret_cast< u8 const* >( block );
-
- // unpack the alpha values pairwise
- for( int i = 0; i < 8; ++i )
- {
- // quantise down to 4 bits
- u8 quant = bytes[i];
-
- // unpack the values
- u8 lo = quant & 0x0f;
- u8 hi = quant & 0xf0;
-
- // convert back up to bytes
- rgba[8*i + 3] = lo | ( lo << 4 );
- rgba[8*i + 7] = hi | ( hi >> 4 );
- }
-}
-
-static void FixRange( int& min, int& max, int steps )
-{
- if( max - min < steps )
- max = std::min( min + steps, 255 );
- if( max - min < steps )
- min = std::max( 0, max - steps );
-}
-
-static int FitCodes( u8 const* rgba, int mask, u8 const* codes, u8* indices )
-{
- // fit each alpha value to the codebook
- int err = 0;
- for( int i = 0; i < 16; ++i )
- {
- // check this pixel is valid
- int bit = 1 << i;
- if( ( mask & bit ) == 0 )
- {
- // use the first code
- indices[i] = 0;
- continue;
- }
-
- // find the least error and corresponding index
- int value = rgba[4*i + 3];
- int least = 2147483647; //INT_MAX
- int index = 0;
- for( int j = 0; j < 8; ++j )
- {
- // get the squared error from this code
- int dist = ( int )value - ( int )codes[j];
- dist *= dist;
-
- // compare with the best so far
- if( dist < least )
- {
- least = dist;
- index = j;
- }
- }
-
- // save this index and accumulate the error
- indices[i] = ( u8 )index;
- err += least;
- }
-
- // return the total error
- return err;
-}
-
-static void WriteAlphaBlock( int alpha0, int alpha1, u8 const* indices, void* block )
-{
- u8* bytes = reinterpret_cast< u8* >( block );
-
- // write the first two bytes
- bytes[0] = ( u8 )alpha0;
- bytes[1] = ( u8 )alpha1;
-
- // pack the indices with 3 bits each
- u8* dest = bytes + 2;
- u8 const* src = indices;
- for( int i = 0; i < 2; ++i )
- {
- // pack 8 3-bit values
- int value = 0;
- for( int j = 0; j < 8; ++j )
- {
- int index = *src++;
- value |= ( index << 3*j );
- }
-
- // store in 3 bytes
- for( int j = 0; j < 3; ++j )
- {
- int byte = ( value >> 8*j ) & 0xff;
- *dest++ = ( u8 )byte;
- }
- }
-}
-
-static void WriteAlphaBlock5( int alpha0, int alpha1, u8 const* indices, void* block )
-{
- // check the relative values of the endpoints
- if( alpha0 > alpha1 )
- {
- // swap the indices
- u8 swapped[16];
- for( int i = 0; i < 16; ++i )
- {
- u8 index = indices[i];
- if( index == 0 )
- swapped[i] = 1;
- else if( index == 1 )
- swapped[i] = 0;
- else if( index <= 5 )
- swapped[i] = 7 - index;
- else
- swapped[i] = index;
- }
-
- // write the block
- WriteAlphaBlock( alpha1, alpha0, swapped, block );
- }
- else
- {
- // write the block
- WriteAlphaBlock( alpha0, alpha1, indices, block );
- }
-}
-
-static void WriteAlphaBlock7( int alpha0, int alpha1, u8 const* indices, void* block )
-{
- // check the relative values of the endpoints
- if( alpha0 < alpha1 )
- {
- // swap the indices
- u8 swapped[16];
- for( int i = 0; i < 16; ++i )
- {
- u8 index = indices[i];
- if( index == 0 )
- swapped[i] = 1;
- else if( index == 1 )
- swapped[i] = 0;
- else
- swapped[i] = 9 - index;
- }
-
- // write the block
- WriteAlphaBlock( alpha1, alpha0, swapped, block );
- }
- else
- {
- // write the block
- WriteAlphaBlock( alpha0, alpha1, indices, block );
- }
-}
-
-void CompressAlphaDxt5( u8 const* rgba, int mask, void* block )
-{
- // get the range for 5-alpha and 7-alpha interpolation
- int min5 = 255;
- int max5 = 0;
- int min7 = 255;
- int max7 = 0;
- for( int i = 0; i < 16; ++i )
- {
- // check this pixel is valid
- int bit = 1 << i;
- if( ( mask & bit ) == 0 )
- continue;
-
- // incorporate into the min/max
- int value = rgba[4*i + 3];
- if( value < min7 )
- min7 = value;
- if( value > max7 )
- max7 = value;
- if( value != 0 && value < min5 )
- min5 = value;
- if( value != 255 && value > max5 )
- max5 = value;
- }
-
- // handle the case that no valid range was found
- if( min5 > max5 )
- min5 = max5;
- if( min7 > max7 )
- min7 = max7;
-
- // fix the range to be the minimum in each case
- FixRange( min5, max5, 5 );
- FixRange( min7, max7, 7 );
-
- // set up the 5-alpha code book
- u8 codes5[8];
- codes5[0] = ( u8 )min5;
- codes5[1] = ( u8 )max5;
- for( int i = 1; i < 5; ++i )
- codes5[1 + i] = ( u8 )( ( ( 5 - i )*min5 + i*max5 )/5 );
- codes5[6] = 0;
- codes5[7] = 255;
-
- // set up the 7-alpha code book
- u8 codes7[8];
- codes7[0] = ( u8 )min7;
- codes7[1] = ( u8 )max7;
- for( int i = 1; i < 7; ++i )
- codes7[1 + i] = ( u8 )( ( ( 7 - i )*min7 + i*max7 )/7 );
-
- // fit the data to both code books
- u8 indices5[16];
- u8 indices7[16];
- int err5 = FitCodes( rgba, mask, codes5, indices5 );
- int err7 = FitCodes( rgba, mask, codes7, indices7 );
-
- // save the block with least error
- if( err5 <= err7 )
- WriteAlphaBlock5( min5, max5, indices5, block );
- else
- WriteAlphaBlock7( min7, max7, indices7, block );
-}
-
-void DecompressAlphaDxt5( u8* rgba, void const* block )
-{
- // get the two alpha values
- u8 const* bytes = reinterpret_cast< u8 const* >( block );
- int alpha0 = bytes[0];
- int alpha1 = bytes[1];
-
- // compare the values to build the codebook
- u8 codes[8];
- codes[0] = ( u8 )alpha0;
- codes[1] = ( u8 )alpha1;
- if( alpha0 <= alpha1 )
- {
- // use 5-alpha codebook
- for( int i = 1; i < 5; ++i )
- codes[1 + i] = ( u8 )( ( ( 5 - i )*alpha0 + i*alpha1 )/5 );
- codes[6] = 0;
- codes[7] = 255;
- }
- else
- {
- // use 7-alpha codebook
- for( int i = 1; i < 7; ++i )
- codes[1 + i] = ( u8 )( ( ( 7 - i )*alpha0 + i*alpha1 )/7 );
- }
-
- // decode the indices
- u8 indices[16];
- u8 const* src = bytes + 2;
- u8* dest = indices;
- for( int i = 0; i < 2; ++i )
- {
- // grab 3 bytes
- int value = 0;
- for( int j = 0; j < 3; ++j )
- {
- int byte = *src++;
- value |= ( byte << 8*j );
- }
-
- // unpack 8 3-bit values from it
- for( int j = 0; j < 8; ++j )
- {
- int index = ( value >> 3*j ) & 0x7;
- *dest++ = ( u8 )index;
- }
- }
-
- // write out the indexed codebook values
- for( int i = 0; i < 16; ++i )
- rgba[4*i + 3] = codes[indices[i]];
-}
-
-} // namespace squish
diff --git a/drivers/squish/alpha.h b/drivers/squish/alpha.h
deleted file mode 100644
index d56fe4d2c..000000000
--- a/drivers/squish/alpha.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_ALPHA_H
-#define SQUISH_ALPHA_H
-
-#include "squish/squish.h"
-
-namespace squish {
-
-void CompressAlphaDxt3( u8 const* rgba, int mask, void* block );
-void CompressAlphaDxt5( u8 const* rgba, int mask, void* block );
-
-void DecompressAlphaDxt3( u8* rgba, void const* block );
-void DecompressAlphaDxt5( u8* rgba, void const* block );
-
-} // namespace squish
-
-#endif // ndef SQUISH_ALPHA_H
diff --git a/drivers/squish/clusterfit.cpp b/drivers/squish/clusterfit.cpp
deleted file mode 100644
index afea84880..000000000
--- a/drivers/squish/clusterfit.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2007 Ignacio Castano icastano@nvidia.com
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "clusterfit.h"
-#include "colourset.h"
-#include "colourblock.h"
-#include <cfloat>
-
-namespace squish {
-
-ClusterFit::ClusterFit( ColourSet const* colours, int flags )
- : ColourFit( colours, flags )
-{
- // set the iteration count
- m_iterationCount = ( m_flags & kColourIterativeClusterFit ) ? kMaxIterations : 1;
-
- // initialise the best error
- m_besterror = VEC4_CONST( FLT_MAX );
-
- // initialise the metric
- bool perceptual = ( ( m_flags & kColourMetricPerceptual ) != 0 );
- if( perceptual )
- m_metric = Vec4( 0.2126f, 0.7152f, 0.0722f, 0.0f );
- else
- m_metric = VEC4_CONST( 1.0f );
-
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // get the covariance matrix
- Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights() );
-
- // compute the principle component
- m_principle = ComputePrincipleComponent( covariance );
-}
-
-bool ClusterFit::ConstructOrdering( Vec3 const& axis, int iteration )
-{
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // build the list of dot products
- float dps[16];
- u8* order = ( u8* )m_order + 16*iteration;
- for( int i = 0; i < count; ++i )
- {
- dps[i] = Dot( values[i], axis );
- order[i] = ( u8 )i;
- }
-
- // stable sort using them
- for( int i = 0; i < count; ++i )
- {
- for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j )
- {
- std::swap( dps[j], dps[j - 1] );
- std::swap( order[j], order[j - 1] );
- }
- }
-
- // check this ordering is unique
- for( int it = 0; it < iteration; ++it )
- {
- u8 const* prev = ( u8* )m_order + 16*it;
- bool same = true;
- for( int i = 0; i < count; ++i )
- {
- if( order[i] != prev[i] )
- {
- same = false;
- break;
- }
- }
- if( same )
- return false;
- }
-
- // copy the ordering and weight all the points
- Vec3 const* unweighted = m_colours->GetPoints();
- float const* weights = m_colours->GetWeights();
- m_xsum_wsum = VEC4_CONST( 0.0f );
- for( int i = 0; i < count; ++i )
- {
- int j = order[i];
- Vec4 p( unweighted[j].X(), unweighted[j].Y(), unweighted[j].Z(), 1.0f );
- Vec4 w( weights[j] );
- Vec4 x = p*w;
- m_points_weights[i] = x;
- m_xsum_wsum += x;
- }
- return true;
-}
-
-void ClusterFit::Compress3( void* block )
-{
- // declare variables
- int const count = m_colours->GetCount();
- Vec4 const two = VEC4_CONST( 2.0 );
- Vec4 const one = VEC4_CONST( 1.0f );
- Vec4 const half_half2( 0.5f, 0.5f, 0.5f, 0.25f );
- Vec4 const zero = VEC4_CONST( 0.0f );
- Vec4 const half = VEC4_CONST( 0.5f );
- Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
- Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
-
- // prepare an ordering using the principle axis
- ConstructOrdering( m_principle, 0 );
-
- // check all possible clusters and iterate on the total order
- Vec4 beststart = VEC4_CONST( 0.0f );
- Vec4 bestend = VEC4_CONST( 0.0f );
- Vec4 besterror = m_besterror;
- u8 bestindices[16];
- int bestiteration = 0;
- int besti = 0, bestj = 0;
-
- // loop over iterations (we avoid the case that all points in first or last cluster)
- for( int iterationIndex = 0;; )
- {
- // first cluster [0,i) is at the start
- Vec4 part0 = VEC4_CONST( 0.0f );
- for( int i = 0; i < count; ++i )
- {
- // second cluster [i,j) is half along
- Vec4 part1 = ( i == 0 ) ? m_points_weights[0] : VEC4_CONST( 0.0f );
- int jmin = ( i == 0 ) ? 1 : i;
- for( int j = jmin;; )
- {
- // last cluster [j,count) is at the end
- Vec4 part2 = m_xsum_wsum - part1 - part0;
-
- // compute least squares terms directly
- Vec4 alphax_sum = MultiplyAdd( part1, half_half2, part0 );
- Vec4 alpha2_sum = alphax_sum.SplatW();
-
- Vec4 betax_sum = MultiplyAdd( part1, half_half2, part2 );
- Vec4 beta2_sum = betax_sum.SplatW();
-
- Vec4 alphabeta_sum = ( part1*half_half2 ).SplatW();
-
- // compute the least-squares optimal points
- Vec4 factor = Reciprocal( NegativeMultiplySubtract( alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum ) );
- Vec4 a = NegativeMultiplySubtract( betax_sum, alphabeta_sum, alphax_sum*beta2_sum )*factor;
- Vec4 b = NegativeMultiplySubtract( alphax_sum, alphabeta_sum, betax_sum*alpha2_sum )*factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Truncate( MultiplyAdd( grid, a, half ) )*gridrcp;
- b = Truncate( MultiplyAdd( grid, b, half ) )*gridrcp;
-
- // compute the error (we skip the constant xxsum)
- Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
- Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
- Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
- Vec4 e4 = MultiplyAdd( two, e3, e1 );
-
- // apply the metric to the error term
- Vec4 e5 = e4*m_metric;
- Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
-
- // keep the solution if it wins
- if( CompareAnyLessThan( error, besterror ) )
- {
- beststart = a;
- bestend = b;
- besti = i;
- bestj = j;
- besterror = error;
- bestiteration = iterationIndex;
- }
-
- // advance
- if( j == count )
- break;
- part1 += m_points_weights[j];
- ++j;
- }
-
- // advance
- part0 += m_points_weights[i];
- }
-
- // stop if we didn't improve in this iteration
- if( bestiteration != iterationIndex )
- break;
-
- // advance if possible
- ++iterationIndex;
- if( iterationIndex == m_iterationCount )
- break;
-
- // stop if a new iteration is an ordering that has already been tried
- Vec3 axis = ( bestend - beststart ).GetVec3();
- if( !ConstructOrdering( axis, iterationIndex ) )
- break;
- }
-
- // save the block if necessary
- if( CompareAnyLessThan( besterror, m_besterror ) )
- {
- // remap the indices
- u8 const* order = ( u8* )m_order + 16*bestiteration;
-
- u8 unordered[16];
- for( int m = 0; m < besti; ++m )
- unordered[order[m]] = 0;
- for( int m = besti; m < bestj; ++m )
- unordered[order[m]] = 2;
- for( int m = bestj; m < count; ++m )
- unordered[order[m]] = 1;
-
- m_colours->RemapIndices( unordered, bestindices );
-
- // save the block
- WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-void ClusterFit::Compress4( void* block )
-{
- // declare variables
- int const count = m_colours->GetCount();
- Vec4 const two = VEC4_CONST( 2.0f );
- Vec4 const one = VEC4_CONST( 1.0f );
- Vec4 const onethird_onethird2( 1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 1.0f/9.0f );
- Vec4 const twothirds_twothirds2( 2.0f/3.0f, 2.0f/3.0f, 2.0f/3.0f, 4.0f/9.0f );
- Vec4 const twonineths = VEC4_CONST( 2.0f/9.0f );
- Vec4 const zero = VEC4_CONST( 0.0f );
- Vec4 const half = VEC4_CONST( 0.5f );
- Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
- Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
-
- // prepare an ordering using the principle axis
- ConstructOrdering( m_principle, 0 );
-
- // check all possible clusters and iterate on the total order
- Vec4 beststart = VEC4_CONST( 0.0f );
- Vec4 bestend = VEC4_CONST( 0.0f );
- Vec4 besterror = m_besterror;
- u8 bestindices[16];
- int bestiteration = 0;
- int besti = 0, bestj = 0, bestk = 0;
-
- // loop over iterations (we avoid the case that all points in first or last cluster)
- for( int iterationIndex = 0;; )
- {
- // first cluster [0,i) is at the start
- Vec4 part0 = VEC4_CONST( 0.0f );
- for( int i = 0; i < count; ++i )
- {
- // second cluster [i,j) is one third along
- Vec4 part1 = VEC4_CONST( 0.0f );
- for( int j = i;; )
- {
- // third cluster [j,k) is two thirds along
- Vec4 part2 = ( j == 0 ) ? m_points_weights[0] : VEC4_CONST( 0.0f );
- int kmin = ( j == 0 ) ? 1 : j;
- for( int k = kmin;; )
- {
- // last cluster [k,count) is at the end
- Vec4 part3 = m_xsum_wsum - part2 - part1 - part0;
-
- // compute least squares terms directly
- Vec4 const alphax_sum = MultiplyAdd( part2, onethird_onethird2, MultiplyAdd( part1, twothirds_twothirds2, part0 ) );
- Vec4 const alpha2_sum = alphax_sum.SplatW();
-
- Vec4 const betax_sum = MultiplyAdd( part1, onethird_onethird2, MultiplyAdd( part2, twothirds_twothirds2, part3 ) );
- Vec4 const beta2_sum = betax_sum.SplatW();
-
- Vec4 const alphabeta_sum = twonineths*( part1 + part2 ).SplatW();
-
- // compute the least-squares optimal points
- Vec4 factor = Reciprocal( NegativeMultiplySubtract( alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum ) );
- Vec4 a = NegativeMultiplySubtract( betax_sum, alphabeta_sum, alphax_sum*beta2_sum )*factor;
- Vec4 b = NegativeMultiplySubtract( alphax_sum, alphabeta_sum, betax_sum*alpha2_sum )*factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Truncate( MultiplyAdd( grid, a, half ) )*gridrcp;
- b = Truncate( MultiplyAdd( grid, b, half ) )*gridrcp;
-
- // compute the error (we skip the constant xxsum)
- Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
- Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
- Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
- Vec4 e4 = MultiplyAdd( two, e3, e1 );
-
- // apply the metric to the error term
- Vec4 e5 = e4*m_metric;
- Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
-
- // keep the solution if it wins
- if( CompareAnyLessThan( error, besterror ) )
- {
- beststart = a;
- bestend = b;
- besterror = error;
- besti = i;
- bestj = j;
- bestk = k;
- bestiteration = iterationIndex;
- }
-
- // advance
- if( k == count )
- break;
- part2 += m_points_weights[k];
- ++k;
- }
-
- // advance
- if( j == count )
- break;
- part1 += m_points_weights[j];
- ++j;
- }
-
- // advance
- part0 += m_points_weights[i];
- }
-
- // stop if we didn't improve in this iteration
- if( bestiteration != iterationIndex )
- break;
-
- // advance if possible
- ++iterationIndex;
- if( iterationIndex == m_iterationCount )
- break;
-
- // stop if a new iteration is an ordering that has already been tried
- Vec3 axis = ( bestend - beststart ).GetVec3();
- if( !ConstructOrdering( axis, iterationIndex ) )
- break;
- }
-
- // save the block if necessary
- if( CompareAnyLessThan( besterror, m_besterror ) )
- {
- // remap the indices
- u8 const* order = ( u8* )m_order + 16*bestiteration;
-
- u8 unordered[16];
- for( int m = 0; m < besti; ++m )
- unordered[order[m]] = 0;
- for( int m = besti; m < bestj; ++m )
- unordered[order[m]] = 2;
- for( int m = bestj; m < bestk; ++m )
- unordered[order[m]] = 3;
- for( int m = bestk; m < count; ++m )
- unordered[order[m]] = 1;
-
- m_colours->RemapIndices( unordered, bestindices );
-
- // save the block
- WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-} // namespace squish
diff --git a/drivers/squish/clusterfit.h b/drivers/squish/clusterfit.h
deleted file mode 100644
index 2d2b67103..000000000
--- a/drivers/squish/clusterfit.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2007 Ignacio Castano icastano@nvidia.com
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_CLUSTERFIT_H
-#define SQUISH_CLUSTERFIT_H
-
-#include "squish/squish.h"
-#include "maths.h"
-#include "simd.h"
-#include "colourfit.h"
-
-namespace squish {
-
-class ClusterFit : public ColourFit
-{
-public:
- ClusterFit( ColourSet const* colours, int flags );
-
-private:
- bool ConstructOrdering( Vec3 const& axis, int iteration );
-
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
- enum { kMaxIterations = 8 };
-
- int m_iterationCount;
- Vec3 m_principle;
- u8 m_order[16*kMaxIterations];
- Vec4 m_points_weights[16];
- Vec4 m_xsum_wsum;
- Vec4 m_metric;
- Vec4 m_besterror;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_CLUSTERFIT_H
diff --git a/drivers/squish/colourblock.cpp b/drivers/squish/colourblock.cpp
deleted file mode 100644
index e6a5788b7..000000000
--- a/drivers/squish/colourblock.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "colourblock.h"
-
-namespace squish {
-
-static int FloatToInt( float a, int limit )
-{
- // use ANSI round-to-zero behaviour to get round-to-nearest
- int i = ( int )( a + 0.5f );
-
- // clamp to the limit
- if( i < 0 )
- i = 0;
- else if( i > limit )
- i = limit;
-
- // done
- return i;
-}
-
-static int FloatTo565( Vec3::Arg colour )
-{
- // get the components in the correct range
- int r = FloatToInt( 31.0f*colour.X(), 31 );
- int g = FloatToInt( 63.0f*colour.Y(), 63 );
- int b = FloatToInt( 31.0f*colour.Z(), 31 );
-
- // pack into a single value
- return ( r << 11 ) | ( g << 5 ) | b;
-}
-
-static void WriteColourBlock( int a, int b, u8* indices, void* block )
-{
- // get the block as bytes
- u8* bytes = ( u8* )block;
-
- // write the endpoints
- bytes[0] = ( u8 )( a & 0xff );
- bytes[1] = ( u8 )( a >> 8 );
- bytes[2] = ( u8 )( b & 0xff );
- bytes[3] = ( u8 )( b >> 8 );
-
- // write the indices
- for( int i = 0; i < 4; ++i )
- {
- u8 const* ind = indices + 4*i;
- bytes[4 + i] = ind[0] | ( ind[1] << 2 ) | ( ind[2] << 4 ) | ( ind[3] << 6 );
- }
-}
-
-void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block )
-{
- // get the packed values
- int a = FloatTo565( start );
- int b = FloatTo565( end );
-
- // remap the indices
- u8 remapped[16];
- if( a <= b )
- {
- // use the indices directly
- for( int i = 0; i < 16; ++i )
- remapped[i] = indices[i];
- }
- else
- {
- // swap a and b
- std::swap( a, b );
- for( int i = 0; i < 16; ++i )
- {
- if( indices[i] == 0 )
- remapped[i] = 1;
- else if( indices[i] == 1 )
- remapped[i] = 0;
- else
- remapped[i] = indices[i];
- }
- }
-
- // write the block
- WriteColourBlock( a, b, remapped, block );
-}
-
-void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block )
-{
- // get the packed values
- int a = FloatTo565( start );
- int b = FloatTo565( end );
-
- // remap the indices
- u8 remapped[16];
- if( a < b )
- {
- // swap a and b
- std::swap( a, b );
- for( int i = 0; i < 16; ++i )
- remapped[i] = ( indices[i] ^ 0x1 ) & 0x3;
- }
- else if( a == b )
- {
- // use index 0
- for( int i = 0; i < 16; ++i )
- remapped[i] = 0;
- }
- else
- {
- // use the indices directly
- for( int i = 0; i < 16; ++i )
- remapped[i] = indices[i];
- }
-
- // write the block
- WriteColourBlock( a, b, remapped, block );
-}
-
-static int Unpack565( u8 const* packed, u8* colour )
-{
- // build the packed value
- int value = ( int )packed[0] | ( ( int )packed[1] << 8 );
-
- // get the components in the stored range
- u8 red = ( u8 )( ( value >> 11 ) & 0x1f );
- u8 green = ( u8 )( ( value >> 5 ) & 0x3f );
- u8 blue = ( u8 )( value & 0x1f );
-
- // scale up to 8 bits
- colour[0] = ( red << 3 ) | ( red >> 2 );
- colour[1] = ( green << 2 ) | ( green >> 4 );
- colour[2] = ( blue << 3 ) | ( blue >> 2 );
- colour[3] = 255;
-
- // return the value
- return value;
-}
-
-void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
-{
- // get the block bytes
- u8 const* bytes = reinterpret_cast< u8 const* >( block );
-
- // unpack the endpoints
- u8 codes[16];
- int a = Unpack565( bytes, codes );
- int b = Unpack565( bytes + 2, codes + 4 );
-
- // generate the midpoints
- for( int i = 0; i < 3; ++i )
- {
- int c = codes[i];
- int d = codes[4 + i];
-
- if( isDxt1 && a <= b )
- {
- codes[8 + i] = ( u8 )( ( c + d )/2 );
- codes[12 + i] = 0;
- }
- else
- {
- codes[8 + i] = ( u8 )( ( 2*c + d )/3 );
- codes[12 + i] = ( u8 )( ( c + 2*d )/3 );
- }
- }
-
- // fill in alpha for the intermediate values
- codes[8 + 3] = 255;
- codes[12 + 3] = ( isDxt1 && a <= b ) ? 0 : 255;
-
- // unpack the indices
- u8 indices[16];
- for( int i = 0; i < 4; ++i )
- {
- u8* ind = indices + 4*i;
- u8 packed = bytes[4 + i];
-
- ind[0] = packed & 0x3;
- ind[1] = ( packed >> 2 ) & 0x3;
- ind[2] = ( packed >> 4 ) & 0x3;
- ind[3] = ( packed >> 6 ) & 0x3;
- }
-
- // store out the colours
- for( int i = 0; i < 16; ++i )
- {
- u8 offset = 4*indices[i];
- for( int j = 0; j < 4; ++j )
- rgba[4*i + j] = codes[offset + j];
- }
-}
-
-} // namespace squish
diff --git a/drivers/squish/colourblock.h b/drivers/squish/colourblock.h
deleted file mode 100644
index 8a25b42a6..000000000
--- a/drivers/squish/colourblock.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_COLOURBLOCK_H
-#define SQUISH_COLOURBLOCK_H
-
-#include "squish/squish.h"
-#include "maths.h"
-
-namespace squish {
-
-void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
-void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
-
-void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
-
-} // namespace squish
-
-#endif // ndef SQUISH_COLOURBLOCK_H
diff --git a/drivers/squish/colourfit.cpp b/drivers/squish/colourfit.cpp
deleted file mode 100644
index dba2b87e8..000000000
--- a/drivers/squish/colourfit.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "colourfit.h"
-#include "colourset.h"
-
-namespace squish {
-
-ColourFit::ColourFit( ColourSet const* colours, int flags )
- : m_colours( colours ),
- m_flags( flags )
-{
-}
-
-void ColourFit::Compress( void* block )
-{
- bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 );
- if( isDxt1 )
- {
- Compress3( block );
- if( !m_colours->IsTransparent() )
- Compress4( block );
- }
- else
- Compress4( block );
-}
-
-} // namespace squish
diff --git a/drivers/squish/colourfit.h b/drivers/squish/colourfit.h
deleted file mode 100644
index d048b4870..000000000
--- a/drivers/squish/colourfit.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_COLOURFIT_H
-#define SQUISH_COLOURFIT_H
-
-#include "squish/squish.h"
-#include "maths.h"
-
-namespace squish {
-
-class ColourSet;
-
-class ColourFit
-{
-public:
- ColourFit( ColourSet const* colours, int flags );
-
- void Compress( void* block );
-
-protected:
- virtual void Compress3( void* block ) = 0;
- virtual void Compress4( void* block ) = 0;
-
- ColourSet const* m_colours;
- int m_flags;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_COLOURFIT_H
diff --git a/drivers/squish/colourset.cpp b/drivers/squish/colourset.cpp
deleted file mode 100644
index 97d29d987..000000000
--- a/drivers/squish/colourset.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "colourset.h"
-
-namespace squish {
-
-ColourSet::ColourSet( u8 const* rgba, int mask, int flags )
- : m_count( 0 ),
- m_transparent( false )
-{
- // check the compression mode for dxt1
- bool isDxt1 = ( ( flags & kDxt1 ) != 0 );
- bool weightByAlpha = ( ( flags & kWeightColourByAlpha ) != 0 );
-
- // create the minimal set
- for( int i = 0; i < 16; ++i )
- {
- // check this pixel is enabled
- int bit = 1 << i;
- if( ( mask & bit ) == 0 )
- {
- m_remap[i] = -1;
- continue;
- }
-
- // check for transparent pixels when using dxt1
- if( isDxt1 && rgba[4*i + 3] < 128 )
- {
- m_remap[i] = -1;
- m_transparent = true;
- continue;
- }
-
- // loop over previous points for a match
- for( int j = 0;; ++j )
- {
- // allocate a new point
- if( j == i )
- {
- // normalise coordinates to [0,1]
- float x = ( float )rgba[4*i] / 255.0f;
- float y = ( float )rgba[4*i + 1] / 255.0f;
- float z = ( float )rgba[4*i + 2] / 255.0f;
-
- // ensure there is always non-zero weight even for zero alpha
- float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
-
- // add the point
- m_points[m_count] = Vec3( x, y, z );
- m_weights[m_count] = ( weightByAlpha ? w : 1.0f );
- m_remap[i] = m_count;
-
- // advance
- ++m_count;
- break;
- }
-
- // check for a match
- int oldbit = 1 << j;
- bool match = ( ( mask & oldbit ) != 0 )
- && ( rgba[4*i] == rgba[4*j] )
- && ( rgba[4*i + 1] == rgba[4*j + 1] )
- && ( rgba[4*i + 2] == rgba[4*j + 2] )
- && ( rgba[4*j + 3] >= 128 || !isDxt1 );
- if( match )
- {
- // get the index of the match
- int index = m_remap[j];
-
- // ensure there is always non-zero weight even for zero alpha
- float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
-
- // map to this point and increase the weight
- m_weights[index] += ( weightByAlpha ? w : 1.0f );
- m_remap[i] = index;
- break;
- }
- }
- }
-
- // square root the weights
- for( int i = 0; i < m_count; ++i )
- m_weights[i] = std::sqrt( m_weights[i] );
-}
-
-void ColourSet::RemapIndices( u8 const* source, u8* target ) const
-{
- for( int i = 0; i < 16; ++i )
- {
- int j = m_remap[i];
- if( j == -1 )
- target[i] = 3;
- else
- target[i] = source[j];
- }
-}
-
-} // namespace squish
diff --git a/drivers/squish/colourset.h b/drivers/squish/colourset.h
deleted file mode 100644
index 803e787f5..000000000
--- a/drivers/squish/colourset.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_COLOURSET_H
-#define SQUISH_COLOURSET_H
-
-#include "squish/squish.h"
-#include "maths.h"
-
-namespace squish {
-
-/*! @brief Represents a set of block colours
-*/
-class ColourSet
-{
-public:
- ColourSet( u8 const* rgba, int mask, int flags );
-
- int GetCount() const { return m_count; }
- Vec3 const* GetPoints() const { return m_points; }
- float const* GetWeights() const { return m_weights; }
- bool IsTransparent() const { return m_transparent; }
-
- void RemapIndices( u8 const* source, u8* target ) const;
-
-private:
- int m_count;
- Vec3 m_points[16];
- float m_weights[16];
- int m_remap[16];
- bool m_transparent;
-};
-
-} // namespace sqish
-
-#endif // ndef SQUISH_COLOURSET_H
diff --git a/drivers/squish/config.h b/drivers/squish/config.h
deleted file mode 100644
index 7bf3760c2..000000000
--- a/drivers/squish/config.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_CONFIG_H
-#define SQUISH_CONFIG_H
-
-// Set to 1 when building squish to use Altivec instructions.
-#ifndef SQUISH_USE_ALTIVEC
-#define SQUISH_USE_ALTIVEC 0
-#endif
-
-// Set to 1 or 2 when building squish to use SSE or SSE2 instructions.
-#ifndef SQUISH_USE_SSE
-#define SQUISH_USE_SSE 0
-#endif
-
-// Internally et SQUISH_USE_SIMD when either Altivec or SSE is available.
-#if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE
-#error "Cannot enable both Altivec and SSE!"
-#endif
-#if SQUISH_USE_ALTIVEC || SQUISH_USE_SSE
-#define SQUISH_USE_SIMD 1
-#else
-#define SQUISH_USE_SIMD 0
-#endif
-
-#endif // ndef SQUISH_CONFIG_H
diff --git a/drivers/squish/maths.cpp b/drivers/squish/maths.cpp
deleted file mode 100644
index 59818a4d2..000000000
--- a/drivers/squish/maths.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-/*! @file
-
- The symmetric eigensystem solver algorithm is from
- http://www.geometrictools.com/Documentation/EigenSymmetric3x3.pdf
-*/
-
-#include "maths.h"
-#include <cfloat>
-
-namespace squish {
-
-Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights )
-{
- // compute the centroid
- float total = 0.0f;
- Vec3 centroid( 0.0f );
- for( int i = 0; i < n; ++i )
- {
- total += weights[i];
- centroid += weights[i]*points[i];
- }
- centroid /= total;
-
- // accumulate the covariance matrix
- Sym3x3 covariance( 0.0f );
- for( int i = 0; i < n; ++i )
- {
- Vec3 a = points[i] - centroid;
- Vec3 b = weights[i]*a;
-
- covariance[0] += a.X()*b.X();
- covariance[1] += a.X()*b.Y();
- covariance[2] += a.X()*b.Z();
- covariance[3] += a.Y()*b.Y();
- covariance[4] += a.Y()*b.Z();
- covariance[5] += a.Z()*b.Z();
- }
-
- // return it
- return covariance;
-}
-
-static Vec3 GetMultiplicity1Evector( Sym3x3 const& matrix, float evalue )
-{
- // compute M
- Sym3x3 m;
- m[0] = matrix[0] - evalue;
- m[1] = matrix[1];
- m[2] = matrix[2];
- m[3] = matrix[3] - evalue;
- m[4] = matrix[4];
- m[5] = matrix[5] - evalue;
-
- // compute U
- Sym3x3 u;
- u[0] = m[3]*m[5] - m[4]*m[4];
- u[1] = m[2]*m[4] - m[1]*m[5];
- u[2] = m[1]*m[4] - m[2]*m[3];
- u[3] = m[0]*m[5] - m[2]*m[2];
- u[4] = m[1]*m[2] - m[4]*m[0];
- u[5] = m[0]*m[3] - m[1]*m[1];
-
- // find the largest component
- float mc = std::fabs( u[0] );
- int mi = 0;
- for( int i = 1; i < 6; ++i )
- {
- float c = std::fabs( u[i] );
- if( c > mc )
- {
- mc = c;
- mi = i;
- }
- }
-
- // pick the column with this component
- switch( mi )
- {
- case 0:
- return Vec3( u[0], u[1], u[2] );
-
- case 1:
- case 3:
- return Vec3( u[1], u[3], u[4] );
-
- default:
- return Vec3( u[2], u[4], u[5] );
- }
-}
-
-static Vec3 GetMultiplicity2Evector( Sym3x3 const& matrix, float evalue )
-{
- // compute M
- Sym3x3 m;
- m[0] = matrix[0] - evalue;
- m[1] = matrix[1];
- m[2] = matrix[2];
- m[3] = matrix[3] - evalue;
- m[4] = matrix[4];
- m[5] = matrix[5] - evalue;
-
- // find the largest component
- float mc = std::fabs( m[0] );
- int mi = 0;
- for( int i = 1; i < 6; ++i )
- {
- float c = std::fabs( m[i] );
- if( c > mc )
- {
- mc = c;
- mi = i;
- }
- }
-
- // pick the first eigenvector based on this index
- switch( mi )
- {
- case 0:
- case 1:
- return Vec3( -m[1], m[0], 0.0f );
-
- case 2:
- return Vec3( m[2], 0.0f, -m[0] );
-
- case 3:
- case 4:
- return Vec3( 0.0f, -m[4], m[3] );
-
- default:
- return Vec3( 0.0f, -m[5], m[4] );
- }
-}
-
-Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
-{
- // compute the cubic coefficients
- float c0 = matrix[0]*matrix[3]*matrix[5]
- + 2.0f*matrix[1]*matrix[2]*matrix[4]
- - matrix[0]*matrix[4]*matrix[4]
- - matrix[3]*matrix[2]*matrix[2]
- - matrix[5]*matrix[1]*matrix[1];
- float c1 = matrix[0]*matrix[3] + matrix[0]*matrix[5] + matrix[3]*matrix[5]
- - matrix[1]*matrix[1] - matrix[2]*matrix[2] - matrix[4]*matrix[4];
- float c2 = matrix[0] + matrix[3] + matrix[5];
-
- // compute the quadratic coefficients
- float a = c1 - ( 1.0f/3.0f )*c2*c2;
- float b = ( -2.0f/27.0f )*c2*c2*c2 + ( 1.0f/3.0f )*c1*c2 - c0;
-
- // compute the root count check
- float Q = 0.25f*b*b + ( 1.0f/27.0f )*a*a*a;
-
- // test the multiplicity
- if( FLT_EPSILON < Q )
- {
- // only one root, which implies we have a multiple of the identity
- return Vec3( 1.0f );
- }
- else if( Q < -FLT_EPSILON )
- {
- // three distinct roots
- float theta = std::atan2( std::sqrt( -Q ), -0.5f*b );
- float rho = std::sqrt( 0.25f*b*b - Q );
-
- float rt = std::pow( rho, 1.0f/3.0f );
- float ct = std::cos( theta/3.0f );
- float st = std::sin( theta/3.0f );
-
- float l1 = ( 1.0f/3.0f )*c2 + 2.0f*rt*ct;
- float l2 = ( 1.0f/3.0f )*c2 - rt*( ct + ( float )sqrt( 3.0f )*st );
- float l3 = ( 1.0f/3.0f )*c2 - rt*( ct - ( float )sqrt( 3.0f )*st );
-
- // pick the larger
- if( std::fabs( l2 ) > std::fabs( l1 ) )
- l1 = l2;
- if( std::fabs( l3 ) > std::fabs( l1 ) )
- l1 = l3;
-
- // get the eigenvector
- return GetMultiplicity1Evector( matrix, l1 );
- }
- else // if( -FLT_EPSILON <= Q && Q <= FLT_EPSILON )
- {
- // two roots
- float rt;
- if( b < 0.0f )
- rt = -std::pow( -0.5f*b, 1.0f/3.0f );
- else
- rt = std::pow( 0.5f*b, 1.0f/3.0f );
-
- float l1 = ( 1.0f/3.0f )*c2 + rt; // repeated
- float l2 = ( 1.0f/3.0f )*c2 - 2.0f*rt;
-
- // get the eigenvector
- if( std::fabs( l1 ) > std::fabs( l2 ) )
- return GetMultiplicity2Evector( matrix, l1 );
- else
- return GetMultiplicity1Evector( matrix, l2 );
- }
-}
-
-} // namespace squish
diff --git a/drivers/squish/maths.h b/drivers/squish/maths.h
deleted file mode 100644
index 769ae463f..000000000
--- a/drivers/squish/maths.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_MATHS_H
-#define SQUISH_MATHS_H
-
-#include <cmath>
-#include <algorithm>
-#include "config.h"
-
-namespace squish {
-
-class Vec3
-{
-public:
- typedef Vec3 const& Arg;
-
- Vec3()
- {
- }
-
- explicit Vec3( float s )
- {
- m_x = s;
- m_y = s;
- m_z = s;
- }
-
- Vec3( float x, float y, float z )
- {
- m_x = x;
- m_y = y;
- m_z = z;
- }
-
- float X() const { return m_x; }
- float Y() const { return m_y; }
- float Z() const { return m_z; }
-
- Vec3 operator-() const
- {
- return Vec3( -m_x, -m_y, -m_z );
- }
-
- Vec3& operator+=( Arg v )
- {
- m_x += v.m_x;
- m_y += v.m_y;
- m_z += v.m_z;
- return *this;
- }
-
- Vec3& operator-=( Arg v )
- {
- m_x -= v.m_x;
- m_y -= v.m_y;
- m_z -= v.m_z;
- return *this;
- }
-
- Vec3& operator*=( Arg v )
- {
- m_x *= v.m_x;
- m_y *= v.m_y;
- m_z *= v.m_z;
- return *this;
- }
-
- Vec3& operator*=( float s )
- {
- m_x *= s;
- m_y *= s;
- m_z *= s;
- return *this;
- }
-
- Vec3& operator/=( Arg v )
- {
- m_x /= v.m_x;
- m_y /= v.m_y;
- m_z /= v.m_z;
- return *this;
- }
-
- Vec3& operator/=( float s )
- {
- float t = 1.0f/s;
- m_x *= t;
- m_y *= t;
- m_z *= t;
- return *this;
- }
-
- friend Vec3 operator+( Arg left, Arg right )
- {
- Vec3 copy( left );
- return copy += right;
- }
-
- friend Vec3 operator-( Arg left, Arg right )
- {
- Vec3 copy( left );
- return copy -= right;
- }
-
- friend Vec3 operator*( Arg left, Arg right )
- {
- Vec3 copy( left );
- return copy *= right;
- }
-
- friend Vec3 operator*( Arg left, float right )
- {
- Vec3 copy( left );
- return copy *= right;
- }
-
- friend Vec3 operator*( float left, Arg right )
- {
- Vec3 copy( right );
- return copy *= left;
- }
-
- friend Vec3 operator/( Arg left, Arg right )
- {
- Vec3 copy( left );
- return copy /= right;
- }
-
- friend Vec3 operator/( Arg left, float right )
- {
- Vec3 copy( left );
- return copy /= right;
- }
-
- friend float Dot( Arg left, Arg right )
- {
- return left.m_x*right.m_x + left.m_y*right.m_y + left.m_z*right.m_z;
- }
-
- friend Vec3 Min( Arg left, Arg right )
- {
- return Vec3(
- std::min( left.m_x, right.m_x ),
- std::min( left.m_y, right.m_y ),
- std::min( left.m_z, right.m_z )
- );
- }
-
- friend Vec3 Max( Arg left, Arg right )
- {
- return Vec3(
- std::max( left.m_x, right.m_x ),
- std::max( left.m_y, right.m_y ),
- std::max( left.m_z, right.m_z )
- );
- }
-
- friend Vec3 Truncate( Arg v )
- {
- return Vec3(
- v.m_x > 0.0f ? std::floor( v.m_x ) : std::ceil( v.m_x ),
- v.m_y > 0.0f ? std::floor( v.m_y ) : std::ceil( v.m_y ),
- v.m_z > 0.0f ? std::floor( v.m_z ) : std::ceil( v.m_z )
- );
- }
-
-private:
- float m_x;
- float m_y;
- float m_z;
-};
-
-inline float LengthSquared( Vec3::Arg v )
-{
- return Dot( v, v );
-}
-
-class Sym3x3
-{
-public:
- Sym3x3()
- {
- }
-
- Sym3x3( float s )
- {
- for( int i = 0; i < 6; ++i )
- m_x[i] = s;
- }
-
- float operator[]( int index ) const
- {
- return m_x[index];
- }
-
- float& operator[]( int index )
- {
- return m_x[index];
- }
-
-private:
- float m_x[6];
-};
-
-Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights );
-Vec3 ComputePrincipleComponent( Sym3x3 const& matrix );
-
-} // namespace squish
-
-#endif // ndef SQUISH_MATHS_H
diff --git a/drivers/squish/rangefit.cpp b/drivers/squish/rangefit.cpp
deleted file mode 100644
index 5a6643605..000000000
--- a/drivers/squish/rangefit.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "rangefit.h"
-#include "colourset.h"
-#include "colourblock.h"
-#include <cfloat>
-
-namespace squish {
-
-RangeFit::RangeFit( ColourSet const* colours, int flags )
- : ColourFit( colours, flags )
-{
- // initialise the metric
- bool perceptual = ( ( m_flags & kColourMetricPerceptual ) != 0 );
- if( perceptual )
- m_metric = Vec3( 0.2126f, 0.7152f, 0.0722f );
- else
- m_metric = Vec3( 1.0f );
-
- // initialise the best error
- m_besterror = FLT_MAX;
-
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
- float const* weights = m_colours->GetWeights();
-
- // get the covariance matrix
- Sym3x3 covariance = ComputeWeightedCovariance( count, values, weights );
-
- // compute the principle component
- Vec3 principle = ComputePrincipleComponent( covariance );
-
- // get the min and max range as the codebook endpoints
- Vec3 start( 0.0f );
- Vec3 end( 0.0f );
- if( count > 0 )
- {
- float min, max;
-
- // compute the range
- start = end = values[0];
- min = max = Dot( values[0], principle );
- for( int i = 1; i < count; ++i )
- {
- float val = Dot( values[i], principle );
- if( val < min )
- {
- start = values[i];
- min = val;
- }
- else if( val > max )
- {
- end = values[i];
- max = val;
- }
- }
- }
-
- // clamp the output to [0, 1]
- Vec3 const one( 1.0f );
- Vec3 const zero( 0.0f );
- start = Min( one, Max( zero, start ) );
- end = Min( one, Max( zero, end ) );
-
- // clamp to the grid and save
- Vec3 const grid( 31.0f, 63.0f, 31.0f );
- Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
- Vec3 const half( 0.5f );
- m_start = Truncate( grid*start + half )*gridrcp;
- m_end = Truncate( grid*end + half )*gridrcp;
-}
-
-void RangeFit::Compress3( void* block )
-{
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // create a codebook
- Vec3 codes[3];
- codes[0] = m_start;
- codes[1] = m_end;
- codes[2] = 0.5f*m_start + 0.5f*m_end;
-
- // match each point to the closest code
- u8 closest[16];
- float error = 0.0f;
- for( int i = 0; i < count; ++i )
- {
- // find the closest code
- float dist = FLT_MAX;
- int idx = 0;
- for( int j = 0; j < 3; ++j )
- {
- float d = LengthSquared( m_metric*( values[i] - codes[j] ) );
- if( d < dist )
- {
- dist = d;
- idx = j;
- }
- }
-
- // save the index
- closest[i] = ( u8 )idx;
-
- // accumulate the error
- error += dist;
- }
-
- // save this scheme if it wins
- if( error < m_besterror )
- {
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( closest, indices );
-
- // save the block
- WriteColourBlock3( m_start, m_end, indices, block );
-
- // save the error
- m_besterror = error;
- }
-}
-
-void RangeFit::Compress4( void* block )
-{
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // create a codebook
- Vec3 codes[4];
- codes[0] = m_start;
- codes[1] = m_end;
- codes[2] = ( 2.0f/3.0f )*m_start + ( 1.0f/3.0f )*m_end;
- codes[3] = ( 1.0f/3.0f )*m_start + ( 2.0f/3.0f )*m_end;
-
- // match each point to the closest code
- u8 closest[16];
- float error = 0.0f;
- for( int i = 0; i < count; ++i )
- {
- // find the closest code
- float dist = FLT_MAX;
- int idx = 0;
- for( int j = 0; j < 4; ++j )
- {
- float d = LengthSquared( m_metric*( values[i] - codes[j] ) );
- if( d < dist )
- {
- dist = d;
- idx = j;
- }
- }
-
- // save the index
- closest[i] = ( u8 )idx;
-
- // accumulate the error
- error += dist;
- }
-
- // save this scheme if it wins
- if( error < m_besterror )
- {
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( closest, indices );
-
- // save the block
- WriteColourBlock4( m_start, m_end, indices, block );
-
- // save the error
- m_besterror = error;
- }
-}
-
-} // namespace squish
diff --git a/drivers/squish/rangefit.h b/drivers/squish/rangefit.h
deleted file mode 100644
index 9d74f9c12..000000000
--- a/drivers/squish/rangefit.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_RANGEFIT_H
-#define SQUISH_RANGEFIT_H
-
-#include "squish/squish.h"
-#include "colourfit.h"
-#include "maths.h"
-
-namespace squish {
-
-class ColourSet;
-
-class RangeFit : public ColourFit
-{
-public:
- RangeFit( ColourSet const* colours, int flags );
-
-private:
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
- Vec3 m_metric;
- Vec3 m_start;
- Vec3 m_end;
- float m_besterror;
-};
-
-} // squish
-
-#endif // ndef SQUISH_RANGEFIT_H
diff --git a/drivers/squish/simd.h b/drivers/squish/simd.h
deleted file mode 100644
index 22bd10a46..000000000
--- a/drivers/squish/simd.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SIMD_H
-#define SQUISH_SIMD_H
-
-#include "maths.h"
-
-#if SQUISH_USE_ALTIVEC
-#include "simd_ve.h"
-#elif SQUISH_USE_SSE
-#include "simd_sse.h"
-#else
-#include "simd_float.h"
-#endif
-
-
-#endif // ndef SQUISH_SIMD_H
diff --git a/drivers/squish/simd_float.h b/drivers/squish/simd_float.h
deleted file mode 100644
index e6351b80e..000000000
--- a/drivers/squish/simd_float.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SIMD_FLOAT_H
-#define SQUISH_SIMD_FLOAT_H
-
-#include <algorithm>
-
-namespace squish {
-
-#define VEC4_CONST( X ) Vec4( X )
-
-class Vec4
-{
-public:
- typedef Vec4 const& Arg;
-
- Vec4() {}
-
- explicit Vec4( float s )
- : m_x( s ),
- m_y( s ),
- m_z( s ),
- m_w( s )
- {
- }
-
- Vec4( float x, float y, float z, float w )
- : m_x( x ),
- m_y( y ),
- m_z( z ),
- m_w( w )
- {
- }
-
- Vec3 GetVec3() const
- {
- return Vec3( m_x, m_y, m_z );
- }
-
- Vec4 SplatX() const { return Vec4( m_x ); }
- Vec4 SplatY() const { return Vec4( m_y ); }
- Vec4 SplatZ() const { return Vec4( m_z ); }
- Vec4 SplatW() const { return Vec4( m_w ); }
-
- Vec4& operator+=( Arg v )
- {
- m_x += v.m_x;
- m_y += v.m_y;
- m_z += v.m_z;
- m_w += v.m_w;
- return *this;
- }
-
- Vec4& operator-=( Arg v )
- {
- m_x -= v.m_x;
- m_y -= v.m_y;
- m_z -= v.m_z;
- m_w -= v.m_w;
- return *this;
- }
-
- Vec4& operator*=( Arg v )
- {
- m_x *= v.m_x;
- m_y *= v.m_y;
- m_z *= v.m_z;
- m_w *= v.m_w;
- return *this;
- }
-
- friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
- {
- Vec4 copy( left );
- return copy += right;
- }
-
- friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
- {
- Vec4 copy( left );
- return copy -= right;
- }
-
- friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
- {
- Vec4 copy( left );
- return copy *= right;
- }
-
- //! Returns a*b + c
- friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return a*b + c;
- }
-
- //! Returns -( a*b - c )
- friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return c - a*b;
- }
-
- friend Vec4 Reciprocal( Vec4::Arg v )
- {
- return Vec4(
- 1.0f/v.m_x,
- 1.0f/v.m_y,
- 1.0f/v.m_z,
- 1.0f/v.m_w
- );
- }
-
- friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4(
- std::min( left.m_x, right.m_x ),
- std::min( left.m_y, right.m_y ),
- std::min( left.m_z, right.m_z ),
- std::min( left.m_w, right.m_w )
- );
- }
-
- friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4(
- std::max( left.m_x, right.m_x ),
- std::max( left.m_y, right.m_y ),
- std::max( left.m_z, right.m_z ),
- std::max( left.m_w, right.m_w )
- );
- }
-
- friend Vec4 Truncate( Vec4::Arg v )
- {
- return Vec4(
- v.m_x > 0.0f ? std::floor( v.m_x ) : std::ceil( v.m_x ),
- v.m_y > 0.0f ? std::floor( v.m_y ) : std::ceil( v.m_y ),
- v.m_z > 0.0f ? std::floor( v.m_z ) : std::ceil( v.m_z ),
- v.m_w > 0.0f ? std::floor( v.m_w ) : std::ceil( v.m_w )
- );
- }
-
- friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
- {
- return left.m_x < right.m_x
- || left.m_y < right.m_y
- || left.m_z < right.m_z
- || left.m_w < right.m_w;
- }
-
-private:
- float m_x;
- float m_y;
- float m_z;
- float m_w;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SIMD_FLOAT_H
-
diff --git a/drivers/squish/simd_sse.h b/drivers/squish/simd_sse.h
deleted file mode 100644
index e584f2a0e..000000000
--- a/drivers/squish/simd_sse.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SIMD_SSE_H
-#define SQUISH_SIMD_SSE_H
-
-#include <xmmintrin.h>
-#if ( SQUISH_USE_SSE > 1 )
-#include <emmintrin.h>
-#endif
-
-#define SQUISH_SSE_SPLAT( a ) \
- ( ( a ) | ( ( a ) << 2 ) | ( ( a ) << 4 ) | ( ( a ) << 6 ) )
-
-#define SQUISH_SSE_SHUF( x, y, z, w ) \
- ( ( x ) | ( ( y ) << 2 ) | ( ( z ) << 4 ) | ( ( w ) << 6 ) )
-
-namespace squish {
-
-#define VEC4_CONST( X ) Vec4( X )
-
-class Vec4
-{
-public:
- typedef Vec4 const& Arg;
-
- Vec4() {}
-
- explicit Vec4( __m128 v ) : m_v( v ) {}
-
- Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {}
-
- Vec4& operator=( Vec4 const& arg )
- {
- m_v = arg.m_v;
- return *this;
- }
-
- explicit Vec4( float s ) : m_v( _mm_set1_ps( s ) ) {}
-
- Vec4( float x, float y, float z, float w ) : m_v( _mm_setr_ps( x, y, z, w ) ) {}
-
- Vec3 GetVec3() const
- {
-#ifdef __GNUC__
- __attribute__ ((__aligned__ (16))) float c[4];
-#else
- __declspec(align(16)) float c[4];
-#endif
- _mm_store_ps( c, m_v );
- return Vec3( c[0], c[1], c[2] );
- }
-
- Vec4 SplatX() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 0 ) ) ); }
- Vec4 SplatY() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 1 ) ) ); }
- Vec4 SplatZ() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 2 ) ) ); }
- Vec4 SplatW() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 3 ) ) ); }
-
- Vec4& operator+=( Arg v )
- {
- m_v = _mm_add_ps( m_v, v.m_v );
- return *this;
- }
-
- Vec4& operator-=( Arg v )
- {
- m_v = _mm_sub_ps( m_v, v.m_v );
- return *this;
- }
-
- Vec4& operator*=( Arg v )
- {
- m_v = _mm_mul_ps( m_v, v.m_v );
- return *this;
- }
-
- friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_add_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_sub_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_mul_ps( left.m_v, right.m_v ) );
- }
-
- //! Returns a*b + c
- friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4( _mm_add_ps( _mm_mul_ps( a.m_v, b.m_v ), c.m_v ) );
- }
-
- //! Returns -( a*b - c )
- friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4( _mm_sub_ps( c.m_v, _mm_mul_ps( a.m_v, b.m_v ) ) );
- }
-
- friend Vec4 Reciprocal( Vec4::Arg v )
- {
- // get the reciprocal estimate
- __m128 estimate = _mm_rcp_ps( v.m_v );
-
- // one round of Newton-Rhaphson refinement
- __m128 diff = _mm_sub_ps( _mm_set1_ps( 1.0f ), _mm_mul_ps( estimate, v.m_v ) );
- return Vec4( _mm_add_ps( _mm_mul_ps( diff, estimate ), estimate ) );
- }
-
- friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_min_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_max_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Truncate( Vec4::Arg v )
- {
-#if ( SQUISH_USE_SSE == 1 )
- // convert to ints
- __m128 input = v.m_v;
- __m64 lo = _mm_cvttps_pi32( input );
- __m64 hi = _mm_cvttps_pi32( _mm_movehl_ps( input, input ) );
-
- // convert to floats
- __m128 part = _mm_movelh_ps( input, _mm_cvtpi32_ps( input, hi ) );
- __m128 truncated = _mm_cvtpi32_ps( part, lo );
-
- // clear out the MMX multimedia state to allow FP calls later
- _mm_empty();
- return Vec4( truncated );
-#else
- // use SSE2 instructions
- return Vec4( _mm_cvtepi32_ps( _mm_cvttps_epi32( v.m_v ) ) );
-#endif
- }
-
- friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
- {
- __m128 bits = _mm_cmplt_ps( left.m_v, right.m_v );
- int value = _mm_movemask_ps( bits );
- return value != 0;
- }
-
-private:
- __m128 m_v;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SIMD_SSE_H
diff --git a/drivers/squish/simd_ve.h b/drivers/squish/simd_ve.h
deleted file mode 100644
index 9a33955ff..000000000
--- a/drivers/squish/simd_ve.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SIMD_VE_H
-#define SQUISH_SIMD_VE_H
-
-#include <altivec.h>
-#undef bool
-
-namespace squish {
-
-#define VEC4_CONST( X ) Vec4( ( vector float )( X ) )
-
-class Vec4
-{
-public:
- typedef Vec4 Arg;
-
- Vec4() {}
-
- explicit Vec4( vector float v ) : m_v( v ) {}
-
- Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {}
-
- Vec4& operator=( Vec4 const& arg )
- {
- m_v = arg.m_v;
- return *this;
- }
-
- explicit Vec4( float s )
- {
- union { vector float v; float c[4]; } u;
- u.c[0] = s;
- u.c[1] = s;
- u.c[2] = s;
- u.c[3] = s;
- m_v = u.v;
- }
-
- Vec4( float x, float y, float z, float w )
- {
- union { vector float v; float c[4]; } u;
- u.c[0] = x;
- u.c[1] = y;
- u.c[2] = z;
- u.c[3] = w;
- m_v = u.v;
- }
-
- Vec3 GetVec3() const
- {
- union { vector float v; float c[4]; } u;
- u.v = m_v;
- return Vec3( u.c[0], u.c[1], u.c[2] );
- }
-
- Vec4 SplatX() const { return Vec4( vec_splat( m_v, 0 ) ); }
- Vec4 SplatY() const { return Vec4( vec_splat( m_v, 1 ) ); }
- Vec4 SplatZ() const { return Vec4( vec_splat( m_v, 2 ) ); }
- Vec4 SplatW() const { return Vec4( vec_splat( m_v, 3 ) ); }
-
- Vec4& operator+=( Arg v )
- {
- m_v = vec_add( m_v, v.m_v );
- return *this;
- }
-
- Vec4& operator-=( Arg v )
- {
- m_v = vec_sub( m_v, v.m_v );
- return *this;
- }
-
- Vec4& operator*=( Arg v )
- {
- m_v = vec_madd( m_v, v.m_v, ( vector float )( -0.0f ) );
- return *this;
- }
-
- friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_add( left.m_v, right.m_v ) );
- }
-
- friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_sub( left.m_v, right.m_v ) );
- }
-
- friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_madd( left.m_v, right.m_v, ( vector float )( -0.0f ) ) );
- }
-
- //! Returns a*b + c
- friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4( vec_madd( a.m_v, b.m_v, c.m_v ) );
- }
-
- //! Returns -( a*b - c )
- friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4( vec_nmsub( a.m_v, b.m_v, c.m_v ) );
- }
-
- friend Vec4 Reciprocal( Vec4::Arg v )
- {
- // get the reciprocal estimate
- vector float estimate = vec_re( v.m_v );
-
- // one round of Newton-Rhaphson refinement
- vector float diff = vec_nmsub( estimate, v.m_v, ( vector float )( 1.0f ) );
- return Vec4( vec_madd( diff, estimate, estimate ) );
- }
-
- friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_min( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_max( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Truncate( Vec4::Arg v )
- {
- return Vec4( vec_trunc( v.m_v ) );
- }
-
- friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
- {
- return vec_any_lt( left.m_v, right.m_v ) != 0;
- }
-
-private:
- vector float m_v;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SIMD_VE_H
diff --git a/drivers/squish/singlecolourfit.cpp b/drivers/squish/singlecolourfit.cpp
deleted file mode 100644
index ac8be1ad7..000000000
--- a/drivers/squish/singlecolourfit.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "singlecolourfit.h"
-#include "colourset.h"
-#include "colourblock.h"
-
-namespace squish {
-
-struct SourceBlock
-{
- u8 start;
- u8 end;
- u8 error;
-};
-
-struct SingleColourLookup
-{
- SourceBlock sources[2];
-};
-
-#include "singlecolourlookup.inl"
-
-static int FloatToInt( float a, int limit )
-{
- // use ANSI round-to-zero behaviour to get round-to-nearest
- int i = ( int )( a + 0.5f );
-
- // clamp to the limit
- if( i < 0 )
- i = 0;
- else if( i > limit )
- i = limit;
-
- // done
- return i;
-}
-
-SingleColourFit::SingleColourFit( ColourSet const* colours, int flags )
- : ColourFit( colours, flags )
-{
- // grab the single colour
- Vec3 const* values = m_colours->GetPoints();
- m_colour[0] = ( u8 )FloatToInt( 255.0f*values->X(), 255 );
- m_colour[1] = ( u8 )FloatToInt( 255.0f*values->Y(), 255 );
- m_colour[2] = ( u8 )FloatToInt( 255.0f*values->Z(), 255 );
-
- // initialise the best error
- m_besterror = 2147483647; //INT_MAX
-}
-
-void SingleColourFit::Compress3( void* block )
-{
- // build the table of lookups
- SingleColourLookup const* const lookups[] =
- {
- lookup_5_3,
- lookup_6_3,
- lookup_5_3
- };
-
- // find the best end-points and index
- ComputeEndPoints( lookups );
-
- // build the block if we win
- if( m_error < m_besterror )
- {
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( &m_index, indices );
-
- // save the block
- WriteColourBlock3( m_start, m_end, indices, block );
-
- // save the error
- m_besterror = m_error;
- }
-}
-
-void SingleColourFit::Compress4( void* block )
-{
- // build the table of lookups
- SingleColourLookup const* const lookups[] =
- {
- lookup_5_4,
- lookup_6_4,
- lookup_5_4
- };
-
- // find the best end-points and index
- ComputeEndPoints( lookups );
-
- // build the block if we win
- if( m_error < m_besterror )
- {
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( &m_index, indices );
-
- // save the block
- WriteColourBlock4( m_start, m_end, indices, block );
-
- // save the error
- m_besterror = m_error;
- }
-}
-
-void SingleColourFit::ComputeEndPoints( SingleColourLookup const* const* lookups )
-{
- // check each index combination (endpoint or intermediate)
- m_error = 2147483647; //INT_MAX
- for( int index = 0; index < 2; ++index )
- {
- // check the error for this codebook index
- SourceBlock const* sources[3];
- int error = 0;
- for( int channel = 0; channel < 3; ++channel )
- {
- // grab the lookup table and index for this channel
- SingleColourLookup const* lookup = lookups[channel];
- int target = m_colour[channel];
-
- // store a pointer to the source for this channel
- sources[channel] = lookup[target].sources + index;
-
- // accumulate the error
- int diff = sources[channel]->error;
- error += diff*diff;
- }
-
- // keep it if the error is lower
- if( error < m_error )
- {
- m_start = Vec3(
- ( float )sources[0]->start/31.0f,
- ( float )sources[1]->start/63.0f,
- ( float )sources[2]->start/31.0f
- );
- m_end = Vec3(
- ( float )sources[0]->end/31.0f,
- ( float )sources[1]->end/63.0f,
- ( float )sources[2]->end/31.0f
- );
- m_index = ( u8 )( 2*index );
- m_error = error;
- }
- }
-}
-
-} // namespace squish
diff --git a/drivers/squish/singlecolourfit.h b/drivers/squish/singlecolourfit.h
deleted file mode 100644
index c8dce2a5a..000000000
--- a/drivers/squish/singlecolourfit.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SINGLECOLOURFIT_H
-#define SQUISH_SINGLECOLOURFIT_H
-
-#include "squish/squish.h"
-#include "colourfit.h"
-
-namespace squish {
-
-class ColourSet;
-struct SingleColourLookup;
-
-class SingleColourFit : public ColourFit
-{
-public:
- SingleColourFit( ColourSet const* colours, int flags );
-
-private:
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
- void ComputeEndPoints( SingleColourLookup const* const* lookups );
-
- u8 m_colour[3];
- Vec3 m_start;
- Vec3 m_end;
- u8 m_index;
- int m_error;
- int m_besterror;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SINGLECOLOURFIT_H
diff --git a/drivers/squish/singlecolourlookup.inl b/drivers/squish/singlecolourlookup.inl
deleted file mode 100644
index f1c95a102..000000000
--- a/drivers/squish/singlecolourlookup.inl
+++ /dev/null
@@ -1,1040 +0,0 @@
-
-static SingleColourLookup const lookup_5_3[] =
-{
- { { { 0, 0, 0 }, { 0, 0, 0 } } },
- { { { 0, 0, 1 }, { 0, 0, 1 } } },
- { { { 0, 0, 2 }, { 0, 0, 2 } } },
- { { { 0, 0, 3 }, { 0, 1, 1 } } },
- { { { 0, 0, 4 }, { 0, 1, 0 } } },
- { { { 1, 0, 3 }, { 0, 1, 1 } } },
- { { { 1, 0, 2 }, { 0, 1, 2 } } },
- { { { 1, 0, 1 }, { 0, 2, 1 } } },
- { { { 1, 0, 0 }, { 0, 2, 0 } } },
- { { { 1, 0, 1 }, { 0, 2, 1 } } },
- { { { 1, 0, 2 }, { 0, 2, 2 } } },
- { { { 1, 0, 3 }, { 0, 3, 1 } } },
- { { { 1, 0, 4 }, { 0, 3, 0 } } },
- { { { 2, 0, 3 }, { 0, 3, 1 } } },
- { { { 2, 0, 2 }, { 0, 3, 2 } } },
- { { { 2, 0, 1 }, { 0, 4, 1 } } },
- { { { 2, 0, 0 }, { 0, 4, 0 } } },
- { { { 2, 0, 1 }, { 0, 4, 1 } } },
- { { { 2, 0, 2 }, { 0, 4, 2 } } },
- { { { 2, 0, 3 }, { 0, 5, 1 } } },
- { { { 2, 0, 4 }, { 0, 5, 0 } } },
- { { { 3, 0, 3 }, { 0, 5, 1 } } },
- { { { 3, 0, 2 }, { 0, 5, 2 } } },
- { { { 3, 0, 1 }, { 0, 6, 1 } } },
- { { { 3, 0, 0 }, { 0, 6, 0 } } },
- { { { 3, 0, 1 }, { 0, 6, 1 } } },
- { { { 3, 0, 2 }, { 0, 6, 2 } } },
- { { { 3, 0, 3 }, { 0, 7, 1 } } },
- { { { 3, 0, 4 }, { 0, 7, 0 } } },
- { { { 4, 0, 4 }, { 0, 7, 1 } } },
- { { { 4, 0, 3 }, { 0, 7, 2 } } },
- { { { 4, 0, 2 }, { 1, 7, 1 } } },
- { { { 4, 0, 1 }, { 1, 7, 0 } } },
- { { { 4, 0, 0 }, { 0, 8, 0 } } },
- { { { 4, 0, 1 }, { 0, 8, 1 } } },
- { { { 4, 0, 2 }, { 2, 7, 1 } } },
- { { { 4, 0, 3 }, { 2, 7, 0 } } },
- { { { 4, 0, 4 }, { 0, 9, 0 } } },
- { { { 5, 0, 3 }, { 0, 9, 1 } } },
- { { { 5, 0, 2 }, { 3, 7, 1 } } },
- { { { 5, 0, 1 }, { 3, 7, 0 } } },
- { { { 5, 0, 0 }, { 0, 10, 0 } } },
- { { { 5, 0, 1 }, { 0, 10, 1 } } },
- { { { 5, 0, 2 }, { 0, 10, 2 } } },
- { { { 5, 0, 3 }, { 0, 11, 1 } } },
- { { { 5, 0, 4 }, { 0, 11, 0 } } },
- { { { 6, 0, 3 }, { 0, 11, 1 } } },
- { { { 6, 0, 2 }, { 0, 11, 2 } } },
- { { { 6, 0, 1 }, { 0, 12, 1 } } },
- { { { 6, 0, 0 }, { 0, 12, 0 } } },
- { { { 6, 0, 1 }, { 0, 12, 1 } } },
- { { { 6, 0, 2 }, { 0, 12, 2 } } },
- { { { 6, 0, 3 }, { 0, 13, 1 } } },
- { { { 6, 0, 4 }, { 0, 13, 0 } } },
- { { { 7, 0, 3 }, { 0, 13, 1 } } },
- { { { 7, 0, 2 }, { 0, 13, 2 } } },
- { { { 7, 0, 1 }, { 0, 14, 1 } } },
- { { { 7, 0, 0 }, { 0, 14, 0 } } },
- { { { 7, 0, 1 }, { 0, 14, 1 } } },
- { { { 7, 0, 2 }, { 0, 14, 2 } } },
- { { { 7, 0, 3 }, { 0, 15, 1 } } },
- { { { 7, 0, 4 }, { 0, 15, 0 } } },
- { { { 8, 0, 4 }, { 0, 15, 1 } } },
- { { { 8, 0, 3 }, { 0, 15, 2 } } },
- { { { 8, 0, 2 }, { 1, 15, 1 } } },
- { { { 8, 0, 1 }, { 1, 15, 0 } } },
- { { { 8, 0, 0 }, { 0, 16, 0 } } },
- { { { 8, 0, 1 }, { 0, 16, 1 } } },
- { { { 8, 0, 2 }, { 2, 15, 1 } } },
- { { { 8, 0, 3 }, { 2, 15, 0 } } },
- { { { 8, 0, 4 }, { 0, 17, 0 } } },
- { { { 9, 0, 3 }, { 0, 17, 1 } } },
- { { { 9, 0, 2 }, { 3, 15, 1 } } },
- { { { 9, 0, 1 }, { 3, 15, 0 } } },
- { { { 9, 0, 0 }, { 0, 18, 0 } } },
- { { { 9, 0, 1 }, { 0, 18, 1 } } },
- { { { 9, 0, 2 }, { 0, 18, 2 } } },
- { { { 9, 0, 3 }, { 0, 19, 1 } } },
- { { { 9, 0, 4 }, { 0, 19, 0 } } },
- { { { 10, 0, 3 }, { 0, 19, 1 } } },
- { { { 10, 0, 2 }, { 0, 19, 2 } } },
- { { { 10, 0, 1 }, { 0, 20, 1 } } },
- { { { 10, 0, 0 }, { 0, 20, 0 } } },
- { { { 10, 0, 1 }, { 0, 20, 1 } } },
- { { { 10, 0, 2 }, { 0, 20, 2 } } },
- { { { 10, 0, 3 }, { 0, 21, 1 } } },
- { { { 10, 0, 4 }, { 0, 21, 0 } } },
- { { { 11, 0, 3 }, { 0, 21, 1 } } },
- { { { 11, 0, 2 }, { 0, 21, 2 } } },
- { { { 11, 0, 1 }, { 0, 22, 1 } } },
- { { { 11, 0, 0 }, { 0, 22, 0 } } },
- { { { 11, 0, 1 }, { 0, 22, 1 } } },
- { { { 11, 0, 2 }, { 0, 22, 2 } } },
- { { { 11, 0, 3 }, { 0, 23, 1 } } },
- { { { 11, 0, 4 }, { 0, 23, 0 } } },
- { { { 12, 0, 4 }, { 0, 23, 1 } } },
- { { { 12, 0, 3 }, { 0, 23, 2 } } },
- { { { 12, 0, 2 }, { 1, 23, 1 } } },
- { { { 12, 0, 1 }, { 1, 23, 0 } } },
- { { { 12, 0, 0 }, { 0, 24, 0 } } },
- { { { 12, 0, 1 }, { 0, 24, 1 } } },
- { { { 12, 0, 2 }, { 2, 23, 1 } } },
- { { { 12, 0, 3 }, { 2, 23, 0 } } },
- { { { 12, 0, 4 }, { 0, 25, 0 } } },
- { { { 13, 0, 3 }, { 0, 25, 1 } } },
- { { { 13, 0, 2 }, { 3, 23, 1 } } },
- { { { 13, 0, 1 }, { 3, 23, 0 } } },
- { { { 13, 0, 0 }, { 0, 26, 0 } } },
- { { { 13, 0, 1 }, { 0, 26, 1 } } },
- { { { 13, 0, 2 }, { 0, 26, 2 } } },
- { { { 13, 0, 3 }, { 0, 27, 1 } } },
- { { { 13, 0, 4 }, { 0, 27, 0 } } },
- { { { 14, 0, 3 }, { 0, 27, 1 } } },
- { { { 14, 0, 2 }, { 0, 27, 2 } } },
- { { { 14, 0, 1 }, { 0, 28, 1 } } },
- { { { 14, 0, 0 }, { 0, 28, 0 } } },
- { { { 14, 0, 1 }, { 0, 28, 1 } } },
- { { { 14, 0, 2 }, { 0, 28, 2 } } },
- { { { 14, 0, 3 }, { 0, 29, 1 } } },
- { { { 14, 0, 4 }, { 0, 29, 0 } } },
- { { { 15, 0, 3 }, { 0, 29, 1 } } },
- { { { 15, 0, 2 }, { 0, 29, 2 } } },
- { { { 15, 0, 1 }, { 0, 30, 1 } } },
- { { { 15, 0, 0 }, { 0, 30, 0 } } },
- { { { 15, 0, 1 }, { 0, 30, 1 } } },
- { { { 15, 0, 2 }, { 0, 30, 2 } } },
- { { { 15, 0, 3 }, { 0, 31, 1 } } },
- { { { 15, 0, 4 }, { 0, 31, 0 } } },
- { { { 16, 0, 4 }, { 0, 31, 1 } } },
- { { { 16, 0, 3 }, { 0, 31, 2 } } },
- { { { 16, 0, 2 }, { 1, 31, 1 } } },
- { { { 16, 0, 1 }, { 1, 31, 0 } } },
- { { { 16, 0, 0 }, { 4, 28, 0 } } },
- { { { 16, 0, 1 }, { 4, 28, 1 } } },
- { { { 16, 0, 2 }, { 2, 31, 1 } } },
- { { { 16, 0, 3 }, { 2, 31, 0 } } },
- { { { 16, 0, 4 }, { 4, 29, 0 } } },
- { { { 17, 0, 3 }, { 4, 29, 1 } } },
- { { { 17, 0, 2 }, { 3, 31, 1 } } },
- { { { 17, 0, 1 }, { 3, 31, 0 } } },
- { { { 17, 0, 0 }, { 4, 30, 0 } } },
- { { { 17, 0, 1 }, { 4, 30, 1 } } },
- { { { 17, 0, 2 }, { 4, 30, 2 } } },
- { { { 17, 0, 3 }, { 4, 31, 1 } } },
- { { { 17, 0, 4 }, { 4, 31, 0 } } },
- { { { 18, 0, 3 }, { 4, 31, 1 } } },
- { { { 18, 0, 2 }, { 4, 31, 2 } } },
- { { { 18, 0, 1 }, { 5, 31, 1 } } },
- { { { 18, 0, 0 }, { 5, 31, 0 } } },
- { { { 18, 0, 1 }, { 5, 31, 1 } } },
- { { { 18, 0, 2 }, { 5, 31, 2 } } },
- { { { 18, 0, 3 }, { 6, 31, 1 } } },
- { { { 18, 0, 4 }, { 6, 31, 0 } } },
- { { { 19, 0, 3 }, { 6, 31, 1 } } },
- { { { 19, 0, 2 }, { 6, 31, 2 } } },
- { { { 19, 0, 1 }, { 7, 31, 1 } } },
- { { { 19, 0, 0 }, { 7, 31, 0 } } },
- { { { 19, 0, 1 }, { 7, 31, 1 } } },
- { { { 19, 0, 2 }, { 7, 31, 2 } } },
- { { { 19, 0, 3 }, { 8, 31, 1 } } },
- { { { 19, 0, 4 }, { 8, 31, 0 } } },
- { { { 20, 0, 4 }, { 8, 31, 1 } } },
- { { { 20, 0, 3 }, { 8, 31, 2 } } },
- { { { 20, 0, 2 }, { 9, 31, 1 } } },
- { { { 20, 0, 1 }, { 9, 31, 0 } } },
- { { { 20, 0, 0 }, { 12, 28, 0 } } },
- { { { 20, 0, 1 }, { 12, 28, 1 } } },
- { { { 20, 0, 2 }, { 10, 31, 1 } } },
- { { { 20, 0, 3 }, { 10, 31, 0 } } },
- { { { 20, 0, 4 }, { 12, 29, 0 } } },
- { { { 21, 0, 3 }, { 12, 29, 1 } } },
- { { { 21, 0, 2 }, { 11, 31, 1 } } },
- { { { 21, 0, 1 }, { 11, 31, 0 } } },
- { { { 21, 0, 0 }, { 12, 30, 0 } } },
- { { { 21, 0, 1 }, { 12, 30, 1 } } },
- { { { 21, 0, 2 }, { 12, 30, 2 } } },
- { { { 21, 0, 3 }, { 12, 31, 1 } } },
- { { { 21, 0, 4 }, { 12, 31, 0 } } },
- { { { 22, 0, 3 }, { 12, 31, 1 } } },
- { { { 22, 0, 2 }, { 12, 31, 2 } } },
- { { { 22, 0, 1 }, { 13, 31, 1 } } },
- { { { 22, 0, 0 }, { 13, 31, 0 } } },
- { { { 22, 0, 1 }, { 13, 31, 1 } } },
- { { { 22, 0, 2 }, { 13, 31, 2 } } },
- { { { 22, 0, 3 }, { 14, 31, 1 } } },
- { { { 22, 0, 4 }, { 14, 31, 0 } } },
- { { { 23, 0, 3 }, { 14, 31, 1 } } },
- { { { 23, 0, 2 }, { 14, 31, 2 } } },
- { { { 23, 0, 1 }, { 15, 31, 1 } } },
- { { { 23, 0, 0 }, { 15, 31, 0 } } },
- { { { 23, 0, 1 }, { 15, 31, 1 } } },
- { { { 23, 0, 2 }, { 15, 31, 2 } } },
- { { { 23, 0, 3 }, { 16, 31, 1 } } },
- { { { 23, 0, 4 }, { 16, 31, 0 } } },
- { { { 24, 0, 4 }, { 16, 31, 1 } } },
- { { { 24, 0, 3 }, { 16, 31, 2 } } },
- { { { 24, 0, 2 }, { 17, 31, 1 } } },
- { { { 24, 0, 1 }, { 17, 31, 0 } } },
- { { { 24, 0, 0 }, { 20, 28, 0 } } },
- { { { 24, 0, 1 }, { 20, 28, 1 } } },
- { { { 24, 0, 2 }, { 18, 31, 1 } } },
- { { { 24, 0, 3 }, { 18, 31, 0 } } },
- { { { 24, 0, 4 }, { 20, 29, 0 } } },
- { { { 25, 0, 3 }, { 20, 29, 1 } } },
- { { { 25, 0, 2 }, { 19, 31, 1 } } },
- { { { 25, 0, 1 }, { 19, 31, 0 } } },
- { { { 25, 0, 0 }, { 20, 30, 0 } } },
- { { { 25, 0, 1 }, { 20, 30, 1 } } },
- { { { 25, 0, 2 }, { 20, 30, 2 } } },
- { { { 25, 0, 3 }, { 20, 31, 1 } } },
- { { { 25, 0, 4 }, { 20, 31, 0 } } },
- { { { 26, 0, 3 }, { 20, 31, 1 } } },
- { { { 26, 0, 2 }, { 20, 31, 2 } } },
- { { { 26, 0, 1 }, { 21, 31, 1 } } },
- { { { 26, 0, 0 }, { 21, 31, 0 } } },
- { { { 26, 0, 1 }, { 21, 31, 1 } } },
- { { { 26, 0, 2 }, { 21, 31, 2 } } },
- { { { 26, 0, 3 }, { 22, 31, 1 } } },
- { { { 26, 0, 4 }, { 22, 31, 0 } } },
- { { { 27, 0, 3 }, { 22, 31, 1 } } },
- { { { 27, 0, 2 }, { 22, 31, 2 } } },
- { { { 27, 0, 1 }, { 23, 31, 1 } } },
- { { { 27, 0, 0 }, { 23, 31, 0 } } },
- { { { 27, 0, 1 }, { 23, 31, 1 } } },
- { { { 27, 0, 2 }, { 23, 31, 2 } } },
- { { { 27, 0, 3 }, { 24, 31, 1 } } },
- { { { 27, 0, 4 }, { 24, 31, 0 } } },
- { { { 28, 0, 4 }, { 24, 31, 1 } } },
- { { { 28, 0, 3 }, { 24, 31, 2 } } },
- { { { 28, 0, 2 }, { 25, 31, 1 } } },
- { { { 28, 0, 1 }, { 25, 31, 0 } } },
- { { { 28, 0, 0 }, { 28, 28, 0 } } },
- { { { 28, 0, 1 }, { 28, 28, 1 } } },
- { { { 28, 0, 2 }, { 26, 31, 1 } } },
- { { { 28, 0, 3 }, { 26, 31, 0 } } },
- { { { 28, 0, 4 }, { 28, 29, 0 } } },
- { { { 29, 0, 3 }, { 28, 29, 1 } } },
- { { { 29, 0, 2 }, { 27, 31, 1 } } },
- { { { 29, 0, 1 }, { 27, 31, 0 } } },
- { { { 29, 0, 0 }, { 28, 30, 0 } } },
- { { { 29, 0, 1 }, { 28, 30, 1 } } },
- { { { 29, 0, 2 }, { 28, 30, 2 } } },
- { { { 29, 0, 3 }, { 28, 31, 1 } } },
- { { { 29, 0, 4 }, { 28, 31, 0 } } },
- { { { 30, 0, 3 }, { 28, 31, 1 } } },
- { { { 30, 0, 2 }, { 28, 31, 2 } } },
- { { { 30, 0, 1 }, { 29, 31, 1 } } },
- { { { 30, 0, 0 }, { 29, 31, 0 } } },
- { { { 30, 0, 1 }, { 29, 31, 1 } } },
- { { { 30, 0, 2 }, { 29, 31, 2 } } },
- { { { 30, 0, 3 }, { 30, 31, 1 } } },
- { { { 30, 0, 4 }, { 30, 31, 0 } } },
- { { { 31, 0, 3 }, { 30, 31, 1 } } },
- { { { 31, 0, 2 }, { 30, 31, 2 } } },
- { { { 31, 0, 1 }, { 31, 31, 1 } } },
- { { { 31, 0, 0 }, { 31, 31, 0 } } }
-};
-
-static SingleColourLookup const lookup_6_3[] =
-{
- { { { 0, 0, 0 }, { 0, 0, 0 } } },
- { { { 0, 0, 1 }, { 0, 1, 1 } } },
- { { { 0, 0, 2 }, { 0, 1, 0 } } },
- { { { 1, 0, 1 }, { 0, 2, 1 } } },
- { { { 1, 0, 0 }, { 0, 2, 0 } } },
- { { { 1, 0, 1 }, { 0, 3, 1 } } },
- { { { 1, 0, 2 }, { 0, 3, 0 } } },
- { { { 2, 0, 1 }, { 0, 4, 1 } } },
- { { { 2, 0, 0 }, { 0, 4, 0 } } },
- { { { 2, 0, 1 }, { 0, 5, 1 } } },
- { { { 2, 0, 2 }, { 0, 5, 0 } } },
- { { { 3, 0, 1 }, { 0, 6, 1 } } },
- { { { 3, 0, 0 }, { 0, 6, 0 } } },
- { { { 3, 0, 1 }, { 0, 7, 1 } } },
- { { { 3, 0, 2 }, { 0, 7, 0 } } },
- { { { 4, 0, 1 }, { 0, 8, 1 } } },
- { { { 4, 0, 0 }, { 0, 8, 0 } } },
- { { { 4, 0, 1 }, { 0, 9, 1 } } },
- { { { 4, 0, 2 }, { 0, 9, 0 } } },
- { { { 5, 0, 1 }, { 0, 10, 1 } } },
- { { { 5, 0, 0 }, { 0, 10, 0 } } },
- { { { 5, 0, 1 }, { 0, 11, 1 } } },
- { { { 5, 0, 2 }, { 0, 11, 0 } } },
- { { { 6, 0, 1 }, { 0, 12, 1 } } },
- { { { 6, 0, 0 }, { 0, 12, 0 } } },
- { { { 6, 0, 1 }, { 0, 13, 1 } } },
- { { { 6, 0, 2 }, { 0, 13, 0 } } },
- { { { 7, 0, 1 }, { 0, 14, 1 } } },
- { { { 7, 0, 0 }, { 0, 14, 0 } } },
- { { { 7, 0, 1 }, { 0, 15, 1 } } },
- { { { 7, 0, 2 }, { 0, 15, 0 } } },
- { { { 8, 0, 1 }, { 0, 16, 1 } } },
- { { { 8, 0, 0 }, { 0, 16, 0 } } },
- { { { 8, 0, 1 }, { 0, 17, 1 } } },
- { { { 8, 0, 2 }, { 0, 17, 0 } } },
- { { { 9, 0, 1 }, { 0, 18, 1 } } },
- { { { 9, 0, 0 }, { 0, 18, 0 } } },
- { { { 9, 0, 1 }, { 0, 19, 1 } } },
- { { { 9, 0, 2 }, { 0, 19, 0 } } },
- { { { 10, 0, 1 }, { 0, 20, 1 } } },
- { { { 10, 0, 0 }, { 0, 20, 0 } } },
- { { { 10, 0, 1 }, { 0, 21, 1 } } },
- { { { 10, 0, 2 }, { 0, 21, 0 } } },
- { { { 11, 0, 1 }, { 0, 22, 1 } } },
- { { { 11, 0, 0 }, { 0, 22, 0 } } },
- { { { 11, 0, 1 }, { 0, 23, 1 } } },
- { { { 11, 0, 2 }, { 0, 23, 0 } } },
- { { { 12, 0, 1 }, { 0, 24, 1 } } },
- { { { 12, 0, 0 }, { 0, 24, 0 } } },
- { { { 12, 0, 1 }, { 0, 25, 1 } } },
- { { { 12, 0, 2 }, { 0, 25, 0 } } },
- { { { 13, 0, 1 }, { 0, 26, 1 } } },
- { { { 13, 0, 0 }, { 0, 26, 0 } } },
- { { { 13, 0, 1 }, { 0, 27, 1 } } },
- { { { 13, 0, 2 }, { 0, 27, 0 } } },
- { { { 14, 0, 1 }, { 0, 28, 1 } } },
- { { { 14, 0, 0 }, { 0, 28, 0 } } },
- { { { 14, 0, 1 }, { 0, 29, 1 } } },
- { { { 14, 0, 2 }, { 0, 29, 0 } } },
- { { { 15, 0, 1 }, { 0, 30, 1 } } },
- { { { 15, 0, 0 }, { 0, 30, 0 } } },
- { { { 15, 0, 1 }, { 0, 31, 1 } } },
- { { { 15, 0, 2 }, { 0, 31, 0 } } },
- { { { 16, 0, 2 }, { 1, 31, 1 } } },
- { { { 16, 0, 1 }, { 1, 31, 0 } } },
- { { { 16, 0, 0 }, { 0, 32, 0 } } },
- { { { 16, 0, 1 }, { 2, 31, 0 } } },
- { { { 16, 0, 2 }, { 0, 33, 0 } } },
- { { { 17, 0, 1 }, { 3, 31, 0 } } },
- { { { 17, 0, 0 }, { 0, 34, 0 } } },
- { { { 17, 0, 1 }, { 4, 31, 0 } } },
- { { { 17, 0, 2 }, { 0, 35, 0 } } },
- { { { 18, 0, 1 }, { 5, 31, 0 } } },
- { { { 18, 0, 0 }, { 0, 36, 0 } } },
- { { { 18, 0, 1 }, { 6, 31, 0 } } },
- { { { 18, 0, 2 }, { 0, 37, 0 } } },
- { { { 19, 0, 1 }, { 7, 31, 0 } } },
- { { { 19, 0, 0 }, { 0, 38, 0 } } },
- { { { 19, 0, 1 }, { 8, 31, 0 } } },
- { { { 19, 0, 2 }, { 0, 39, 0 } } },
- { { { 20, 0, 1 }, { 9, 31, 0 } } },
- { { { 20, 0, 0 }, { 0, 40, 0 } } },
- { { { 20, 0, 1 }, { 10, 31, 0 } } },
- { { { 20, 0, 2 }, { 0, 41, 0 } } },
- { { { 21, 0, 1 }, { 11, 31, 0 } } },
- { { { 21, 0, 0 }, { 0, 42, 0 } } },
- { { { 21, 0, 1 }, { 12, 31, 0 } } },
- { { { 21, 0, 2 }, { 0, 43, 0 } } },
- { { { 22, 0, 1 }, { 13, 31, 0 } } },
- { { { 22, 0, 0 }, { 0, 44, 0 } } },
- { { { 22, 0, 1 }, { 14, 31, 0 } } },
- { { { 22, 0, 2 }, { 0, 45, 0 } } },
- { { { 23, 0, 1 }, { 15, 31, 0 } } },
- { { { 23, 0, 0 }, { 0, 46, 0 } } },
- { { { 23, 0, 1 }, { 0, 47, 1 } } },
- { { { 23, 0, 2 }, { 0, 47, 0 } } },
- { { { 24, 0, 1 }, { 0, 48, 1 } } },
- { { { 24, 0, 0 }, { 0, 48, 0 } } },
- { { { 24, 0, 1 }, { 0, 49, 1 } } },
- { { { 24, 0, 2 }, { 0, 49, 0 } } },
- { { { 25, 0, 1 }, { 0, 50, 1 } } },
- { { { 25, 0, 0 }, { 0, 50, 0 } } },
- { { { 25, 0, 1 }, { 0, 51, 1 } } },
- { { { 25, 0, 2 }, { 0, 51, 0 } } },
- { { { 26, 0, 1 }, { 0, 52, 1 } } },
- { { { 26, 0, 0 }, { 0, 52, 0 } } },
- { { { 26, 0, 1 }, { 0, 53, 1 } } },
- { { { 26, 0, 2 }, { 0, 53, 0 } } },
- { { { 27, 0, 1 }, { 0, 54, 1 } } },
- { { { 27, 0, 0 }, { 0, 54, 0 } } },
- { { { 27, 0, 1 }, { 0, 55, 1 } } },
- { { { 27, 0, 2 }, { 0, 55, 0 } } },
- { { { 28, 0, 1 }, { 0, 56, 1 } } },
- { { { 28, 0, 0 }, { 0, 56, 0 } } },
- { { { 28, 0, 1 }, { 0, 57, 1 } } },
- { { { 28, 0, 2 }, { 0, 57, 0 } } },
- { { { 29, 0, 1 }, { 0, 58, 1 } } },
- { { { 29, 0, 0 }, { 0, 58, 0 } } },
- { { { 29, 0, 1 }, { 0, 59, 1 } } },
- { { { 29, 0, 2 }, { 0, 59, 0 } } },
- { { { 30, 0, 1 }, { 0, 60, 1 } } },
- { { { 30, 0, 0 }, { 0, 60, 0 } } },
- { { { 30, 0, 1 }, { 0, 61, 1 } } },
- { { { 30, 0, 2 }, { 0, 61, 0 } } },
- { { { 31, 0, 1 }, { 0, 62, 1 } } },
- { { { 31, 0, 0 }, { 0, 62, 0 } } },
- { { { 31, 0, 1 }, { 0, 63, 1 } } },
- { { { 31, 0, 2 }, { 0, 63, 0 } } },
- { { { 32, 0, 2 }, { 1, 63, 1 } } },
- { { { 32, 0, 1 }, { 1, 63, 0 } } },
- { { { 32, 0, 0 }, { 16, 48, 0 } } },
- { { { 32, 0, 1 }, { 2, 63, 0 } } },
- { { { 32, 0, 2 }, { 16, 49, 0 } } },
- { { { 33, 0, 1 }, { 3, 63, 0 } } },
- { { { 33, 0, 0 }, { 16, 50, 0 } } },
- { { { 33, 0, 1 }, { 4, 63, 0 } } },
- { { { 33, 0, 2 }, { 16, 51, 0 } } },
- { { { 34, 0, 1 }, { 5, 63, 0 } } },
- { { { 34, 0, 0 }, { 16, 52, 0 } } },
- { { { 34, 0, 1 }, { 6, 63, 0 } } },
- { { { 34, 0, 2 }, { 16, 53, 0 } } },
- { { { 35, 0, 1 }, { 7, 63, 0 } } },
- { { { 35, 0, 0 }, { 16, 54, 0 } } },
- { { { 35, 0, 1 }, { 8, 63, 0 } } },
- { { { 35, 0, 2 }, { 16, 55, 0 } } },
- { { { 36, 0, 1 }, { 9, 63, 0 } } },
- { { { 36, 0, 0 }, { 16, 56, 0 } } },
- { { { 36, 0, 1 }, { 10, 63, 0 } } },
- { { { 36, 0, 2 }, { 16, 57, 0 } } },
- { { { 37, 0, 1 }, { 11, 63, 0 } } },
- { { { 37, 0, 0 }, { 16, 58, 0 } } },
- { { { 37, 0, 1 }, { 12, 63, 0 } } },
- { { { 37, 0, 2 }, { 16, 59, 0 } } },
- { { { 38, 0, 1 }, { 13, 63, 0 } } },
- { { { 38, 0, 0 }, { 16, 60, 0 } } },
- { { { 38, 0, 1 }, { 14, 63, 0 } } },
- { { { 38, 0, 2 }, { 16, 61, 0 } } },
- { { { 39, 0, 1 }, { 15, 63, 0 } } },
- { { { 39, 0, 0 }, { 16, 62, 0 } } },
- { { { 39, 0, 1 }, { 16, 63, 1 } } },
- { { { 39, 0, 2 }, { 16, 63, 0 } } },
- { { { 40, 0, 1 }, { 17, 63, 1 } } },
- { { { 40, 0, 0 }, { 17, 63, 0 } } },
- { { { 40, 0, 1 }, { 18, 63, 1 } } },
- { { { 40, 0, 2 }, { 18, 63, 0 } } },
- { { { 41, 0, 1 }, { 19, 63, 1 } } },
- { { { 41, 0, 0 }, { 19, 63, 0 } } },
- { { { 41, 0, 1 }, { 20, 63, 1 } } },
- { { { 41, 0, 2 }, { 20, 63, 0 } } },
- { { { 42, 0, 1 }, { 21, 63, 1 } } },
- { { { 42, 0, 0 }, { 21, 63, 0 } } },
- { { { 42, 0, 1 }, { 22, 63, 1 } } },
- { { { 42, 0, 2 }, { 22, 63, 0 } } },
- { { { 43, 0, 1 }, { 23, 63, 1 } } },
- { { { 43, 0, 0 }, { 23, 63, 0 } } },
- { { { 43, 0, 1 }, { 24, 63, 1 } } },
- { { { 43, 0, 2 }, { 24, 63, 0 } } },
- { { { 44, 0, 1 }, { 25, 63, 1 } } },
- { { { 44, 0, 0 }, { 25, 63, 0 } } },
- { { { 44, 0, 1 }, { 26, 63, 1 } } },
- { { { 44, 0, 2 }, { 26, 63, 0 } } },
- { { { 45, 0, 1 }, { 27, 63, 1 } } },
- { { { 45, 0, 0 }, { 27, 63, 0 } } },
- { { { 45, 0, 1 }, { 28, 63, 1 } } },
- { { { 45, 0, 2 }, { 28, 63, 0 } } },
- { { { 46, 0, 1 }, { 29, 63, 1 } } },
- { { { 46, 0, 0 }, { 29, 63, 0 } } },
- { { { 46, 0, 1 }, { 30, 63, 1 } } },
- { { { 46, 0, 2 }, { 30, 63, 0 } } },
- { { { 47, 0, 1 }, { 31, 63, 1 } } },
- { { { 47, 0, 0 }, { 31, 63, 0 } } },
- { { { 47, 0, 1 }, { 32, 63, 1 } } },
- { { { 47, 0, 2 }, { 32, 63, 0 } } },
- { { { 48, 0, 2 }, { 33, 63, 1 } } },
- { { { 48, 0, 1 }, { 33, 63, 0 } } },
- { { { 48, 0, 0 }, { 48, 48, 0 } } },
- { { { 48, 0, 1 }, { 34, 63, 0 } } },
- { { { 48, 0, 2 }, { 48, 49, 0 } } },
- { { { 49, 0, 1 }, { 35, 63, 0 } } },
- { { { 49, 0, 0 }, { 48, 50, 0 } } },
- { { { 49, 0, 1 }, { 36, 63, 0 } } },
- { { { 49, 0, 2 }, { 48, 51, 0 } } },
- { { { 50, 0, 1 }, { 37, 63, 0 } } },
- { { { 50, 0, 0 }, { 48, 52, 0 } } },
- { { { 50, 0, 1 }, { 38, 63, 0 } } },
- { { { 50, 0, 2 }, { 48, 53, 0 } } },
- { { { 51, 0, 1 }, { 39, 63, 0 } } },
- { { { 51, 0, 0 }, { 48, 54, 0 } } },
- { { { 51, 0, 1 }, { 40, 63, 0 } } },
- { { { 51, 0, 2 }, { 48, 55, 0 } } },
- { { { 52, 0, 1 }, { 41, 63, 0 } } },
- { { { 52, 0, 0 }, { 48, 56, 0 } } },
- { { { 52, 0, 1 }, { 42, 63, 0 } } },
- { { { 52, 0, 2 }, { 48, 57, 0 } } },
- { { { 53, 0, 1 }, { 43, 63, 0 } } },
- { { { 53, 0, 0 }, { 48, 58, 0 } } },
- { { { 53, 0, 1 }, { 44, 63, 0 } } },
- { { { 53, 0, 2 }, { 48, 59, 0 } } },
- { { { 54, 0, 1 }, { 45, 63, 0 } } },
- { { { 54, 0, 0 }, { 48, 60, 0 } } },
- { { { 54, 0, 1 }, { 46, 63, 0 } } },
- { { { 54, 0, 2 }, { 48, 61, 0 } } },
- { { { 55, 0, 1 }, { 47, 63, 0 } } },
- { { { 55, 0, 0 }, { 48, 62, 0 } } },
- { { { 55, 0, 1 }, { 48, 63, 1 } } },
- { { { 55, 0, 2 }, { 48, 63, 0 } } },
- { { { 56, 0, 1 }, { 49, 63, 1 } } },
- { { { 56, 0, 0 }, { 49, 63, 0 } } },
- { { { 56, 0, 1 }, { 50, 63, 1 } } },
- { { { 56, 0, 2 }, { 50, 63, 0 } } },
- { { { 57, 0, 1 }, { 51, 63, 1 } } },
- { { { 57, 0, 0 }, { 51, 63, 0 } } },
- { { { 57, 0, 1 }, { 52, 63, 1 } } },
- { { { 57, 0, 2 }, { 52, 63, 0 } } },
- { { { 58, 0, 1 }, { 53, 63, 1 } } },
- { { { 58, 0, 0 }, { 53, 63, 0 } } },
- { { { 58, 0, 1 }, { 54, 63, 1 } } },
- { { { 58, 0, 2 }, { 54, 63, 0 } } },
- { { { 59, 0, 1 }, { 55, 63, 1 } } },
- { { { 59, 0, 0 }, { 55, 63, 0 } } },
- { { { 59, 0, 1 }, { 56, 63, 1 } } },
- { { { 59, 0, 2 }, { 56, 63, 0 } } },
- { { { 60, 0, 1 }, { 57, 63, 1 } } },
- { { { 60, 0, 0 }, { 57, 63, 0 } } },
- { { { 60, 0, 1 }, { 58, 63, 1 } } },
- { { { 60, 0, 2 }, { 58, 63, 0 } } },
- { { { 61, 0, 1 }, { 59, 63, 1 } } },
- { { { 61, 0, 0 }, { 59, 63, 0 } } },
- { { { 61, 0, 1 }, { 60, 63, 1 } } },
- { { { 61, 0, 2 }, { 60, 63, 0 } } },
- { { { 62, 0, 1 }, { 61, 63, 1 } } },
- { { { 62, 0, 0 }, { 61, 63, 0 } } },
- { { { 62, 0, 1 }, { 62, 63, 1 } } },
- { { { 62, 0, 2 }, { 62, 63, 0 } } },
- { { { 63, 0, 1 }, { 63, 63, 1 } } },
- { { { 63, 0, 0 }, { 63, 63, 0 } } }
-};
-
-static SingleColourLookup const lookup_5_4[] =
-{
- { { { 0, 0, 0 }, { 0, 0, 0 } } },
- { { { 0, 0, 1 }, { 0, 1, 1 } } },
- { { { 0, 0, 2 }, { 0, 1, 0 } } },
- { { { 0, 0, 3 }, { 0, 1, 1 } } },
- { { { 0, 0, 4 }, { 0, 2, 1 } } },
- { { { 1, 0, 3 }, { 0, 2, 0 } } },
- { { { 1, 0, 2 }, { 0, 2, 1 } } },
- { { { 1, 0, 1 }, { 0, 3, 1 } } },
- { { { 1, 0, 0 }, { 0, 3, 0 } } },
- { { { 1, 0, 1 }, { 1, 2, 1 } } },
- { { { 1, 0, 2 }, { 1, 2, 0 } } },
- { { { 1, 0, 3 }, { 0, 4, 0 } } },
- { { { 1, 0, 4 }, { 0, 5, 1 } } },
- { { { 2, 0, 3 }, { 0, 5, 0 } } },
- { { { 2, 0, 2 }, { 0, 5, 1 } } },
- { { { 2, 0, 1 }, { 0, 6, 1 } } },
- { { { 2, 0, 0 }, { 0, 6, 0 } } },
- { { { 2, 0, 1 }, { 2, 3, 1 } } },
- { { { 2, 0, 2 }, { 2, 3, 0 } } },
- { { { 2, 0, 3 }, { 0, 7, 0 } } },
- { { { 2, 0, 4 }, { 1, 6, 1 } } },
- { { { 3, 0, 3 }, { 1, 6, 0 } } },
- { { { 3, 0, 2 }, { 0, 8, 0 } } },
- { { { 3, 0, 1 }, { 0, 9, 1 } } },
- { { { 3, 0, 0 }, { 0, 9, 0 } } },
- { { { 3, 0, 1 }, { 0, 9, 1 } } },
- { { { 3, 0, 2 }, { 0, 10, 1 } } },
- { { { 3, 0, 3 }, { 0, 10, 0 } } },
- { { { 3, 0, 4 }, { 2, 7, 1 } } },
- { { { 4, 0, 4 }, { 2, 7, 0 } } },
- { { { 4, 0, 3 }, { 0, 11, 0 } } },
- { { { 4, 0, 2 }, { 1, 10, 1 } } },
- { { { 4, 0, 1 }, { 1, 10, 0 } } },
- { { { 4, 0, 0 }, { 0, 12, 0 } } },
- { { { 4, 0, 1 }, { 0, 13, 1 } } },
- { { { 4, 0, 2 }, { 0, 13, 0 } } },
- { { { 4, 0, 3 }, { 0, 13, 1 } } },
- { { { 4, 0, 4 }, { 0, 14, 1 } } },
- { { { 5, 0, 3 }, { 0, 14, 0 } } },
- { { { 5, 0, 2 }, { 2, 11, 1 } } },
- { { { 5, 0, 1 }, { 2, 11, 0 } } },
- { { { 5, 0, 0 }, { 0, 15, 0 } } },
- { { { 5, 0, 1 }, { 1, 14, 1 } } },
- { { { 5, 0, 2 }, { 1, 14, 0 } } },
- { { { 5, 0, 3 }, { 0, 16, 0 } } },
- { { { 5, 0, 4 }, { 0, 17, 1 } } },
- { { { 6, 0, 3 }, { 0, 17, 0 } } },
- { { { 6, 0, 2 }, { 0, 17, 1 } } },
- { { { 6, 0, 1 }, { 0, 18, 1 } } },
- { { { 6, 0, 0 }, { 0, 18, 0 } } },
- { { { 6, 0, 1 }, { 2, 15, 1 } } },
- { { { 6, 0, 2 }, { 2, 15, 0 } } },
- { { { 6, 0, 3 }, { 0, 19, 0 } } },
- { { { 6, 0, 4 }, { 1, 18, 1 } } },
- { { { 7, 0, 3 }, { 1, 18, 0 } } },
- { { { 7, 0, 2 }, { 0, 20, 0 } } },
- { { { 7, 0, 1 }, { 0, 21, 1 } } },
- { { { 7, 0, 0 }, { 0, 21, 0 } } },
- { { { 7, 0, 1 }, { 0, 21, 1 } } },
- { { { 7, 0, 2 }, { 0, 22, 1 } } },
- { { { 7, 0, 3 }, { 0, 22, 0 } } },
- { { { 7, 0, 4 }, { 2, 19, 1 } } },
- { { { 8, 0, 4 }, { 2, 19, 0 } } },
- { { { 8, 0, 3 }, { 0, 23, 0 } } },
- { { { 8, 0, 2 }, { 1, 22, 1 } } },
- { { { 8, 0, 1 }, { 1, 22, 0 } } },
- { { { 8, 0, 0 }, { 0, 24, 0 } } },
- { { { 8, 0, 1 }, { 0, 25, 1 } } },
- { { { 8, 0, 2 }, { 0, 25, 0 } } },
- { { { 8, 0, 3 }, { 0, 25, 1 } } },
- { { { 8, 0, 4 }, { 0, 26, 1 } } },
- { { { 9, 0, 3 }, { 0, 26, 0 } } },
- { { { 9, 0, 2 }, { 2, 23, 1 } } },
- { { { 9, 0, 1 }, { 2, 23, 0 } } },
- { { { 9, 0, 0 }, { 0, 27, 0 } } },
- { { { 9, 0, 1 }, { 1, 26, 1 } } },
- { { { 9, 0, 2 }, { 1, 26, 0 } } },
- { { { 9, 0, 3 }, { 0, 28, 0 } } },
- { { { 9, 0, 4 }, { 0, 29, 1 } } },
- { { { 10, 0, 3 }, { 0, 29, 0 } } },
- { { { 10, 0, 2 }, { 0, 29, 1 } } },
- { { { 10, 0, 1 }, { 0, 30, 1 } } },
- { { { 10, 0, 0 }, { 0, 30, 0 } } },
- { { { 10, 0, 1 }, { 2, 27, 1 } } },
- { { { 10, 0, 2 }, { 2, 27, 0 } } },
- { { { 10, 0, 3 }, { 0, 31, 0 } } },
- { { { 10, 0, 4 }, { 1, 30, 1 } } },
- { { { 11, 0, 3 }, { 1, 30, 0 } } },
- { { { 11, 0, 2 }, { 4, 24, 0 } } },
- { { { 11, 0, 1 }, { 1, 31, 1 } } },
- { { { 11, 0, 0 }, { 1, 31, 0 } } },
- { { { 11, 0, 1 }, { 1, 31, 1 } } },
- { { { 11, 0, 2 }, { 2, 30, 1 } } },
- { { { 11, 0, 3 }, { 2, 30, 0 } } },
- { { { 11, 0, 4 }, { 2, 31, 1 } } },
- { { { 12, 0, 4 }, { 2, 31, 0 } } },
- { { { 12, 0, 3 }, { 4, 27, 0 } } },
- { { { 12, 0, 2 }, { 3, 30, 1 } } },
- { { { 12, 0, 1 }, { 3, 30, 0 } } },
- { { { 12, 0, 0 }, { 4, 28, 0 } } },
- { { { 12, 0, 1 }, { 3, 31, 1 } } },
- { { { 12, 0, 2 }, { 3, 31, 0 } } },
- { { { 12, 0, 3 }, { 3, 31, 1 } } },
- { { { 12, 0, 4 }, { 4, 30, 1 } } },
- { { { 13, 0, 3 }, { 4, 30, 0 } } },
- { { { 13, 0, 2 }, { 6, 27, 1 } } },
- { { { 13, 0, 1 }, { 6, 27, 0 } } },
- { { { 13, 0, 0 }, { 4, 31, 0 } } },
- { { { 13, 0, 1 }, { 5, 30, 1 } } },
- { { { 13, 0, 2 }, { 5, 30, 0 } } },
- { { { 13, 0, 3 }, { 8, 24, 0 } } },
- { { { 13, 0, 4 }, { 5, 31, 1 } } },
- { { { 14, 0, 3 }, { 5, 31, 0 } } },
- { { { 14, 0, 2 }, { 5, 31, 1 } } },
- { { { 14, 0, 1 }, { 6, 30, 1 } } },
- { { { 14, 0, 0 }, { 6, 30, 0 } } },
- { { { 14, 0, 1 }, { 6, 31, 1 } } },
- { { { 14, 0, 2 }, { 6, 31, 0 } } },
- { { { 14, 0, 3 }, { 8, 27, 0 } } },
- { { { 14, 0, 4 }, { 7, 30, 1 } } },
- { { { 15, 0, 3 }, { 7, 30, 0 } } },
- { { { 15, 0, 2 }, { 8, 28, 0 } } },
- { { { 15, 0, 1 }, { 7, 31, 1 } } },
- { { { 15, 0, 0 }, { 7, 31, 0 } } },
- { { { 15, 0, 1 }, { 7, 31, 1 } } },
- { { { 15, 0, 2 }, { 8, 30, 1 } } },
- { { { 15, 0, 3 }, { 8, 30, 0 } } },
- { { { 15, 0, 4 }, { 10, 27, 1 } } },
- { { { 16, 0, 4 }, { 10, 27, 0 } } },
- { { { 16, 0, 3 }, { 8, 31, 0 } } },
- { { { 16, 0, 2 }, { 9, 30, 1 } } },
- { { { 16, 0, 1 }, { 9, 30, 0 } } },
- { { { 16, 0, 0 }, { 12, 24, 0 } } },
- { { { 16, 0, 1 }, { 9, 31, 1 } } },
- { { { 16, 0, 2 }, { 9, 31, 0 } } },
- { { { 16, 0, 3 }, { 9, 31, 1 } } },
- { { { 16, 0, 4 }, { 10, 30, 1 } } },
- { { { 17, 0, 3 }, { 10, 30, 0 } } },
- { { { 17, 0, 2 }, { 10, 31, 1 } } },
- { { { 17, 0, 1 }, { 10, 31, 0 } } },
- { { { 17, 0, 0 }, { 12, 27, 0 } } },
- { { { 17, 0, 1 }, { 11, 30, 1 } } },
- { { { 17, 0, 2 }, { 11, 30, 0 } } },
- { { { 17, 0, 3 }, { 12, 28, 0 } } },
- { { { 17, 0, 4 }, { 11, 31, 1 } } },
- { { { 18, 0, 3 }, { 11, 31, 0 } } },
- { { { 18, 0, 2 }, { 11, 31, 1 } } },
- { { { 18, 0, 1 }, { 12, 30, 1 } } },
- { { { 18, 0, 0 }, { 12, 30, 0 } } },
- { { { 18, 0, 1 }, { 14, 27, 1 } } },
- { { { 18, 0, 2 }, { 14, 27, 0 } } },
- { { { 18, 0, 3 }, { 12, 31, 0 } } },
- { { { 18, 0, 4 }, { 13, 30, 1 } } },
- { { { 19, 0, 3 }, { 13, 30, 0 } } },
- { { { 19, 0, 2 }, { 16, 24, 0 } } },
- { { { 19, 0, 1 }, { 13, 31, 1 } } },
- { { { 19, 0, 0 }, { 13, 31, 0 } } },
- { { { 19, 0, 1 }, { 13, 31, 1 } } },
- { { { 19, 0, 2 }, { 14, 30, 1 } } },
- { { { 19, 0, 3 }, { 14, 30, 0 } } },
- { { { 19, 0, 4 }, { 14, 31, 1 } } },
- { { { 20, 0, 4 }, { 14, 31, 0 } } },
- { { { 20, 0, 3 }, { 16, 27, 0 } } },
- { { { 20, 0, 2 }, { 15, 30, 1 } } },
- { { { 20, 0, 1 }, { 15, 30, 0 } } },
- { { { 20, 0, 0 }, { 16, 28, 0 } } },
- { { { 20, 0, 1 }, { 15, 31, 1 } } },
- { { { 20, 0, 2 }, { 15, 31, 0 } } },
- { { { 20, 0, 3 }, { 15, 31, 1 } } },
- { { { 20, 0, 4 }, { 16, 30, 1 } } },
- { { { 21, 0, 3 }, { 16, 30, 0 } } },
- { { { 21, 0, 2 }, { 18, 27, 1 } } },
- { { { 21, 0, 1 }, { 18, 27, 0 } } },
- { { { 21, 0, 0 }, { 16, 31, 0 } } },
- { { { 21, 0, 1 }, { 17, 30, 1 } } },
- { { { 21, 0, 2 }, { 17, 30, 0 } } },
- { { { 21, 0, 3 }, { 20, 24, 0 } } },
- { { { 21, 0, 4 }, { 17, 31, 1 } } },
- { { { 22, 0, 3 }, { 17, 31, 0 } } },
- { { { 22, 0, 2 }, { 17, 31, 1 } } },
- { { { 22, 0, 1 }, { 18, 30, 1 } } },
- { { { 22, 0, 0 }, { 18, 30, 0 } } },
- { { { 22, 0, 1 }, { 18, 31, 1 } } },
- { { { 22, 0, 2 }, { 18, 31, 0 } } },
- { { { 22, 0, 3 }, { 20, 27, 0 } } },
- { { { 22, 0, 4 }, { 19, 30, 1 } } },
- { { { 23, 0, 3 }, { 19, 30, 0 } } },
- { { { 23, 0, 2 }, { 20, 28, 0 } } },
- { { { 23, 0, 1 }, { 19, 31, 1 } } },
- { { { 23, 0, 0 }, { 19, 31, 0 } } },
- { { { 23, 0, 1 }, { 19, 31, 1 } } },
- { { { 23, 0, 2 }, { 20, 30, 1 } } },
- { { { 23, 0, 3 }, { 20, 30, 0 } } },
- { { { 23, 0, 4 }, { 22, 27, 1 } } },
- { { { 24, 0, 4 }, { 22, 27, 0 } } },
- { { { 24, 0, 3 }, { 20, 31, 0 } } },
- { { { 24, 0, 2 }, { 21, 30, 1 } } },
- { { { 24, 0, 1 }, { 21, 30, 0 } } },
- { { { 24, 0, 0 }, { 24, 24, 0 } } },
- { { { 24, 0, 1 }, { 21, 31, 1 } } },
- { { { 24, 0, 2 }, { 21, 31, 0 } } },
- { { { 24, 0, 3 }, { 21, 31, 1 } } },
- { { { 24, 0, 4 }, { 22, 30, 1 } } },
- { { { 25, 0, 3 }, { 22, 30, 0 } } },
- { { { 25, 0, 2 }, { 22, 31, 1 } } },
- { { { 25, 0, 1 }, { 22, 31, 0 } } },
- { { { 25, 0, 0 }, { 24, 27, 0 } } },
- { { { 25, 0, 1 }, { 23, 30, 1 } } },
- { { { 25, 0, 2 }, { 23, 30, 0 } } },
- { { { 25, 0, 3 }, { 24, 28, 0 } } },
- { { { 25, 0, 4 }, { 23, 31, 1 } } },
- { { { 26, 0, 3 }, { 23, 31, 0 } } },
- { { { 26, 0, 2 }, { 23, 31, 1 } } },
- { { { 26, 0, 1 }, { 24, 30, 1 } } },
- { { { 26, 0, 0 }, { 24, 30, 0 } } },
- { { { 26, 0, 1 }, { 26, 27, 1 } } },
- { { { 26, 0, 2 }, { 26, 27, 0 } } },
- { { { 26, 0, 3 }, { 24, 31, 0 } } },
- { { { 26, 0, 4 }, { 25, 30, 1 } } },
- { { { 27, 0, 3 }, { 25, 30, 0 } } },
- { { { 27, 0, 2 }, { 28, 24, 0 } } },
- { { { 27, 0, 1 }, { 25, 31, 1 } } },
- { { { 27, 0, 0 }, { 25, 31, 0 } } },
- { { { 27, 0, 1 }, { 25, 31, 1 } } },
- { { { 27, 0, 2 }, { 26, 30, 1 } } },
- { { { 27, 0, 3 }, { 26, 30, 0 } } },
- { { { 27, 0, 4 }, { 26, 31, 1 } } },
- { { { 28, 0, 4 }, { 26, 31, 0 } } },
- { { { 28, 0, 3 }, { 28, 27, 0 } } },
- { { { 28, 0, 2 }, { 27, 30, 1 } } },
- { { { 28, 0, 1 }, { 27, 30, 0 } } },
- { { { 28, 0, 0 }, { 28, 28, 0 } } },
- { { { 28, 0, 1 }, { 27, 31, 1 } } },
- { { { 28, 0, 2 }, { 27, 31, 0 } } },
- { { { 28, 0, 3 }, { 27, 31, 1 } } },
- { { { 28, 0, 4 }, { 28, 30, 1 } } },
- { { { 29, 0, 3 }, { 28, 30, 0 } } },
- { { { 29, 0, 2 }, { 30, 27, 1 } } },
- { { { 29, 0, 1 }, { 30, 27, 0 } } },
- { { { 29, 0, 0 }, { 28, 31, 0 } } },
- { { { 29, 0, 1 }, { 29, 30, 1 } } },
- { { { 29, 0, 2 }, { 29, 30, 0 } } },
- { { { 29, 0, 3 }, { 29, 30, 1 } } },
- { { { 29, 0, 4 }, { 29, 31, 1 } } },
- { { { 30, 0, 3 }, { 29, 31, 0 } } },
- { { { 30, 0, 2 }, { 29, 31, 1 } } },
- { { { 30, 0, 1 }, { 30, 30, 1 } } },
- { { { 30, 0, 0 }, { 30, 30, 0 } } },
- { { { 30, 0, 1 }, { 30, 31, 1 } } },
- { { { 30, 0, 2 }, { 30, 31, 0 } } },
- { { { 30, 0, 3 }, { 30, 31, 1 } } },
- { { { 30, 0, 4 }, { 31, 30, 1 } } },
- { { { 31, 0, 3 }, { 31, 30, 0 } } },
- { { { 31, 0, 2 }, { 31, 30, 1 } } },
- { { { 31, 0, 1 }, { 31, 31, 1 } } },
- { { { 31, 0, 0 }, { 31, 31, 0 } } }
-};
-
-static SingleColourLookup const lookup_6_4[] =
-{
- { { { 0, 0, 0 }, { 0, 0, 0 } } },
- { { { 0, 0, 1 }, { 0, 1, 0 } } },
- { { { 0, 0, 2 }, { 0, 2, 0 } } },
- { { { 1, 0, 1 }, { 0, 3, 1 } } },
- { { { 1, 0, 0 }, { 0, 3, 0 } } },
- { { { 1, 0, 1 }, { 0, 4, 0 } } },
- { { { 1, 0, 2 }, { 0, 5, 0 } } },
- { { { 2, 0, 1 }, { 0, 6, 1 } } },
- { { { 2, 0, 0 }, { 0, 6, 0 } } },
- { { { 2, 0, 1 }, { 0, 7, 0 } } },
- { { { 2, 0, 2 }, { 0, 8, 0 } } },
- { { { 3, 0, 1 }, { 0, 9, 1 } } },
- { { { 3, 0, 0 }, { 0, 9, 0 } } },
- { { { 3, 0, 1 }, { 0, 10, 0 } } },
- { { { 3, 0, 2 }, { 0, 11, 0 } } },
- { { { 4, 0, 1 }, { 0, 12, 1 } } },
- { { { 4, 0, 0 }, { 0, 12, 0 } } },
- { { { 4, 0, 1 }, { 0, 13, 0 } } },
- { { { 4, 0, 2 }, { 0, 14, 0 } } },
- { { { 5, 0, 1 }, { 0, 15, 1 } } },
- { { { 5, 0, 0 }, { 0, 15, 0 } } },
- { { { 5, 0, 1 }, { 0, 16, 0 } } },
- { { { 5, 0, 2 }, { 1, 15, 0 } } },
- { { { 6, 0, 1 }, { 0, 17, 0 } } },
- { { { 6, 0, 0 }, { 0, 18, 0 } } },
- { { { 6, 0, 1 }, { 0, 19, 0 } } },
- { { { 6, 0, 2 }, { 3, 14, 0 } } },
- { { { 7, 0, 1 }, { 0, 20, 0 } } },
- { { { 7, 0, 0 }, { 0, 21, 0 } } },
- { { { 7, 0, 1 }, { 0, 22, 0 } } },
- { { { 7, 0, 2 }, { 4, 15, 0 } } },
- { { { 8, 0, 1 }, { 0, 23, 0 } } },
- { { { 8, 0, 0 }, { 0, 24, 0 } } },
- { { { 8, 0, 1 }, { 0, 25, 0 } } },
- { { { 8, 0, 2 }, { 6, 14, 0 } } },
- { { { 9, 0, 1 }, { 0, 26, 0 } } },
- { { { 9, 0, 0 }, { 0, 27, 0 } } },
- { { { 9, 0, 1 }, { 0, 28, 0 } } },
- { { { 9, 0, 2 }, { 7, 15, 0 } } },
- { { { 10, 0, 1 }, { 0, 29, 0 } } },
- { { { 10, 0, 0 }, { 0, 30, 0 } } },
- { { { 10, 0, 1 }, { 0, 31, 0 } } },
- { { { 10, 0, 2 }, { 9, 14, 0 } } },
- { { { 11, 0, 1 }, { 0, 32, 0 } } },
- { { { 11, 0, 0 }, { 0, 33, 0 } } },
- { { { 11, 0, 1 }, { 2, 30, 0 } } },
- { { { 11, 0, 2 }, { 0, 34, 0 } } },
- { { { 12, 0, 1 }, { 0, 35, 0 } } },
- { { { 12, 0, 0 }, { 0, 36, 0 } } },
- { { { 12, 0, 1 }, { 3, 31, 0 } } },
- { { { 12, 0, 2 }, { 0, 37, 0 } } },
- { { { 13, 0, 1 }, { 0, 38, 0 } } },
- { { { 13, 0, 0 }, { 0, 39, 0 } } },
- { { { 13, 0, 1 }, { 5, 30, 0 } } },
- { { { 13, 0, 2 }, { 0, 40, 0 } } },
- { { { 14, 0, 1 }, { 0, 41, 0 } } },
- { { { 14, 0, 0 }, { 0, 42, 0 } } },
- { { { 14, 0, 1 }, { 6, 31, 0 } } },
- { { { 14, 0, 2 }, { 0, 43, 0 } } },
- { { { 15, 0, 1 }, { 0, 44, 0 } } },
- { { { 15, 0, 0 }, { 0, 45, 0 } } },
- { { { 15, 0, 1 }, { 8, 30, 0 } } },
- { { { 15, 0, 2 }, { 0, 46, 0 } } },
- { { { 16, 0, 2 }, { 0, 47, 0 } } },
- { { { 16, 0, 1 }, { 1, 46, 0 } } },
- { { { 16, 0, 0 }, { 0, 48, 0 } } },
- { { { 16, 0, 1 }, { 0, 49, 0 } } },
- { { { 16, 0, 2 }, { 0, 50, 0 } } },
- { { { 17, 0, 1 }, { 2, 47, 0 } } },
- { { { 17, 0, 0 }, { 0, 51, 0 } } },
- { { { 17, 0, 1 }, { 0, 52, 0 } } },
- { { { 17, 0, 2 }, { 0, 53, 0 } } },
- { { { 18, 0, 1 }, { 4, 46, 0 } } },
- { { { 18, 0, 0 }, { 0, 54, 0 } } },
- { { { 18, 0, 1 }, { 0, 55, 0 } } },
- { { { 18, 0, 2 }, { 0, 56, 0 } } },
- { { { 19, 0, 1 }, { 5, 47, 0 } } },
- { { { 19, 0, 0 }, { 0, 57, 0 } } },
- { { { 19, 0, 1 }, { 0, 58, 0 } } },
- { { { 19, 0, 2 }, { 0, 59, 0 } } },
- { { { 20, 0, 1 }, { 7, 46, 0 } } },
- { { { 20, 0, 0 }, { 0, 60, 0 } } },
- { { { 20, 0, 1 }, { 0, 61, 0 } } },
- { { { 20, 0, 2 }, { 0, 62, 0 } } },
- { { { 21, 0, 1 }, { 8, 47, 0 } } },
- { { { 21, 0, 0 }, { 0, 63, 0 } } },
- { { { 21, 0, 1 }, { 1, 62, 0 } } },
- { { { 21, 0, 2 }, { 1, 63, 0 } } },
- { { { 22, 0, 1 }, { 10, 46, 0 } } },
- { { { 22, 0, 0 }, { 2, 62, 0 } } },
- { { { 22, 0, 1 }, { 2, 63, 0 } } },
- { { { 22, 0, 2 }, { 3, 62, 0 } } },
- { { { 23, 0, 1 }, { 11, 47, 0 } } },
- { { { 23, 0, 0 }, { 3, 63, 0 } } },
- { { { 23, 0, 1 }, { 4, 62, 0 } } },
- { { { 23, 0, 2 }, { 4, 63, 0 } } },
- { { { 24, 0, 1 }, { 13, 46, 0 } } },
- { { { 24, 0, 0 }, { 5, 62, 0 } } },
- { { { 24, 0, 1 }, { 5, 63, 0 } } },
- { { { 24, 0, 2 }, { 6, 62, 0 } } },
- { { { 25, 0, 1 }, { 14, 47, 0 } } },
- { { { 25, 0, 0 }, { 6, 63, 0 } } },
- { { { 25, 0, 1 }, { 7, 62, 0 } } },
- { { { 25, 0, 2 }, { 7, 63, 0 } } },
- { { { 26, 0, 1 }, { 16, 45, 0 } } },
- { { { 26, 0, 0 }, { 8, 62, 0 } } },
- { { { 26, 0, 1 }, { 8, 63, 0 } } },
- { { { 26, 0, 2 }, { 9, 62, 0 } } },
- { { { 27, 0, 1 }, { 16, 48, 0 } } },
- { { { 27, 0, 0 }, { 9, 63, 0 } } },
- { { { 27, 0, 1 }, { 10, 62, 0 } } },
- { { { 27, 0, 2 }, { 10, 63, 0 } } },
- { { { 28, 0, 1 }, { 16, 51, 0 } } },
- { { { 28, 0, 0 }, { 11, 62, 0 } } },
- { { { 28, 0, 1 }, { 11, 63, 0 } } },
- { { { 28, 0, 2 }, { 12, 62, 0 } } },
- { { { 29, 0, 1 }, { 16, 54, 0 } } },
- { { { 29, 0, 0 }, { 12, 63, 0 } } },
- { { { 29, 0, 1 }, { 13, 62, 0 } } },
- { { { 29, 0, 2 }, { 13, 63, 0 } } },
- { { { 30, 0, 1 }, { 16, 57, 0 } } },
- { { { 30, 0, 0 }, { 14, 62, 0 } } },
- { { { 30, 0, 1 }, { 14, 63, 0 } } },
- { { { 30, 0, 2 }, { 15, 62, 0 } } },
- { { { 31, 0, 1 }, { 16, 60, 0 } } },
- { { { 31, 0, 0 }, { 15, 63, 0 } } },
- { { { 31, 0, 1 }, { 24, 46, 0 } } },
- { { { 31, 0, 2 }, { 16, 62, 0 } } },
- { { { 32, 0, 2 }, { 16, 63, 0 } } },
- { { { 32, 0, 1 }, { 17, 62, 0 } } },
- { { { 32, 0, 0 }, { 25, 47, 0 } } },
- { { { 32, 0, 1 }, { 17, 63, 0 } } },
- { { { 32, 0, 2 }, { 18, 62, 0 } } },
- { { { 33, 0, 1 }, { 18, 63, 0 } } },
- { { { 33, 0, 0 }, { 27, 46, 0 } } },
- { { { 33, 0, 1 }, { 19, 62, 0 } } },
- { { { 33, 0, 2 }, { 19, 63, 0 } } },
- { { { 34, 0, 1 }, { 20, 62, 0 } } },
- { { { 34, 0, 0 }, { 28, 47, 0 } } },
- { { { 34, 0, 1 }, { 20, 63, 0 } } },
- { { { 34, 0, 2 }, { 21, 62, 0 } } },
- { { { 35, 0, 1 }, { 21, 63, 0 } } },
- { { { 35, 0, 0 }, { 30, 46, 0 } } },
- { { { 35, 0, 1 }, { 22, 62, 0 } } },
- { { { 35, 0, 2 }, { 22, 63, 0 } } },
- { { { 36, 0, 1 }, { 23, 62, 0 } } },
- { { { 36, 0, 0 }, { 31, 47, 0 } } },
- { { { 36, 0, 1 }, { 23, 63, 0 } } },
- { { { 36, 0, 2 }, { 24, 62, 0 } } },
- { { { 37, 0, 1 }, { 24, 63, 0 } } },
- { { { 37, 0, 0 }, { 32, 47, 0 } } },
- { { { 37, 0, 1 }, { 25, 62, 0 } } },
- { { { 37, 0, 2 }, { 25, 63, 0 } } },
- { { { 38, 0, 1 }, { 26, 62, 0 } } },
- { { { 38, 0, 0 }, { 32, 50, 0 } } },
- { { { 38, 0, 1 }, { 26, 63, 0 } } },
- { { { 38, 0, 2 }, { 27, 62, 0 } } },
- { { { 39, 0, 1 }, { 27, 63, 0 } } },
- { { { 39, 0, 0 }, { 32, 53, 0 } } },
- { { { 39, 0, 1 }, { 28, 62, 0 } } },
- { { { 39, 0, 2 }, { 28, 63, 0 } } },
- { { { 40, 0, 1 }, { 29, 62, 0 } } },
- { { { 40, 0, 0 }, { 32, 56, 0 } } },
- { { { 40, 0, 1 }, { 29, 63, 0 } } },
- { { { 40, 0, 2 }, { 30, 62, 0 } } },
- { { { 41, 0, 1 }, { 30, 63, 0 } } },
- { { { 41, 0, 0 }, { 32, 59, 0 } } },
- { { { 41, 0, 1 }, { 31, 62, 0 } } },
- { { { 41, 0, 2 }, { 31, 63, 0 } } },
- { { { 42, 0, 1 }, { 32, 61, 0 } } },
- { { { 42, 0, 0 }, { 32, 62, 0 } } },
- { { { 42, 0, 1 }, { 32, 63, 0 } } },
- { { { 42, 0, 2 }, { 41, 46, 0 } } },
- { { { 43, 0, 1 }, { 33, 62, 0 } } },
- { { { 43, 0, 0 }, { 33, 63, 0 } } },
- { { { 43, 0, 1 }, { 34, 62, 0 } } },
- { { { 43, 0, 2 }, { 42, 47, 0 } } },
- { { { 44, 0, 1 }, { 34, 63, 0 } } },
- { { { 44, 0, 0 }, { 35, 62, 0 } } },
- { { { 44, 0, 1 }, { 35, 63, 0 } } },
- { { { 44, 0, 2 }, { 44, 46, 0 } } },
- { { { 45, 0, 1 }, { 36, 62, 0 } } },
- { { { 45, 0, 0 }, { 36, 63, 0 } } },
- { { { 45, 0, 1 }, { 37, 62, 0 } } },
- { { { 45, 0, 2 }, { 45, 47, 0 } } },
- { { { 46, 0, 1 }, { 37, 63, 0 } } },
- { { { 46, 0, 0 }, { 38, 62, 0 } } },
- { { { 46, 0, 1 }, { 38, 63, 0 } } },
- { { { 46, 0, 2 }, { 47, 46, 0 } } },
- { { { 47, 0, 1 }, { 39, 62, 0 } } },
- { { { 47, 0, 0 }, { 39, 63, 0 } } },
- { { { 47, 0, 1 }, { 40, 62, 0 } } },
- { { { 47, 0, 2 }, { 48, 46, 0 } } },
- { { { 48, 0, 2 }, { 40, 63, 0 } } },
- { { { 48, 0, 1 }, { 41, 62, 0 } } },
- { { { 48, 0, 0 }, { 41, 63, 0 } } },
- { { { 48, 0, 1 }, { 48, 49, 0 } } },
- { { { 48, 0, 2 }, { 42, 62, 0 } } },
- { { { 49, 0, 1 }, { 42, 63, 0 } } },
- { { { 49, 0, 0 }, { 43, 62, 0 } } },
- { { { 49, 0, 1 }, { 48, 52, 0 } } },
- { { { 49, 0, 2 }, { 43, 63, 0 } } },
- { { { 50, 0, 1 }, { 44, 62, 0 } } },
- { { { 50, 0, 0 }, { 44, 63, 0 } } },
- { { { 50, 0, 1 }, { 48, 55, 0 } } },
- { { { 50, 0, 2 }, { 45, 62, 0 } } },
- { { { 51, 0, 1 }, { 45, 63, 0 } } },
- { { { 51, 0, 0 }, { 46, 62, 0 } } },
- { { { 51, 0, 1 }, { 48, 58, 0 } } },
- { { { 51, 0, 2 }, { 46, 63, 0 } } },
- { { { 52, 0, 1 }, { 47, 62, 0 } } },
- { { { 52, 0, 0 }, { 47, 63, 0 } } },
- { { { 52, 0, 1 }, { 48, 61, 0 } } },
- { { { 52, 0, 2 }, { 48, 62, 0 } } },
- { { { 53, 0, 1 }, { 56, 47, 0 } } },
- { { { 53, 0, 0 }, { 48, 63, 0 } } },
- { { { 53, 0, 1 }, { 49, 62, 0 } } },
- { { { 53, 0, 2 }, { 49, 63, 0 } } },
- { { { 54, 0, 1 }, { 58, 46, 0 } } },
- { { { 54, 0, 0 }, { 50, 62, 0 } } },
- { { { 54, 0, 1 }, { 50, 63, 0 } } },
- { { { 54, 0, 2 }, { 51, 62, 0 } } },
- { { { 55, 0, 1 }, { 59, 47, 0 } } },
- { { { 55, 0, 0 }, { 51, 63, 0 } } },
- { { { 55, 0, 1 }, { 52, 62, 0 } } },
- { { { 55, 0, 2 }, { 52, 63, 0 } } },
- { { { 56, 0, 1 }, { 61, 46, 0 } } },
- { { { 56, 0, 0 }, { 53, 62, 0 } } },
- { { { 56, 0, 1 }, { 53, 63, 0 } } },
- { { { 56, 0, 2 }, { 54, 62, 0 } } },
- { { { 57, 0, 1 }, { 62, 47, 0 } } },
- { { { 57, 0, 0 }, { 54, 63, 0 } } },
- { { { 57, 0, 1 }, { 55, 62, 0 } } },
- { { { 57, 0, 2 }, { 55, 63, 0 } } },
- { { { 58, 0, 1 }, { 56, 62, 1 } } },
- { { { 58, 0, 0 }, { 56, 62, 0 } } },
- { { { 58, 0, 1 }, { 56, 63, 0 } } },
- { { { 58, 0, 2 }, { 57, 62, 0 } } },
- { { { 59, 0, 1 }, { 57, 63, 1 } } },
- { { { 59, 0, 0 }, { 57, 63, 0 } } },
- { { { 59, 0, 1 }, { 58, 62, 0 } } },
- { { { 59, 0, 2 }, { 58, 63, 0 } } },
- { { { 60, 0, 1 }, { 59, 62, 1 } } },
- { { { 60, 0, 0 }, { 59, 62, 0 } } },
- { { { 60, 0, 1 }, { 59, 63, 0 } } },
- { { { 60, 0, 2 }, { 60, 62, 0 } } },
- { { { 61, 0, 1 }, { 60, 63, 1 } } },
- { { { 61, 0, 0 }, { 60, 63, 0 } } },
- { { { 61, 0, 1 }, { 61, 62, 0 } } },
- { { { 61, 0, 2 }, { 61, 63, 0 } } },
- { { { 62, 0, 1 }, { 62, 62, 1 } } },
- { { { 62, 0, 0 }, { 62, 62, 0 } } },
- { { { 62, 0, 1 }, { 62, 63, 0 } } },
- { { { 62, 0, 2 }, { 63, 62, 0 } } },
- { { { 63, 0, 1 }, { 63, 63, 1 } } },
- { { { 63, 0, 0 }, { 63, 63, 0 } } }
-};
diff --git a/drivers/squish/squish.cpp b/drivers/squish/squish.cpp
deleted file mode 100644
index 400a3b0c4..000000000
--- a/drivers/squish/squish.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "squish/squish.h"
-#include "colourset.h"
-#include "maths.h"
-#include "rangefit.h"
-#include "clusterfit.h"
-#include "colourblock.h"
-#include "alpha.h"
-#include "singlecolourfit.h"
-
-namespace squish {
-
-static int FixFlags( int flags )
-{
- // grab the flag bits
- int method = flags & ( kDxt1 | kDxt3 | kDxt5 );
- int fit = flags & ( kColourIterativeClusterFit | kColourClusterFit | kColourRangeFit );
- int metric = flags & ( kColourMetricPerceptual | kColourMetricUniform );
- int extra = flags & kWeightColourByAlpha;
-
- // set defaults
- if( method != kDxt3 && method != kDxt5 )
- method = kDxt1;
- if( fit != kColourRangeFit )
- fit = kColourClusterFit;
- if( metric != kColourMetricUniform )
- metric = kColourMetricPerceptual;
-
- // done
- return method | fit | metric | extra;
-}
-
-void Compress( u8 const* rgba, void* block, int flags )
-{
- // compress with full mask
- CompressMasked( rgba, 0xffff, block, flags );
-}
-
-void CompressMasked( u8 const* rgba, int mask, void* block, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // get the block locations
- void* colourBlock = block;
- void* alphaBock = block;
- if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 )
- colourBlock = reinterpret_cast< u8* >( block ) + 8;
-
- // create the minimal point set
- ColourSet colours( rgba, mask, flags );
-
- // check the compression type and compress colour
- if( colours.GetCount() == 1 )
- {
- // always do a single colour fit
- SingleColourFit fit( &colours, flags );
- fit.Compress( colourBlock );
- }
- else if( ( flags & kColourRangeFit ) != 0 || colours.GetCount() == 0 )
- {
- // do a range fit
- RangeFit fit( &colours, flags );
- fit.Compress( colourBlock );
- }
- else
- {
- // default to a cluster fit (could be iterative or not)
- ClusterFit fit( &colours, flags );
- fit.Compress( colourBlock );
- }
-
- // compress alpha separately if necessary
- if( ( flags & kDxt3 ) != 0 )
- CompressAlphaDxt3( rgba, mask, alphaBock );
- else if( ( flags & kDxt5 ) != 0 )
- CompressAlphaDxt5( rgba, mask, alphaBock );
-}
-
-void Decompress( u8* rgba, void const* block, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // get the block locations
- void const* colourBlock = block;
- void const* alphaBock = block;
- if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 )
- colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
-
- // decompress colour
- DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
-
- // decompress alpha separately if necessary
- if( ( flags & kDxt3 ) != 0 )
- DecompressAlphaDxt3( rgba, alphaBock );
- else if( ( flags & kDxt5 ) != 0 )
- DecompressAlphaDxt5( rgba, alphaBock );
-}
-
-int GetStorageRequirements( int width, int height, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // compute the storage requirements
- int blockcount = ( ( width + 3 )/4 ) * ( ( height + 3 )/4 );
- int blocksize = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
- return blockcount*blocksize;
-}
-
-void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // initialise the block output
- u8* targetBlock = reinterpret_cast< u8* >( blocks );
- int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
-
- // loop over blocks
- for( int y = 0; y < height; y += 4 )
- {
- for( int x = 0; x < width; x += 4 )
- {
- // build the 4x4 block of pixels
- u8 sourceRgba[16*4];
- u8* targetPixel = sourceRgba;
- int mask = 0;
- for( int py = 0; py < 4; ++py )
- {
- for( int px = 0; px < 4; ++px )
- {
- // get the source pixel in the image
- int sx = x + px;
- int sy = y + py;
-
- // enable if we're in the image
- if( sx < width && sy < height )
- {
- // copy the rgba value
- u8 const* sourcePixel = rgba + 4*( width*sy + sx );
- for( int i = 0; i < 4; ++i )
- *targetPixel++ = *sourcePixel++;
-
- // enable this pixel
- mask |= ( 1 << ( 4*py + px ) );
- }
- else
- {
- // skip this pixel as its outside the image
- targetPixel += 4;
- }
- }
- }
-
- // compress it into the output
- CompressMasked( sourceRgba, mask, targetBlock, flags );
-
- // advance
- targetBlock += bytesPerBlock;
- }
- }
-}
-
-void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // initialise the block input
- u8 const* sourceBlock = reinterpret_cast< u8 const* >( blocks );
- int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
-
- // loop over blocks
- for( int y = 0; y < height; y += 4 )
- {
- for( int x = 0; x < width; x += 4 )
- {
- // decompress the block
- u8 targetRgba[4*16];
- Decompress( targetRgba, sourceBlock, flags );
-
- // write the decompressed pixels to the correct image locations
- u8 const* sourcePixel = targetRgba;
- for( int py = 0; py < 4; ++py )
- {
- for( int px = 0; px < 4; ++px )
- {
- // get the target location
- int sx = x + px;
- int sy = y + py;
- if( sx < width && sy < height )
- {
- u8* targetPixel = rgba + 4*( width*sy + sx );
-
- // copy the rgba value
- for( int i = 0; i < 4; ++i )
- *targetPixel++ = *sourcePixel++;
- }
- else
- {
- // skip this pixel as its outside the image
- sourcePixel += 4;
- }
- }
- }
-
- // advance
- sourceBlock += bytesPerBlock;
- }
- }
-}
-
-} // namespace squish
diff --git a/drivers/squish/squish.h b/drivers/squish/squish.h
deleted file mode 100644
index 5f5ac149d..000000000
--- a/drivers/squish/squish.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_H
-#define SQUISH_H
-
-//! All squish API functions live in this namespace.
-namespace squish {
-
-// -----------------------------------------------------------------------------
-
-//! Typedef a quantity that is a single unsigned byte.
-typedef unsigned char u8;
-
-// -----------------------------------------------------------------------------
-
-enum
-{
- //! Use DXT1 compression.
- kDxt1 = ( 1 << 0 ),
-
- //! Use DXT3 compression.
- kDxt3 = ( 1 << 1 ),
-
- //! Use DXT5 compression.
- kDxt5 = ( 1 << 2 ),
-
- //! Use a very slow but very high quality colour compressor.
- kColourIterativeClusterFit = ( 1 << 8 ),
-
- //! Use a slow but high quality colour compressor (the default).
- kColourClusterFit = ( 1 << 3 ),
-
- //! Use a fast but low quality colour compressor.
- kColourRangeFit = ( 1 << 4 ),
-
- //! Use a perceptual metric for colour error (the default).
- kColourMetricPerceptual = ( 1 << 5 ),
-
- //! Use a uniform metric for colour error.
- kColourMetricUniform = ( 1 << 6 ),
-
- //! Weight the colour by alpha during cluster fit (disabled by default).
- kWeightColourByAlpha = ( 1 << 7 )
-};
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Compresses a 4x4 block of pixels.
-
- @param rgba The rgba values of the 16 source pixels.
- @param block Storage for the compressed DXT block.
- @param flags Compression flags.
-
- The source pixels should be presented as a contiguous array of 16 rgba
- values, with each component as 1 byte each. In memory this should be:
-
- { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. When using DXT1
- compression, 8 bytes of storage are required for the compressed DXT block.
- DXT3 and DXT5 compression require 16 bytes of storage per block.
-
- The flags parameter can also specify a preferred colour compressor and
- colour error metric to use when fitting the RGB components of the data.
- Possible colour compressors are: kColourClusterFit (the default),
- kColourRangeFit or kColourIterativeClusterFit. Possible colour error metrics
- are: kColourMetricPerceptual (the default) or kColourMetricUniform. If no
- flags are specified in any particular category then the default will be
- used. Unknown flags are ignored.
-
- When using kColourClusterFit, an additional flag can be specified to
- weight the colour of each pixel by its alpha value. For images that are
- rendered using alpha blending, this can significantly increase the
- perceived quality.
-*/
-void Compress( u8 const* rgba, void* block, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Compresses a 4x4 block of pixels.
-
- @param rgba The rgba values of the 16 source pixels.
- @param mask The valid pixel mask.
- @param block Storage for the compressed DXT block.
- @param flags Compression flags.
-
- The source pixels should be presented as a contiguous array of 16 rgba
- values, with each component as 1 byte each. In memory this should be:
-
- { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
-
- The mask parameter enables only certain pixels within the block. The lowest
- bit enables the first pixel and so on up to the 16th bit. Bits beyond the
- 16th bit are ignored. Pixels that are not enabled are allowed to take
- arbitrary colours in the output block. An example of how this can be used
- is in the CompressImage function to disable pixels outside the bounds of
- the image when the width or height is not divisible by 4.
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. When using DXT1
- compression, 8 bytes of storage are required for the compressed DXT block.
- DXT3 and DXT5 compression require 16 bytes of storage per block.
-
- The flags parameter can also specify a preferred colour compressor and
- colour error metric to use when fitting the RGB components of the data.
- Possible colour compressors are: kColourClusterFit (the default),
- kColourRangeFit or kColourIterativeClusterFit. Possible colour error metrics
- are: kColourMetricPerceptual (the default) or kColourMetricUniform. If no
- flags are specified in any particular category then the default will be
- used. Unknown flags are ignored.
-
- When using kColourClusterFit, an additional flag can be specified to
- weight the colour of each pixel by its alpha value. For images that are
- rendered using alpha blending, this can significantly increase the
- perceived quality.
-*/
-void CompressMasked( u8 const* rgba, int mask, void* block, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Decompresses a 4x4 block of pixels.
-
- @param rgba Storage for the 16 decompressed pixels.
- @param block The compressed DXT block.
- @param flags Compression flags.
-
- The decompressed pixels will be written as a contiguous array of 16 rgba
- values, with each component as 1 byte each. In memory this is:
-
- { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. All other flags
- are ignored.
-*/
-void Decompress( u8* rgba, void const* block, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Computes the amount of compressed storage required.
-
- @param width The width of the image.
- @param height The height of the image.
- @param flags Compression flags.
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. All other flags
- are ignored.
-
- Most DXT images will be a multiple of 4 in each dimension, but this
- function supports arbitrary size images by allowing the outer blocks to
- be only partially used.
-*/
-int GetStorageRequirements( int width, int height, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Compresses an image in memory.
-
- @param rgba The pixels of the source.
- @param width The width of the source image.
- @param height The height of the source image.
- @param blocks Storage for the compressed output.
- @param flags Compression flags.
-
- The source pixels should be presented as a contiguous array of width*height
- rgba values, with each component as 1 byte each. In memory this should be:
-
- { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. When using DXT1
- compression, 8 bytes of storage are required for each compressed DXT block.
- DXT3 and DXT5 compression require 16 bytes of storage per block.
-
- The flags parameter can also specify a preferred colour compressor and
- colour error metric to use when fitting the RGB components of the data.
- Possible colour compressors are: kColourClusterFit (the default),
- kColourRangeFit or kColourIterativeClusterFit. Possible colour error metrics
- are: kColourMetricPerceptual (the default) or kColourMetricUniform. If no
- flags are specified in any particular category then the default will be
- used. Unknown flags are ignored.
-
- When using kColourClusterFit, an additional flag can be specified to
- weight the colour of each pixel by its alpha value. For images that are
- rendered using alpha blending, this can significantly increase the
- perceived quality.
-
- Internally this function calls squish::Compress for each block. To see how
- much memory is required in the compressed image, use
- squish::GetStorageRequirements.
-*/
-void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Decompresses an image in memory.
-
- @param rgba Storage for the decompressed pixels.
- @param width The width of the source image.
- @param height The height of the source image.
- @param blocks The compressed DXT blocks.
- @param flags Compression flags.
-
- The decompressed pixels will be written as a contiguous array of width*height
- 16 rgba values, with each component as 1 byte each. In memory this is:
-
- { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. All other flags
- are ignored.
-
- Internally this function calls squish::Decompress for each block.
-*/
-void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags );
-
-// -----------------------------------------------------------------------------
-
-} // namespace squish
-
-#endif // ndef SQUISH_H
-
diff --git a/drivers/theora/SCsub b/drivers/theora/SCsub
deleted file mode 100644
index 94477d282..000000000
--- a/drivers/theora/SCsub
+++ /dev/null
@@ -1,65 +0,0 @@
-Import('env')
-
-sources = [
- #"theora/analyze.c",
- #"theora/apiwrapper.c",
- "theora/bitpack.c",
- "theora/cpu.c",
- #"theora/decapiwrapper.c",
- "theora/decinfo.c",
- "theora/decode.c",
- "theora/dequant.c",
- #"theora/encapiwrapper.c",
- #"theora/encfrag.c",
- #"theora/encinfo.c",
- #"theora/encode.c",
- #"theora/encoder_disabled.c",
- #"theora/enquant.c",
- #"theora/fdct.c",
- "theora/fragment.c",
- "theora/huffdec.c",
- #"theora/huffenc.c",
- "theora/idct.c",
- "theora/info.c",
- "theora/internal.c",
- #"theora/mathops.c",
- #"theora/mcenc.c",
- "theora/quant.c",
- #"theora/rate.c",
- "theora/state.c",
- #"theora/tokenize.c",
- "theora/video_stream_theora.cpp",
-]
-
-sources_x86 = [
- #"theora/x86/mmxencfrag.c",
- #"theora/x86/mmxfdct.c",
- "theora/x86/mmxfrag.c",
- "theora/x86/mmxidct.c",
- "theora/x86/mmxstate.c",
- #"theora/x86/sse2fdct.c",
- #"theora/x86/x86enc.c",
- "theora/x86/x86state.c",
-]
-
-sources_x86_vc = [
- #"theora/x86_vc/mmxencfrag.c",
- #"theora/x86_vc/mmxfdct.c",
- "theora/x86_vc/mmxfrag.c",
- "theora/x86_vc/mmxidct.c",
- "theora/x86_vc/mmxstate.c",
- #"theora/x86_vc/x86enc.c",
- "theora/x86_vc/x86state.c",
-]
-
-env.drivers_sources += sources
-
-if (env["x86_opt_gcc"]):
- env.drivers_sources += sources_x86
-
-if (env["x86_opt_vc"]):
- env.drivers_sources += sources_x86_vc
-
-if (env["x86_opt_gcc"] or env["x86_opt_vc"]):
- Import('env_drivers')
- env_drivers.Append(CCFLAGS=["-DOC_X86_ASM"])
diff --git a/drivers/theora/theora.exp b/drivers/theora/theora.exp
deleted file mode 100644
index b4e0225f1..000000000
--- a/drivers/theora/theora.exp
+++ /dev/null
@@ -1,55 +0,0 @@
-# export list for libtheora
-_theora_version_string
-_theora_version_number
-_theora_encode_init
-_theora_encode_YUVin
-_theora_encode_packetout
-_theora_encode_header
-_theora_encode_comment
-_theora_encode_tables
-_theora_decode_header
-_theora_decode_init
-_theora_decode_packetin
-_theora_decode_YUVout
-_theora_control
-_theora_packet_isheader
-_theora_packet_iskeyframe
-_theora_granule_shift
-_theora_granule_frame
-_theora_granule_time
-_theora_info_init
-_theora_info_clear
-_theora_clear
-_theora_comment_init
-_theora_comment_add
-_theora_comment_add_tag
-_theora_comment_query
-_theora_comment_query_count
-_theora_comment_clear
-_th_version_string
-_th_version_number
-_th_decode_headerin
-_th_decode_alloc
-_th_setup_free
-_th_decode_ctl
-_th_decode_packetin
-_th_decode_ycbcr_out
-_th_decode_free
-_th_packet_isheader
-_th_packet_iskeyframe
-_th_granule_frame
-_th_granule_time
-_th_info_init
-_th_info_clear
-_th_comment_init
-_th_comment_add
-_th_comment_add_tag
-_th_comment_query
-_th_comment_query_count
-_th_comment_clear
-_th_encode_alloc
-_th_encode_ctl
-_th_encode_flushheader
-_th_encode_packetout
-_th_encode_ycbcr_in
-_th_encode_free
diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub
index 3d46a85cd..36a172025 100644
--- a/drivers/unix/SCsub
+++ b/drivers/unix/SCsub
@@ -10,6 +10,6 @@ f = open("os_unix_global_settings_path.cpp","wb")
f.write(g_set_p)
f.close()
-env.add_source_files(env.drivers_sources,"*.cpp")
+env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')
diff --git a/drivers/vorbis/SCsub b/drivers/vorbis/SCsub
deleted file mode 100644
index 4afafcc4b..000000000
--- a/drivers/vorbis/SCsub
+++ /dev/null
@@ -1,36 +0,0 @@
-Import('env')
-
-sources = [
- "vorbis/audio_stream_ogg_vorbis.cpp",
-]
-
-sources_lib = [
- #"vorbis/analysis.c",
- #"vorbis/barkmel.c",
- "vorbis/bitrate.c",
- "vorbis/block.c",
- "vorbis/codebook.c",
- "vorbis/envelope.c",
- "vorbis/floor0.c",
- "vorbis/floor1.c",
- "vorbis/info.c",
- "vorbis/lookup.c",
- "vorbis/lpc.c",
- "vorbis/lsp.c",
- "vorbis/mapping0.c",
- "vorbis/mdct.c",
- "vorbis/psy.c",
- #"vorbis/psytune.c",
- "vorbis/registry.c",
- "vorbis/res0.c",
- "vorbis/sharedbook.c",
- "vorbis/smallft.c",
- "vorbis/synthesis.c",
- #"vorbis/tone.c",
- #"vorbis/vorbisenc.c",
- "vorbis/vorbisfile.c",
- "vorbis/window.c",
-]
-
-env.drivers_sources += sources
-env.drivers_sources += sources_lib
diff --git a/drivers/webp/SCsub b/drivers/webp/SCsub
deleted file mode 100644
index f65bd13db..000000000
--- a/drivers/webp/SCsub
+++ /dev/null
@@ -1,115 +0,0 @@
-Import('env')
-
-webp_sources = [
-"webp/enc/webpenc.c",\
-"webp/enc/near_lossless.c",\
-"webp/enc/frame.c",\
-"webp/enc/alpha.c",\
-"webp/enc/picture_csp.c",\
-"webp/enc/vp8l.c",\
-"webp/enc/picture_psnr.c",\
-"webp/enc/delta_palettization.c",\
-"webp/enc/syntax.c",\
-"webp/enc/backward_references.c",\
-"webp/enc/token.c",\
-"webp/enc/analysis.c",\
-"webp/enc/iterator.c",\
-"webp/enc/picture_tools.c",\
-"webp/enc/picture_rescale.c",\
-"webp/enc/config.c",\
-"webp/enc/tree.c",\
-"webp/enc/cost.c",\
-"webp/enc/picture.c",\
-"webp/enc/quant.c",\
-"webp/enc/filter.c",\
-"webp/enc/histogram.c",\
-"webp/image_loader_webp.cpp",\
-"webp/utils/rescaler.c",\
-"webp/utils/filters.c",\
-"webp/utils/quant_levels_dec.c",\
-"webp/utils/huffman.c",\
-"webp/utils/thread.c",\
-"webp/utils/quant_levels.c",\
-"webp/utils/bit_writer.c",\
-"webp/utils/bit_reader.c",\
-"webp/utils/random.c",\
-"webp/utils/utils.c",\
-"webp/utils/huffman_encode.c",\
-"webp/utils/color_cache.c",\
-"webp/mux/muxinternal.c",\
-"webp/mux/muxread.c",\
-"webp/mux/anim_encode.c",\
-"webp/mux/muxedit.c",\
-"webp/dec/webp.c",\
-"webp/dec/frame.c",\
-"webp/dec/alpha.c",\
-"webp/dec/vp8l.c",\
-"webp/dec/io.c",\
-"webp/dec/vp8.c",\
-"webp/dec/idec.c",\
-"webp/dec/tree.c",\
-"webp/dec/buffer.c",\
-"webp/dec/quant.c",\
-"webp/demux/demux.c",\
-"webp/demux/anim_decode.c",\
-"webp/dsp/yuv.c",\
-"webp/dsp/filters_sse2.c",\
-"webp/dsp/dec_sse41.c",\
-"webp/dsp/rescaler.c",\
-"webp/dsp/lossless_sse2.c",\
-"webp/dsp/alpha_processing_sse41.c",\
-"webp/dsp/alpha_processing_sse2.c",\
-"webp/dsp/filters.c",\
-"webp/dsp/upsampling_mips_dsp_r2.c",\
-"webp/dsp/dec_neon.c",\
-"webp/dsp/enc_neon.c",\
-"webp/dsp/lossless_enc_mips32.c",\
-"webp/dsp/lossless_enc_sse2.c",\
-"webp/dsp/upsampling.c",\
-"webp/dsp/lossless_enc_neon.c",\
-"webp/dsp/alpha_processing.c",\
-"webp/dsp/cost_sse2.c",\
-"webp/dsp/dec_mips32.c",\
-"webp/dsp/enc_avx2.c",\
-"webp/dsp/rescaler_mips32.c",\
-"webp/dsp/enc.c",\
-"webp/dsp/lossless_enc_sse41.c",\
-"webp/dsp/cost_mips32.c",\
-"webp/dsp/lossless_mips_dsp_r2.c",\
-"webp/dsp/filters_mips_dsp_r2.c",\
-"webp/dsp/upsampling_neon.c",\
-"webp/dsp/alpha_processing_mips_dsp_r2.c",\
-"webp/dsp/enc_mips_dsp_r2.c",\
-"webp/dsp/lossless.c",\
-"webp/dsp/yuv_mips_dsp_r2.c",\
-"webp/dsp/cost_mips_dsp_r2.c",\
-"webp/dsp/argb.c",\
-"webp/dsp/dec_sse2.c",\
-"webp/dsp/rescaler_sse2.c",\
-"webp/dsp/enc_sse41.c",\
-"webp/dsp/argb_mips_dsp_r2.c",\
-"webp/dsp/lossless_enc_mips_dsp_r2.c",\
-"webp/dsp/dec_clip_tables.c",\
-"webp/dsp/yuv_mips32.c",\
-"webp/dsp/cpu.c",\
-"webp/dsp/dec.c",\
-"webp/dsp/argb_sse2.c",\
-"webp/dsp/lossless_neon.c",\
-"webp/dsp/lossless_enc.c",\
-"webp/dsp/enc_mips32.c",\
-"webp/dsp/cost.c",\
-"webp/dsp/rescaler_mips_dsp_r2.c",\
-"webp/dsp/dec_mips_dsp_r2.c",\
-"webp/dsp/rescaler_neon.c",\
-"webp/dsp/yuv_sse2.c",\
-"webp/dsp/enc_sse2.c",\
-"webp/dsp/upsampling_sse2.c"
-]
-
-env.drivers_sources+=webp_sources
-
-#env.add_source_files(env.drivers_sources, webp_sources)
-
-
-Export('env')
-
diff --git a/drivers/webp/extras.h b/drivers/webp/extras.h
deleted file mode 100644
index 1c24be2e0..000000000
--- a/drivers/webp/extras.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the COPYING file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-// -----------------------------------------------------------------------------
-//
-
-#ifndef WEBP_WEBP_EXTRAS_H_
-#define WEBP_WEBP_EXTRAS_H_
-
-#include "./types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "./encode.h"
-
-#define WEBP_EXTRAS_ABI_VERSION 0x0000 // MAJOR(8b) + MINOR(8b)
-
-//------------------------------------------------------------------------------
-
-// Returns the version number of the extras library, packed in hexadecimal using
-// 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507.
-WEBP_EXTERN(int) WebPGetExtrasVersion(void);
-
-//------------------------------------------------------------------------------
-// Ad-hoc colorspace importers.
-
-// Import luma sample (gray scale image) into 'picture'. The 'picture'
-// width and height must be set prior to calling this function.
-WEBP_EXTERN(int) WebPImportGray(const uint8_t* gray, WebPPicture* picture);
-
-// Import rgb sample in RGB565 packed format into 'picture'. The 'picture'
-// width and height must be set prior to calling this function.
-WEBP_EXTERN(int) WebPImportRGB565(const uint8_t* rgb565, WebPPicture* pic);
-
-// Import rgb sample in RGB4444 packed format into 'picture'. The 'picture'
-// width and height must be set prior to calling this function.
-WEBP_EXTERN(int) WebPImportRGB4444(const uint8_t* rgb4444, WebPPicture* pic);
-
-//------------------------------------------------------------------------------
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* WEBP_WEBP_EXTRAS_H_ */
diff --git a/drivers/windows/SCsub b/drivers/windows/SCsub
index 9fbb467ba..0582e0197 100644
--- a/drivers/windows/SCsub
+++ b/drivers/windows/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.drivers_sources,"*.cpp")
+env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')
diff --git a/drivers/zlib/SCsub b/drivers/zlib/SCsub
new file mode 100644
index 000000000..d0bbcd452
--- /dev/null
+++ b/drivers/zlib/SCsub
@@ -0,0 +1,24 @@
+Import('env')
+
+# Not cloning the env, the includes need to be accessible for core/
+
+# Thirdparty source files
+# No check here as already done in drivers/SCsub
+thirdparty_dir = "#thirdparty/zlib/"
+thirdparty_sources = [
+ "adler32.c",
+ "compress.c",
+ "crc32.c",
+ "deflate.c",
+ "infback.c",
+ "inffast.c",
+ "inflate.c",
+ "inftrees.c",
+ "trees.c",
+ "uncompr.c",
+ "zutil.c",
+]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+env.add_source_files(env.drivers_sources, thirdparty_sources)
+env.Append(CPPPATH = [thirdparty_dir])
diff --git a/modules/chibi/SCsub b/modules/chibi/SCsub
new file mode 100644
index 000000000..e39554977
--- /dev/null
+++ b/modules/chibi/SCsub
@@ -0,0 +1,7 @@
+Import('env')
+Import('env_modules')
+
+env_chibi = env_modules.Clone()
+
+# Godot source files
+env_chibi.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/chibi/config.py b/modules/chibi/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/chibi/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/drivers/chibi/cp_config.h b/modules/chibi/cp_config.h
index 2ad704ace..2ad704ace 100644
--- a/drivers/chibi/cp_config.h
+++ b/modules/chibi/cp_config.h
diff --git a/drivers/chibi/cp_envelope.cpp b/modules/chibi/cp_envelope.cpp
index 9892b6d4b..9892b6d4b 100644
--- a/drivers/chibi/cp_envelope.cpp
+++ b/modules/chibi/cp_envelope.cpp
diff --git a/drivers/chibi/cp_envelope.h b/modules/chibi/cp_envelope.h
index d1ada53f7..d1ada53f7 100644
--- a/drivers/chibi/cp_envelope.h
+++ b/modules/chibi/cp_envelope.h
diff --git a/drivers/chibi/cp_file_access_wrapper.h b/modules/chibi/cp_file_access_wrapper.h
index 5b361c0ea..5b361c0ea 100644
--- a/drivers/chibi/cp_file_access_wrapper.h
+++ b/modules/chibi/cp_file_access_wrapper.h
diff --git a/drivers/chibi/cp_instrument.cpp b/modules/chibi/cp_instrument.cpp
index 7a732e33a..7a732e33a 100644
--- a/drivers/chibi/cp_instrument.cpp
+++ b/modules/chibi/cp_instrument.cpp
diff --git a/drivers/chibi/cp_instrument.h b/modules/chibi/cp_instrument.h
index d8eb8333e..d8eb8333e 100644
--- a/drivers/chibi/cp_instrument.h
+++ b/modules/chibi/cp_instrument.h
diff --git a/drivers/chibi/cp_loader.h b/modules/chibi/cp_loader.h
index 9d1074d1b..9d1074d1b 100644
--- a/drivers/chibi/cp_loader.h
+++ b/modules/chibi/cp_loader.h
diff --git a/drivers/chibi/cp_loader_it.cpp b/modules/chibi/cp_loader_it.cpp
index 20a3960a2..20a3960a2 100644
--- a/drivers/chibi/cp_loader_it.cpp
+++ b/modules/chibi/cp_loader_it.cpp
diff --git a/drivers/chibi/cp_loader_it.h b/modules/chibi/cp_loader_it.h
index 38a1cdd9c..38a1cdd9c 100644
--- a/drivers/chibi/cp_loader_it.h
+++ b/modules/chibi/cp_loader_it.h
diff --git a/drivers/chibi/cp_loader_it_info.cpp b/modules/chibi/cp_loader_it_info.cpp
index 0360f7f9a..0360f7f9a 100644
--- a/drivers/chibi/cp_loader_it_info.cpp
+++ b/modules/chibi/cp_loader_it_info.cpp
diff --git a/drivers/chibi/cp_loader_it_instruments.cpp b/modules/chibi/cp_loader_it_instruments.cpp
index ccb24bd81..ccb24bd81 100644
--- a/drivers/chibi/cp_loader_it_instruments.cpp
+++ b/modules/chibi/cp_loader_it_instruments.cpp
diff --git a/drivers/chibi/cp_loader_it_patterns.cpp b/modules/chibi/cp_loader_it_patterns.cpp
index d951a9162..d951a9162 100644
--- a/drivers/chibi/cp_loader_it_patterns.cpp
+++ b/modules/chibi/cp_loader_it_patterns.cpp
diff --git a/drivers/chibi/cp_loader_it_samples.cpp b/modules/chibi/cp_loader_it_samples.cpp
index ced7252a6..ced7252a6 100644
--- a/drivers/chibi/cp_loader_it_samples.cpp
+++ b/modules/chibi/cp_loader_it_samples.cpp
diff --git a/drivers/chibi/cp_loader_mod.cpp b/modules/chibi/cp_loader_mod.cpp
index f867b7791..f867b7791 100644
--- a/drivers/chibi/cp_loader_mod.cpp
+++ b/modules/chibi/cp_loader_mod.cpp
diff --git a/drivers/chibi/cp_loader_mod.h b/modules/chibi/cp_loader_mod.h
index 636f4f00f..636f4f00f 100644
--- a/drivers/chibi/cp_loader_mod.h
+++ b/modules/chibi/cp_loader_mod.h
diff --git a/drivers/chibi/cp_loader_s3m.cpp b/modules/chibi/cp_loader_s3m.cpp
index 0fc15c1e2..0fc15c1e2 100644
--- a/drivers/chibi/cp_loader_s3m.cpp
+++ b/modules/chibi/cp_loader_s3m.cpp
diff --git a/drivers/chibi/cp_loader_s3m.h b/modules/chibi/cp_loader_s3m.h
index 175e5e80f..175e5e80f 100644
--- a/drivers/chibi/cp_loader_s3m.h
+++ b/modules/chibi/cp_loader_s3m.h
diff --git a/drivers/chibi/cp_loader_xm.cpp b/modules/chibi/cp_loader_xm.cpp
index bff8615a3..bff8615a3 100644
--- a/drivers/chibi/cp_loader_xm.cpp
+++ b/modules/chibi/cp_loader_xm.cpp
diff --git a/drivers/chibi/cp_loader_xm.h b/modules/chibi/cp_loader_xm.h
index 9ae480cc8..9ae480cc8 100644
--- a/drivers/chibi/cp_loader_xm.h
+++ b/modules/chibi/cp_loader_xm.h
diff --git a/drivers/chibi/cp_mixer.h b/modules/chibi/cp_mixer.h
index 7ad22ac14..7ad22ac14 100644
--- a/drivers/chibi/cp_mixer.h
+++ b/modules/chibi/cp_mixer.h
diff --git a/drivers/chibi/cp_note.h b/modules/chibi/cp_note.h
index 5cfa3f11e..5cfa3f11e 100644
--- a/drivers/chibi/cp_note.h
+++ b/modules/chibi/cp_note.h
diff --git a/drivers/chibi/cp_order.h b/modules/chibi/cp_order.h
index 03ecc00bb..03ecc00bb 100644
--- a/drivers/chibi/cp_order.h
+++ b/modules/chibi/cp_order.h
diff --git a/drivers/chibi/cp_pattern.cpp b/modules/chibi/cp_pattern.cpp
index 83e165bf8..83e165bf8 100644
--- a/drivers/chibi/cp_pattern.cpp
+++ b/modules/chibi/cp_pattern.cpp
diff --git a/drivers/chibi/cp_pattern.h b/modules/chibi/cp_pattern.h
index 4065caa5e..4065caa5e 100644
--- a/drivers/chibi/cp_pattern.h
+++ b/modules/chibi/cp_pattern.h
diff --git a/drivers/chibi/cp_player_data.cpp b/modules/chibi/cp_player_data.cpp
index 3f3e9a520..3f3e9a520 100644
--- a/drivers/chibi/cp_player_data.cpp
+++ b/modules/chibi/cp_player_data.cpp
diff --git a/drivers/chibi/cp_player_data.h b/modules/chibi/cp_player_data.h
index 282592b8f..282592b8f 100644
--- a/drivers/chibi/cp_player_data.h
+++ b/modules/chibi/cp_player_data.h
diff --git a/drivers/chibi/cp_player_data_control.cpp b/modules/chibi/cp_player_data_control.cpp
index d9aaed904..d9aaed904 100644
--- a/drivers/chibi/cp_player_data_control.cpp
+++ b/modules/chibi/cp_player_data_control.cpp
diff --git a/drivers/chibi/cp_player_data_effects.cpp b/modules/chibi/cp_player_data_effects.cpp
index 3a52a3b91..3a52a3b91 100644
--- a/drivers/chibi/cp_player_data_effects.cpp
+++ b/modules/chibi/cp_player_data_effects.cpp
diff --git a/drivers/chibi/cp_player_data_envelopes.cpp b/modules/chibi/cp_player_data_envelopes.cpp
index 96af42d19..96af42d19 100644
--- a/drivers/chibi/cp_player_data_envelopes.cpp
+++ b/modules/chibi/cp_player_data_envelopes.cpp
diff --git a/drivers/chibi/cp_player_data_events.cpp b/modules/chibi/cp_player_data_events.cpp
index fb5090461..fb5090461 100644
--- a/drivers/chibi/cp_player_data_events.cpp
+++ b/modules/chibi/cp_player_data_events.cpp
diff --git a/drivers/chibi/cp_player_data_filter.cpp b/modules/chibi/cp_player_data_filter.cpp
index 30db807ee..30db807ee 100644
--- a/drivers/chibi/cp_player_data_filter.cpp
+++ b/modules/chibi/cp_player_data_filter.cpp
diff --git a/drivers/chibi/cp_player_data_nna.cpp b/modules/chibi/cp_player_data_nna.cpp
index 844f04369..844f04369 100644
--- a/drivers/chibi/cp_player_data_nna.cpp
+++ b/modules/chibi/cp_player_data_nna.cpp
diff --git a/drivers/chibi/cp_player_data_notes.cpp b/modules/chibi/cp_player_data_notes.cpp
index 621be019e..621be019e 100644
--- a/drivers/chibi/cp_player_data_notes.cpp
+++ b/modules/chibi/cp_player_data_notes.cpp
diff --git a/drivers/chibi/cp_player_data_utils.cpp b/modules/chibi/cp_player_data_utils.cpp
index 170a84986..170a84986 100644
--- a/drivers/chibi/cp_player_data_utils.cpp
+++ b/modules/chibi/cp_player_data_utils.cpp
diff --git a/drivers/chibi/cp_sample.cpp b/modules/chibi/cp_sample.cpp
index 55c2c910a..55c2c910a 100644
--- a/drivers/chibi/cp_sample.cpp
+++ b/modules/chibi/cp_sample.cpp
diff --git a/drivers/chibi/cp_sample.h b/modules/chibi/cp_sample.h
index 4b3d21810..4b3d21810 100644
--- a/drivers/chibi/cp_sample.h
+++ b/modules/chibi/cp_sample.h
diff --git a/drivers/chibi/cp_sample_defs.h b/modules/chibi/cp_sample_defs.h
index 169963c98..169963c98 100644
--- a/drivers/chibi/cp_sample_defs.h
+++ b/modules/chibi/cp_sample_defs.h
diff --git a/drivers/chibi/cp_sample_manager.cpp b/modules/chibi/cp_sample_manager.cpp
index 5c2988e3f..5c2988e3f 100644
--- a/drivers/chibi/cp_sample_manager.cpp
+++ b/modules/chibi/cp_sample_manager.cpp
diff --git a/drivers/chibi/cp_sample_manager.h b/modules/chibi/cp_sample_manager.h
index 74bcafc0c..74bcafc0c 100644
--- a/drivers/chibi/cp_sample_manager.h
+++ b/modules/chibi/cp_sample_manager.h
diff --git a/drivers/chibi/cp_song.cpp b/modules/chibi/cp_song.cpp
index 4aa1a4228..4aa1a4228 100644
--- a/drivers/chibi/cp_song.cpp
+++ b/modules/chibi/cp_song.cpp
diff --git a/drivers/chibi/cp_song.h b/modules/chibi/cp_song.h
index da5d106a6..da5d106a6 100644
--- a/drivers/chibi/cp_song.h
+++ b/modules/chibi/cp_song.h
diff --git a/drivers/chibi/cp_tables.cpp b/modules/chibi/cp_tables.cpp
index 8c62150f3..8c62150f3 100644
--- a/drivers/chibi/cp_tables.cpp
+++ b/modules/chibi/cp_tables.cpp
diff --git a/drivers/chibi/cp_tables.h b/modules/chibi/cp_tables.h
index ac7ee562b..ac7ee562b 100644
--- a/drivers/chibi/cp_tables.h
+++ b/modules/chibi/cp_tables.h
diff --git a/drivers/chibi/event_stream_chibi.cpp b/modules/chibi/event_stream_chibi.cpp
index b88f4ee70..b88f4ee70 100644
--- a/drivers/chibi/event_stream_chibi.cpp
+++ b/modules/chibi/event_stream_chibi.cpp
diff --git a/drivers/chibi/event_stream_chibi.h b/modules/chibi/event_stream_chibi.h
index cc7b0ace8..cc7b0ace8 100644
--- a/drivers/chibi/event_stream_chibi.h
+++ b/modules/chibi/event_stream_chibi.h
diff --git a/modules/chibi/register_types.cpp b/modules/chibi/register_types.cpp
new file mode 100644
index 000000000..b2ba16fa0
--- /dev/null
+++ b/modules/chibi/register_types.cpp
@@ -0,0 +1,41 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "event_stream_chibi.h"
+
+void register_chibi_types() {
+
+ initialize_chibi();
+}
+
+void unregister_chibi_types() {
+
+ finalize_chibi();
+}
diff --git a/modules/chibi/register_types.h b/modules/chibi/register_types.h
new file mode 100644
index 000000000..159823b85
--- /dev/null
+++ b/modules/chibi/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_chibi_types();
+void unregister_chibi_types();
diff --git a/modules/cscript/SCsub b/modules/cscript/SCsub
index 403fe68f6..9ff13fc43 100644
--- a/modules/cscript/SCsub
+++ b/modules/cscript/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/dds/SCsub b/modules/dds/SCsub
new file mode 100644
index 000000000..c54a58e07
--- /dev/null
+++ b/modules/dds/SCsub
@@ -0,0 +1,6 @@
+Import('env')
+Import('env_modules')
+
+env_dds = env_modules.Clone()
+
+env_dds.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/dds/config.py b/modules/dds/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/dds/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/dds/register_types.cpp b/modules/dds/register_types.cpp
new file mode 100644
index 000000000..0d28e2bbe
--- /dev/null
+++ b/modules/dds/register_types.cpp
@@ -0,0 +1,44 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "texture_loader_dds.h"
+
+static ResourceFormatDDS *resource_loader_dds = NULL;
+
+void register_dds_types() {
+
+ resource_loader_dds = memnew( ResourceFormatDDS );
+ ResourceLoader::add_resource_format_loader(resource_loader_dds);
+}
+
+void unregister_dds_types() {
+
+ memdelete(resource_loader_dds);
+}
diff --git a/modules/dds/register_types.h b/modules/dds/register_types.h
new file mode 100644
index 000000000..f9ecfb8ef
--- /dev/null
+++ b/modules/dds/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_dds_types();
+void unregister_dds_types();
diff --git a/drivers/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 0cc84f02f..0cc84f02f 100644
--- a/drivers/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
diff --git a/drivers/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h
index 371eb1858..371eb1858 100644
--- a/drivers/dds/texture_loader_dds.h
+++ b/modules/dds/texture_loader_dds.h
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
index d2bc8801e..66c60baab 100644
--- a/modules/enet/SCsub
+++ b/modules/enet/SCsub
@@ -1,8 +1,26 @@
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources,"*.cpp")
-env.add_source_files(env.modules_sources,"*.c")
-#TODO: Make it possible to build against system enet
-env.Append(CPPPATH = ["#modules/enet"])
+# Thirdparty source files
-Export('env')
+env_enet = env_modules.Clone()
+
+if (env["enet"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/enet/"
+ thirdparty_sources = [
+ "callbacks.c",
+ "compress.c",
+ "host.c",
+ "list.c",
+ "packet.c",
+ "peer.c",
+ "protocol.c",
+ "unix.c",
+ "win32.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_enet.add_source_files(env.modules_sources, thirdparty_sources)
+ env_enet.Append(CPPPATH = [thirdparty_dir])
+
+env_enet.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/enet/config.py b/modules/enet/config.py
index ea7e83378..368e97e15 100644
--- a/modules/enet/config.py
+++ b/modules/enet/config.py
@@ -1,11 +1,6 @@
-
def can_build(platform):
- return True
-
+ return True
def configure(env):
pass
-
-
-
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index ac89c0e9e..b4dfa9c62 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* networked_multiplayer_enet.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "os/os.h"
#include "io/marshalls.h"
#include "networked_multiplayer_enet.h"
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index f64db4561..3db318c96 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* networked_multiplayer_enet.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef NETWORKED_MULTIPLAYER_ENET_H
#define NETWORKED_MULTIPLAYER_ENET_H
diff --git a/modules/etc1/SCsub b/modules/etc1/SCsub
new file mode 100644
index 000000000..ad343ab57
--- /dev/null
+++ b/modules/etc1/SCsub
@@ -0,0 +1,18 @@
+Import('env')
+Import('env_modules')
+
+env_etc1 = env_modules.Clone()
+
+# Thirdparty source files
+# Not unbundled so far since not widespread as shared library
+thirdparty_dir = "#thirdparty/rg-etc1/"
+thirdparty_sources = [
+ "rg_etc1.cpp",
+]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+env_etc1.add_source_files(env.modules_sources, thirdparty_sources)
+env_etc1.Append(CPPPATH = [thirdparty_dir])
+
+# Godot source files
+env_etc1.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/etc1/config.py b/modules/etc1/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/etc1/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/drivers/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp
index cf2384240..cf2384240 100644
--- a/drivers/etc1/image_etc.cpp
+++ b/modules/etc1/image_etc.cpp
diff --git a/drivers/etc1/image_etc.h b/modules/etc1/image_etc.h
index edcff39bf..edcff39bf 100644
--- a/drivers/etc1/image_etc.h
+++ b/modules/etc1/image_etc.h
diff --git a/modules/etc1/register_types.cpp b/modules/etc1/register_types.cpp
new file mode 100644
index 000000000..e9eba6c86
--- /dev/null
+++ b/modules/etc1/register_types.cpp
@@ -0,0 +1,47 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "image_etc.h"
+#include "texture_loader_pkm.h"
+
+static ResourceFormatPKM *resource_loader_pkm = NULL;
+
+void register_etc1_types() {
+
+ resource_loader_pkm = memnew( ResourceFormatPKM );
+ ResourceLoader::add_resource_format_loader(resource_loader_pkm);
+
+ _register_etc1_compress_func();
+}
+
+void unregister_etc1_types() {
+
+ memdelete(resource_loader_pkm);
+}
diff --git a/modules/etc1/register_types.h b/modules/etc1/register_types.h
new file mode 100644
index 000000000..bc26699d5
--- /dev/null
+++ b/modules/etc1/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_etc1_types();
+void unregister_etc1_types();
diff --git a/drivers/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp
index 275afc1fd..275afc1fd 100644
--- a/drivers/etc1/texture_loader_pkm.cpp
+++ b/modules/etc1/texture_loader_pkm.cpp
diff --git a/drivers/etc1/texture_loader_pkm.h b/modules/etc1/texture_loader_pkm.h
index 5788716d9..5788716d9 100644
--- a/drivers/etc1/texture_loader_pkm.h
+++ b/modules/etc1/texture_loader_pkm.h
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
new file mode 100644
index 000000000..10c58558a
--- /dev/null
+++ b/modules/freetype/SCsub
@@ -0,0 +1,88 @@
+Import('env')
+
+# Not building in a separate env as core needs it
+
+# Thirdparty source files
+if (env["freetype"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/freetype/"
+ thirdparty_sources = [
+ "src/autofit/autofit.c",
+ "src/base/ftapi.c",
+ "src/base/ftbase.c",
+ "src/base/ftbbox.c",
+ "src/base/ftbdf.c",
+ "src/base/ftbitmap.c",
+ "src/base/ftcid.c",
+ "src/base/ftdebug.c",
+ "src/base/ftfntfmt.c",
+ "src/base/ftfstype.c",
+ "src/base/ftgasp.c",
+ "src/base/ftglyph.c",
+ "src/base/ftgxval.c",
+ "src/base/ftinit.c",
+ "src/base/ftlcdfil.c",
+ "src/base/ftmm.c",
+ "src/base/ftotval.c",
+ "src/base/ftpatent.c",
+ "src/base/ftpfr.c",
+ "src/base/ftpic.c",
+ "src/base/ftstroke.c",
+ "src/base/ftsynth.c",
+ "src/base/ftsystem.c",
+ "src/base/fttype1.c",
+ "src/base/ftwinfnt.c",
+ "src/bdf/bdf.c",
+ "src/cache/ftcache.c",
+ "src/cff/cff.c",
+ "src/cid/type1cid.c",
+ "src/gxvalid/gxvalid.c",
+ "src/otvalid/otvalid.c",
+ "src/pcf/pcf.c",
+ "src/pfr/pfr.c",
+ "src/psaux/psaux.c",
+ "src/pshinter/pshinter.c",
+ "src/psnames/psnames.c",
+ "src/raster/raster.c",
+ "src/sfnt/sfnt.c",
+ "src/smooth/smooth.c",
+ "src/truetype/truetype.c",
+ "src/type1/type1.c",
+ "src/type42/type42.c",
+ "src/winfonts/winfnt.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ # Include header for WinRT to fix build issues
+ if "platform" in env and env["platform"] == "winrt":
+ env.Append(CCFLAGS = ['/FI', '"modules/freetype/winrtdef.h"'])
+
+ env.Append(CPPPATH = [thirdparty_dir, thirdparty_dir + "/include"])
+
+ # also requires libpng headers
+ if (env["libpng"] != "system"): # builtin
+ env.Append(CPPPATH = ["#thirdparty/libpng"])
+
+ """ FIXME: Remove this commented code if Windows can handle the monolithic lib
+ # fix for Windows' shell miserably failing on long lines, split in two libraries
+ half1 = []
+ half2 = []
+ for x in thirdparty_sources:
+ if (x.find("src/base") != -1 and x.find("src/sfnt") != -1):
+ half1.append(x)
+ else:
+ half2.append(x)
+
+ lib = env.Library("freetype_builtin1", half2)
+ env.Append(LIBS = [lib])
+ lib = env.Library("freetype_builtin2", half1)
+ env.Append(LIBS = [lib])
+ """
+
+ lib = env.Library("freetype_builtin", thirdparty_sources)
+ env.Append(LIBS = [lib])
+
+# Godot source files
+env.add_source_files(env.modules_sources, "*.cpp")
+env.Append(CCFLAGS = ['-DFREETYPE_ENABLED'])
+
+Export('env')
diff --git a/modules/freetype/config.py b/modules/freetype/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/freetype/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/freetype/register_types.cpp b/modules/freetype/register_types.cpp
new file mode 100644
index 000000000..2b9f47f54
--- /dev/null
+++ b/modules/freetype/register_types.cpp
@@ -0,0 +1,33 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+void register_freetype_types() {}
+
+void unregister_freetype_types() {}
diff --git a/modules/freetype/register_types.h b/modules/freetype/register_types.h
new file mode 100644
index 000000000..326cd2e6e
--- /dev/null
+++ b/modules/freetype/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_freetype_types();
+void unregister_freetype_types();
diff --git a/drivers/freetype/winrtdef.h b/modules/freetype/winrtdef.h
index 69c6baf53..69c6baf53 100644
--- a/drivers/freetype/winrtdef.h
+++ b/modules/freetype/winrtdef.h
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub
index 403fe68f6..9ff13fc43 100644
--- a/modules/gdscript/SCsub
+++ b/modules/gdscript/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp
index e82eb8377..d3f7dcd35 100644
--- a/modules/gdscript/gd_functions.cpp
+++ b/modules/gdscript/gd_functions.cpp
@@ -88,6 +88,7 @@ const char *GDFunctions::get_func_name(Function p_func) {
"convert",
"typeof",
"type_exists",
+ "char",
"str",
"print",
"printt",
@@ -538,6 +539,12 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
r_ret = ObjectTypeDB::type_exists(*p_args[0]);
} break;
+ case TEXT_CHAR: {
+ VALIDATE_ARG_COUNT(1);
+ VALIDATE_ARG_NUM(0);
+ CharType result[2] = {*p_args[0], 0};
+ r_ret=String(result);
+ } break;
case TEXT_STR: {
String str;
@@ -840,10 +847,6 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
r_ret=Variant();
- } else if(((String)(*p_args[0])).begins_with("/")) {
- r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_error.argument=0;
- r_ret=RTR("Paths cannot start with '/', absolute paths must start with 'res://', 'user://', or 'local://'");
} else {
r_ret=ResourceLoader::load(*p_args[0]);
}
@@ -1138,6 +1141,7 @@ bool GDFunctions::is_deterministic(Function p_func) {
case TYPE_CONVERT:
case TYPE_OF:
case TYPE_EXISTS:
+ case TEXT_CHAR:
case TEXT_STR:
case COLOR8:
// enable for debug only, otherwise not desirable - case GEN_RANGE:
@@ -1408,6 +1412,13 @@ MethodInfo GDFunctions::get_info(Function p_func) {
return mi;
} break;
+ case TEXT_CHAR: {
+
+ MethodInfo mi("char",PropertyInfo(Variant::INT,"ascii"));
+ mi.return_val.type=Variant::STRING;
+ return mi;
+
+ } break;
case TEXT_STR: {
MethodInfo mi("str",PropertyInfo(Variant::NIL,"what"),PropertyInfo(Variant::NIL,"..."));
diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h
index c78956fe2..f444bb3b5 100644
--- a/modules/gdscript/gd_functions.h
+++ b/modules/gdscript/gd_functions.h
@@ -82,6 +82,7 @@ public:
TYPE_CONVERT,
TYPE_OF,
TYPE_EXISTS,
+ TEXT_CHAR,
TEXT_STR,
TEXT_PRINT,
TEXT_PRINT_TABBED,
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index e2d284ae0..434f91835 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -309,10 +309,6 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
_set_error("expected string constant as 'preload' argument.");
return NULL;
}
- if (path.begins_with("/")) {
- _set_error("Paths cannot start with '/', absolute paths must start with \'res://\', \'user://\', or \'local://\'");
- return NULL;
- }
if (!path.is_abs_path() && base_path!="")
path=base_path+"/"+path;
path = path.replace("///","//").simplify_path();
@@ -2122,10 +2118,6 @@ void GDParser::_parse_extends(ClassNode *p_class) {
_set_error("'extends' constant must be a string.");
return;
}
- if (((String)(constant)).begins_with("/")) {
- _set_error("Paths cannot start with '/', absolute paths must start with \'res://\', \'user://\', or \'local://\'");
- return;
- }
p_class->extends_file=constant;
tokenizer->advance();
diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub
index 211a04346..9ff13fc43 100644
--- a/modules/gridmap/SCsub
+++ b/modules/gridmap/SCsub
@@ -1,3 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
+
+Export('env')
diff --git a/modules/ik/SCsub b/modules/ik/SCsub
index 211a04346..9ff13fc43 100644
--- a/modules/ik/SCsub
+++ b/modules/ik/SCsub
@@ -1,3 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
+
+Export('env')
diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub
new file mode 100644
index 000000000..258fd2f4a
--- /dev/null
+++ b/modules/jpg/SCsub
@@ -0,0 +1,18 @@
+Import('env')
+Import('env_modules')
+
+env_jpg = env_modules.Clone()
+
+# Thirdparty source files
+# Not unbundled for now as they are not commonly available as shared library
+thirdparty_dir = "#thirdparty/jpeg-compressor/"
+thirdparty_sources = [
+ "jpgd.cpp",
+]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+env_jpg.add_source_files(env.modules_sources, thirdparty_sources)
+env_jpg.Append(CPPPATH = [thirdparty_dir])
+
+# Godot's own source files
+env_jpg.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/jpg/config.py b/modules/jpg/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/jpg/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/drivers/jpegd/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp
index 496334605..03c3b19fc 100644
--- a/drivers/jpegd/image_loader_jpegd.cpp
+++ b/modules/jpg/image_loader_jpegd.cpp
@@ -30,7 +30,8 @@
#include "print_string.h"
#include "os/os.h"
-#include "jpgd.h"
+
+#include <jpgd.h>
#include <string.h>
diff --git a/drivers/jpegd/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h
index 2c52309ab..2c52309ab 100644
--- a/drivers/jpegd/image_loader_jpegd.h
+++ b/modules/jpg/image_loader_jpegd.h
diff --git a/modules/jpg/register_types.cpp b/modules/jpg/register_types.cpp
new file mode 100644
index 000000000..a648423cd
--- /dev/null
+++ b/modules/jpg/register_types.cpp
@@ -0,0 +1,44 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "image_loader_jpegd.h"
+
+static ImageLoaderJPG *image_loader_jpg = NULL;
+
+void register_jpg_types() {
+
+ image_loader_jpg = memnew( ImageLoaderJPG );
+ ImageLoader::add_image_format_loader(image_loader_jpg);
+}
+
+void unregister_jpg_types() {
+
+ memdelete( image_loader_jpg );
+}
diff --git a/modules/jpg/register_types.h b/modules/jpg/register_types.h
new file mode 100644
index 000000000..0e06c4ff8
--- /dev/null
+++ b/modules/jpg/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_jpg_types();
+void unregister_jpg_types();
diff --git a/modules/mpc/SCsub b/modules/mpc/SCsub
new file mode 100644
index 000000000..d2662c34a
--- /dev/null
+++ b/modules/mpc/SCsub
@@ -0,0 +1,26 @@
+Import('env')
+Import('env_modules')
+
+env_mpc = env_modules.Clone()
+
+# Thirdparty source files
+if (env["libmpcdec"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/libmpcdec/"
+ thirdparty_sources = [
+ "huffman.c",
+ "mpc_bits_reader.c",
+ "mpc_decoder.c",
+ "mpc_demux.c",
+ "mpc_reader.c",
+ "requant.c",
+ "streaminfo.c",
+ "synth_filter.c",
+ ]
+
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_mpc.add_source_files(env.modules_sources, thirdparty_sources)
+ env_mpc.Append(CPPPATH = [thirdparty_dir])
+
+# Godot source files
+env_mpc.add_source_files(env.modules_sources, "*.cpp")
diff --git a/drivers/mpc/audio_stream_mpc.cpp b/modules/mpc/audio_stream_mpc.cpp
index 9713eb3c7..9713eb3c7 100644
--- a/drivers/mpc/audio_stream_mpc.cpp
+++ b/modules/mpc/audio_stream_mpc.cpp
diff --git a/drivers/mpc/audio_stream_mpc.h b/modules/mpc/audio_stream_mpc.h
index 27f55777d..c982bdc35 100644
--- a/drivers/mpc/audio_stream_mpc.h
+++ b/modules/mpc/audio_stream_mpc.h
@@ -29,13 +29,12 @@
#ifndef AUDIO_STREAM_MPC_H
#define AUDIO_STREAM_MPC_H
-#include "scene/resources/audio_stream.h"
+#include "io/resource_loader.h"
#include "os/file_access.h"
-#include "mpc/mpcdec.h"
#include "os/thread_safe.h"
-#include "io/resource_loader.h"
-//#include "../libmpcdec/decoder.h"
-//#include "../libmpcdec/internal.h"
+#include "scene/resources/audio_stream.h"
+
+#include <mpc/mpcdec.h>
class AudioStreamPlaybackMPC : public AudioStreamPlayback {
diff --git a/modules/mpc/config.py b/modules/mpc/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/mpc/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/mpc/register_types.cpp b/modules/mpc/register_types.cpp
new file mode 100644
index 000000000..f6a1f59dc
--- /dev/null
+++ b/modules/mpc/register_types.cpp
@@ -0,0 +1,45 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "audio_stream_mpc.h"
+
+static ResourceFormatLoaderAudioStreamMPC* mpc_stream_loader = NULL;
+
+void register_mpc_types() {
+
+ mpc_stream_loader=memnew( ResourceFormatLoaderAudioStreamMPC );
+ ResourceLoader::add_resource_format_loader(mpc_stream_loader);
+ ObjectTypeDB::register_type<AudioStreamMPC>();
+}
+
+void unregister_mpc_types() {
+
+ memdelete( mpc_stream_loader );
+}
diff --git a/modules/mpc/register_types.h b/modules/mpc/register_types.h
new file mode 100644
index 000000000..3d0661ed6
--- /dev/null
+++ b/modules/mpc/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_mpc_types();
+void unregister_mpc_types();
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
new file mode 100644
index 000000000..fd5ddf55c
--- /dev/null
+++ b/modules/ogg/SCsub
@@ -0,0 +1,19 @@
+Import('env')
+Import('env_modules')
+
+env_ogg = env_modules.Clone()
+
+# Thirdparty source files
+if (env["libogg"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/libogg/"
+ thirdparty_sources = [
+ "bitwise.c",
+ "framing.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_ogg.add_source_files(env.modules_sources, thirdparty_sources)
+ env_ogg.Append(CPPPATH = [thirdparty_dir])
+
+# Godot source files
+env_ogg.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/ogg/config.py b/modules/ogg/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/ogg/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/ogg/register_types.cpp b/modules/ogg/register_types.cpp
new file mode 100644
index 000000000..823ca510c
--- /dev/null
+++ b/modules/ogg/register_types.cpp
@@ -0,0 +1,35 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+// Dummy module as libogg is needed by other modules (vorbis, theora, opus, ...)
+
+void register_ogg_types() {}
+
+void unregister_ogg_types() {}
diff --git a/modules/ogg/register_types.h b/modules/ogg/register_types.h
new file mode 100644
index 000000000..b5268a1df
--- /dev/null
+++ b/modules/ogg/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_ogg_types();
+void unregister_ogg_types();
diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub
new file mode 100644
index 000000000..79facba99
--- /dev/null
+++ b/modules/openssl/SCsub
@@ -0,0 +1,685 @@
+Import('env')
+Import('env_modules')
+
+env_openssl = env_modules.Clone()
+
+# Thirdparty source files
+if (env["openssl"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/openssl/"
+
+ thirdparty_sources = [
+ "ssl/t1_lib.c",
+ "ssl/t1_ext.c",
+ "ssl/s3_srvr.c",
+ "ssl/t1_enc.c",
+ "ssl/t1_meth.c",
+ "ssl/s23_clnt.c",
+ "ssl/ssl_asn1.c",
+ "ssl/tls_srp.c",
+ "ssl/kssl.c",
+ "ssl/d1_both.c",
+ "ssl/t1_clnt.c",
+ "ssl/bio_ssl.c",
+ "ssl/d1_srtp.c",
+ "ssl/t1_reneg.c",
+ "ssl/ssl_cert.c",
+ "ssl/s3_lib.c",
+ "ssl/d1_srvr.c",
+ "ssl/s23_meth.c",
+ "ssl/ssl_stat.c",
+ "ssl/ssl_err.c",
+ "ssl/ssl_algs.c",
+ "ssl/s3_cbc.c",
+ "ssl/d1_clnt.c",
+ "ssl/s3_pkt.c",
+ "ssl/d1_meth.c",
+ "ssl/s3_both.c",
+ "ssl/s2_enc.c",
+ "ssl/s3_meth.c",
+ "ssl/s3_enc.c",
+ "ssl/s23_pkt.c",
+ "ssl/s2_pkt.c",
+ "ssl/d1_pkt.c",
+ "ssl/ssl_rsa.c",
+ "ssl/s23_srvr.c",
+ "ssl/s2_meth.c",
+ "ssl/s3_clnt.c",
+ "ssl/s23_lib.c",
+ "ssl/t1_srvr.c",
+ "ssl/ssl_lib.c",
+ "ssl/ssl_txt.c",
+ "ssl/s2_srvr.c",
+ "ssl/ssl_sess.c",
+ "ssl/s2_clnt.c",
+ "ssl/d1_lib.c",
+ "ssl/s2_lib.c",
+ "ssl/ssl_err2.c",
+ "ssl/ssl_ciph.c",
+ "crypto/dsa/dsa_lib.c",
+ "crypto/dsa/dsa_pmeth.c",
+ "crypto/dsa/dsa_ossl.c",
+ "crypto/dsa/dsa_gen.c",
+ "crypto/dsa/dsa_asn1.c",
+ "crypto/dsa/dsa_prn.c",
+ "crypto/dsa/dsa_sign.c",
+ "crypto/dsa/dsa_key.c",
+ "crypto/dsa/dsa_vrf.c",
+ "crypto/dsa/dsa_err.c",
+ "crypto/dsa/dsa_ameth.c",
+ "crypto/dsa/dsa_depr.c",
+ "crypto/x509/x509_lu.c",
+ "crypto/x509/x509cset.c",
+ "crypto/x509/x509_set.c",
+ "crypto/x509/x509_d2.c",
+ "crypto/x509/x509_txt.c",
+ "crypto/x509/x509rset.c",
+ "crypto/x509/by_dir.c",
+ "crypto/x509/x509_vpm.c",
+ "crypto/x509/x509_vfy.c",
+ "crypto/x509/x509_trs.c",
+ "crypto/x509/by_file.c",
+ "crypto/x509/x509_obj.c",
+ "crypto/x509/x509spki.c",
+ "crypto/x509/x509_v3.c",
+ "crypto/x509/x509_req.c",
+ "crypto/x509/x509_att.c",
+ "crypto/x509/x_all.c",
+ "crypto/x509/x509_ext.c",
+ "crypto/x509/x509type.c",
+ "crypto/x509/x509_def.c",
+ "crypto/x509/x509_err.c",
+ "crypto/x509/x509name.c",
+ "crypto/x509/x509_r2x.c",
+ "crypto/x509/x509_cmp.c",
+ "crypto/asn1/x_pkey.c",
+ "crypto/asn1/a_gentm.c",
+ "crypto/asn1/x_sig.c",
+ "crypto/asn1/t_req.c",
+ "crypto/asn1/t_pkey.c",
+ "crypto/asn1/p8_pkey.c",
+ "crypto/asn1/a_i2d_fp.c",
+ "crypto/asn1/x_val.c",
+ "crypto/asn1/f_string.c",
+ "crypto/asn1/p5_pbe.c",
+ "crypto/asn1/bio_ndef.c",
+ "crypto/asn1/a_bool.c",
+ "crypto/asn1/asn1_gen.c",
+ "crypto/asn1/x_algor.c",
+ "crypto/asn1/bio_asn1.c",
+ "crypto/asn1/asn_mime.c",
+ "crypto/asn1/t_x509.c",
+ "crypto/asn1/a_strex.c",
+ "crypto/asn1/x_nx509.c",
+ "crypto/asn1/asn1_err.c",
+ "crypto/asn1/x_crl.c",
+ "crypto/asn1/a_print.c",
+ "crypto/asn1/a_type.c",
+ "crypto/asn1/tasn_new.c",
+ "crypto/asn1/n_pkey.c",
+ "crypto/asn1/x_bignum.c",
+ "crypto/asn1/asn_pack.c",
+ "crypto/asn1/evp_asn1.c",
+ "crypto/asn1/t_bitst.c",
+ "crypto/asn1/x_req.c",
+ "crypto/asn1/a_time.c",
+ "crypto/asn1/x_name.c",
+ "crypto/asn1/x_pubkey.c",
+ "crypto/asn1/tasn_typ.c",
+ "crypto/asn1/asn_moid.c",
+ "crypto/asn1/a_utctm.c",
+ "crypto/asn1/asn1_lib.c",
+ "crypto/asn1/x_x509a.c",
+ "crypto/asn1/a_set.c",
+ "crypto/asn1/t_crl.c",
+ "crypto/asn1/p5_pbev2.c",
+ "crypto/asn1/tasn_enc.c",
+ "crypto/asn1/a_mbstr.c",
+ "crypto/asn1/tasn_dec.c",
+ "crypto/asn1/x_x509.c",
+ "crypto/asn1/a_octet.c",
+ "crypto/asn1/x_long.c",
+ "crypto/asn1/a_bytes.c",
+ "crypto/asn1/t_x509a.c",
+ "crypto/asn1/a_enum.c",
+ "crypto/asn1/a_int.c",
+ "crypto/asn1/tasn_prn.c",
+ "crypto/asn1/i2d_pr.c",
+ "crypto/asn1/a_utf8.c",
+ "crypto/asn1/t_spki.c",
+ "crypto/asn1/a_digest.c",
+ "crypto/asn1/a_dup.c",
+ "crypto/asn1/i2d_pu.c",
+ "crypto/asn1/a_verify.c",
+ "crypto/asn1/f_enum.c",
+ "crypto/asn1/a_sign.c",
+ "crypto/asn1/d2i_pr.c",
+ "crypto/asn1/asn1_par.c",
+ "crypto/asn1/x_spki.c",
+ "crypto/asn1/a_d2i_fp.c",
+ "crypto/asn1/f_int.c",
+ "crypto/asn1/x_exten.c",
+ "crypto/asn1/tasn_utl.c",
+ "crypto/asn1/nsseq.c",
+ "crypto/asn1/a_bitstr.c",
+ "crypto/asn1/x_info.c",
+ "crypto/asn1/a_strnid.c",
+ "crypto/asn1/a_object.c",
+ "crypto/asn1/tasn_fre.c",
+ "crypto/asn1/d2i_pu.c",
+ "crypto/asn1/ameth_lib.c",
+ "crypto/asn1/x_attrib.c",
+ "crypto/evp/m_sha.c",
+ "crypto/evp/e_camellia.c",
+ "crypto/evp/e_aes.c",
+ "crypto/evp/bio_b64.c",
+ "crypto/evp/m_sigver.c",
+ "crypto/evp/m_wp.c",
+ "crypto/evp/m_sha1.c",
+ "crypto/evp/p_seal.c",
+ "crypto/evp/c_alld.c",
+ "crypto/evp/p5_crpt.c",
+ "crypto/evp/e_rc4.c",
+ "crypto/evp/m_ecdsa.c",
+ "crypto/evp/bio_enc.c",
+ "crypto/evp/e_des3.c",
+ "crypto/evp/m_null.c",
+ "crypto/evp/bio_ok.c",
+ "crypto/evp/pmeth_gn.c",
+ "crypto/evp/e_rc5.c",
+ "crypto/evp/e_rc2.c",
+ "crypto/evp/p_dec.c",
+ "crypto/evp/p_verify.c",
+ "crypto/evp/e_rc4_hmac_md5.c",
+ "crypto/evp/pmeth_lib.c",
+ "crypto/evp/m_ripemd.c",
+ "crypto/evp/m_md5.c",
+ "crypto/evp/e_bf.c",
+ "crypto/evp/p_enc.c",
+ "crypto/evp/m_dss.c",
+ "crypto/evp/bio_md.c",
+ "crypto/evp/evp_pbe.c",
+ "crypto/evp/e_seed.c",
+ "crypto/evp/e_cast.c",
+ "crypto/evp/p_open.c",
+ "crypto/evp/p5_crpt2.c",
+ "crypto/evp/m_dss1.c",
+ "crypto/evp/names.c",
+ "crypto/evp/evp_acnf.c",
+ "crypto/evp/e_des.c",
+ "crypto/evp/evp_cnf.c",
+ "crypto/evp/evp_lib.c",
+ "crypto/evp/digest.c",
+ "crypto/evp/evp_err.c",
+ "crypto/evp/evp_enc.c",
+ "crypto/evp/e_old.c",
+ "crypto/evp/c_all.c",
+ "crypto/evp/m_md2.c",
+ "crypto/evp/e_xcbc_d.c",
+ "crypto/evp/pmeth_fn.c",
+ "crypto/evp/p_lib.c",
+ "crypto/evp/evp_key.c",
+ "crypto/evp/encode.c",
+ "crypto/evp/e_aes_cbc_hmac_sha1.c",
+ "crypto/evp/e_aes_cbc_hmac_sha256.c",
+ "crypto/evp/m_mdc2.c",
+ "crypto/evp/e_null.c",
+ "crypto/evp/p_sign.c",
+ "crypto/evp/e_idea.c",
+ "crypto/evp/c_allc.c",
+ "crypto/evp/evp_pkey.c",
+ "crypto/evp/m_md4.c",
+ "crypto/ex_data.c",
+ "crypto/pkcs12/p12_p8e.c",
+ "crypto/pkcs12/p12_crt.c",
+ "crypto/pkcs12/p12_utl.c",
+ "crypto/pkcs12/p12_attr.c",
+ "crypto/pkcs12/p12_npas.c",
+ "crypto/pkcs12/p12_decr.c",
+ "crypto/pkcs12/p12_init.c",
+ "crypto/pkcs12/p12_kiss.c",
+ "crypto/pkcs12/p12_add.c",
+ "crypto/pkcs12/p12_p8d.c",
+ "crypto/pkcs12/p12_mutl.c",
+ "crypto/pkcs12/p12_crpt.c",
+ "crypto/pkcs12/pk12err.c",
+ "crypto/pkcs12/p12_asn.c",
+ "crypto/pkcs12/p12_key.c",
+ "crypto/ecdh/ech_key.c",
+ "crypto/ecdh/ech_ossl.c",
+ "crypto/ecdh/ech_lib.c",
+ "crypto/ecdh/ech_err.c",
+ "crypto/ecdh/ech_kdf.c",
+ "crypto/o_str.c",
+ "crypto/conf/conf_api.c",
+ "crypto/conf/conf_err.c",
+ "crypto/conf/conf_def.c",
+ "crypto/conf/conf_lib.c",
+ "crypto/conf/conf_mall.c",
+ "crypto/conf/conf_sap.c",
+ "crypto/conf/conf_mod.c",
+ "crypto/ebcdic.c",
+ "crypto/ecdsa/ecs_lib.c",
+ "crypto/ecdsa/ecs_asn1.c",
+ "crypto/ecdsa/ecs_ossl.c",
+ "crypto/ecdsa/ecs_vrf.c",
+ "crypto/ecdsa/ecs_sign.c",
+ "crypto/ecdsa/ecs_err.c",
+ "crypto/dso/dso_win32.c",
+ "crypto/dso/dso_lib.c",
+ "crypto/dso/dso_dlfcn.c",
+ "crypto/dso/dso_dl.c",
+ "crypto/dso/dso_beos.c",
+ "crypto/dso/dso_null.c",
+ "crypto/dso/dso_vms.c",
+ "crypto/dso/dso_err.c",
+ "crypto/dso/dso_openssl.c",
+ "crypto/cryptlib.c",
+ "crypto/md5/md5_one.c",
+ "crypto/md5/md5_dgst.c",
+ "crypto/pkcs7/pkcs7err.c",
+ "crypto/pkcs7/pk7_smime.c",
+ "crypto/pkcs7/bio_pk7.c",
+ "crypto/pkcs7/pk7_mime.c",
+ "crypto/pkcs7/pk7_lib.c",
+ "crypto/pkcs7/pk7_asn1.c",
+ "crypto/pkcs7/pk7_doit.c",
+ "crypto/pkcs7/pk7_attr.c",
+ "crypto/md4/md4_one.c",
+ "crypto/md4/md4_dgst.c",
+ "crypto/o_dir.c",
+ "crypto/buffer/buf_err.c",
+ "crypto/buffer/buf_str.c",
+ "crypto/buffer/buffer.c",
+ "crypto/cms/cms_lib.c",
+ "crypto/cms/cms_io.c",
+ "crypto/cms/cms_err.c",
+ "crypto/cms/cms_dd.c",
+ "crypto/cms/cms_smime.c",
+ "crypto/cms/cms_att.c",
+ "crypto/cms/cms_pwri.c",
+ "crypto/cms/cms_cd.c",
+ "crypto/cms/cms_sd.c",
+ "crypto/cms/cms_asn1.c",
+ "crypto/cms/cms_env.c",
+ "crypto/cms/cms_enc.c",
+ "crypto/cms/cms_ess.c",
+ "crypto/cms/cms_kari.c",
+ "crypto/mem_dbg.c",
+ "crypto/uid.c",
+ "crypto/stack/stack.c",
+ "crypto/ec/ec_ameth.c",
+ "crypto/ec/ec_err.c",
+ "crypto/ec/ec_lib.c",
+ "crypto/ec/ec_curve.c",
+ "crypto/ec/ec_oct.c",
+ "crypto/ec/ec_asn1.c",
+ "crypto/ec/ecp_oct.c",
+ "crypto/ec/ec_print.c",
+ "crypto/ec/ec2_smpl.c",
+ "crypto/ec/ecp_nistp224.c",
+ "crypto/ec/ec2_oct.c",
+ "crypto/ec/eck_prn.c",
+ "crypto/ec/ec_key.c",
+ "crypto/ec/ecp_nist.c",
+ "crypto/ec/ec_check.c",
+ "crypto/ec/ecp_smpl.c",
+ "crypto/ec/ec2_mult.c",
+ "crypto/ec/ecp_mont.c",
+ "crypto/ec/ecp_nistp521.c",
+ "crypto/ec/ec_mult.c",
+ "crypto/ec/ecp_nistputil.c",
+ "crypto/ec/ec_pmeth.c",
+ "crypto/ec/ec_cvt.c",
+ "crypto/ec/ecp_nistp256.c",
+ "crypto/krb5/krb5_asn.c",
+ "crypto/hmac/hmac.c",
+ "crypto/hmac/hm_ameth.c",
+ "crypto/hmac/hm_pmeth.c",
+ "crypto/comp/c_rle.c",
+ "crypto/comp/c_zlib.c",
+ "crypto/comp/comp_lib.c",
+ "crypto/comp/comp_err.c",
+ "crypto/des/fcrypt.c",
+ "crypto/des/str2key.c",
+ "crypto/des/cbc_cksm.c",
+ "crypto/des/des_enc.c",
+ "crypto/des/ofb_enc.c",
+ "crypto/des/read2pwd.c",
+ "crypto/des/ecb3_enc.c",
+ "crypto/des/rand_key.c",
+ "crypto/des/cfb64ede.c",
+ "crypto/des/rpc_enc.c",
+ "crypto/des/ofb64ede.c",
+ "crypto/des/qud_cksm.c",
+ "crypto/des/enc_writ.c",
+ "crypto/des/set_key.c",
+ "crypto/des/xcbc_enc.c",
+ "crypto/des/fcrypt_b.c",
+ "crypto/des/ede_cbcm_enc.c",
+ "crypto/des/des_old2.c",
+ "crypto/des/cfb_enc.c",
+ "crypto/des/ecb_enc.c",
+ "crypto/des/enc_read.c",
+ "crypto/des/des_old.c",
+ "crypto/des/ofb64enc.c",
+ "crypto/des/pcbc_enc.c",
+ "crypto/des/cbc_enc.c",
+ "crypto/des/cfb64enc.c",
+ "crypto/lhash/lh_stats.c",
+ "crypto/lhash/lhash.c",
+ "crypto/x509v3/v3_genn.c",
+ "crypto/x509v3/pcy_cache.c",
+ "crypto/x509v3/v3_sxnet.c",
+ "crypto/x509v3/v3_scts.c",
+ "crypto/x509v3/v3err.c",
+ "crypto/x509v3/v3_conf.c",
+ "crypto/x509v3/v3_utl.c",
+ "crypto/x509v3/v3_akeya.c",
+ "crypto/x509v3/v3_lib.c",
+ "crypto/x509v3/pcy_lib.c",
+ "crypto/x509v3/v3_cpols.c",
+ "crypto/x509v3/v3_ia5.c",
+ "crypto/x509v3/v3_bitst.c",
+ "crypto/x509v3/v3_skey.c",
+ "crypto/x509v3/v3_info.c",
+ "crypto/x509v3/v3_asid.c",
+ "crypto/x509v3/pcy_tree.c",
+ "crypto/x509v3/v3_pcons.c",
+ "crypto/x509v3/v3_bcons.c",
+ "crypto/x509v3/v3_pku.c",
+ "crypto/x509v3/v3_ocsp.c",
+ "crypto/x509v3/pcy_map.c",
+ "crypto/x509v3/v3_ncons.c",
+ "crypto/x509v3/v3_purp.c",
+ "crypto/x509v3/v3_enum.c",
+ "crypto/x509v3/v3_pmaps.c",
+ "crypto/x509v3/pcy_node.c",
+ "crypto/x509v3/v3_pcia.c",
+ "crypto/x509v3/v3_crld.c",
+ "crypto/x509v3/v3_pci.c",
+ "crypto/x509v3/v3_akey.c",
+ "crypto/x509v3/v3_addr.c",
+ "crypto/x509v3/v3_int.c",
+ "crypto/x509v3/v3_alt.c",
+ "crypto/x509v3/v3_extku.c",
+ "crypto/x509v3/v3_prn.c",
+ "crypto/x509v3/pcy_data.c",
+ "crypto/aes/aes_ofb.c",
+ "crypto/aes/aes_ctr.c",
+ "crypto/aes/aes_ecb.c",
+ "crypto/aes/aes_cfb.c",
+ "crypto/aes/aes_wrap.c",
+ "crypto/aes/aes_ige.c",
+ "crypto/aes/aes_misc.c",
+ "crypto/pqueue/pqueue.c",
+ "crypto/sha/sha_one.c",
+ "crypto/sha/sha_dgst.c",
+ "crypto/sha/sha512.c",
+ "crypto/sha/sha1_one.c",
+ "crypto/sha/sha1dgst.c",
+ "crypto/sha/sha256.c",
+ "crypto/whrlpool/wp_dgst.c",
+ "crypto/objects/obj_xref.c",
+ "crypto/objects/o_names.c",
+ "crypto/objects/obj_err.c",
+ "crypto/objects/obj_dat.c",
+ "crypto/objects/obj_lib.c",
+ "crypto/mem.c",
+ "crypto/fips_ers.c",
+ "crypto/o_fips.c",
+ "crypto/engine/eng_rdrand.c",
+ "crypto/engine/eng_err.c",
+ "crypto/engine/tb_ecdsa.c",
+ "crypto/engine/tb_rsa.c",
+ "crypto/engine/tb_cipher.c",
+ "crypto/engine/tb_dsa.c",
+ "crypto/engine/eng_lib.c",
+ "crypto/engine/tb_asnmth.c",
+ "crypto/engine/tb_ecdh.c",
+ "crypto/engine/tb_dh.c",
+ "crypto/engine/tb_store.c",
+ "crypto/engine/eng_init.c",
+ "crypto/engine/eng_cnf.c",
+ "crypto/engine/eng_all.c",
+ "crypto/engine/tb_digest.c",
+ "crypto/engine/tb_pkmeth.c",
+ "crypto/engine/eng_table.c",
+ "crypto/engine/eng_ctrl.c",
+ "crypto/engine/eng_list.c",
+ "crypto/engine/eng_cryptodev.c",
+ "crypto/engine/eng_pkey.c",
+ "crypto/engine/tb_rand.c",
+ "crypto/engine/eng_openssl.c",
+ "crypto/engine/eng_fat.c",
+ "crypto/engine/eng_dyn.c",
+ "crypto/ts/ts_rsp_verify.c",
+ "crypto/ts/ts_req_print.c",
+ "crypto/ts/ts_verify_ctx.c",
+ "crypto/ts/ts_req_utils.c",
+ "crypto/ts/ts_err.c",
+ "crypto/ts/ts_rsp_print.c",
+ "crypto/ts/ts_rsp_utils.c",
+ "crypto/ts/ts_lib.c",
+ "crypto/ts/ts_conf.c",
+ "crypto/ts/ts_asn1.c",
+ "crypto/ts/ts_rsp_sign.c",
+ "crypto/ocsp/ocsp_ext.c",
+ "crypto/ocsp/ocsp_cl.c",
+ "crypto/ocsp/ocsp_ht.c",
+ "crypto/ocsp/ocsp_lib.c",
+ "crypto/ocsp/ocsp_srv.c",
+ "crypto/ocsp/ocsp_vfy.c",
+ "crypto/ocsp/ocsp_err.c",
+ "crypto/ocsp/ocsp_prn.c",
+ "crypto/ocsp/ocsp_asn.c",
+ "crypto/bf/bf_cfb64.c",
+ "crypto/bf/bf_ecb.c",
+ "crypto/bf/bf_enc.c",
+ "crypto/bf/bf_skey.c",
+ "crypto/bf/bf_ofb64.c",
+ "crypto/idea/i_skey.c",
+ "crypto/idea/i_ofb64.c",
+ "crypto/idea/i_cbc.c",
+ "crypto/idea/i_ecb.c",
+ "crypto/idea/i_cfb64.c",
+ "crypto/cmac/cm_ameth.c",
+ "crypto/cmac/cmac.c",
+ "crypto/cmac/cm_pmeth.c",
+ "crypto/dh/dh_lib.c",
+ "crypto/dh/dh_key.c",
+ "crypto/dh/dh_asn1.c",
+ "crypto/dh/dh_depr.c",
+ "crypto/dh/dh_pmeth.c",
+ "crypto/dh/dh_prn.c",
+ "crypto/dh/dh_gen.c",
+ "crypto/dh/dh_ameth.c",
+ "crypto/dh/dh_check.c",
+ "crypto/dh/dh_err.c",
+ "crypto/dh/dh_kdf.c",
+ "crypto/dh/dh_rfc5114.c",
+ "crypto/modes/ccm128.c",
+ "crypto/modes/ofb128.c",
+ "crypto/modes/cts128.c",
+ "crypto/modes/ctr128.c",
+ "crypto/modes/gcm128.c",
+ "crypto/modes/cbc128.c",
+ "crypto/modes/cfb128.c",
+ "crypto/modes/xts128.c",
+ "crypto/modes/wrap128.c",
+ "crypto/camellia/cmll_cfb.c",
+ "crypto/camellia/cmll_ecb.c",
+ "crypto/camellia/cmll_utl.c",
+ "crypto/camellia/cmll_misc.c",
+ "crypto/camellia/cmll_ofb.c",
+ "crypto/camellia/cmll_ctr.c",
+ "crypto/seed/seed_ecb.c",
+ "crypto/seed/seed_cbc.c",
+ "crypto/seed/seed.c",
+ "crypto/seed/seed_ofb.c",
+ "crypto/seed/seed_cfb.c",
+ "crypto/txt_db/txt_db.c",
+ "crypto/cpt_err.c",
+ "crypto/pem/pem_pk8.c",
+ "crypto/pem/pem_lib.c",
+ "crypto/pem/pem_sign.c",
+ "crypto/pem/pem_all.c",
+ "crypto/pem/pem_info.c",
+ "crypto/pem/pem_pkey.c",
+ "crypto/pem/pem_seal.c",
+ "crypto/pem/pem_err.c",
+ "crypto/pem/pem_xaux.c",
+ "crypto/pem/pvkfmt.c",
+ "crypto/pem/pem_x509.c",
+ "crypto/pem/pem_oth.c",
+ "crypto/rand/rand_lib.c",
+ "crypto/rand/randfile.c",
+ "crypto/rand/rand_os2.c",
+ "crypto/rand/rand_unix.c",
+ "crypto/rand/rand_nw.c",
+ "crypto/rand/md_rand.c",
+ "crypto/rand/rand_err.c",
+ "crypto/rand/rand_win.c",
+ "crypto/rand/rand_egd.c",
+ "crypto/cversion.c",
+ "crypto/cast/c_ecb.c",
+ "crypto/cast/c_skey.c",
+ "crypto/cast/c_ofb64.c",
+ "crypto/cast/c_enc.c",
+ "crypto/cast/c_cfb64.c",
+ "crypto/o_time.c",
+ "crypto/mdc2/mdc2dgst.c",
+ "crypto/mdc2/mdc2_one.c",
+ "crypto/rc4/rc4_utl.c",
+ "crypto/ui/ui_compat.c",
+ "crypto/ui/ui_util.c",
+ "crypto/ui/ui_lib.c",
+ "crypto/ui/ui_err.c",
+ "crypto/ui/ui_openssl.c",
+ "crypto/bio/bf_buff.c",
+ "crypto/bio/bss_null.c",
+ "crypto/bio/bss_acpt.c",
+ "crypto/bio/bss_conn.c",
+ "crypto/bio/bss_fd.c",
+ "crypto/bio/bf_null.c",
+ "crypto/bio/bio_err.c",
+ "crypto/bio/bss_sock.c",
+ "crypto/bio/bss_mem.c",
+ "crypto/bio/b_dump.c",
+ "crypto/bio/b_print.c",
+ "crypto/bio/b_sock.c",
+ "crypto/bio/bss_dgram.c",
+ "crypto/bio/bf_nbio.c",
+ "crypto/bio/bio_lib.c",
+ "crypto/bio/bss_file.c",
+ "crypto/bio/bss_bio.c",
+ "crypto/bio/bss_log.c",
+ "crypto/bio/bio_cb.c",
+ "crypto/o_init.c",
+ "crypto/rc2/rc2_skey.c",
+ "crypto/rc2/rc2_cbc.c",
+ "crypto/rc2/rc2cfb64.c",
+ "crypto/rc2/rc2_ecb.c",
+ "crypto/rc2/rc2ofb64.c",
+ "crypto/bn/bn_x931p.c",
+ "crypto/bn/bn_blind.c",
+ "crypto/bn/bn_gf2m.c",
+ "crypto/bn/bn_const.c",
+ "crypto/bn/bn_sqr.c",
+ "crypto/bn/bn_nist.c",
+ "crypto/bn/bn_rand.c",
+ "crypto/bn/bn_err.c",
+ "crypto/bn/bn_div.c",
+ "crypto/bn/bn_kron.c",
+ "crypto/bn/bn_ctx.c",
+ "crypto/bn/bn_shift.c",
+ "crypto/bn/bn_mod.c",
+ "crypto/bn/bn_exp2.c",
+ "crypto/bn/bn_word.c",
+ "crypto/bn/bn_add.c",
+ "crypto/bn/bn_exp.c",
+ "crypto/bn/bn_mont.c",
+ "crypto/bn/bn_print.c",
+ "crypto/bn/bn_mul.c",
+ "crypto/bn/bn_prime.c",
+ "crypto/bn/bn_depr.c",
+ "crypto/bn/bn_gcd.c",
+ "crypto/bn/bn_mpi.c",
+ "crypto/bn/bn_sqrt.c",
+ "crypto/bn/bn_recp.c",
+ "crypto/bn/bn_lib.c",
+ "crypto/ripemd/rmd_dgst.c",
+ "crypto/ripemd/rmd_one.c",
+ "crypto/rsa/rsa_x931.c",
+ "crypto/rsa/rsa_depr.c",
+ "crypto/rsa/rsa_saos.c",
+ "crypto/rsa/rsa_crpt.c",
+ "crypto/rsa/rsa_pss.c",
+ "crypto/rsa/rsa_oaep.c",
+ "crypto/rsa/rsa_null.c",
+ "crypto/rsa/rsa_gen.c",
+ "crypto/rsa/rsa_prn.c",
+ "crypto/rsa/rsa_pmeth.c",
+ "crypto/rsa/rsa_asn1.c",
+ "crypto/rsa/rsa_ssl.c",
+ "crypto/rsa/rsa_ameth.c",
+ "crypto/rsa/rsa_pk1.c",
+ "crypto/rsa/rsa_err.c",
+ "crypto/rsa/rsa_lib.c",
+ "crypto/rsa/rsa_none.c",
+ "crypto/rsa/rsa_chk.c",
+ "crypto/rsa/rsa_eay.c",
+ "crypto/rsa/rsa_sign.c",
+ "crypto/srp/srp_lib.c",
+ "crypto/srp/srp_vfy.c",
+ "crypto/err/err.c",
+ "crypto/err/err_prn.c",
+ "crypto/err/err_all.c",
+ "crypto/mem_clr.c",
+ "crypto/rc4/rc4_skey.c",
+ "crypto/rc4/rc4_enc.c",
+ "crypto/camellia/camellia.c",
+ "crypto/camellia/cmll_cbc.c",
+ #"crypto/aes/aes_x86core.c",
+ "crypto/aes/aes_core.c",
+ "crypto/aes/aes_cbc.c",
+ "crypto/whrlpool/wp_block.c",
+ "crypto/bn/bn_asm.c",
+ ]
+
+ if "platform" in env and env["platform"] == "winrt":
+ thirdparty_sources += ['winrt.cpp']
+
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_openssl.add_source_files(env.modules_sources, thirdparty_sources)
+
+ # FIXME: Clone the environment to make a env_openssl and not pollute the modules env
+ thirdparty_include_paths = [
+ "",
+ "crypto",
+ "crypto/asn1",
+ "crypto/evp",
+ "crypto/modes",
+ "openssl",
+ ]
+ env_openssl.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+
+ env_openssl.Append(CPPFLAGS = ["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"])
+
+ # Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
+ import os
+ import methods
+ if not (os.name=="nt" and methods.msvc_is_detected()): # not Windows and not MSVC
+ env_openssl.Append(CFLAGS = ["-Wno-error=implicit-function-declaration"])
+
+
+# Module sources
+env_openssl.add_source_files(env.modules_sources, "*.cpp")
+env_openssl.add_source_files(env.modules_sources, "*.c")
+
+# platform/winrt need to know openssl is available, pass to main env
+if "platform" in env and env["platform"] == "winrt":
+ env.Append(CPPPATH = [thirdparty_dir])
+ env.Append(CPPFLAGS = ['-DOPENSSL_ENABLED']);
+
+Export('env')
diff --git a/modules/openssl/config.py b/modules/openssl/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/openssl/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/drivers/openssl/curl_hostcheck.c b/modules/openssl/curl_hostcheck.c
index f5d44bfaf..feef23261 100644
--- a/drivers/openssl/curl_hostcheck.c
+++ b/modules/openssl/curl_hostcheck.c
@@ -46,8 +46,6 @@ be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.
*/
-#ifdef OPENSSL_ENABLED
-
#include "curl_hostcheck.h"
#include <string.h>
@@ -217,5 +215,3 @@ int Tool_Curl_cert_hostcheck(const char *match_pattern, const char *hostname)
return 1;
return 0;
}
-
-#endif
diff --git a/drivers/openssl/curl_hostcheck.h b/modules/openssl/curl_hostcheck.h
index 7611c6e44..1b7fbe81e 100644
--- a/drivers/openssl/curl_hostcheck.h
+++ b/modules/openssl/curl_hostcheck.h
@@ -1,8 +1,6 @@
#ifndef HEADER_TOOL_CURL_HOSTCHECK_H
#define HEADER_TOOL_CURL_HOSTCHECK_H
-#ifdef OPENSSL_ENABLED
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -37,7 +35,5 @@ int Tool_Curl_cert_hostcheck(const char *match_pattern, const char *hostname);
}
#endif
-#endif
-
#endif /* HEADER_CURL_HOSTCHECK_H */
diff --git a/drivers/openssl/register_openssl.cpp b/modules/openssl/register_types.cpp
index 0d2f9fd53..4aba9f530 100644
--- a/drivers/openssl/register_openssl.cpp
+++ b/modules/openssl/register_types.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* register_openssl.cpp */
+/* register_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,22 +26,17 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "register_openssl.h"
+#include "register_types.h"
#include "stream_peer_openssl.h"
-#ifdef OPENSSL_ENABLED
-void register_openssl() {
+void register_openssl_types() {
ObjectTypeDB::register_type<StreamPeerOpenSSL>();
StreamPeerOpenSSL::initialize_ssl();
-
}
-void unregister_openssl() {
+void unregister_openssl_types() {
StreamPeerOpenSSL::finalize_ssl();
-
}
-#endif
-
diff --git a/modules/openssl/register_types.h b/modules/openssl/register_types.h
new file mode 100644
index 000000000..2db140cc8
--- /dev/null
+++ b/modules/openssl/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_openssl_types();
+void unregister_openssl_types();
diff --git a/drivers/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp
index aa3d8a8f7..b9bec4ca0 100644
--- a/drivers/openssl/stream_peer_openssl.cpp
+++ b/modules/openssl/stream_peer_openssl.cpp
@@ -26,7 +26,6 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef OPENSSL_ENABLED
#include "stream_peer_openssl.h"
//hostname matching code from curl
@@ -645,5 +644,3 @@ void StreamPeerOpenSSL::finalize_ssl(){
}
certs.clear();
}
-
-#endif
diff --git a/drivers/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h
index f1f25f4fc..853ede203 100644
--- a/drivers/openssl/stream_peer_openssl.h
+++ b/modules/openssl/stream_peer_openssl.h
@@ -29,9 +29,6 @@
#ifndef STREAM_PEER_OPEN_SSL_H
#define STREAM_PEER_OPEN_SSL_H
-#ifdef OPENSSL_ENABLED
-
-
#include <stdio.h> // If you don't know what this is for stop reading now.
#include "io/stream_peer_ssl.h"
#include "globals.h"
@@ -109,5 +106,4 @@ public:
~StreamPeerOpenSSL();
};
-#endif
#endif // STREAM_PEER_SSL_H
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
new file mode 100644
index 000000000..5c587a078
--- /dev/null
+++ b/modules/opus/SCsub
@@ -0,0 +1,213 @@
+Import('env')
+Import('env_modules')
+
+env_opus = env_modules.Clone()
+
+# Thirdparty source files
+if (env["opus"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/opus/"
+
+ thirdparty_sources = [
+ "silk/tables_other.c",
+ "silk/sum_sqr_shift.c",
+ "silk/PLC.c",
+ "silk/dec_API.c",
+ "silk/decode_pulses.c",
+ "silk/inner_prod_aligned.c",
+ "silk/init_encoder.c",
+ "silk/interpolate.c",
+ "silk/stereo_encode_pred.c",
+ "silk/decode_frame.c",
+ "silk/NLSF_del_dec_quant.c",
+ "silk/VAD.c",
+ "silk/resampler_private_AR2.c",
+ "silk/NLSF_unpack.c",
+ "silk/resampler_down2.c",
+ "silk/sort.c",
+ "silk/resampler_private_IIR_FIR.c",
+ "silk/resampler_down2_3.c",
+ "silk/resampler_private_up2_HQ.c",
+ "silk/tables_gain.c",
+ "silk/stereo_find_predictor.c",
+ "silk/stereo_quant_pred.c",
+ "silk/NLSF_stabilize.c",
+ "silk/ana_filt_bank_1.c",
+ "silk/check_control_input.c",
+ "silk/bwexpander.c",
+ "silk/A2NLSF.c",
+ "silk/LPC_inv_pred_gain.c",
+ "silk/log2lin.c",
+ "silk/process_NLSFs.c",
+ "silk/sigm_Q15.c",
+ "silk/VQ_WMat_EC.c",
+ "silk/quant_LTP_gains.c",
+ "silk/resampler_private_down_FIR.c",
+ "silk/NLSF_decode.c",
+ "silk/control_codec.c",
+ "silk/NLSF_VQ_weights_laroia.c",
+ "silk/decode_pitch.c",
+ "silk/stereo_decode_pred.c",
+ "silk/tables_pulses_per_block.c",
+ "silk/init_decoder.c",
+ "silk/table_LSF_cos.c",
+ "silk/decode_core.c",
+ "silk/code_signs.c",
+ "silk/enc_API.c",
+ "silk/tables_LTP.c",
+ "silk/pitch_est_tables.c",
+ "silk/biquad_alt.c",
+ "silk/encode_indices.c",
+ "silk/tables_NLSF_CB_WB.c",
+ "silk/debug.c",
+ "silk/decode_parameters.c",
+ "silk/tables_pitch_lag.c",
+ "silk/NLSF2A.c",
+ "silk/resampler.c",
+ "silk/decode_indices.c",
+ "silk/NLSF_VQ.c",
+ "silk/bwexpander_32.c",
+ "silk/tables_NLSF_CB_NB_MB.c",
+ "silk/encode_pulses.c",
+ "silk/NSQ_del_dec.c",
+ "silk/control_SNR.c",
+ "silk/shell_coder.c",
+ "silk/NLSF_encode.c",
+ "silk/stereo_MS_to_LR.c",
+ "silk/stereo_LR_to_MS.c",
+ "silk/HP_variable_cutoff.c",
+ "silk/LPC_analysis_filter.c",
+ "silk/CNG.c",
+ "silk/decoder_set_fs.c",
+ "silk/resampler_rom.c",
+ "silk/control_audio_bandwidth.c",
+ "silk/lin2log.c",
+ "silk/LP_variable_cutoff.c",
+ "silk/NSQ.c",
+ "silk/gain_quant.c",
+ "celt/laplace.c",
+ "celt/vq.c",
+ "celt/quant_bands.c",
+ "celt/kiss_fft.c",
+ "celt/entcode.c",
+ "celt/entenc.c",
+ "celt/celt_lpc.c",
+ "celt/pitch.c",
+ "celt/rate.c",
+ "celt/mathops.c",
+ #"celt/arm/armcpu.c",
+ #"celt/arm/celt_neon_intr.c",
+ #"celt/arm/celt_ne10_mdct.c",
+ #"celt/arm/celt_ne10_fft.c",
+ #"celt/arm/arm_celt_map.c",
+ "celt/celt_encoder.c",
+ "celt/celt.c",
+ "celt/bands.c",
+ "celt/cwrs.c",
+ "celt/entdec.c",
+ "celt/celt_decoder.c",
+ "celt/mdct.c",
+ "celt/modes.c",
+ "repacketizer.c",
+ "mlp_data.c",
+ "opus_multistream.c",
+ "opusfile.c",
+ "opus_encoder.c",
+ "analysis.c",
+ "mlp.c",
+ "info.c",
+ "stream.c",
+ "opus_decoder.c",
+ "internal.c",
+ "wincerts.c",
+ "opus.c",
+ "opus_multistream_encoder.c",
+ "http.c",
+ "opus_multistream_decoder.c"
+ ]
+
+ opus_sources_silk = []
+
+ if("opus_fixed_point" in env and env.opus_fixed_point=="yes"):
+ env_opus.Append(CFLAGS = ["-DFIXED_POINT"])
+ opus_sources_silk = [
+ "silk/fixed/schur64_FIX.c",
+ "silk/fixed/residual_energy16_FIX.c",
+ "silk/fixed/encode_frame_FIX.c",
+ "silk/fixed/regularize_correlations_FIX.c",
+ "silk/fixed/apply_sine_window_FIX.c",
+ "silk/fixed/solve_LS_FIX.c",
+ "silk/fixed/schur_FIX.c",
+ "silk/fixed/pitch_analysis_core_FIX.c",
+ "silk/fixed/noise_shape_analysis_FIX.c",
+ "silk/fixed/find_LTP_FIX.c",
+ "silk/fixed/vector_ops_FIX.c",
+ "silk/fixed/autocorr_FIX.c",
+ "silk/fixed/warped_autocorrelation_FIX.c",
+ "silk/fixed/find_pitch_lags_FIX.c",
+ "silk/fixed/k2a_Q16_FIX.c",
+ "silk/fixed/LTP_scale_ctrl_FIX.c",
+ "silk/fixed/corrMatrix_FIX.c",
+ "silk/fixed/prefilter_FIX.c",
+ "silk/fixed/find_LPC_FIX.c",
+ "silk/fixed/residual_energy_FIX.c",
+ "silk/fixed/process_gains_FIX.c",
+ "silk/fixed/LTP_analysis_filter_FIX.c",
+ "silk/fixed/k2a_FIX.c",
+ "silk/fixed/burg_modified_FIX.c",
+ "silk/fixed/find_pred_coefs_FIX.c"
+ ]
+ else:
+ opus_sources_silk = [
+ "silk/float/LTP_scale_ctrl_FLP.c",
+ "silk/float/regularize_correlations_FLP.c",
+ "silk/float/corrMatrix_FLP.c",
+ "silk/float/LPC_analysis_filter_FLP.c",
+ "silk/float/levinsondurbin_FLP.c",
+ "silk/float/schur_FLP.c",
+ "silk/float/scale_vector_FLP.c",
+ "silk/float/apply_sine_window_FLP.c",
+ "silk/float/pitch_analysis_core_FLP.c",
+ "silk/float/wrappers_FLP.c",
+ "silk/float/bwexpander_FLP.c",
+ "silk/float/warped_autocorrelation_FLP.c",
+ "silk/float/solve_LS_FLP.c",
+ "silk/float/find_LPC_FLP.c",
+ "silk/float/autocorrelation_FLP.c",
+ "silk/float/find_pred_coefs_FLP.c",
+ "silk/float/find_pitch_lags_FLP.c",
+ "silk/float/burg_modified_FLP.c",
+ "silk/float/find_LTP_FLP.c",
+ "silk/float/energy_FLP.c",
+ "silk/float/sort_FLP.c",
+ "silk/float/LPC_inv_pred_gain_FLP.c",
+ "silk/float/k2a_FLP.c",
+ "silk/float/noise_shape_analysis_FLP.c",
+ "silk/float/inner_product_FLP.c",
+ "silk/float/process_gains_FLP.c",
+ "silk/float/encode_frame_FLP.c",
+ "silk/float/scale_copy_vector_FLP.c",
+ "silk/float/residual_energy_FLP.c",
+ "silk/float/LTP_analysis_filter_FLP.c",
+ "silk/float/prefilter_FLP.c"
+ ]
+
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
+
+ env_opus.add_source_files(env.modules_sources, thirdparty_sources)
+ env_opus.Append(CFLAGS=["-DHAVE_CONFIG_H"])
+
+ thirdparty_include_paths = [
+ "",
+ "celt",
+ "silk",
+ "silk/fixed",
+ "silk/float",
+ ]
+ env_opus.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+
+ # also requires libogg
+ if (env["libogg"] != "system"): # builtin
+ env_opus.Append(CPPPATH = ["#thirdparty/libogg"])
+
+# Module files
+env_opus.add_source_files(env.modules_sources, "*.cpp")
diff --git a/drivers/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index ab53fee0c..ab53fee0c 100644
--- a/drivers/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
diff --git a/drivers/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h
index fc5531470..4da66fe16 100644
--- a/drivers/opus/audio_stream_opus.h
+++ b/modules/opus/audio_stream_opus.h
@@ -32,11 +32,11 @@
#ifndef AUDIO_STREAM_OPUS_H
#define AUDIO_STREAM_OPUS_H
-#include "scene/resources/audio_stream.h"
-#include "opus/opusfile.h"
-#include "opus/internal.h"
-#include "os/file_access.h"
#include "io/resource_loader.h"
+#include "os/file_access.h"
+#include "scene/resources/audio_stream.h"
+
+#include <opusfile.h>
class AudioStreamPlaybackOpus : public AudioStreamPlayback {
diff --git a/modules/opus/config.py b/modules/opus/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/opus/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/opus/register_types.cpp b/modules/opus/register_types.cpp
new file mode 100644
index 000000000..a4d71a52c
--- /dev/null
+++ b/modules/opus/register_types.cpp
@@ -0,0 +1,45 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "audio_stream_opus.h"
+
+static ResourceFormatLoaderAudioStreamOpus *opus_stream_loader = NULL;
+
+void register_opus_types() {
+
+ opus_stream_loader = memnew( ResourceFormatLoaderAudioStreamOpus );
+ ResourceLoader::add_resource_format_loader(opus_stream_loader);
+ ObjectTypeDB::register_type<AudioStreamOpus>();
+}
+
+void unregister_opus_types() {
+
+ memdelete( opus_stream_loader );
+}
diff --git a/modules/opus/register_types.h b/modules/opus/register_types.h
new file mode 100644
index 000000000..f4386c373
--- /dev/null
+++ b/modules/opus/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_opus_types();
+void unregister_opus_types();
diff --git a/modules/pbm/SCsub b/modules/pbm/SCsub
new file mode 100644
index 000000000..e0b19fb2a
--- /dev/null
+++ b/modules/pbm/SCsub
@@ -0,0 +1,6 @@
+Import('env')
+Import('env_modules')
+
+env_pbm = env_modules.Clone()
+
+env_pbm.add_source_files(env.modules_sources, "*.cpp")
diff --git a/drivers/pnm/bitmap_loader_pnm.cpp b/modules/pbm/bitmap_loader_pbm.cpp
index e06d4c80f..1d08b1082 100644
--- a/drivers/pnm/bitmap_loader_pnm.cpp
+++ b/modules/pbm/bitmap_loader_pbm.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* bitmap_loader_pnm.cpp */
+/* bitmap_loader_pbm.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,7 +26,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "bitmap_loader_pnm.h"
+#include "bitmap_loader_pbm.h"
#include "os/file_access.h"
#include "scene/resources/bit_mask.h"
diff --git a/drivers/pnm/bitmap_loader_pnm.h b/modules/pbm/bitmap_loader_pbm.h
index 965cf7a45..4f7144b3e 100644
--- a/drivers/pnm/bitmap_loader_pnm.h
+++ b/modules/pbm/bitmap_loader_pbm.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* bitmap_loader_pnm.h */
+/* bitmap_loader_pbm.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef BITMAP_LOADER_PNM_H
-#define BITMAP_LOADER_PNM_H
+#ifndef BITMAP_LOADER_PBM_H
+#define BITMAP_LOADER_PBM_H
#include "io/resource_loader.h"
diff --git a/modules/pbm/config.py b/modules/pbm/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/pbm/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/pbm/register_types.cpp b/modules/pbm/register_types.cpp
new file mode 100644
index 000000000..181083773
--- /dev/null
+++ b/modules/pbm/register_types.cpp
@@ -0,0 +1,44 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "bitmap_loader_pbm.h"
+
+static ResourceFormatPBM * pbm_loader = NULL;
+
+void register_pbm_types() {
+
+ pbm_loader = memnew( ResourceFormatPBM );
+ ResourceLoader::add_resource_format_loader(pbm_loader);
+}
+
+void unregister_pbm_types() {
+
+ memdelete( pbm_loader );
+}
diff --git a/modules/pbm/register_types.h b/modules/pbm/register_types.h
new file mode 100644
index 000000000..20c8133c2
--- /dev/null
+++ b/modules/pbm/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_pbm_types();
+void unregister_pbm_types();
diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub
new file mode 100644
index 000000000..cd0a3129d
--- /dev/null
+++ b/modules/pvr/SCsub
@@ -0,0 +1,22 @@
+Import('env')
+Import('env_modules')
+
+env_pvr = env_modules.Clone()
+
+# Thirdparty source files
+# Not unbundled so far since not widespread as shared library
+thirdparty_dir = "#thirdparty/pvrtccompressor/"
+thirdparty_sources = [
+ "BitScale.cpp",
+ "MortonTable.cpp",
+ "PvrTcDecoder.cpp",
+ "PvrTcEncoder.cpp",
+ "PvrTcPacket.cpp",
+]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+env_pvr.add_source_files(env.modules_sources, thirdparty_sources)
+env_pvr.Append(CPPPATH = [thirdparty_dir])
+
+# Godot source files
+env_pvr.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/pvr/config.py b/modules/pvr/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/pvr/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/pvr/register_types.cpp b/modules/pvr/register_types.cpp
new file mode 100644
index 000000000..e5e18fb3d
--- /dev/null
+++ b/modules/pvr/register_types.cpp
@@ -0,0 +1,44 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "texture_loader_pvr.h"
+
+static ResourceFormatPVR *resource_loader_pvr = NULL;
+
+void register_pvr_types() {
+
+ resource_loader_pvr = memnew( ResourceFormatPVR );
+ ResourceLoader::add_resource_format_loader(resource_loader_pvr);
+}
+
+void unregister_pvr_types() {
+
+ memdelete(resource_loader_pvr);
+}
diff --git a/modules/pvr/register_types.h b/modules/pvr/register_types.h
new file mode 100644
index 000000000..d600f54d5
--- /dev/null
+++ b/modules/pvr/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_pvr_types();
+void unregister_pvr_types();
diff --git a/drivers/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 3ab324051..3ab324051 100644
--- a/drivers/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
diff --git a/drivers/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h
index 5efb3b250..5efb3b250 100644
--- a/drivers/pvr/texture_loader_pvr.h
+++ b/modules/pvr/texture_loader_pvr.h
diff --git a/modules/squish/SCsub b/modules/squish/SCsub
new file mode 100644
index 000000000..072921ef6
--- /dev/null
+++ b/modules/squish/SCsub
@@ -0,0 +1,27 @@
+Import('env')
+Import('env_modules')
+
+env_squish = env_modules.Clone()
+
+# Thirdparty source files
+if (env["squish"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/squish/"
+ thirdparty_sources = [
+ "alpha.cpp",
+ "clusterfit.cpp",
+ "colourblock.cpp",
+ "colourfit.cpp",
+ "colourset.cpp",
+ "maths.cpp",
+ "rangefit.cpp",
+ "singlecolourfit.cpp",
+ "squish.cpp",
+ ]
+
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_squish.add_source_files(env.modules_sources, thirdparty_sources)
+ env_squish.Append(CPPPATH = [thirdparty_dir])
+
+# Godot source files
+env_squish.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/squish/config.py b/modules/squish/config.py
new file mode 100644
index 000000000..d28d9c702
--- /dev/null
+++ b/modules/squish/config.py
@@ -0,0 +1,10 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ # Tools only, disabled for non-tools
+ # TODO: Find a cleaner way to achieve that
+ if (env["tools"] == "no"):
+ env["module_squish_enabled"] = "no"
+ env.disabled_modules.append("squish")
diff --git a/drivers/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index 95de83d5a..ac7c935ce 100644
--- a/drivers/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -27,9 +27,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "image_compress_squish.h"
-#include "squish/squish.h"
+
#include "print_string.h"
+#include <squish.h>
+
void image_compress_squish(Image *p_image) {
int w=p_image->get_width();
@@ -88,4 +90,3 @@ void image_compress_squish(Image *p_image) {
p_image->create(p_image->get_width(),p_image->get_height(),p_image->get_mipmaps(),target_format,data);
}
-
diff --git a/drivers/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 8c37ac2ca..19dd90067 100644
--- a/drivers/squish/image_compress_squish.h
+++ b/modules/squish/image_compress_squish.h
@@ -29,11 +29,8 @@
#ifndef IMAGE_COMPRESS_SQUISH_H
#define IMAGE_COMPRESS_SQUISH_H
-
#include "image.h"
-
void image_compress_squish(Image *p_image);
-
#endif // IMAGE_COMPRESS_SQUISH_H
diff --git a/drivers/nedmalloc/memory_pool_static_nedmalloc.h b/modules/squish/register_types.cpp
index 0033353a6..9e9621eb6 100644
--- a/drivers/nedmalloc/memory_pool_static_nedmalloc.h
+++ b/modules/squish/register_types.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* memory_pool_static_nedmalloc.h */
+/* register_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,52 +26,17 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef NEDMALLOC_ENABLED
+#include "register_types.h"
-//
-// C++ Interface: memory_static_malloc
-//
-// Description:
-//
-//
-// Author: Juan Linietsky <red@lunatea>, (C) 2006
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-#ifndef MEMORY_POOL_STATIC_NEDMALLOC_H
-#define MEMORY_POOL_STATIC_NEDMALLOC_H
+#ifdef TOOLS_ENABLED
-#include "os/memory_pool_static.h"
-#include "os/mutex.h"
-/**
- @author Juan Linietsky <red@lunatea>
-*/
-class MemoryPoolStaticNedMalloc : public MemoryPoolStatic {
+#include "image_compress_squish.h"
- Mutex *mutex;
+void register_squish_types() {
-public:
+ Image::set_compress_bc_func(image_compress_squish);
+}
- void* alloc(size_t p_bytes,const char *p_description=""); ///< Pointer in p_description shold be to a const char const like "hello"
- void* realloc(void *p_memory,size_t p_bytes); ///< Pointer in
- void free(void *p_ptr); ///< Pointer in p_description shold be to a const char const
- virtual size_t get_available_mem() const;
- virtual size_t get_total_usage();
-
- /* Most likely available only if memory debugger was compiled in */
- virtual int get_alloc_count();
- virtual void * get_alloc_ptr(int p_alloc_idx);
- virtual const char* get_alloc_description(int p_alloc_idx);
- virtual size_t get_alloc_size(int p_alloc_idx);
-
- virtual void debug_print_all_memory();
-
- MemoryPoolStaticNedMalloc();
- ~MemoryPoolStaticNedMalloc();
-
-};
-
-#endif
+void unregister_squish_types() {}
#endif
diff --git a/drivers/openssl/register_openssl.h b/modules/squish/register_types.h
index a66ca1e9c..bbde6a44b 100644
--- a/drivers/openssl/register_openssl.h
+++ b/modules/squish/register_types.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* register_openssl.h */
+/* register_types.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,14 +26,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef REGISTER_OPENSSL_H
-#define REGISTER_OPENSSL_H
-
-#ifdef OPENSSL_ENABLED
-
-void register_openssl();
-void unregister_openssl();
-
+#ifdef TOOLS_ENABLED
+void register_squish_types();
+void unregister_squish_types();
#endif
-
-#endif // REGISTER_OPENSSL_H
diff --git a/modules/theora/SCsub b/modules/theora/SCsub
new file mode 100644
index 000000000..cf1a8e670
--- /dev/null
+++ b/modules/theora/SCsub
@@ -0,0 +1,81 @@
+Import('env')
+Import('env_modules')
+
+env_theora = env_modules.Clone()
+
+# Thirdparty source files
+if (env["libtheora"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/libtheora/"
+ thirdparty_sources = [
+ #"analyze.c",
+ #"apiwrapper.c",
+ "bitpack.c",
+ "cpu.c",
+ #"decapiwrapper.c",
+ "decinfo.c",
+ "decode.c",
+ "dequant.c",
+ #"encapiwrapper.c",
+ #"encfrag.c",
+ #"encinfo.c",
+ #"encode.c",
+ #"encoder_disabled.c",
+ #"enquant.c",
+ #"fdct.c",
+ "fragment.c",
+ "huffdec.c",
+ #"huffenc.c",
+ "idct.c",
+ "info.c",
+ "internal.c",
+ #"mathops.c",
+ #"mcenc.c",
+ "quant.c",
+ #"rate.c",
+ "state.c",
+ #"tokenize.c",
+ ]
+
+ thirdparty_sources_x86 = [
+ #"x86/mmxencfrag.c",
+ #"x86/mmxfdct.c",
+ "x86/mmxfrag.c",
+ "x86/mmxidct.c",
+ "x86/mmxstate.c",
+ #"x86/sse2fdct.c",
+ #"x86/x86enc.c",
+ "x86/x86state.c",
+ ]
+
+ thirdparty_sources_x86_vc = [
+ #"x86_vc/mmxencfrag.c",
+ #"x86_vc/mmxfdct.c",
+ "x86_vc/mmxfrag.c",
+ "x86_vc/mmxidct.c",
+ "x86_vc/mmxstate.c",
+ #"x86_vc/x86enc.c",
+ "x86_vc/x86state.c",
+ ]
+
+ if (env["x86_libtheora_opt_gcc"]):
+ thirdparty_sources += thirdparty_sources_x86
+
+ if (env["x86_libtheora_opt_vc"]):
+ thirdparty_sources += thirdparty_sources_x86_vc
+
+ if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]):
+ env_theora.Append(CCFLAGS = ["-DOC_X86_ASM"])
+
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_theora.add_source_files(env.modules_sources, thirdparty_sources)
+ env_theora.Append(CPPPATH = [thirdparty_dir])
+
+ # also requires libogg and libvorbis
+ if (env["libogg"] != "system"): # builtin
+ env_theora.Append(CPPPATH = ["#thirdparty/libogg"])
+ if (env["libvorbis"] != "system"): # builtin
+ env_theora.Append(CPPPATH = ["#thirdparty/libvorbis"])
+
+# Godot source files
+env_theora.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/theora/config.py b/modules/theora/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/theora/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp
new file mode 100644
index 000000000..282b59b0e
--- /dev/null
+++ b/modules/theora/register_types.cpp
@@ -0,0 +1,45 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "video_stream_theora.h"
+
+static ResourceFormatLoaderVideoStreamTheora* theora_stream_loader = NULL;
+
+void register_theora_types() {
+
+ theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
+ ResourceLoader::add_resource_format_loader(theora_stream_loader);
+ ObjectTypeDB::register_type<VideoStreamTheora>();
+}
+
+void unregister_theora_types() {
+
+ memdelete( theora_stream_loader );
+}
diff --git a/modules/theora/register_types.h b/modules/theora/register_types.h
new file mode 100644
index 000000000..18bdbf0c4
--- /dev/null
+++ b/modules/theora/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_theora_types();
+void unregister_theora_types();
diff --git a/drivers/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 1f3832ec1..3ddfee3a1 100644
--- a/drivers/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -26,13 +26,11 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef THEORA_ENABLED
-
#include "video_stream_theora.h"
+
+#include "globals.h"
#include "os/os.h"
#include "yuv2rgb.h"
-#include "globals.h"
-
int VideoStreamPlaybackTheora:: buffer_data() {
@@ -940,6 +938,3 @@ String ResourceFormatLoaderVideoStreamTheora::get_resource_type(const String &p_
return "VideoStreamTheora";
return "";
}
-
-#endif
-
diff --git a/drivers/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 548481584..04a5c56ee 100644
--- a/drivers/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -29,16 +29,15 @@
#ifndef VIDEO_STREAM_THEORA_H
#define VIDEO_STREAM_THEORA_H
-#ifdef THEORA_ENABLED
-
-#include "theora/theoradec.h"
-#include "vorbis/codec.h"
-#include "os/file_access.h"
-#include "ring_buffer.h"
#include "io/resource_loader.h"
-#include "scene/resources/video_stream.h"
+#include "os/file_access.h"
#include "os/thread.h"
#include "os/semaphore.h"
+#include "ring_buffer.h"
+#include "scene/resources/video_stream.h"
+
+#include <theora/theoradec.h>
+#include <vorbis/codec.h>
//#define THEORA_USE_THREAD_STREAMING
@@ -197,8 +196,4 @@ public:
};
-
-
-#endif
-
#endif
diff --git a/drivers/theora/yuv2rgb.h b/modules/theora/yuv2rgb.h
index 59101bd05..59101bd05 100644
--- a/drivers/theora/yuv2rgb.h
+++ b/modules/theora/yuv2rgb.h
diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub
index 403fe68f6..9ff13fc43 100644
--- a/modules/visual_script/SCsub
+++ b/modules/visual_script/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 24a44d350..2bfb6bc9e 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -55,6 +55,7 @@ const char* VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX
"convert",
"typeof",
"type_exists",
+ "char",
"str",
"print",
"printerr",
@@ -141,6 +142,7 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
case LOGIC_NEAREST_PO2:
case OBJ_WEAKREF:
case TYPE_OF:
+ case TEXT_CHAR:
case TEXT_STR:
case TEXT_PRINT:
case TEXT_PRINTERR:
@@ -362,6 +364,12 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
return PropertyInfo(Variant::STRING,"type");
} break;
+ case TEXT_CHAR: {
+
+ return PropertyInfo(Variant::INT,"ascii");
+
+
+ } break;
case TEXT_STR: {
return PropertyInfo(Variant::NIL,"value");
@@ -517,6 +525,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
t=Variant::BOOL;
} break;
+ case TEXT_CHAR:
case TEXT_STR: {
t=Variant::STRING;
@@ -975,6 +984,13 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
*r_return = ObjectTypeDB::type_exists(*p_inputs[0]);
} break;
+ case VisualScriptBuiltinFunc::TEXT_CHAR: {
+
+ CharType result[2] = {*p_inputs[0], 0};
+
+ *r_return=String(result);
+
+ } break;
case VisualScriptBuiltinFunc::TEXT_STR: {
String str = *p_inputs[0];
@@ -1213,6 +1229,7 @@ void register_visual_script_builtin_func_node() {
VisualScriptLanguage::singleton->add_register_func("functions/built_in/convert",create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_CONVERT>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/typeof",create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_OF>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/type_exists",create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_EXISTS>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/char",create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_CHAR>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/str",create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_STR>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/print",create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_PRINT>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/printerr",create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_PRINTERR>);
diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h
index 000230d84..8b0d70c1e 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -57,6 +57,7 @@ public:
TYPE_CONVERT,
TYPE_OF,
TYPE_EXISTS,
+ TEXT_CHAR,
TEXT_STR,
TEXT_PRINT,
TEXT_PRINTERR,
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
new file mode 100644
index 000000000..f3dbc893f
--- /dev/null
+++ b/modules/vorbis/SCsub
@@ -0,0 +1,47 @@
+Import('env')
+Import('env_modules')
+
+env_vorbis = env_modules.Clone()
+
+# Thirdparty source files
+if (env["libvorbis"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/libvorbis/"
+ thirdparty_sources = [
+ #"analysis.c",
+ #"barkmel.c",
+ "bitrate.c",
+ "block.c",
+ "codebook.c",
+ "envelope.c",
+ "floor0.c",
+ "floor1.c",
+ "info.c",
+ "lookup.c",
+ "lpc.c",
+ "lsp.c",
+ "mapping0.c",
+ "mdct.c",
+ "psy.c",
+ #"psytune.c",
+ "registry.c",
+ "res0.c",
+ "sharedbook.c",
+ "smallft.c",
+ "synthesis.c",
+ #"tone.c",
+ #"vorbisenc.c",
+ "vorbisfile.c",
+ "window.c",
+ ]
+
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_vorbis.add_source_files(env.modules_sources, thirdparty_sources)
+ env_vorbis.Append(CPPPATH = [thirdparty_dir])
+
+ # also requires libogg
+ if (env["libogg"] != "system"): # builtin
+ env_vorbis.Append(CPPPATH = ["#thirdparty/libogg"])
+
+# Godot source files
+env_vorbis.add_source_files(env.modules_sources, "*.cpp")
diff --git a/drivers/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 4ce7940a0..4ce7940a0 100644
--- a/drivers/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
diff --git a/drivers/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index bb4d521c1..8d8d7392b 100644
--- a/drivers/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -29,12 +29,12 @@
#ifndef AUDIO_STREAM_OGG_VORBIS_H
#define AUDIO_STREAM_OGG_VORBIS_H
-#include "scene/resources/audio_stream.h"
-#include "vorbis/vorbisfile.h"
-#include "os/file_access.h"
#include "io/resource_loader.h"
+#include "os/file_access.h"
#include "os/thread_safe.h"
+#include "scene/resources/audio_stream.h"
+#include <vorbis/vorbisfile.h>
class AudioStreamPlaybackOGGVorbis : public AudioStreamPlayback {
diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/vorbis/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/vorbis/register_types.cpp b/modules/vorbis/register_types.cpp
new file mode 100644
index 000000000..ae63b5af3
--- /dev/null
+++ b/modules/vorbis/register_types.cpp
@@ -0,0 +1,45 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "audio_stream_ogg_vorbis.h"
+
+static ResourceFormatLoaderAudioStreamOGGVorbis *vorbis_stream_loader = NULL;
+
+void register_vorbis_types() {
+
+ vorbis_stream_loader = memnew( ResourceFormatLoaderAudioStreamOGGVorbis );
+ ResourceLoader::add_resource_format_loader(vorbis_stream_loader);
+ ObjectTypeDB::register_type<AudioStreamOGGVorbis>();
+}
+
+void unregister_vorbis_types() {
+
+ memdelete( vorbis_stream_loader );
+}
diff --git a/modules/vorbis/register_types.h b/modules/vorbis/register_types.h
new file mode 100644
index 000000000..6baaed7ce
--- /dev/null
+++ b/modules/vorbis/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_vorbis_types();
+void unregister_vorbis_types();
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
new file mode 100644
index 000000000..4997aa335
--- /dev/null
+++ b/modules/webp/SCsub
@@ -0,0 +1,119 @@
+Import('env')
+Import('env_modules')
+
+env_webp = env_modules.Clone()
+
+# Thirdparty source files
+if (env["libwebp"] != "system"): # builtin
+ thirdparty_dir = "#thirdparty/libwebp/"
+ thirdparty_sources = [
+ "enc/webpenc.c",
+ "enc/near_lossless.c",
+ "enc/frame.c",
+ "enc/alpha.c",
+ "enc/picture_csp.c",
+ "enc/vp8l.c",
+ "enc/picture_psnr.c",
+ "enc/delta_palettization.c",
+ "enc/syntax.c",
+ "enc/backward_references.c",
+ "enc/token.c",
+ "enc/analysis.c",
+ "enc/iterator.c",
+ "enc/picture_tools.c",
+ "enc/picture_rescale.c",
+ "enc/config.c",
+ "enc/tree.c",
+ "enc/cost.c",
+ "enc/picture.c",
+ "enc/quant.c",
+ "enc/filter.c",
+ "enc/histogram.c",
+ "utils/rescaler.c",
+ "utils/filters.c",
+ "utils/quant_levels_dec.c",
+ "utils/huffman.c",
+ "utils/thread.c",
+ "utils/quant_levels.c",
+ "utils/bit_writer.c",
+ "utils/bit_reader.c",
+ "utils/random.c",
+ "utils/utils.c",
+ "utils/huffman_encode.c",
+ "utils/color_cache.c",
+ "mux/muxinternal.c",
+ "mux/muxread.c",
+ "mux/anim_encode.c",
+ "mux/muxedit.c",
+ "dec/webp.c",
+ "dec/frame.c",
+ "dec/alpha.c",
+ "dec/vp8l.c",
+ "dec/io.c",
+ "dec/vp8.c",
+ "dec/idec.c",
+ "dec/tree.c",
+ "dec/buffer.c",
+ "dec/quant.c",
+ "demux/demux.c",
+ "demux/anim_decode.c",
+ "dsp/yuv.c",
+ "dsp/filters_sse2.c",
+ "dsp/dec_sse41.c",
+ "dsp/rescaler.c",
+ "dsp/lossless_sse2.c",
+ "dsp/alpha_processing_sse41.c",
+ "dsp/alpha_processing_sse2.c",
+ "dsp/filters.c",
+ "dsp/upsampling_mips_dsp_r2.c",
+ "dsp/dec_neon.c",
+ "dsp/enc_neon.c",
+ "dsp/lossless_enc_mips32.c",
+ "dsp/lossless_enc_sse2.c",
+ "dsp/upsampling.c",
+ "dsp/lossless_enc_neon.c",
+ "dsp/alpha_processing.c",
+ "dsp/cost_sse2.c",
+ "dsp/dec_mips32.c",
+ "dsp/enc_avx2.c",
+ "dsp/rescaler_mips32.c",
+ "dsp/enc.c",
+ "dsp/lossless_enc_sse41.c",
+ "dsp/cost_mips32.c",
+ "dsp/lossless_mips_dsp_r2.c",
+ "dsp/filters_mips_dsp_r2.c",
+ "dsp/upsampling_neon.c",
+ "dsp/alpha_processing_mips_dsp_r2.c",
+ "dsp/enc_mips_dsp_r2.c",
+ "dsp/lossless.c",
+ "dsp/yuv_mips_dsp_r2.c",
+ "dsp/cost_mips_dsp_r2.c",
+ "dsp/argb.c",
+ "dsp/dec_sse2.c",
+ "dsp/rescaler_sse2.c",
+ "dsp/enc_sse41.c",
+ "dsp/argb_mips_dsp_r2.c",
+ "dsp/lossless_enc_mips_dsp_r2.c",
+ "dsp/dec_clip_tables.c",
+ "dsp/yuv_mips32.c",
+ "dsp/cpu.c",
+ "dsp/dec.c",
+ "dsp/argb_sse2.c",
+ "dsp/lossless_neon.c",
+ "dsp/lossless_enc.c",
+ "dsp/enc_mips32.c",
+ "dsp/cost.c",
+ "dsp/rescaler_mips_dsp_r2.c",
+ "dsp/dec_mips_dsp_r2.c",
+ "dsp/rescaler_neon.c",
+ "dsp/yuv_sse2.c",
+ "dsp/enc_sse2.c",
+ "dsp/upsampling_sse2.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_webp.add_source_files(env.modules_sources, thirdparty_sources)
+ env_webp.Append(CPPPATH = [thirdparty_dir])
+
+# Godot source files
+env_webp.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/webp/config.py b/modules/webp/config.py
new file mode 100644
index 000000000..368e97e15
--- /dev/null
+++ b/modules/webp/config.py
@@ -0,0 +1,6 @@
+
+def can_build(platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/drivers/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 68bb85729..0fe2db326 100644
--- a/drivers/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -28,12 +28,13 @@
/*************************************************************************/
#include "image_loader_webp.h"
+#include "io/marshalls.h"
#include "print_string.h"
#include "os/os.h"
-#include "drivers/webp/decode.h"
-#include "drivers/webp/encode.h"
-#include "io/marshalls.h"
+
#include <stdlib.h>
+#include <webp/decode.h>
+#include <webp/encode.h>
static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) {
diff --git a/drivers/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h
index 24f79708d..24f79708d 100644
--- a/drivers/webp/image_loader_webp.h
+++ b/modules/webp/image_loader_webp.h
diff --git a/modules/webp/register_types.cpp b/modules/webp/register_types.cpp
new file mode 100644
index 000000000..039876bbb
--- /dev/null
+++ b/modules/webp/register_types.cpp
@@ -0,0 +1,44 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "image_loader_webp.h"
+
+static ImageLoaderWEBP *image_loader_webp = NULL;
+
+void register_webp_types() {
+
+ image_loader_webp = memnew( ImageLoaderWEBP );
+ ImageLoader::add_image_format_loader(image_loader_webp);
+}
+
+void unregister_webp_types() {
+
+ memdelete( image_loader_webp );
+}
diff --git a/modules/webp/register_types.h b/modules/webp/register_types.h
new file mode 100644
index 000000000..a200188e4
--- /dev/null
+++ b/modules/webp/register_types.h
@@ -0,0 +1,30 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_webp_types();
+void unregister_webp_types();
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 7e482047c..acf4ce412 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -34,10 +34,8 @@ def get_flags():
return [
('tools', 'no'),
- ('nedmalloc', 'no'),
- ('builtin_zlib', 'no'),
- ('openssl','builtin'), #use builtin openssl
- ]
+ ('openssl', 'builtin'), #use builtin openssl
+ ]
def create(env):
@@ -98,7 +96,7 @@ def configure(env):
if env['android_arch']=='x86':
env['NDK_TARGET']=env['NDK_TARGET_X86']
- env["x86_opt_gcc"]=True
+ env["x86_libtheora_opt_gcc"]=True
if env['PLATFORM'] == 'win32':
env.Tool('gcc')
@@ -124,19 +122,20 @@ def configure(env):
gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/";
- if (sys.platform.find("linux")==0):
- if (platform.architecture()[0]=='64bit' or os.path.isdir(gcc_path+"linux-x86_64/bin")): # check was not working
+ if (sys.platform.startswith("linux")):
+ if (platform.machine().endswith('64')):
gcc_path=gcc_path+"/linux-x86_64/bin"
else:
gcc_path=gcc_path+"/linux-x86/bin"
- elif (sys.platform=="darwin"):
- gcc_path=gcc_path+"/darwin-x86_64/bin" #this may be wrong
+ elif (sys.platform.startswith("darwin")):
+ gcc_path=gcc_path+"/darwin-x86_64/bin"
env['SHLINKFLAGS'][1] = '-shared'
env['SHLIBSUFFIX'] = '.so'
- elif (os.name=="nt"):
- gcc_path=gcc_path+"/windows-x86_64/bin" #this may be wrong
-
-
+ elif (os.platform.startswith('win')):
+ if (platform.machine().endswith('64')):
+ gcc_path=gcc_path+"/windows-x86_64/bin"
+ else:
+ gcc_path=gcc_path+"/windows-x86/bin"
env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH']
if env['android_arch']=='x86':
@@ -204,7 +203,8 @@ def configure(env):
env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT'])
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
- if(env["opus"]=="yes"):
+ # TODO: Move that to opus module's config
+ if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
if (env["android_arch"]=="armv6" or env["android_arch"]=="armv7"):
env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
env.opus_fixed_point="yes"
diff --git a/platform/bb10/detect.py b/platform/bb10/detect.py
index 9ab94e619..2b76aa349 100644
--- a/platform/bb10/detect.py
+++ b/platform/bb10/detect.py
@@ -32,11 +32,9 @@ def get_opts():
def get_flags():
return [
- ('lua', 'no'),
('tools', 'no'),
- ('nedmalloc', 'no'),
- ('theora', 'no'),
-
+ ('builtin_zlib', 'yes'),
+ ('module_theora_enabled', 'no'),
]
def configure(env):
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index f36b0c567..af997a573 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -23,8 +23,6 @@ def get_opts():
def get_flags():
return [
- ('builtin_zlib', 'no'),
- ('glew', 'yes'),
]
def configure(env):
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 9cb52d456..1be63891b 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -38,6 +38,7 @@ def get_flags():
return [
('tools', 'no'),
('webp', 'yes'),
+ ('builtin_zlib', 'yes'),
('openssl','builtin'), #use builtin openssl
]
@@ -165,7 +166,8 @@ def configure(env):
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
- if(env["opus"]=="yes"):
+ # TODO: Move that to opus module's config
+ if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
env.opus_fixed_point="yes"
if env["arch"]=="x86":
pass
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index aeff5a1a3..e1f91cf94 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -25,21 +25,11 @@ def get_opts():
def get_flags():
return [
- ('lua', 'no'),
('tools', 'no'),
- ('nedmalloc', 'no'),
- ('theora', 'no'),
- ('tools', 'no'),
- ('nedmalloc', 'no'),
- ('musepack', 'no'),
- ('squirrel', 'no'),
- ('squish', 'no'),
- ('speex', 'no'),
- ('old_scenes', 'no'),
- ('etc1', 'no'),
-# ('default_gui_theme', 'no'),
-
- #('builtin_zlib', 'no'),
+ ('builtin_zlib', 'yes'),
+ ('module_etc1_enabled', 'no'),
+ ('module_mpc_enabled', 'no'),
+ ('module_theora_enabled', 'no'),
]
@@ -80,8 +70,9 @@ def configure(env):
#env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
- if(env["opus"]=="yes"):
- env.opus_fixed_point="yes"
+ # TODO: Move that to opus module's config
+ if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+ env.opus_fixed_point = "yes"
env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti'])
env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS'])
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 01ea09fa2..f8b2153ae 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -28,9 +28,6 @@ def get_opts():
def get_flags():
return [
- ('legacygl', 'yes'),
- ('builtin_zlib', 'no'),
- ('glew', 'yes'),
]
@@ -83,10 +80,6 @@ def configure(env):
env['AS'] = basecmd+"as"
-# env.Append(CPPPATH=['#platform/osx/include/freetype2', '#platform/osx/include'])
-# env.Append(LIBPATH=['#platform/osx/lib'])
-
-
env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
env.Append(CPPFLAGS=['-DUNIX_ENABLED','-DGLES2_ENABLED','-DOSX_ENABLED'])
env.Append(LIBS=['pthread'])
@@ -109,4 +102,4 @@ def configure(env):
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
- env["x86_opt_gcc"]=True
+ env["x86_libtheora_opt_gcc"]=True
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index 86505206a..f02a4bc44 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/platform_config.h
@@ -27,5 +27,5 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include <alloca.h>
-#define GLES2_INCLUDE_H "gl_context/GL/glew.h"
+#define GLES2_INCLUDE_H "GL/glew.h"
#define PTHREAD_RENAME_SELF
diff --git a/platform/server/detect.py b/platform/server/detect.py
index e6fab2043..2f6fb00e0 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -27,7 +27,6 @@ def get_opts():
def get_flags():
return [
- ('builtin_zlib', 'no'),
]
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 12ea5a93e..a5b26930b 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -176,7 +176,7 @@ def get_opts():
def get_flags():
return [
- ('glew','yes'),
+ ('builtin_zlib', 'yes'),
('openssl','builtin'), #use builtin openssl
]
@@ -279,13 +279,13 @@ def configure(env):
# Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
# that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
env["bits"]="32"
- env["x86_opt_vc"]=True
+ env["x86_libtheora_opt_vc"]=True
print "Detected MSVC compiler: "+compiler_version_str
# If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
env["bits"]="64"
- env["x86_opt_vc"]=False
+ env["x86_libtheora_opt_vc"]=False
print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"):
print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)."
@@ -365,7 +365,7 @@ def configure(env):
env['AR'] = mingw_prefix+"ar"
env['RANLIB'] = mingw_prefix+"ranlib"
env['LD'] = mingw_prefix+"g++"
- env["x86_opt_gcc"]=True
+ env["x86_libtheora_opt_gcc"]=True
#env['CC'] = "winegcc"
#env['CXX'] = "wineg++"
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 35d90a830..0ca5d3bd0 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -29,7 +29,6 @@
#include "drivers/gles2/rasterizer_gles2.h"
#include "os_windows.h"
-#include "drivers/nedmalloc/memory_pool_static_nedmalloc.h"
#include "drivers/unix/memory_pool_static_malloc.h"
#include "os/memory_pool_dynamic_static.h"
#include "drivers/windows/thread_windows.h"
diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h
index 9e2075081..31512a105 100644
--- a/platform/windows/platform_config.h
+++ b/platform/windows/platform_config.h
@@ -30,6 +30,4 @@
//#else
//#include <alloca.h>
//#endif
-#define GLES2_INCLUDE_H "gl_context/GL/glew.h"
-
-
+#define GLES2_INCLUDE_H "GL/glew.h"
diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py
index 7f220736d..79fc3651e 100644
--- a/platform/winrt/detect.py
+++ b/platform/winrt/detect.py
@@ -29,6 +29,7 @@ def get_flags():
return [
('tools', 'no'),
+ ('builtin_zlib', 'yes'),
('openssl', 'builtin'),
]
diff --git a/platform/winrt/os_winrt.cpp b/platform/winrt/os_winrt.cpp
index 0ce561f88..4b23f3960 100644
--- a/platform/winrt/os_winrt.cpp
+++ b/platform/winrt/os_winrt.cpp
@@ -28,7 +28,6 @@
/*************************************************************************/
#include "drivers/gles2/rasterizer_gles2.h"
#include "os_winrt.h"
-#include "drivers/nedmalloc/memory_pool_static_nedmalloc.h"
#include "drivers/unix/memory_pool_static_malloc.h"
#include "os/memory_pool_dynamic_static.h"
#include "thread_winrt.h"
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index ba232f6d4..eb71ac740 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -68,13 +68,10 @@ def get_opts():
def get_flags():
return [
- ('builtin_zlib', 'no'),
- ('glew', 'yes'),
- ("openssl", "yes"),
- ('freetype','yes'), #use system freetype
-
- #("theora","no"),
- ]
+ ("openssl", "system"),
+ ('freetype', 'system'),
+ ('libpng', 'system'),
+ ]
@@ -140,18 +137,50 @@ def configure(env):
env.ParseConfig('pkg-config xcursor --cflags --libs')
env.ParseConfig('pkg-config xrandr --cflags --libs')
- if (env["openssl"]=="yes"):
+ if (env["openssl"] == "system"):
env.ParseConfig('pkg-config openssl --cflags --libs')
+ if (env["libwebp"] == "system"):
+ env.ParseConfig('pkg-config libwebp --cflags --libs')
- if (env["freetype"]=="yes"):
+ if (env["freetype"] == "system"):
+ env["libpng"] = "system" # Freetype links against libpng
env.ParseConfig('pkg-config freetype2 --cflags --libs')
+ if (env["libpng"] == "system"):
+ env.ParseConfig('pkg-config libpng --cflags --libs')
+
+ if (env["enet"] == "system"):
+ env.ParseConfig('pkg-config libenet --cflags --libs')
+
+ if (env["squish"] == "system" and env["tools"] == "yes"):
+ env.ParseConfig('pkg-config libsquish --cflags --libs')
+
+ # Sound and video libraries
+ # Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
+ if (env["libtheora"] == "system"):
+ env["libogg"] = "system" # Needed to link against system libtheora
+ env["libvorbis"] = "system" # Needed to link against system libtheora
+ env.ParseConfig('pkg-config theora theoradec --cflags --libs')
+
+ if (env["libvorbis"] == "system"):
+ env["libogg"] = "system" # Needed to link against system libvorbis
+ env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
+
+ if (env["opus"] == "system"):
+ env["libogg"] = "system" # Needed to link against system opus
+ env.ParseConfig('pkg-config opus opusfile --cflags --libs')
+
+ if (env["libogg"] == "system"):
+ env.ParseConfig('pkg-config ogg --cflags --libs')
env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])
+ if (env["glew"] == "system"):
+ env.ParseConfig('pkg-config glew --cflags --libs')
+
if os.system("pkg-config --exists alsa")==0:
print("Enabling ALSA")
env.Append(CPPFLAGS=["-DALSA_ENABLED"])
@@ -208,5 +237,5 @@ def configure(env):
list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
if any(platform.machine() in s for s in list_of_x86):
- env["x86_opt_gcc"]=True
+ env["x86_libtheora_opt_gcc"]=True
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index 3b47b2c92..015953157 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -34,6 +34,4 @@
#define PTHREAD_BSD_SET_NAME
#endif
-#define GLES2_INCLUDE_H "gl_context/GL/glew.h"
-
-
+#define GLES2_INCLUDE_H "GL/glew.h"
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 6479dd2d0..64d68738b 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -243,12 +243,22 @@ void BaseButton::_notification(int p_what) {
update();
}
}
+
+ if (p_what==NOTIFICATION_FOCUS_ENTER) {
+
+ status.hovering=true;
+ update();
+ }
if (p_what==NOTIFICATION_FOCUS_EXIT) {
if (status.pressing_button && status.press_attempt) {
status.press_attempt=false;
status.pressing_button=0;
+ status.hovering=false;
+ update();
+ } else if (status.hovering) {
+ status.hovering=false;
update();
}
}
diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp
index be4829611..df1872380 100644
--- a/scene/gui/button_array.cpp
+++ b/scene/gui/button_array.cpp
@@ -60,6 +60,8 @@ bool ButtonArray::_set(const StringName& p_name, const Variant& p_value) {
String f = n.get_slicec('/',2);
if (f=="text")
buttons[idx].text=p_value;
+ else if (f=="tooltip")
+ buttons[idx].tooltip=p_value;
else if (f=="icon")
buttons[idx].icon=p_value;
else
@@ -95,6 +97,8 @@ bool ButtonArray::_get(const StringName& p_name,Variant &r_ret) const {
String f = n.get_slicec('/',2);
if (f=="text")
r_ret=buttons[idx].text;
+ else if (f=="tooltip")
+ r_ret=buttons[idx].tooltip;
else if (f=="icon")
r_ret=buttons[idx].icon;
else
@@ -115,6 +119,7 @@ void ButtonArray::_get_property_list( List<PropertyInfo> *p_list) const {
for(int i=0;i<buttons.size();i++) {
String base="button/"+itos(i)+"/";
p_list->push_back( PropertyInfo( Variant::STRING, base+"text"));
+ p_list->push_back( PropertyInfo( Variant::STRING, base+"tooltip"));
p_list->push_back( PropertyInfo( Variant::OBJECT, base+"icon",PROPERTY_HINT_RESOURCE_TYPE,"Texture"));
}
if (buttons.size()>0) {
@@ -168,8 +173,12 @@ Size2 ButtonArray::get_minimum_size() const {
void ButtonArray::_notification(int p_what) {
switch(p_what) {
+ case NOTIFICATION_MOUSE_EXIT:{
+ hover=-1;
+ update();
+ }break;
case NOTIFICATION_READY:{
- MethodInfo mi;
+ MethodInfo mi;
mi.name="mouse_sub_enter";
add_user_signal(mi);
@@ -245,8 +254,12 @@ void ButtonArray::_notification(int p_what) {
Ref<Font> f;
Color c;
+ Point2 sbsize;
+ Point2 sbofs;
if (i==selected) {
draw_style_box(style_selected,r);
+ sbsize=style_selected->get_minimum_size();
+ sbofs=style_selected->get_offset();
f=font_selected;
c=color_selected;
if (has_focus())
@@ -256,6 +269,8 @@ void ButtonArray::_notification(int p_what) {
draw_style_box(style_hover,r);
else
draw_style_box(style_normal,r);
+ sbsize=style_selected->get_minimum_size();
+ sbofs=style_normal->get_offset();
f=font_normal;
c=color_normal;
}
@@ -265,7 +280,7 @@ void ButtonArray::_notification(int p_what) {
ssize.x+=buttons[i].icon->get_width();
}
- Point2 text_ofs=((r.size-ssize)/2.0+Point2(0,f->get_ascent())).floor();
+ Point2 text_ofs=((r.size-ssize-sbsize)/2.0+Point2(0,f->get_ascent())).floor()+sbofs;
if (buttons[i].icon.is_valid()) {
draw_texture(buttons[i].icon,r.pos+Point2(text_ofs.x,Math::floor((r.size.height-buttons[i].icon->get_height())/2.0)));
@@ -349,6 +364,18 @@ void ButtonArray::_input_event(const InputEvent& p_event) {
}
+String ButtonArray::get_tooltip(const Point2& p_pos) const {
+
+ int ofs = orientation==HORIZONTAL ? p_pos.x: p_pos.y;
+ for(int i=0;i<buttons.size();i++) {
+
+ if (ofs>=buttons[i]._pos_cache && ofs<buttons[i]._pos_cache+buttons[i]._size_cache)
+ return buttons[i].tooltip;
+
+ }
+ return Control::get_tooltip(p_pos);
+}
+
void ButtonArray::set_align(Align p_align) {
align=p_align;
@@ -362,10 +389,11 @@ ButtonArray::Align ButtonArray::get_align() const {
}
-void ButtonArray::add_button(const String& p_text) {
+void ButtonArray::add_button(const String& p_text,const String& p_tooltip) {
Button button;
button.text=p_text;
+ button.tooltip=p_tooltip;
buttons.push_back(button);
update();
@@ -375,11 +403,12 @@ void ButtonArray::add_button(const String& p_text) {
minimum_size_changed();
}
-void ButtonArray::add_icon_button(const Ref<Texture>& p_icon,const String& p_text) {
+void ButtonArray::add_icon_button(const Ref<Texture>& p_icon,const String& p_text,const String& p_tooltip) {
Button button;
button.text=p_text;
button.icon=p_icon;
+ button.tooltip=p_tooltip;
buttons.push_back(button);
if (selected==-1)
selected=0;
@@ -397,6 +426,13 @@ void ButtonArray::set_button_text(int p_button, const String& p_text) {
}
+void ButtonArray::set_button_tooltip(int p_button, const String& p_text) {
+
+ ERR_FAIL_INDEX(p_button,buttons.size());
+ buttons[p_button].tooltip=p_text;
+
+}
+
void ButtonArray::set_button_icon(int p_button, const Ref<Texture>& p_icon) {
ERR_FAIL_INDEX(p_button,buttons.size());
@@ -411,6 +447,12 @@ String ButtonArray::get_button_text(int p_button) const {
return buttons[p_button].text;
}
+String ButtonArray::get_button_tooltip(int p_button) const {
+
+ ERR_FAIL_INDEX_V(p_button,buttons.size(),"");
+ return buttons[p_button].tooltip;
+}
+
Ref<Texture> ButtonArray::get_button_icon(int p_button) const {
ERR_FAIL_INDEX_V(p_button,buttons.size(),Ref<Texture>());
@@ -465,18 +507,22 @@ int ButtonArray::get_button_count() const {
void ButtonArray::get_translatable_strings(List<String> *p_strings) const {
- for(int i=0;i<buttons.size();i++)
+ for(int i=0;i<buttons.size();i++) {
p_strings->push_back(buttons[i].text);
+ p_strings->push_back(buttons[i].tooltip);
+ }
}
void ButtonArray::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("add_button","text"),&ButtonArray::add_button);
- ObjectTypeDB::bind_method(_MD("add_icon_button","icon:Texture","text"),&ButtonArray::add_icon_button,DEFVAL(""));
+ ObjectTypeDB::bind_method(_MD("add_button","text","tooltip"),&ButtonArray::add_button,DEFVAL(""));
+ ObjectTypeDB::bind_method(_MD("add_icon_button","icon:Texture","text","tooltip"),&ButtonArray::add_icon_button,DEFVAL(""),DEFVAL(""));
ObjectTypeDB::bind_method(_MD("set_button_text","button_idx","text"),&ButtonArray::set_button_text);
+ ObjectTypeDB::bind_method(_MD("set_button_tooltip","button_idx","text"),&ButtonArray::set_button_tooltip);
ObjectTypeDB::bind_method(_MD("set_button_icon","button_idx","icon:Texture"),&ButtonArray::set_button_icon);
ObjectTypeDB::bind_method(_MD("get_button_text","button_idx"),&ButtonArray::get_button_text);
+ ObjectTypeDB::bind_method(_MD("get_button_tooltip","button_idx"),&ButtonArray::get_button_tooltip);
ObjectTypeDB::bind_method(_MD("get_button_icon:Texture","button_idx"),&ButtonArray::get_button_icon);
ObjectTypeDB::bind_method(_MD("get_button_count"),&ButtonArray::get_button_count);
ObjectTypeDB::bind_method(_MD("get_selected"),&ButtonArray::get_selected);
diff --git a/scene/gui/button_array.h b/scene/gui/button_array.h
index c4b9b0c9e..62997a8e3 100644
--- a/scene/gui/button_array.h
+++ b/scene/gui/button_array.h
@@ -50,6 +50,7 @@ private:
struct Button {
String text;
+ String tooltip;
Ref<Texture> icon;
mutable int _ms_cache;
mutable int _pos_cache;
@@ -78,14 +79,16 @@ public:
void set_align(Align p_align);
Align get_align() const;
- void add_button(const String& p_button);
- void add_icon_button(const Ref<Texture>& p_icon,const String& p_button="");
+ void add_button(const String& p_button,const String& p_tooltip="");
+ void add_icon_button(const Ref<Texture>& p_icon,const String& p_button="",const String& p_tooltip="");
void set_button_text(int p_button, const String& p_text);
+ void set_button_tooltip(int p_button, const String& p_text);
void set_button_icon(int p_button, const Ref<Texture>& p_icon);
String get_button_text(int p_button) const;
+ String get_button_tooltip(int p_button) const;
Ref<Texture> get_button_icon(int p_button) const;
int get_selected() const;
@@ -100,6 +103,7 @@ public:
virtual Size2 get_minimum_size() const;
virtual void get_translatable_strings(List<String> *p_strings) const;
+ virtual String get_tooltip(const Point2& p_pos) const;
ButtonArray(Orientation p_orientation=HORIZONTAL);
diff --git a/scene/gui/button_group.cpp b/scene/gui/button_group.cpp
index 04ba5fc06..5d9f290f7 100644
--- a/scene/gui/button_group.cpp
+++ b/scene/gui/button_group.cpp
@@ -60,6 +60,9 @@ void ButtonGroup::_pressed(Object *p_button) {
BaseButton *bb=E->get();
bb->set_pressed( b==bb );
+ if (b==bb){
+ emit_signal("button_selected", b);
+ }
}
}
@@ -153,6 +156,7 @@ void ButtonGroup::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_pressed"),&ButtonGroup::_pressed);
ObjectTypeDB::bind_method(_MD("set_pressed_button","button:BaseButton"),&ButtonGroup::_pressed);
+ ADD_SIGNAL( MethodInfo("button_selected",PropertyInfo(Variant::OBJECT,"button",PROPERTY_HINT_RESOURCE_TYPE,"BaseButton")));
}
ButtonGroup::ButtonGroup() : BoxContainer(true)
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 15ff334c9..b8c5f227c 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -232,6 +232,8 @@ String AcceptDialog::get_text() const {
void AcceptDialog::set_text(String p_text) {
label->set_text(p_text);
+ minimum_size_changed();
+ _update_child_rect();
}
void AcceptDialog::set_hide_on_ok(bool p_hide) {
@@ -253,38 +255,51 @@ void AcceptDialog::register_text_enter(Node *p_line_edit) {
void AcceptDialog::_update_child_rect() {
- int margin = get_constant("margin","Dialogs");
- Size2 size = get_size();
+ const int margin = get_constant("margin","Dialogs");
+ const Size2 size = get_size();
Size2 hminsize = hbc->get_combined_minimum_size();
- Vector2 cpos(margin,margin);
- Vector2 csize(size.x-margin*2,size.y-margin*3-hminsize.y);
+ const Size2 max_csize(
+ size.width - margin * 2,
+ size.height - margin * 3 - hminsize.height);
+ hminsize.width = max_csize.width;
+
+ Point2 cpos(margin, margin);
+ Size2 csize = label->get_combined_minimum_size();
+ if(label->get_text().empty())
+ csize.y = 0;
+ csize.x = MIN(csize.width, max_csize.width);
+ csize.y = MIN(csize.height, max_csize.height);
label->set_pos(cpos);
label->set_size(csize);
- if (child) {
+ if(child) {
+ const float child_y_offset = csize.height + (csize.height > 0 ? margin : 0);
+ cpos.y += child_y_offset;
+ csize = max_csize;
+ csize.height -= child_y_offset;
child->set_pos(cpos);
child->set_size(csize);
}
- cpos.y+=csize.y+margin;
- csize.y=hminsize.y;
+ cpos.y += csize.height + margin;
hbc->set_pos(cpos);
- hbc->set_size(csize);
-
+ hbc->set_size(hminsize);
}
Size2 AcceptDialog::get_minimum_size() const {
int margin = get_constant("margin","Dialogs");
Size2 minsize = label->get_combined_minimum_size();
+ if(label->get_text().empty())
+ minsize.y = 0;
if (child) {
Size2 cminsize = child->get_combined_minimum_size();
minsize.x=MAX(cminsize.x,minsize.x);
- minsize.y=MAX(cminsize.y,minsize.y);
+ minsize.y += cminsize.y + (minsize.y > 0 ? margin : 0);
}
Size2 hminsize = hbc->get_combined_minimum_size();
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index acc3ec3b2..6366b5ee2 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -254,6 +254,7 @@ void GraphEdit::add_child_notify(Node *p_child) {
gn->set_scale(Vector2(zoom,zoom));
gn->connect("offset_changed",this,"_graph_node_moved",varray(gn));
gn->connect("raise_request",this,"_graph_node_raised",varray(gn));
+ gn->connect("item_rect_changed",connections_layer,"update");
_graph_node_moved(gn);
gn->set_stop_mouse(false);
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index a68d3c13a..f1a2823e8 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -693,6 +693,8 @@ void TextEdit::_notification(int p_what) {
// get the highlighted words
String highlighted_text = get_selection_text();
+ String line_num_padding = line_numbers_zero_padded ? "0" : " ";
+
for (int i=0;i<visible_rows;i++) {
int line=i+cursor.line_ofs;
@@ -758,7 +760,7 @@ void TextEdit::_notification(int p_what) {
if (cache.line_number_w) {
String fc = String::num(line+1);
while (fc.length() < line_number_char_count) {
- fc="0"+fc;
+ fc=line_num_padding+fc;
}
cache.font->draw(ci,Point2(cache.style_normal->get_margin(MARGIN_LEFT)+cache.breakpoint_gutter_width,ofs_y+cache.font->get_ascent()),fc,cache.line_number_color);
@@ -4520,6 +4522,12 @@ void TextEdit::set_show_line_numbers(bool p_show) {
update();
}
+void TextEdit::set_line_numbers_zero_padded(bool p_zero_padded) {
+
+ line_numbers_zero_padded=p_zero_padded;
+ update();
+}
+
bool TextEdit::is_show_line_numbers_enabled() const {
return line_numbers;
}
@@ -4811,6 +4819,7 @@ TextEdit::TextEdit() {
completion_line_ofs=0;
tooltip_obj=NULL;
line_numbers=false;
+ line_numbers_zero_padded=false;
line_length_guideline=false;
line_length_guideline_col=80;
draw_breakpoint_gutter=false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index e6401e2b9..7820fefdd 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -232,6 +232,7 @@ class TextEdit : public Control {
bool text_changed_dirty;
bool undo_enabled;
bool line_numbers;
+ bool line_numbers_zero_padded;
bool line_length_guideline;
int line_length_guideline_col;
bool draw_breakpoint_gutter;
@@ -489,6 +490,8 @@ public:
void set_show_line_numbers(bool p_show);
bool is_show_line_numbers_enabled() const;
+ void set_line_numbers_zero_padded(bool p_zero_padded);
+
void set_show_line_length_guideline(bool p_show);
void set_line_length_guideline_column(int p_column);
diff --git a/thirdparty/README.md b/thirdparty/README.md
new file mode 100644
index 000000000..f073bef8e
--- /dev/null
+++ b/thirdparty/README.md
@@ -0,0 +1,218 @@
+# Third party libraries
+
+
+## enet
+
+- Upstream: http://enet.bespin.org
+- Version: 1.3.13
+- License: MIT
+
+Files extracted from upstream source:
+
+- all .c files in the main directory
+- the include/enet/ folder as enet/
+- LICENSE file
+
+Important: Some files have been modified by Godot developers so that they work
+for all platforms (especially WinRT). Check the diff with the 1.3.13 tarball
+before the next update.
+
+
+## freetype
+
+- Upstream: https://www.freetype.org
+- Version: 2.6.5
+- License: FreeType License (BSD-like)
+
+Files extracted from upstream source:
+
+- the src/ folder, stripped of the `Jamfile` files
+- the include/ folder
+- `docs/{FTL.TXT,LICENSE.TXT}`
+
+
+## glew
+
+- Upstream: http://glew.sourceforge.net
+- Version: 1.13.0
+- License: BSD-3-Clause
+
+Files extracted from upstream source:
+
+- `src/glew.c`
+- include/GL/ as GL/
+- LICENSE.txt
+
+
+## jpeg-compressor
+
+- Upstream: https://github.com/richgel999/jpeg-compressor
+- Version: 1.04
+- License: Public domain
+
+Files extracted from upstream source:
+
+- `jpgd.{c,h}`
+
+
+## libmpcdec
+
+- Upstream: https://www.musepack.net
+- Version: SVN somewhere between SV7 and SV8 (r475)
+- License: BSD-3-Clause
+
+Files extracted from upstream source:
+
+- all .c and .h files in libmpcdec/
+- include/mpc as mpc/
+- COPYING from libmpcdec/
+
+
+## libogg
+
+- Upstream: https://www.xiph.org/ogg
+- Version: 1.3.2
+- License: BSD-3-Clause
+
+Files extracted from upstream source:
+
+- `src/*.c`
+- `include/ogg/*.h` in ogg/
+- COPYING
+
+
+## libpng
+
+- Upstream: http://libpng.org/pub/png/libpng.html
+- Version: 1.6.23
+- License: libpng/zlib
+
+Files extracted from upstream source:
+
+- all .c and .h files of the main directory, except from
+ `example.c` and `pngtest.c`
+- the arm/ folder
+- `scripts/pnglibconf.h.prebuilt` as `pnglibconf.h`
+
+
+## libvorbis
+
+- Upstream: https://www.xiph.org/vorbis
+- Version: 1.3.5
+- License: BSD-3-Clause
+
+Files extracted from upstream source:
+
+- `src/*` except from: `lookups.pl`, `Makefile.*`
+- `include/vorbis/*.h` as vorbis/
+- COPYING
+
+
+## libwebp
+
+- Upstream: https://chromium.googlesource.com/webm/libwebp/
+- Version: 0.5.1
+- License: BSD-3-Clause
+
+Files extracted from upstream source:
+
+- `src/*` except from: .am and .in, files, extras/, `webp/extras.h`
+- AUTHORS, COPYING, PATENTS
+
+Important: The files `utils/bit_reader.{c,h}` have Godot-made
+changes to ensure they build for Javascript/HTML5. Those
+changes are marked with `// -- GODOT --` comments.
+
+
+## openssl
+
+- Upstream: https://www.openssl.org
+- Version: 1.2.0h
+- License: OpenSSL license / BSD-like
+
+Files extracted from the upstream source:
+
+TODO.
+
+
+## opus
+
+- Upstream: https://opus-codec.org
+- Version: 1.1.2 (opus) and 0.7 (opusfile)
+- License: BSD-3-Clause
+
+Files extracted from upstream source:
+
+- all .c and .h files in src/ (both opus and opusfile),
+ except `opus_demo.c`
+- all .h files in include/ (both opus and opusfile)
+- COPYING
+
+
+## pvrtccompressor
+
+- Upstream: https://bitbucket.org/jthlim/pvrtccompressor
+- Version: hg commit cf71777 - 2015-01-08
+- License: BSD-3-Clause
+
+Files extracted from upstream source:
+
+- all .cpp and .h files apart from `main.cpp`
+- LICENSE.TXT
+
+
+## rg-etc1
+
+- Upstream: https://github.com/richgel999/rg-etc1
+- Version: 1.04
+- License: zlib
+
+Files extracted from upstream source:
+
+- `rg_etc1.{cpp,h}`
+
+
+## rtaudio
+
+- Upstream: http://www.music.mcgill.ca/~gary/rtaudio/
+- Version: 4.1.2
+- License: MIT-like
+
+Files extracted from upstream source:
+
+- `RtAudio.{cpp,h}`
+
+
+## squish
+
+- Upstream: https://sourceforge.net/projects/libsquish
+- Version: 1.14
+- License: MIT
+
+Files extracted from upstream source:
+
+- all .cpp, .h and .inl files
+
+
+## theora
+
+- Upstream: https://www.theora.org
+- Version: 1.1.1
+- License: BSD-3-Clause
+
+Files extracted from upstream source:
+
+- all .c, .h in lib/
+- all .h files in include/theora/ as theora/
+- COPYING and LICENSE
+
+
+## zlib
+
+- Upstream: http://www.zlib.net/
+- Version: 1.2.8
+- License: zlib
+
+Files extracted from upstream source:
+
+- all .c and .h files apart from `gz*`
diff --git a/thirdparty/enet/LICENSE b/thirdparty/enet/LICENSE
new file mode 100644
index 000000000..39af84a8f
--- /dev/null
+++ b/thirdparty/enet/LICENSE
@@ -0,0 +1,7 @@
+Copyright (c) 2002-2016 Lee Salzman
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/modules/enet/callbacks.c b/thirdparty/enet/callbacks.c
index b3990af1f..b3990af1f 100644
--- a/modules/enet/callbacks.c
+++ b/thirdparty/enet/callbacks.c
diff --git a/modules/enet/compress.c b/thirdparty/enet/compress.c
index 784489a78..784489a78 100644
--- a/modules/enet/compress.c
+++ b/thirdparty/enet/compress.c
diff --git a/modules/enet/enet/callbacks.h b/thirdparty/enet/enet/callbacks.h
index 340a4a989..340a4a989 100644
--- a/modules/enet/enet/callbacks.h
+++ b/thirdparty/enet/enet/callbacks.h
diff --git a/modules/enet/enet/enet.h b/thirdparty/enet/enet/enet.h
index 650b199ee..650b199ee 100644
--- a/modules/enet/enet/enet.h
+++ b/thirdparty/enet/enet/enet.h
diff --git a/modules/enet/enet/list.h b/thirdparty/enet/enet/list.h
index d7b260084..d7b260084 100644
--- a/modules/enet/enet/list.h
+++ b/thirdparty/enet/enet/list.h
diff --git a/modules/enet/enet/protocol.h b/thirdparty/enet/enet/protocol.h
index f8c73d8a6..f8c73d8a6 100644
--- a/modules/enet/enet/protocol.h
+++ b/thirdparty/enet/enet/protocol.h
diff --git a/modules/enet/enet/time.h b/thirdparty/enet/enet/time.h
index c82a54603..c82a54603 100644
--- a/modules/enet/enet/time.h
+++ b/thirdparty/enet/enet/time.h
diff --git a/modules/enet/enet/types.h b/thirdparty/enet/enet/types.h
index ab010a4b1..ab010a4b1 100644
--- a/modules/enet/enet/types.h
+++ b/thirdparty/enet/enet/types.h
diff --git a/modules/enet/enet/unix.h b/thirdparty/enet/enet/unix.h
index a59e34060..a59e34060 100644
--- a/modules/enet/enet/unix.h
+++ b/thirdparty/enet/enet/unix.h
diff --git a/modules/enet/enet/utility.h b/thirdparty/enet/enet/utility.h
index e48a476be..e48a476be 100644
--- a/modules/enet/enet/utility.h
+++ b/thirdparty/enet/enet/utility.h
diff --git a/modules/enet/enet/win32.h b/thirdparty/enet/enet/win32.h
index e73ca9d05..e73ca9d05 100644
--- a/modules/enet/enet/win32.h
+++ b/thirdparty/enet/enet/win32.h
diff --git a/modules/enet/host.c b/thirdparty/enet/host.c
index 3be6c0922..3be6c0922 100644
--- a/modules/enet/host.c
+++ b/thirdparty/enet/host.c
diff --git a/modules/enet/list.c b/thirdparty/enet/list.c
index 1c1a8dfaa..1c1a8dfaa 100644
--- a/modules/enet/list.c
+++ b/thirdparty/enet/list.c
diff --git a/modules/enet/packet.c b/thirdparty/enet/packet.c
index 5fa78b28a..5fa78b28a 100644
--- a/modules/enet/packet.c
+++ b/thirdparty/enet/packet.c
diff --git a/modules/enet/peer.c b/thirdparty/enet/peer.c
index e2d0872bd..e2d0872bd 100644
--- a/modules/enet/peer.c
+++ b/thirdparty/enet/peer.c
diff --git a/modules/enet/protocol.c b/thirdparty/enet/protocol.c
index 4a2a4ed18..4a2a4ed18 100644
--- a/modules/enet/protocol.c
+++ b/thirdparty/enet/protocol.c
diff --git a/modules/enet/unix.c b/thirdparty/enet/unix.c
index 3138cc04b..3138cc04b 100644
--- a/modules/enet/unix.c
+++ b/thirdparty/enet/unix.c
diff --git a/modules/enet/win32.c b/thirdparty/enet/win32.c
index 15edd7acb..15edd7acb 100644
--- a/modules/enet/win32.c
+++ b/thirdparty/enet/win32.c
diff --git a/drivers/freetype/FTL.TXT b/thirdparty/freetype/FTL.TXT
index 433ab060e..433ab060e 100644
--- a/drivers/freetype/FTL.TXT
+++ b/thirdparty/freetype/FTL.TXT
diff --git a/drivers/freetype/LICENSE.TXT b/thirdparty/freetype/LICENSE.TXT
index af5a1c50f..af5a1c50f 100644
--- a/drivers/freetype/LICENSE.TXT
+++ b/thirdparty/freetype/LICENSE.TXT
diff --git a/drivers/freetype/include/freetype/config/ftconfig.h b/thirdparty/freetype/include/freetype/config/ftconfig.h
index 157a704fa..157a704fa 100644
--- a/drivers/freetype/include/freetype/config/ftconfig.h
+++ b/thirdparty/freetype/include/freetype/config/ftconfig.h
diff --git a/drivers/freetype/include/freetype/config/ftheader.h b/thirdparty/freetype/include/freetype/config/ftheader.h
index 68e14834d..68e14834d 100644
--- a/drivers/freetype/include/freetype/config/ftheader.h
+++ b/thirdparty/freetype/include/freetype/config/ftheader.h
diff --git a/drivers/freetype/include/freetype/config/ftmodule.h b/thirdparty/freetype/include/freetype/config/ftmodule.h
index 76d271a74..76d271a74 100644
--- a/drivers/freetype/include/freetype/config/ftmodule.h
+++ b/thirdparty/freetype/include/freetype/config/ftmodule.h
diff --git a/drivers/freetype/include/freetype/config/ftoption.h b/thirdparty/freetype/include/freetype/config/ftoption.h
index afd32f1cd..afd32f1cd 100644
--- a/drivers/freetype/include/freetype/config/ftoption.h
+++ b/thirdparty/freetype/include/freetype/config/ftoption.h
diff --git a/drivers/freetype/include/freetype/config/ftstdlib.h b/thirdparty/freetype/include/freetype/config/ftstdlib.h
index 562e25581..562e25581 100644
--- a/drivers/freetype/include/freetype/config/ftstdlib.h
+++ b/thirdparty/freetype/include/freetype/config/ftstdlib.h
diff --git a/drivers/freetype/include/freetype/freetype.h b/thirdparty/freetype/include/freetype/freetype.h
index 45e10c48a..45e10c48a 100644
--- a/drivers/freetype/include/freetype/freetype.h
+++ b/thirdparty/freetype/include/freetype/freetype.h
diff --git a/drivers/freetype/include/freetype/ftadvanc.h b/thirdparty/freetype/include/freetype/ftadvanc.h
index 023dd84b7..023dd84b7 100644
--- a/drivers/freetype/include/freetype/ftadvanc.h
+++ b/thirdparty/freetype/include/freetype/ftadvanc.h
diff --git a/drivers/freetype/include/freetype/ftautoh.h b/thirdparty/freetype/include/freetype/ftautoh.h
index 40c8003c4..40c8003c4 100644
--- a/drivers/freetype/include/freetype/ftautoh.h
+++ b/thirdparty/freetype/include/freetype/ftautoh.h
diff --git a/drivers/freetype/include/freetype/ftbbox.h b/thirdparty/freetype/include/freetype/ftbbox.h
index 2a4d21441..2a4d21441 100644
--- a/drivers/freetype/include/freetype/ftbbox.h
+++ b/thirdparty/freetype/include/freetype/ftbbox.h
diff --git a/drivers/freetype/include/freetype/ftbdf.h b/thirdparty/freetype/include/freetype/ftbdf.h
index 016dba086..016dba086 100644
--- a/drivers/freetype/include/freetype/ftbdf.h
+++ b/thirdparty/freetype/include/freetype/ftbdf.h
diff --git a/drivers/freetype/include/freetype/ftbitmap.h b/thirdparty/freetype/include/freetype/ftbitmap.h
index 0eac7b9d7..0eac7b9d7 100644
--- a/drivers/freetype/include/freetype/ftbitmap.h
+++ b/thirdparty/freetype/include/freetype/ftbitmap.h
diff --git a/drivers/freetype/include/freetype/ftbzip2.h b/thirdparty/freetype/include/freetype/ftbzip2.h
index b7f2eee87..b7f2eee87 100644
--- a/drivers/freetype/include/freetype/ftbzip2.h
+++ b/thirdparty/freetype/include/freetype/ftbzip2.h
diff --git a/drivers/freetype/include/freetype/ftcache.h b/thirdparty/freetype/include/freetype/ftcache.h
index 883c88d5d..883c88d5d 100644
--- a/drivers/freetype/include/freetype/ftcache.h
+++ b/thirdparty/freetype/include/freetype/ftcache.h
diff --git a/drivers/freetype/include/freetype/ftcffdrv.h b/thirdparty/freetype/include/freetype/ftcffdrv.h
index ad34541fd..ad34541fd 100644
--- a/drivers/freetype/include/freetype/ftcffdrv.h
+++ b/thirdparty/freetype/include/freetype/ftcffdrv.h
diff --git a/drivers/freetype/include/freetype/ftchapters.h b/thirdparty/freetype/include/freetype/ftchapters.h
index ab4389530..ab4389530 100644
--- a/drivers/freetype/include/freetype/ftchapters.h
+++ b/thirdparty/freetype/include/freetype/ftchapters.h
diff --git a/drivers/freetype/include/freetype/ftcid.h b/thirdparty/freetype/include/freetype/ftcid.h
index e1bc9fe01..e1bc9fe01 100644
--- a/drivers/freetype/include/freetype/ftcid.h
+++ b/thirdparty/freetype/include/freetype/ftcid.h
diff --git a/drivers/freetype/include/freetype/fterrdef.h b/thirdparty/freetype/include/freetype/fterrdef.h
index 3f53dd582..3f53dd582 100644
--- a/drivers/freetype/include/freetype/fterrdef.h
+++ b/thirdparty/freetype/include/freetype/fterrdef.h
diff --git a/drivers/freetype/include/freetype/fterrors.h b/thirdparty/freetype/include/freetype/fterrors.h
index e15bfb001..e15bfb001 100644
--- a/drivers/freetype/include/freetype/fterrors.h
+++ b/thirdparty/freetype/include/freetype/fterrors.h
diff --git a/drivers/freetype/include/freetype/ftfntfmt.h b/thirdparty/freetype/include/freetype/ftfntfmt.h
index bd423247b..bd423247b 100644
--- a/drivers/freetype/include/freetype/ftfntfmt.h
+++ b/thirdparty/freetype/include/freetype/ftfntfmt.h
diff --git a/drivers/freetype/include/freetype/ftgasp.h b/thirdparty/freetype/include/freetype/ftgasp.h
index 3f5b3bc69..3f5b3bc69 100644
--- a/drivers/freetype/include/freetype/ftgasp.h
+++ b/thirdparty/freetype/include/freetype/ftgasp.h
diff --git a/drivers/freetype/include/freetype/ftglyph.h b/thirdparty/freetype/include/freetype/ftglyph.h
index d9840a81f..d9840a81f 100644
--- a/drivers/freetype/include/freetype/ftglyph.h
+++ b/thirdparty/freetype/include/freetype/ftglyph.h
diff --git a/drivers/freetype/include/freetype/ftgxval.h b/thirdparty/freetype/include/freetype/ftgxval.h
index a58e86a04..a58e86a04 100644
--- a/drivers/freetype/include/freetype/ftgxval.h
+++ b/thirdparty/freetype/include/freetype/ftgxval.h
diff --git a/drivers/freetype/include/freetype/ftgzip.h b/thirdparty/freetype/include/freetype/ftgzip.h
index 3932ce688..3932ce688 100644
--- a/drivers/freetype/include/freetype/ftgzip.h
+++ b/thirdparty/freetype/include/freetype/ftgzip.h
diff --git a/drivers/freetype/include/freetype/ftimage.h b/thirdparty/freetype/include/freetype/ftimage.h
index 28b2704e8..28b2704e8 100644
--- a/drivers/freetype/include/freetype/ftimage.h
+++ b/thirdparty/freetype/include/freetype/ftimage.h
diff --git a/drivers/freetype/include/freetype/ftincrem.h b/thirdparty/freetype/include/freetype/ftincrem.h
index 46b58b791..46b58b791 100644
--- a/drivers/freetype/include/freetype/ftincrem.h
+++ b/thirdparty/freetype/include/freetype/ftincrem.h
diff --git a/drivers/freetype/include/freetype/ftlcdfil.h b/thirdparty/freetype/include/freetype/ftlcdfil.h
index e06a8957f..e06a8957f 100644
--- a/drivers/freetype/include/freetype/ftlcdfil.h
+++ b/thirdparty/freetype/include/freetype/ftlcdfil.h
diff --git a/drivers/freetype/include/freetype/ftlist.h b/thirdparty/freetype/include/freetype/ftlist.h
index 82f437ac6..82f437ac6 100644
--- a/drivers/freetype/include/freetype/ftlist.h
+++ b/thirdparty/freetype/include/freetype/ftlist.h
diff --git a/drivers/freetype/include/freetype/ftlzw.h b/thirdparty/freetype/include/freetype/ftlzw.h
index 582e2c146..582e2c146 100644
--- a/drivers/freetype/include/freetype/ftlzw.h
+++ b/thirdparty/freetype/include/freetype/ftlzw.h
diff --git a/drivers/freetype/include/freetype/ftmac.h b/thirdparty/freetype/include/freetype/ftmac.h
index adb15cadf..adb15cadf 100644
--- a/drivers/freetype/include/freetype/ftmac.h
+++ b/thirdparty/freetype/include/freetype/ftmac.h
diff --git a/drivers/freetype/include/freetype/ftmm.h b/thirdparty/freetype/include/freetype/ftmm.h
index 6c05f0c39..6c05f0c39 100644
--- a/drivers/freetype/include/freetype/ftmm.h
+++ b/thirdparty/freetype/include/freetype/ftmm.h
diff --git a/drivers/freetype/include/freetype/ftmodapi.h b/thirdparty/freetype/include/freetype/ftmodapi.h
index b4d2758ef..b4d2758ef 100644
--- a/drivers/freetype/include/freetype/ftmodapi.h
+++ b/thirdparty/freetype/include/freetype/ftmodapi.h
diff --git a/drivers/freetype/include/freetype/ftmoderr.h b/thirdparty/freetype/include/freetype/ftmoderr.h
index 2a7671c81..2a7671c81 100644
--- a/drivers/freetype/include/freetype/ftmoderr.h
+++ b/thirdparty/freetype/include/freetype/ftmoderr.h
diff --git a/drivers/freetype/include/freetype/ftotval.h b/thirdparty/freetype/include/freetype/ftotval.h
index 3e6e18d8a..3e6e18d8a 100644
--- a/drivers/freetype/include/freetype/ftotval.h
+++ b/thirdparty/freetype/include/freetype/ftotval.h
diff --git a/drivers/freetype/include/freetype/ftoutln.h b/thirdparty/freetype/include/freetype/ftoutln.h
index 6a6451207..6a6451207 100644
--- a/drivers/freetype/include/freetype/ftoutln.h
+++ b/thirdparty/freetype/include/freetype/ftoutln.h
diff --git a/drivers/freetype/include/freetype/ftpfr.h b/thirdparty/freetype/include/freetype/ftpfr.h
index 2e1bff2f6..2e1bff2f6 100644
--- a/drivers/freetype/include/freetype/ftpfr.h
+++ b/thirdparty/freetype/include/freetype/ftpfr.h
diff --git a/drivers/freetype/include/freetype/ftrender.h b/thirdparty/freetype/include/freetype/ftrender.h
index 9f7ed9e9d..9f7ed9e9d 100644
--- a/drivers/freetype/include/freetype/ftrender.h
+++ b/thirdparty/freetype/include/freetype/ftrender.h
diff --git a/drivers/freetype/include/freetype/ftsizes.h b/thirdparty/freetype/include/freetype/ftsizes.h
index 55e0d5ccf..55e0d5ccf 100644
--- a/drivers/freetype/include/freetype/ftsizes.h
+++ b/thirdparty/freetype/include/freetype/ftsizes.h
diff --git a/drivers/freetype/include/freetype/ftsnames.h b/thirdparty/freetype/include/freetype/ftsnames.h
index a7b51c2cb..a7b51c2cb 100644
--- a/drivers/freetype/include/freetype/ftsnames.h
+++ b/thirdparty/freetype/include/freetype/ftsnames.h
diff --git a/drivers/freetype/include/freetype/ftstroke.h b/thirdparty/freetype/include/freetype/ftstroke.h
index b3b9922da..b3b9922da 100644
--- a/drivers/freetype/include/freetype/ftstroke.h
+++ b/thirdparty/freetype/include/freetype/ftstroke.h
diff --git a/drivers/freetype/include/freetype/ftsynth.h b/thirdparty/freetype/include/freetype/ftsynth.h
index fdfcb6912..fdfcb6912 100644
--- a/drivers/freetype/include/freetype/ftsynth.h
+++ b/thirdparty/freetype/include/freetype/ftsynth.h
diff --git a/drivers/freetype/include/freetype/ftsystem.h b/thirdparty/freetype/include/freetype/ftsystem.h
index a75f95802..a75f95802 100644
--- a/drivers/freetype/include/freetype/ftsystem.h
+++ b/thirdparty/freetype/include/freetype/ftsystem.h
diff --git a/drivers/freetype/include/freetype/fttrigon.h b/thirdparty/freetype/include/freetype/fttrigon.h
index f789b524c..f789b524c 100644
--- a/drivers/freetype/include/freetype/fttrigon.h
+++ b/thirdparty/freetype/include/freetype/fttrigon.h
diff --git a/drivers/freetype/include/freetype/ftttdrv.h b/thirdparty/freetype/include/freetype/ftttdrv.h
index 0d868bc25..0d868bc25 100644
--- a/drivers/freetype/include/freetype/ftttdrv.h
+++ b/thirdparty/freetype/include/freetype/ftttdrv.h
diff --git a/drivers/freetype/include/freetype/fttypes.h b/thirdparty/freetype/include/freetype/fttypes.h
index 2673e79c3..2673e79c3 100644
--- a/drivers/freetype/include/freetype/fttypes.h
+++ b/thirdparty/freetype/include/freetype/fttypes.h
diff --git a/drivers/freetype/include/freetype/ftwinfnt.h b/thirdparty/freetype/include/freetype/ftwinfnt.h
index a1a715baa..a1a715baa 100644
--- a/drivers/freetype/include/freetype/ftwinfnt.h
+++ b/thirdparty/freetype/include/freetype/ftwinfnt.h
diff --git a/drivers/freetype/include/freetype/internal/autohint.h b/thirdparty/freetype/include/freetype/internal/autohint.h
index 7ef82b8f3..7ef82b8f3 100644
--- a/drivers/freetype/include/freetype/internal/autohint.h
+++ b/thirdparty/freetype/include/freetype/internal/autohint.h
diff --git a/drivers/freetype/include/freetype/internal/ftcalc.h b/thirdparty/freetype/include/freetype/internal/ftcalc.h
index 8a884f680..8a884f680 100644
--- a/drivers/freetype/include/freetype/internal/ftcalc.h
+++ b/thirdparty/freetype/include/freetype/internal/ftcalc.h
diff --git a/drivers/freetype/include/freetype/internal/ftdebug.h b/thirdparty/freetype/include/freetype/internal/ftdebug.h
index d11045715..d11045715 100644
--- a/drivers/freetype/include/freetype/internal/ftdebug.h
+++ b/thirdparty/freetype/include/freetype/internal/ftdebug.h
diff --git a/drivers/freetype/include/freetype/internal/ftdriver.h b/thirdparty/freetype/include/freetype/internal/ftdriver.h
index 3e1e66e97..3e1e66e97 100644
--- a/drivers/freetype/include/freetype/internal/ftdriver.h
+++ b/thirdparty/freetype/include/freetype/internal/ftdriver.h
diff --git a/drivers/freetype/include/freetype/internal/ftgloadr.h b/thirdparty/freetype/include/freetype/internal/ftgloadr.h
index bebf5dbba..bebf5dbba 100644
--- a/drivers/freetype/include/freetype/internal/ftgloadr.h
+++ b/thirdparty/freetype/include/freetype/internal/ftgloadr.h
diff --git a/drivers/freetype/include/freetype/internal/fthash.h b/thirdparty/freetype/include/freetype/internal/fthash.h
index f22f9d5d3..f22f9d5d3 100644
--- a/drivers/freetype/include/freetype/internal/fthash.h
+++ b/thirdparty/freetype/include/freetype/internal/fthash.h
diff --git a/drivers/freetype/include/freetype/internal/ftmemory.h b/thirdparty/freetype/include/freetype/internal/ftmemory.h
index 8c06fc21a..8c06fc21a 100644
--- a/drivers/freetype/include/freetype/internal/ftmemory.h
+++ b/thirdparty/freetype/include/freetype/internal/ftmemory.h
diff --git a/drivers/freetype/include/freetype/internal/ftobjs.h b/thirdparty/freetype/include/freetype/internal/ftobjs.h
index e3fa32083..e3fa32083 100644
--- a/drivers/freetype/include/freetype/internal/ftobjs.h
+++ b/thirdparty/freetype/include/freetype/internal/ftobjs.h
diff --git a/drivers/freetype/include/freetype/internal/ftpic.h b/thirdparty/freetype/include/freetype/internal/ftpic.h
index 6d800a08a..6d800a08a 100644
--- a/drivers/freetype/include/freetype/internal/ftpic.h
+++ b/thirdparty/freetype/include/freetype/internal/ftpic.h
diff --git a/drivers/freetype/include/freetype/internal/ftrfork.h b/thirdparty/freetype/include/freetype/internal/ftrfork.h
index b923401e6..b923401e6 100644
--- a/drivers/freetype/include/freetype/internal/ftrfork.h
+++ b/thirdparty/freetype/include/freetype/internal/ftrfork.h
diff --git a/drivers/freetype/include/freetype/internal/ftserv.h b/thirdparty/freetype/include/freetype/internal/ftserv.h
index 91897177b..91897177b 100644
--- a/drivers/freetype/include/freetype/internal/ftserv.h
+++ b/thirdparty/freetype/include/freetype/internal/ftserv.h
diff --git a/drivers/freetype/include/freetype/internal/ftstream.h b/thirdparty/freetype/include/freetype/internal/ftstream.h
index 6d0487565..6d0487565 100644
--- a/drivers/freetype/include/freetype/internal/ftstream.h
+++ b/thirdparty/freetype/include/freetype/internal/ftstream.h
diff --git a/drivers/freetype/include/freetype/internal/fttrace.h b/thirdparty/freetype/include/freetype/internal/fttrace.h
index efb335595..efb335595 100644
--- a/drivers/freetype/include/freetype/internal/fttrace.h
+++ b/thirdparty/freetype/include/freetype/internal/fttrace.h
diff --git a/drivers/freetype/include/freetype/internal/ftvalid.h b/thirdparty/freetype/include/freetype/internal/ftvalid.h
index aac92c9af..aac92c9af 100644
--- a/drivers/freetype/include/freetype/internal/ftvalid.h
+++ b/thirdparty/freetype/include/freetype/internal/ftvalid.h
diff --git a/drivers/freetype/include/freetype/internal/internal.h b/thirdparty/freetype/include/freetype/internal/internal.h
index 8c3c14c12..8c3c14c12 100644
--- a/drivers/freetype/include/freetype/internal/internal.h
+++ b/thirdparty/freetype/include/freetype/internal/internal.h
diff --git a/drivers/freetype/include/freetype/internal/psaux.h b/thirdparty/freetype/include/freetype/internal/psaux.h
index 15dedfd28..15dedfd28 100644
--- a/drivers/freetype/include/freetype/internal/psaux.h
+++ b/thirdparty/freetype/include/freetype/internal/psaux.h
diff --git a/drivers/freetype/include/freetype/internal/pshints.h b/thirdparty/freetype/include/freetype/internal/pshints.h
index e60dc9cd5..e60dc9cd5 100644
--- a/drivers/freetype/include/freetype/internal/pshints.h
+++ b/thirdparty/freetype/include/freetype/internal/pshints.h
diff --git a/drivers/freetype/include/freetype/internal/services/svbdf.h b/thirdparty/freetype/include/freetype/internal/services/svbdf.h
index c24475fc2..c24475fc2 100644
--- a/drivers/freetype/include/freetype/internal/services/svbdf.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svbdf.h
diff --git a/drivers/freetype/include/freetype/internal/services/svcid.h b/thirdparty/freetype/include/freetype/internal/services/svcid.h
index dbbe6044a..dbbe6044a 100644
--- a/drivers/freetype/include/freetype/internal/services/svcid.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svcid.h
diff --git a/drivers/freetype/include/freetype/internal/services/svfntfmt.h b/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
index bd295c9c6..bd295c9c6 100644
--- a/drivers/freetype/include/freetype/internal/services/svfntfmt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
diff --git a/drivers/freetype/include/freetype/internal/services/svgldict.h b/thirdparty/freetype/include/freetype/internal/services/svgldict.h
index fff29bc40..fff29bc40 100644
--- a/drivers/freetype/include/freetype/internal/services/svgldict.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svgldict.h
diff --git a/drivers/freetype/include/freetype/internal/services/svgxval.h b/thirdparty/freetype/include/freetype/internal/services/svgxval.h
index fb8ffba83..fb8ffba83 100644
--- a/drivers/freetype/include/freetype/internal/services/svgxval.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svgxval.h
diff --git a/drivers/freetype/include/freetype/internal/services/svkern.h b/thirdparty/freetype/include/freetype/internal/services/svkern.h
index a636f1af1..a636f1af1 100644
--- a/drivers/freetype/include/freetype/internal/services/svkern.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svkern.h
diff --git a/drivers/freetype/include/freetype/internal/services/svmm.h b/thirdparty/freetype/include/freetype/internal/services/svmm.h
index b78a19f8e..b78a19f8e 100644
--- a/drivers/freetype/include/freetype/internal/services/svmm.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svmm.h
diff --git a/drivers/freetype/include/freetype/internal/services/svotval.h b/thirdparty/freetype/include/freetype/internal/services/svotval.h
index bc929d4bd..bc929d4bd 100644
--- a/drivers/freetype/include/freetype/internal/services/svotval.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svotval.h
diff --git a/drivers/freetype/include/freetype/internal/services/svpfr.h b/thirdparty/freetype/include/freetype/internal/services/svpfr.h
index d0f7c4df9..d0f7c4df9 100644
--- a/drivers/freetype/include/freetype/internal/services/svpfr.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpfr.h
diff --git a/drivers/freetype/include/freetype/internal/services/svpostnm.h b/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
index f12438005..f12438005 100644
--- a/drivers/freetype/include/freetype/internal/services/svpostnm.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
diff --git a/drivers/freetype/include/freetype/internal/services/svprop.h b/thirdparty/freetype/include/freetype/internal/services/svprop.h
index 870e90ed7..870e90ed7 100644
--- a/drivers/freetype/include/freetype/internal/services/svprop.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svprop.h
diff --git a/drivers/freetype/include/freetype/internal/services/svpscmap.h b/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
index 9acc21690..9acc21690 100644
--- a/drivers/freetype/include/freetype/internal/services/svpscmap.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
diff --git a/drivers/freetype/include/freetype/internal/services/svpsinfo.h b/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
index f2c806044..f2c806044 100644
--- a/drivers/freetype/include/freetype/internal/services/svpsinfo.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
diff --git a/drivers/freetype/include/freetype/internal/services/svsfnt.h b/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
index 0f38cf195..0f38cf195 100644
--- a/drivers/freetype/include/freetype/internal/services/svsfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
diff --git a/drivers/freetype/include/freetype/internal/services/svttcmap.h b/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
index 772c72189..772c72189 100644
--- a/drivers/freetype/include/freetype/internal/services/svttcmap.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
diff --git a/drivers/freetype/include/freetype/internal/services/svtteng.h b/thirdparty/freetype/include/freetype/internal/services/svtteng.h
index c55061a03..c55061a03 100644
--- a/drivers/freetype/include/freetype/internal/services/svtteng.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svtteng.h
diff --git a/drivers/freetype/include/freetype/internal/services/svttglyf.h b/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
index c33edd46d..c33edd46d 100644
--- a/drivers/freetype/include/freetype/internal/services/svttglyf.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
diff --git a/drivers/freetype/include/freetype/internal/services/svwinfnt.h b/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
index c2f6d4c6d..c2f6d4c6d 100644
--- a/drivers/freetype/include/freetype/internal/services/svwinfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
diff --git a/drivers/freetype/include/freetype/internal/sfnt.h b/thirdparty/freetype/include/freetype/internal/sfnt.h
index e139315a1..e139315a1 100644
--- a/drivers/freetype/include/freetype/internal/sfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/sfnt.h
diff --git a/drivers/freetype/include/freetype/internal/t1types.h b/thirdparty/freetype/include/freetype/internal/t1types.h
index 494c011fc..494c011fc 100644
--- a/drivers/freetype/include/freetype/internal/t1types.h
+++ b/thirdparty/freetype/include/freetype/internal/t1types.h
diff --git a/drivers/freetype/include/freetype/internal/tttypes.h b/thirdparty/freetype/include/freetype/internal/tttypes.h
index 4110d5028..4110d5028 100644
--- a/drivers/freetype/include/freetype/internal/tttypes.h
+++ b/thirdparty/freetype/include/freetype/internal/tttypes.h
diff --git a/drivers/freetype/include/freetype/t1tables.h b/thirdparty/freetype/include/freetype/t1tables.h
index e272324ba..e272324ba 100644
--- a/drivers/freetype/include/freetype/t1tables.h
+++ b/thirdparty/freetype/include/freetype/t1tables.h
diff --git a/drivers/freetype/include/freetype/ttnameid.h b/thirdparty/freetype/include/freetype/ttnameid.h
index ce707f164..ce707f164 100644
--- a/drivers/freetype/include/freetype/ttnameid.h
+++ b/thirdparty/freetype/include/freetype/ttnameid.h
diff --git a/drivers/freetype/include/freetype/tttables.h b/thirdparty/freetype/include/freetype/tttables.h
index 1c075dcf6..1c075dcf6 100644
--- a/drivers/freetype/include/freetype/tttables.h
+++ b/thirdparty/freetype/include/freetype/tttables.h
diff --git a/drivers/freetype/include/freetype/tttags.h b/thirdparty/freetype/include/freetype/tttags.h
index f3c9aa5fc..f3c9aa5fc 100644
--- a/drivers/freetype/include/freetype/tttags.h
+++ b/thirdparty/freetype/include/freetype/tttags.h
diff --git a/drivers/freetype/include/freetype/ttunpat.h b/thirdparty/freetype/include/freetype/ttunpat.h
index ca4676baf..ca4676baf 100644
--- a/drivers/freetype/include/freetype/ttunpat.h
+++ b/thirdparty/freetype/include/freetype/ttunpat.h
diff --git a/drivers/freetype/include/ft2build.h b/thirdparty/freetype/include/ft2build.h
index 1e8a9b499..1e8a9b499 100644
--- a/drivers/freetype/include/ft2build.h
+++ b/thirdparty/freetype/include/ft2build.h
diff --git a/drivers/freetype/src/autofit/afangles.c b/thirdparty/freetype/src/autofit/afangles.c
index b856e57a8..b856e57a8 100644
--- a/drivers/freetype/src/autofit/afangles.c
+++ b/thirdparty/freetype/src/autofit/afangles.c
diff --git a/drivers/freetype/src/autofit/afangles.h b/thirdparty/freetype/src/autofit/afangles.h
index f33f9e108..f33f9e108 100644
--- a/drivers/freetype/src/autofit/afangles.h
+++ b/thirdparty/freetype/src/autofit/afangles.h
diff --git a/drivers/freetype/src/autofit/afblue.c b/thirdparty/freetype/src/autofit/afblue.c
index 95786ed6f..95786ed6f 100644
--- a/drivers/freetype/src/autofit/afblue.c
+++ b/thirdparty/freetype/src/autofit/afblue.c
diff --git a/drivers/freetype/src/autofit/afblue.cin b/thirdparty/freetype/src/autofit/afblue.cin
index 0c3cae818..0c3cae818 100644
--- a/drivers/freetype/src/autofit/afblue.cin
+++ b/thirdparty/freetype/src/autofit/afblue.cin
diff --git a/drivers/freetype/src/autofit/afblue.dat b/thirdparty/freetype/src/autofit/afblue.dat
index 0734ec71f..0734ec71f 100644
--- a/drivers/freetype/src/autofit/afblue.dat
+++ b/thirdparty/freetype/src/autofit/afblue.dat
diff --git a/drivers/freetype/src/autofit/afblue.h b/thirdparty/freetype/src/autofit/afblue.h
index 41f838e45..41f838e45 100644
--- a/drivers/freetype/src/autofit/afblue.h
+++ b/thirdparty/freetype/src/autofit/afblue.h
diff --git a/drivers/freetype/src/autofit/afblue.hin b/thirdparty/freetype/src/autofit/afblue.hin
index dd44e7725..dd44e7725 100644
--- a/drivers/freetype/src/autofit/afblue.hin
+++ b/thirdparty/freetype/src/autofit/afblue.hin
diff --git a/drivers/freetype/src/autofit/afcjk.c b/thirdparty/freetype/src/autofit/afcjk.c
index 4823c1d7f..4823c1d7f 100644
--- a/drivers/freetype/src/autofit/afcjk.c
+++ b/thirdparty/freetype/src/autofit/afcjk.c
diff --git a/drivers/freetype/src/autofit/afcjk.h b/thirdparty/freetype/src/autofit/afcjk.h
index 40d118438..40d118438 100644
--- a/drivers/freetype/src/autofit/afcjk.h
+++ b/thirdparty/freetype/src/autofit/afcjk.h
diff --git a/drivers/freetype/src/autofit/afcover.h b/thirdparty/freetype/src/autofit/afcover.h
index 1c39a707e..1c39a707e 100644
--- a/drivers/freetype/src/autofit/afcover.h
+++ b/thirdparty/freetype/src/autofit/afcover.h
diff --git a/drivers/freetype/src/autofit/afdummy.c b/thirdparty/freetype/src/autofit/afdummy.c
index f3960c85f..f3960c85f 100644
--- a/drivers/freetype/src/autofit/afdummy.c
+++ b/thirdparty/freetype/src/autofit/afdummy.c
diff --git a/drivers/freetype/src/autofit/afdummy.h b/thirdparty/freetype/src/autofit/afdummy.h
index 7e58d1a9a..7e58d1a9a 100644
--- a/drivers/freetype/src/autofit/afdummy.h
+++ b/thirdparty/freetype/src/autofit/afdummy.h
diff --git a/drivers/freetype/src/autofit/aferrors.h b/thirdparty/freetype/src/autofit/aferrors.h
index 53c01f64d..53c01f64d 100644
--- a/drivers/freetype/src/autofit/aferrors.h
+++ b/thirdparty/freetype/src/autofit/aferrors.h
diff --git a/drivers/freetype/src/autofit/afglobal.c b/thirdparty/freetype/src/autofit/afglobal.c
index ac6dcafc0..ac6dcafc0 100644
--- a/drivers/freetype/src/autofit/afglobal.c
+++ b/thirdparty/freetype/src/autofit/afglobal.c
diff --git a/drivers/freetype/src/autofit/afglobal.h b/thirdparty/freetype/src/autofit/afglobal.h
index ce6b9e8f2..ce6b9e8f2 100644
--- a/drivers/freetype/src/autofit/afglobal.h
+++ b/thirdparty/freetype/src/autofit/afglobal.h
diff --git a/drivers/freetype/src/autofit/afhints.c b/thirdparty/freetype/src/autofit/afhints.c
index 6c3d032d1..6c3d032d1 100644
--- a/drivers/freetype/src/autofit/afhints.c
+++ b/thirdparty/freetype/src/autofit/afhints.c
diff --git a/drivers/freetype/src/autofit/afhints.h b/thirdparty/freetype/src/autofit/afhints.h
index 5142e6ed2..5142e6ed2 100644
--- a/drivers/freetype/src/autofit/afhints.h
+++ b/thirdparty/freetype/src/autofit/afhints.h
diff --git a/drivers/freetype/src/autofit/afindic.c b/thirdparty/freetype/src/autofit/afindic.c
index 097a2b299..097a2b299 100644
--- a/drivers/freetype/src/autofit/afindic.c
+++ b/thirdparty/freetype/src/autofit/afindic.c
diff --git a/drivers/freetype/src/autofit/afindic.h b/thirdparty/freetype/src/autofit/afindic.h
index 0772e07a2..0772e07a2 100644
--- a/drivers/freetype/src/autofit/afindic.h
+++ b/thirdparty/freetype/src/autofit/afindic.h
diff --git a/drivers/freetype/src/autofit/aflatin.c b/thirdparty/freetype/src/autofit/aflatin.c
index 7ccf3f6e3..7ccf3f6e3 100644
--- a/drivers/freetype/src/autofit/aflatin.c
+++ b/thirdparty/freetype/src/autofit/aflatin.c
diff --git a/drivers/freetype/src/autofit/aflatin.h b/thirdparty/freetype/src/autofit/aflatin.h
index fe6bbd801..fe6bbd801 100644
--- a/drivers/freetype/src/autofit/aflatin.h
+++ b/thirdparty/freetype/src/autofit/aflatin.h
diff --git a/drivers/freetype/src/autofit/aflatin2.c b/thirdparty/freetype/src/autofit/aflatin2.c
index 5db4a4114..5db4a4114 100644
--- a/drivers/freetype/src/autofit/aflatin2.c
+++ b/thirdparty/freetype/src/autofit/aflatin2.c
diff --git a/drivers/freetype/src/autofit/aflatin2.h b/thirdparty/freetype/src/autofit/aflatin2.h
index f83f70428..f83f70428 100644
--- a/drivers/freetype/src/autofit/aflatin2.h
+++ b/thirdparty/freetype/src/autofit/aflatin2.h
diff --git a/drivers/freetype/src/autofit/afloader.c b/thirdparty/freetype/src/autofit/afloader.c
index 26bba065b..26bba065b 100644
--- a/drivers/freetype/src/autofit/afloader.c
+++ b/thirdparty/freetype/src/autofit/afloader.c
diff --git a/drivers/freetype/src/autofit/afloader.h b/thirdparty/freetype/src/autofit/afloader.h
index 0062eb9b0..0062eb9b0 100644
--- a/drivers/freetype/src/autofit/afloader.h
+++ b/thirdparty/freetype/src/autofit/afloader.h
diff --git a/drivers/freetype/src/autofit/afmodule.c b/thirdparty/freetype/src/autofit/afmodule.c
index 4127382c0..4127382c0 100644
--- a/drivers/freetype/src/autofit/afmodule.c
+++ b/thirdparty/freetype/src/autofit/afmodule.c
diff --git a/drivers/freetype/src/autofit/afmodule.h b/thirdparty/freetype/src/autofit/afmodule.h
index e65db5f5c..e65db5f5c 100644
--- a/drivers/freetype/src/autofit/afmodule.h
+++ b/thirdparty/freetype/src/autofit/afmodule.h
diff --git a/drivers/freetype/src/autofit/afpic.c b/thirdparty/freetype/src/autofit/afpic.c
index 3cbd9168e..3cbd9168e 100644
--- a/drivers/freetype/src/autofit/afpic.c
+++ b/thirdparty/freetype/src/autofit/afpic.c
diff --git a/drivers/freetype/src/autofit/afpic.h b/thirdparty/freetype/src/autofit/afpic.h
index 98a45a26b..98a45a26b 100644
--- a/drivers/freetype/src/autofit/afpic.h
+++ b/thirdparty/freetype/src/autofit/afpic.h
diff --git a/drivers/freetype/src/autofit/afranges.c b/thirdparty/freetype/src/autofit/afranges.c
index 732f3d162..732f3d162 100644
--- a/drivers/freetype/src/autofit/afranges.c
+++ b/thirdparty/freetype/src/autofit/afranges.c
diff --git a/drivers/freetype/src/autofit/afranges.h b/thirdparty/freetype/src/autofit/afranges.h
index 1a0e4b153..1a0e4b153 100644
--- a/drivers/freetype/src/autofit/afranges.h
+++ b/thirdparty/freetype/src/autofit/afranges.h
diff --git a/drivers/freetype/src/autofit/afscript.h b/thirdparty/freetype/src/autofit/afscript.h
index 33c301298..33c301298 100644
--- a/drivers/freetype/src/autofit/afscript.h
+++ b/thirdparty/freetype/src/autofit/afscript.h
diff --git a/drivers/freetype/src/autofit/afshaper.c b/thirdparty/freetype/src/autofit/afshaper.c
index 6d13b6585..6d13b6585 100644
--- a/drivers/freetype/src/autofit/afshaper.c
+++ b/thirdparty/freetype/src/autofit/afshaper.c
diff --git a/drivers/freetype/src/autofit/afshaper.h b/thirdparty/freetype/src/autofit/afshaper.h
index 0d41f7876..0d41f7876 100644
--- a/drivers/freetype/src/autofit/afshaper.h
+++ b/thirdparty/freetype/src/autofit/afshaper.h
diff --git a/drivers/freetype/src/autofit/afstyles.h b/thirdparty/freetype/src/autofit/afstyles.h
index e83a95bb5..e83a95bb5 100644
--- a/drivers/freetype/src/autofit/afstyles.h
+++ b/thirdparty/freetype/src/autofit/afstyles.h
diff --git a/drivers/freetype/src/autofit/aftypes.h b/thirdparty/freetype/src/autofit/aftypes.h
index ef62043c8..ef62043c8 100644
--- a/drivers/freetype/src/autofit/aftypes.h
+++ b/thirdparty/freetype/src/autofit/aftypes.h
diff --git a/drivers/freetype/src/autofit/afwarp.c b/thirdparty/freetype/src/autofit/afwarp.c
index ce1806c9d..ce1806c9d 100644
--- a/drivers/freetype/src/autofit/afwarp.c
+++ b/thirdparty/freetype/src/autofit/afwarp.c
diff --git a/drivers/freetype/src/autofit/afwarp.h b/thirdparty/freetype/src/autofit/afwarp.h
index 6d96f86d7..6d96f86d7 100644
--- a/drivers/freetype/src/autofit/afwarp.h
+++ b/thirdparty/freetype/src/autofit/afwarp.h
diff --git a/drivers/freetype/src/autofit/afwrtsys.h b/thirdparty/freetype/src/autofit/afwrtsys.h
index 842f4921a..842f4921a 100644
--- a/drivers/freetype/src/autofit/afwrtsys.h
+++ b/thirdparty/freetype/src/autofit/afwrtsys.h
diff --git a/drivers/freetype/src/autofit/autofit.c b/thirdparty/freetype/src/autofit/autofit.c
index dda9aeb6d..dda9aeb6d 100644
--- a/drivers/freetype/src/autofit/autofit.c
+++ b/thirdparty/freetype/src/autofit/autofit.c
diff --git a/drivers/freetype/src/autofit/module.mk b/thirdparty/freetype/src/autofit/module.mk
index 98f0612b9..98f0612b9 100644
--- a/drivers/freetype/src/autofit/module.mk
+++ b/thirdparty/freetype/src/autofit/module.mk
diff --git a/drivers/freetype/src/autofit/rules.mk b/thirdparty/freetype/src/autofit/rules.mk
index 1ef470464..1ef470464 100644
--- a/drivers/freetype/src/autofit/rules.mk
+++ b/thirdparty/freetype/src/autofit/rules.mk
diff --git a/drivers/freetype/src/base/basepic.c b/thirdparty/freetype/src/base/basepic.c
index f2cea90d7..f2cea90d7 100644
--- a/drivers/freetype/src/base/basepic.c
+++ b/thirdparty/freetype/src/base/basepic.c
diff --git a/drivers/freetype/src/base/basepic.h b/thirdparty/freetype/src/base/basepic.h
index a1a75a0ba..a1a75a0ba 100644
--- a/drivers/freetype/src/base/basepic.h
+++ b/thirdparty/freetype/src/base/basepic.h
diff --git a/drivers/freetype/src/base/ftadvanc.c b/thirdparty/freetype/src/base/ftadvanc.c
index 9e2ab8984..9e2ab8984 100644
--- a/drivers/freetype/src/base/ftadvanc.c
+++ b/thirdparty/freetype/src/base/ftadvanc.c
diff --git a/drivers/freetype/src/base/ftapi.c b/thirdparty/freetype/src/base/ftapi.c
index b94c3eb9f..b94c3eb9f 100644
--- a/drivers/freetype/src/base/ftapi.c
+++ b/thirdparty/freetype/src/base/ftapi.c
diff --git a/drivers/freetype/src/base/ftbase.c b/thirdparty/freetype/src/base/ftbase.c
index ab1af6f9f..ab1af6f9f 100644
--- a/drivers/freetype/src/base/ftbase.c
+++ b/thirdparty/freetype/src/base/ftbase.c
diff --git a/drivers/freetype/src/base/ftbase.h b/thirdparty/freetype/src/base/ftbase.h
index 717fdaae2..717fdaae2 100644
--- a/drivers/freetype/src/base/ftbase.h
+++ b/thirdparty/freetype/src/base/ftbase.h
diff --git a/drivers/freetype/src/base/ftbbox.c b/thirdparty/freetype/src/base/ftbbox.c
index d3e45ffa0..d3e45ffa0 100644
--- a/drivers/freetype/src/base/ftbbox.c
+++ b/thirdparty/freetype/src/base/ftbbox.c
diff --git a/drivers/freetype/src/base/ftbdf.c b/thirdparty/freetype/src/base/ftbdf.c
index 4aafc2b98..4aafc2b98 100644
--- a/drivers/freetype/src/base/ftbdf.c
+++ b/thirdparty/freetype/src/base/ftbdf.c
diff --git a/drivers/freetype/src/base/ftbitmap.c b/thirdparty/freetype/src/base/ftbitmap.c
index 24fead3e1..24fead3e1 100644
--- a/drivers/freetype/src/base/ftbitmap.c
+++ b/thirdparty/freetype/src/base/ftbitmap.c
diff --git a/drivers/freetype/src/base/ftcalc.c b/thirdparty/freetype/src/base/ftcalc.c
index 67549d0c4..67549d0c4 100644
--- a/drivers/freetype/src/base/ftcalc.c
+++ b/thirdparty/freetype/src/base/ftcalc.c
diff --git a/drivers/freetype/src/base/ftcid.c b/thirdparty/freetype/src/base/ftcid.c
index 251bbd009..251bbd009 100644
--- a/drivers/freetype/src/base/ftcid.c
+++ b/thirdparty/freetype/src/base/ftcid.c
diff --git a/drivers/freetype/src/base/ftdbgmem.c b/thirdparty/freetype/src/base/ftdbgmem.c
index 6ab507274..6ab507274 100644
--- a/drivers/freetype/src/base/ftdbgmem.c
+++ b/thirdparty/freetype/src/base/ftdbgmem.c
diff --git a/drivers/freetype/src/base/ftdebug.c b/thirdparty/freetype/src/base/ftdebug.c
index 40925d14a..40925d14a 100644
--- a/drivers/freetype/src/base/ftdebug.c
+++ b/thirdparty/freetype/src/base/ftdebug.c
diff --git a/drivers/freetype/src/base/ftfntfmt.c b/thirdparty/freetype/src/base/ftfntfmt.c
index c6eb3190c..c6eb3190c 100644
--- a/drivers/freetype/src/base/ftfntfmt.c
+++ b/thirdparty/freetype/src/base/ftfntfmt.c
diff --git a/drivers/freetype/src/base/ftfstype.c b/thirdparty/freetype/src/base/ftfstype.c
index ae56c8fc8..ae56c8fc8 100644
--- a/drivers/freetype/src/base/ftfstype.c
+++ b/thirdparty/freetype/src/base/ftfstype.c
diff --git a/drivers/freetype/src/base/ftgasp.c b/thirdparty/freetype/src/base/ftgasp.c
index e38e55b6c..e38e55b6c 100644
--- a/drivers/freetype/src/base/ftgasp.c
+++ b/thirdparty/freetype/src/base/ftgasp.c
diff --git a/drivers/freetype/src/base/ftgloadr.c b/thirdparty/freetype/src/base/ftgloadr.c
index c4f0ff70f..c4f0ff70f 100644
--- a/drivers/freetype/src/base/ftgloadr.c
+++ b/thirdparty/freetype/src/base/ftgloadr.c
diff --git a/drivers/freetype/src/base/ftglyph.c b/thirdparty/freetype/src/base/ftglyph.c
index c2376dd03..c2376dd03 100644
--- a/drivers/freetype/src/base/ftglyph.c
+++ b/thirdparty/freetype/src/base/ftglyph.c
diff --git a/drivers/freetype/src/base/ftgxval.c b/thirdparty/freetype/src/base/ftgxval.c
index 6667b371a..6667b371a 100644
--- a/drivers/freetype/src/base/ftgxval.c
+++ b/thirdparty/freetype/src/base/ftgxval.c
diff --git a/drivers/freetype/src/base/fthash.c b/thirdparty/freetype/src/base/fthash.c
index 21bc8dd5b..21bc8dd5b 100644
--- a/drivers/freetype/src/base/fthash.c
+++ b/thirdparty/freetype/src/base/fthash.c
diff --git a/drivers/freetype/src/base/ftinit.c b/thirdparty/freetype/src/base/ftinit.c
index c2dd0a7b3..c2dd0a7b3 100644
--- a/drivers/freetype/src/base/ftinit.c
+++ b/thirdparty/freetype/src/base/ftinit.c
diff --git a/drivers/freetype/src/base/ftlcdfil.c b/thirdparty/freetype/src/base/ftlcdfil.c
index 8bcbed7aa..8bcbed7aa 100644
--- a/drivers/freetype/src/base/ftlcdfil.c
+++ b/thirdparty/freetype/src/base/ftlcdfil.c
diff --git a/drivers/freetype/src/base/ftmac.c b/thirdparty/freetype/src/base/ftmac.c
index e97fdbfc2..e97fdbfc2 100644
--- a/drivers/freetype/src/base/ftmac.c
+++ b/thirdparty/freetype/src/base/ftmac.c
diff --git a/drivers/freetype/src/base/ftmm.c b/thirdparty/freetype/src/base/ftmm.c
index 6b759ca46..6b759ca46 100644
--- a/drivers/freetype/src/base/ftmm.c
+++ b/thirdparty/freetype/src/base/ftmm.c
diff --git a/drivers/freetype/src/base/ftobjs.c b/thirdparty/freetype/src/base/ftobjs.c
index c2dc6183b..c2dc6183b 100644
--- a/drivers/freetype/src/base/ftobjs.c
+++ b/thirdparty/freetype/src/base/ftobjs.c
diff --git a/drivers/freetype/src/base/ftotval.c b/thirdparty/freetype/src/base/ftotval.c
index fe54e0228..fe54e0228 100644
--- a/drivers/freetype/src/base/ftotval.c
+++ b/thirdparty/freetype/src/base/ftotval.c
diff --git a/drivers/freetype/src/base/ftoutln.c b/thirdparty/freetype/src/base/ftoutln.c
index fc28225c6..fc28225c6 100644
--- a/drivers/freetype/src/base/ftoutln.c
+++ b/thirdparty/freetype/src/base/ftoutln.c
diff --git a/drivers/freetype/src/base/ftpatent.c b/thirdparty/freetype/src/base/ftpatent.c
index 4861be130..4861be130 100644
--- a/drivers/freetype/src/base/ftpatent.c
+++ b/thirdparty/freetype/src/base/ftpatent.c
diff --git a/drivers/freetype/src/base/ftpfr.c b/thirdparty/freetype/src/base/ftpfr.c
index 81faa529c..81faa529c 100644
--- a/drivers/freetype/src/base/ftpfr.c
+++ b/thirdparty/freetype/src/base/ftpfr.c
diff --git a/drivers/freetype/src/base/ftpic.c b/thirdparty/freetype/src/base/ftpic.c
index 03769dba2..03769dba2 100644
--- a/drivers/freetype/src/base/ftpic.c
+++ b/thirdparty/freetype/src/base/ftpic.c
diff --git a/drivers/freetype/src/base/ftrfork.c b/thirdparty/freetype/src/base/ftrfork.c
index 4660c971c..4660c971c 100644
--- a/drivers/freetype/src/base/ftrfork.c
+++ b/thirdparty/freetype/src/base/ftrfork.c
diff --git a/drivers/freetype/src/base/ftsnames.c b/thirdparty/freetype/src/base/ftsnames.c
index ce7964118..ce7964118 100644
--- a/drivers/freetype/src/base/ftsnames.c
+++ b/thirdparty/freetype/src/base/ftsnames.c
diff --git a/drivers/freetype/src/base/ftstream.c b/thirdparty/freetype/src/base/ftstream.c
index bb512a7cc..bb512a7cc 100644
--- a/drivers/freetype/src/base/ftstream.c
+++ b/thirdparty/freetype/src/base/ftstream.c
diff --git a/drivers/freetype/src/base/ftstroke.c b/thirdparty/freetype/src/base/ftstroke.c
index 4f3c4937b..4f3c4937b 100644
--- a/drivers/freetype/src/base/ftstroke.c
+++ b/thirdparty/freetype/src/base/ftstroke.c
diff --git a/drivers/freetype/src/base/ftsynth.c b/thirdparty/freetype/src/base/ftsynth.c
index 4b66a33c3..4b66a33c3 100644
--- a/drivers/freetype/src/base/ftsynth.c
+++ b/thirdparty/freetype/src/base/ftsynth.c
diff --git a/drivers/freetype/src/base/ftsystem.c b/thirdparty/freetype/src/base/ftsystem.c
index ac1f01c8b..ac1f01c8b 100644
--- a/drivers/freetype/src/base/ftsystem.c
+++ b/thirdparty/freetype/src/base/ftsystem.c
diff --git a/drivers/freetype/src/base/fttrigon.c b/thirdparty/freetype/src/base/fttrigon.c
index 7b582c8a3..7b582c8a3 100644
--- a/drivers/freetype/src/base/fttrigon.c
+++ b/thirdparty/freetype/src/base/fttrigon.c
diff --git a/drivers/freetype/src/base/fttype1.c b/thirdparty/freetype/src/base/fttype1.c
index 5c0fce868..5c0fce868 100644
--- a/drivers/freetype/src/base/fttype1.c
+++ b/thirdparty/freetype/src/base/fttype1.c
diff --git a/drivers/freetype/src/base/ftutil.c b/thirdparty/freetype/src/base/ftutil.c
index fad7d1a5f..fad7d1a5f 100644
--- a/drivers/freetype/src/base/ftutil.c
+++ b/thirdparty/freetype/src/base/ftutil.c
diff --git a/drivers/freetype/src/base/ftwinfnt.c b/thirdparty/freetype/src/base/ftwinfnt.c
index 89e915509..89e915509 100644
--- a/drivers/freetype/src/base/ftwinfnt.c
+++ b/thirdparty/freetype/src/base/ftwinfnt.c
diff --git a/drivers/freetype/src/base/md5.c b/thirdparty/freetype/src/base/md5.c
index b235e17a5..b235e17a5 100644
--- a/drivers/freetype/src/base/md5.c
+++ b/thirdparty/freetype/src/base/md5.c
diff --git a/drivers/freetype/src/base/md5.h b/thirdparty/freetype/src/base/md5.h
index 2da44bf35..2da44bf35 100644
--- a/drivers/freetype/src/base/md5.h
+++ b/thirdparty/freetype/src/base/md5.h
diff --git a/drivers/freetype/src/base/rules.mk b/thirdparty/freetype/src/base/rules.mk
index aa424c546..aa424c546 100644
--- a/drivers/freetype/src/base/rules.mk
+++ b/thirdparty/freetype/src/base/rules.mk
diff --git a/drivers/freetype/src/bdf/README b/thirdparty/freetype/src/bdf/README
index b761aba2b..b761aba2b 100644
--- a/drivers/freetype/src/bdf/README
+++ b/thirdparty/freetype/src/bdf/README
diff --git a/drivers/freetype/src/bdf/bdf.c b/thirdparty/freetype/src/bdf/bdf.c
index f95fb7622..f95fb7622 100644
--- a/drivers/freetype/src/bdf/bdf.c
+++ b/thirdparty/freetype/src/bdf/bdf.c
diff --git a/drivers/freetype/src/bdf/bdf.h b/thirdparty/freetype/src/bdf/bdf.h
index 9012727c7..9012727c7 100644
--- a/drivers/freetype/src/bdf/bdf.h
+++ b/thirdparty/freetype/src/bdf/bdf.h
diff --git a/drivers/freetype/src/bdf/bdfdrivr.c b/thirdparty/freetype/src/bdf/bdfdrivr.c
index a381cf68f..a381cf68f 100644
--- a/drivers/freetype/src/bdf/bdfdrivr.c
+++ b/thirdparty/freetype/src/bdf/bdfdrivr.c
diff --git a/drivers/freetype/src/bdf/bdfdrivr.h b/thirdparty/freetype/src/bdf/bdfdrivr.h
index 94550818c..94550818c 100644
--- a/drivers/freetype/src/bdf/bdfdrivr.h
+++ b/thirdparty/freetype/src/bdf/bdfdrivr.h
diff --git a/drivers/freetype/src/bdf/bdferror.h b/thirdparty/freetype/src/bdf/bdferror.h
index b462c7d3b..b462c7d3b 100644
--- a/drivers/freetype/src/bdf/bdferror.h
+++ b/thirdparty/freetype/src/bdf/bdferror.h
diff --git a/drivers/freetype/src/bdf/bdflib.c b/thirdparty/freetype/src/bdf/bdflib.c
index e1dce954f..e1dce954f 100644
--- a/drivers/freetype/src/bdf/bdflib.c
+++ b/thirdparty/freetype/src/bdf/bdflib.c
diff --git a/drivers/freetype/src/bdf/module.mk b/thirdparty/freetype/src/bdf/module.mk
index fe06ae8e0..fe06ae8e0 100644
--- a/drivers/freetype/src/bdf/module.mk
+++ b/thirdparty/freetype/src/bdf/module.mk
diff --git a/drivers/freetype/src/bdf/rules.mk b/thirdparty/freetype/src/bdf/rules.mk
index d1dd76b1c..d1dd76b1c 100644
--- a/drivers/freetype/src/bdf/rules.mk
+++ b/thirdparty/freetype/src/bdf/rules.mk
diff --git a/drivers/freetype/src/cache/ftcache.c b/thirdparty/freetype/src/cache/ftcache.c
index 50941df4c..50941df4c 100644
--- a/drivers/freetype/src/cache/ftcache.c
+++ b/thirdparty/freetype/src/cache/ftcache.c
diff --git a/drivers/freetype/src/cache/ftcbasic.c b/thirdparty/freetype/src/cache/ftcbasic.c
index 8e6de8c41..8e6de8c41 100644
--- a/drivers/freetype/src/cache/ftcbasic.c
+++ b/thirdparty/freetype/src/cache/ftcbasic.c
diff --git a/drivers/freetype/src/cache/ftccache.c b/thirdparty/freetype/src/cache/ftccache.c
index 3b1a4bc7e..3b1a4bc7e 100644
--- a/drivers/freetype/src/cache/ftccache.c
+++ b/thirdparty/freetype/src/cache/ftccache.c
diff --git a/drivers/freetype/src/cache/ftccache.h b/thirdparty/freetype/src/cache/ftccache.h
index 1b1295951..1b1295951 100644
--- a/drivers/freetype/src/cache/ftccache.h
+++ b/thirdparty/freetype/src/cache/ftccache.h
diff --git a/drivers/freetype/src/cache/ftccback.h b/thirdparty/freetype/src/cache/ftccback.h
index 279e94d92..279e94d92 100644
--- a/drivers/freetype/src/cache/ftccback.h
+++ b/thirdparty/freetype/src/cache/ftccback.h
diff --git a/drivers/freetype/src/cache/ftccmap.c b/thirdparty/freetype/src/cache/ftccmap.c
index 41a0ce97d..41a0ce97d 100644
--- a/drivers/freetype/src/cache/ftccmap.c
+++ b/thirdparty/freetype/src/cache/ftccmap.c
diff --git a/drivers/freetype/src/cache/ftcerror.h b/thirdparty/freetype/src/cache/ftcerror.h
index 1fd7357a8..1fd7357a8 100644
--- a/drivers/freetype/src/cache/ftcerror.h
+++ b/thirdparty/freetype/src/cache/ftcerror.h
diff --git a/drivers/freetype/src/cache/ftcglyph.c b/thirdparty/freetype/src/cache/ftcglyph.c
index c4046812d..c4046812d 100644
--- a/drivers/freetype/src/cache/ftcglyph.c
+++ b/thirdparty/freetype/src/cache/ftcglyph.c
diff --git a/drivers/freetype/src/cache/ftcglyph.h b/thirdparty/freetype/src/cache/ftcglyph.h
index dc7be06f0..dc7be06f0 100644
--- a/drivers/freetype/src/cache/ftcglyph.h
+++ b/thirdparty/freetype/src/cache/ftcglyph.h
diff --git a/drivers/freetype/src/cache/ftcimage.c b/thirdparty/freetype/src/cache/ftcimage.c
index 74040aa74..74040aa74 100644
--- a/drivers/freetype/src/cache/ftcimage.c
+++ b/thirdparty/freetype/src/cache/ftcimage.c
diff --git a/drivers/freetype/src/cache/ftcimage.h b/thirdparty/freetype/src/cache/ftcimage.h
index 25aa43b97..25aa43b97 100644
--- a/drivers/freetype/src/cache/ftcimage.h
+++ b/thirdparty/freetype/src/cache/ftcimage.h
diff --git a/drivers/freetype/src/cache/ftcmanag.c b/thirdparty/freetype/src/cache/ftcmanag.c
index 661a32af5..661a32af5 100644
--- a/drivers/freetype/src/cache/ftcmanag.c
+++ b/thirdparty/freetype/src/cache/ftcmanag.c
diff --git a/drivers/freetype/src/cache/ftcmanag.h b/thirdparty/freetype/src/cache/ftcmanag.h
index f2c434a13..f2c434a13 100644
--- a/drivers/freetype/src/cache/ftcmanag.h
+++ b/thirdparty/freetype/src/cache/ftcmanag.h
diff --git a/drivers/freetype/src/cache/ftcmru.c b/thirdparty/freetype/src/cache/ftcmru.c
index d107584a1..d107584a1 100644
--- a/drivers/freetype/src/cache/ftcmru.c
+++ b/thirdparty/freetype/src/cache/ftcmru.c
diff --git a/drivers/freetype/src/cache/ftcmru.h b/thirdparty/freetype/src/cache/ftcmru.h
index ae3c4ce23..ae3c4ce23 100644
--- a/drivers/freetype/src/cache/ftcmru.h
+++ b/thirdparty/freetype/src/cache/ftcmru.h
diff --git a/drivers/freetype/src/cache/ftcsbits.c b/thirdparty/freetype/src/cache/ftcsbits.c
index d6f1ddcd4..d6f1ddcd4 100644
--- a/drivers/freetype/src/cache/ftcsbits.c
+++ b/thirdparty/freetype/src/cache/ftcsbits.c
diff --git a/drivers/freetype/src/cache/ftcsbits.h b/thirdparty/freetype/src/cache/ftcsbits.h
index a0600ede0..a0600ede0 100644
--- a/drivers/freetype/src/cache/ftcsbits.h
+++ b/thirdparty/freetype/src/cache/ftcsbits.h
diff --git a/drivers/freetype/src/cache/rules.mk b/thirdparty/freetype/src/cache/rules.mk
index 827e259f9..827e259f9 100644
--- a/drivers/freetype/src/cache/rules.mk
+++ b/thirdparty/freetype/src/cache/rules.mk
diff --git a/drivers/freetype/src/cff/cf2arrst.c b/thirdparty/freetype/src/cff/cf2arrst.c
index 89f3e9f1d..89f3e9f1d 100644
--- a/drivers/freetype/src/cff/cf2arrst.c
+++ b/thirdparty/freetype/src/cff/cf2arrst.c
diff --git a/drivers/freetype/src/cff/cf2arrst.h b/thirdparty/freetype/src/cff/cf2arrst.h
index 3c21a3b67..3c21a3b67 100644
--- a/drivers/freetype/src/cff/cf2arrst.h
+++ b/thirdparty/freetype/src/cff/cf2arrst.h
diff --git a/drivers/freetype/src/cff/cf2blues.c b/thirdparty/freetype/src/cff/cf2blues.c
index 250f89e0d..250f89e0d 100644
--- a/drivers/freetype/src/cff/cf2blues.c
+++ b/thirdparty/freetype/src/cff/cf2blues.c
diff --git a/drivers/freetype/src/cff/cf2blues.h b/thirdparty/freetype/src/cff/cf2blues.h
index 96fb60f38..96fb60f38 100644
--- a/drivers/freetype/src/cff/cf2blues.h
+++ b/thirdparty/freetype/src/cff/cf2blues.h
diff --git a/drivers/freetype/src/cff/cf2error.c b/thirdparty/freetype/src/cff/cf2error.c
index b5595a3d1..b5595a3d1 100644
--- a/drivers/freetype/src/cff/cf2error.c
+++ b/thirdparty/freetype/src/cff/cf2error.c
diff --git a/drivers/freetype/src/cff/cf2error.h b/thirdparty/freetype/src/cff/cf2error.h
index 512edd1d2..512edd1d2 100644
--- a/drivers/freetype/src/cff/cf2error.h
+++ b/thirdparty/freetype/src/cff/cf2error.h
diff --git a/drivers/freetype/src/cff/cf2fixed.h b/thirdparty/freetype/src/cff/cf2fixed.h
index 74af37708..74af37708 100644
--- a/drivers/freetype/src/cff/cf2fixed.h
+++ b/thirdparty/freetype/src/cff/cf2fixed.h
diff --git a/drivers/freetype/src/cff/cf2font.c b/thirdparty/freetype/src/cff/cf2font.c
index 83fd348f2..83fd348f2 100644
--- a/drivers/freetype/src/cff/cf2font.c
+++ b/thirdparty/freetype/src/cff/cf2font.c
diff --git a/drivers/freetype/src/cff/cf2font.h b/thirdparty/freetype/src/cff/cf2font.h
index bd05e69e7..bd05e69e7 100644
--- a/drivers/freetype/src/cff/cf2font.h
+++ b/thirdparty/freetype/src/cff/cf2font.h
diff --git a/drivers/freetype/src/cff/cf2ft.c b/thirdparty/freetype/src/cff/cf2ft.c
index 55f3206ac..55f3206ac 100644
--- a/drivers/freetype/src/cff/cf2ft.c
+++ b/thirdparty/freetype/src/cff/cf2ft.c
diff --git a/drivers/freetype/src/cff/cf2ft.h b/thirdparty/freetype/src/cff/cf2ft.h
index 8e55e841a..8e55e841a 100644
--- a/drivers/freetype/src/cff/cf2ft.h
+++ b/thirdparty/freetype/src/cff/cf2ft.h
diff --git a/drivers/freetype/src/cff/cf2glue.h b/thirdparty/freetype/src/cff/cf2glue.h
index 56a7c248f..56a7c248f 100644
--- a/drivers/freetype/src/cff/cf2glue.h
+++ b/thirdparty/freetype/src/cff/cf2glue.h
diff --git a/drivers/freetype/src/cff/cf2hints.c b/thirdparty/freetype/src/cff/cf2hints.c
index bbbe8e3c3..bbbe8e3c3 100644
--- a/drivers/freetype/src/cff/cf2hints.c
+++ b/thirdparty/freetype/src/cff/cf2hints.c
diff --git a/drivers/freetype/src/cff/cf2hints.h b/thirdparty/freetype/src/cff/cf2hints.h
index a8984542a..a8984542a 100644
--- a/drivers/freetype/src/cff/cf2hints.h
+++ b/thirdparty/freetype/src/cff/cf2hints.h
diff --git a/drivers/freetype/src/cff/cf2intrp.c b/thirdparty/freetype/src/cff/cf2intrp.c
index 7d663dd0e..7d663dd0e 100644
--- a/drivers/freetype/src/cff/cf2intrp.c
+++ b/thirdparty/freetype/src/cff/cf2intrp.c
diff --git a/drivers/freetype/src/cff/cf2intrp.h b/thirdparty/freetype/src/cff/cf2intrp.h
index ec030e894..ec030e894 100644
--- a/drivers/freetype/src/cff/cf2intrp.h
+++ b/thirdparty/freetype/src/cff/cf2intrp.h
diff --git a/drivers/freetype/src/cff/cf2read.c b/thirdparty/freetype/src/cff/cf2read.c
index 2b429e3ee..2b429e3ee 100644
--- a/drivers/freetype/src/cff/cf2read.c
+++ b/thirdparty/freetype/src/cff/cf2read.c
diff --git a/drivers/freetype/src/cff/cf2read.h b/thirdparty/freetype/src/cff/cf2read.h
index b0b0db803..b0b0db803 100644
--- a/drivers/freetype/src/cff/cf2read.h
+++ b/thirdparty/freetype/src/cff/cf2read.h
diff --git a/drivers/freetype/src/cff/cf2stack.c b/thirdparty/freetype/src/cff/cf2stack.c
index 6fafd901f..6fafd901f 100644
--- a/drivers/freetype/src/cff/cf2stack.c
+++ b/thirdparty/freetype/src/cff/cf2stack.c
diff --git a/drivers/freetype/src/cff/cf2stack.h b/thirdparty/freetype/src/cff/cf2stack.h
index e740a7ac4..e740a7ac4 100644
--- a/drivers/freetype/src/cff/cf2stack.h
+++ b/thirdparty/freetype/src/cff/cf2stack.h
diff --git a/drivers/freetype/src/cff/cf2types.h b/thirdparty/freetype/src/cff/cf2types.h
index 5b7e1239a..5b7e1239a 100644
--- a/drivers/freetype/src/cff/cf2types.h
+++ b/thirdparty/freetype/src/cff/cf2types.h
diff --git a/drivers/freetype/src/cff/cff.c b/thirdparty/freetype/src/cff/cff.c
index 86ca1be04..86ca1be04 100644
--- a/drivers/freetype/src/cff/cff.c
+++ b/thirdparty/freetype/src/cff/cff.c
diff --git a/drivers/freetype/src/cff/cffcmap.c b/thirdparty/freetype/src/cff/cffcmap.c
index 3ef48328c..3ef48328c 100644
--- a/drivers/freetype/src/cff/cffcmap.c
+++ b/thirdparty/freetype/src/cff/cffcmap.c
diff --git a/drivers/freetype/src/cff/cffcmap.h b/thirdparty/freetype/src/cff/cffcmap.h
index 23795d509..23795d509 100644
--- a/drivers/freetype/src/cff/cffcmap.h
+++ b/thirdparty/freetype/src/cff/cffcmap.h
diff --git a/drivers/freetype/src/cff/cffdrivr.c b/thirdparty/freetype/src/cff/cffdrivr.c
index 950a9605c..950a9605c 100644
--- a/drivers/freetype/src/cff/cffdrivr.c
+++ b/thirdparty/freetype/src/cff/cffdrivr.c
diff --git a/drivers/freetype/src/cff/cffdrivr.h b/thirdparty/freetype/src/cff/cffdrivr.h
index d7b059837..d7b059837 100644
--- a/drivers/freetype/src/cff/cffdrivr.h
+++ b/thirdparty/freetype/src/cff/cffdrivr.h
diff --git a/drivers/freetype/src/cff/cfferrs.h b/thirdparty/freetype/src/cff/cfferrs.h
index e7fc6eb71..e7fc6eb71 100644
--- a/drivers/freetype/src/cff/cfferrs.h
+++ b/thirdparty/freetype/src/cff/cfferrs.h
diff --git a/drivers/freetype/src/cff/cffgload.c b/thirdparty/freetype/src/cff/cffgload.c
index 752c18ed9..752c18ed9 100644
--- a/drivers/freetype/src/cff/cffgload.c
+++ b/thirdparty/freetype/src/cff/cffgload.c
diff --git a/drivers/freetype/src/cff/cffgload.h b/thirdparty/freetype/src/cff/cffgload.h
index b875fbed9..b875fbed9 100644
--- a/drivers/freetype/src/cff/cffgload.h
+++ b/thirdparty/freetype/src/cff/cffgload.h
diff --git a/drivers/freetype/src/cff/cffload.c b/thirdparty/freetype/src/cff/cffload.c
index 3d1bda97b..3d1bda97b 100644
--- a/drivers/freetype/src/cff/cffload.c
+++ b/thirdparty/freetype/src/cff/cffload.c
diff --git a/drivers/freetype/src/cff/cffload.h b/thirdparty/freetype/src/cff/cffload.h
index 1dd07baf1..1dd07baf1 100644
--- a/drivers/freetype/src/cff/cffload.h
+++ b/thirdparty/freetype/src/cff/cffload.h
diff --git a/drivers/freetype/src/cff/cffobjs.c b/thirdparty/freetype/src/cff/cffobjs.c
index 0f0769677..0f0769677 100644
--- a/drivers/freetype/src/cff/cffobjs.c
+++ b/thirdparty/freetype/src/cff/cffobjs.c
diff --git a/drivers/freetype/src/cff/cffobjs.h b/thirdparty/freetype/src/cff/cffobjs.h
index 9dc77536b..9dc77536b 100644
--- a/drivers/freetype/src/cff/cffobjs.h
+++ b/thirdparty/freetype/src/cff/cffobjs.h
diff --git a/drivers/freetype/src/cff/cffparse.c b/thirdparty/freetype/src/cff/cffparse.c
index a4f986b67..a4f986b67 100644
--- a/drivers/freetype/src/cff/cffparse.c
+++ b/thirdparty/freetype/src/cff/cffparse.c
diff --git a/drivers/freetype/src/cff/cffparse.h b/thirdparty/freetype/src/cff/cffparse.h
index a95970edc..a95970edc 100644
--- a/drivers/freetype/src/cff/cffparse.h
+++ b/thirdparty/freetype/src/cff/cffparse.h
diff --git a/drivers/freetype/src/cff/cffpic.c b/thirdparty/freetype/src/cff/cffpic.c
index a0bc34fd5..a0bc34fd5 100644
--- a/drivers/freetype/src/cff/cffpic.c
+++ b/thirdparty/freetype/src/cff/cffpic.c
diff --git a/drivers/freetype/src/cff/cffpic.h b/thirdparty/freetype/src/cff/cffpic.h
index bed6b35a8..bed6b35a8 100644
--- a/drivers/freetype/src/cff/cffpic.h
+++ b/thirdparty/freetype/src/cff/cffpic.h
diff --git a/drivers/freetype/src/cff/cfftoken.h b/thirdparty/freetype/src/cff/cfftoken.h
index 22637c780..22637c780 100644
--- a/drivers/freetype/src/cff/cfftoken.h
+++ b/thirdparty/freetype/src/cff/cfftoken.h
diff --git a/drivers/freetype/src/cff/cfftypes.h b/thirdparty/freetype/src/cff/cfftypes.h
index 4426c7e4f..4426c7e4f 100644
--- a/drivers/freetype/src/cff/cfftypes.h
+++ b/thirdparty/freetype/src/cff/cfftypes.h
diff --git a/drivers/freetype/src/cff/module.mk b/thirdparty/freetype/src/cff/module.mk
index 1b4781afe..1b4781afe 100644
--- a/drivers/freetype/src/cff/module.mk
+++ b/thirdparty/freetype/src/cff/module.mk
diff --git a/drivers/freetype/src/cff/rules.mk b/thirdparty/freetype/src/cff/rules.mk
index 92f68b1ed..92f68b1ed 100644
--- a/drivers/freetype/src/cff/rules.mk
+++ b/thirdparty/freetype/src/cff/rules.mk
diff --git a/drivers/freetype/src/cid/ciderrs.h b/thirdparty/freetype/src/cid/ciderrs.h
index 1dc98c7cd..1dc98c7cd 100644
--- a/drivers/freetype/src/cid/ciderrs.h
+++ b/thirdparty/freetype/src/cid/ciderrs.h
diff --git a/drivers/freetype/src/cid/cidgload.c b/thirdparty/freetype/src/cid/cidgload.c
index c7b95593e..c7b95593e 100644
--- a/drivers/freetype/src/cid/cidgload.c
+++ b/thirdparty/freetype/src/cid/cidgload.c
diff --git a/drivers/freetype/src/cid/cidgload.h b/thirdparty/freetype/src/cid/cidgload.h
index 62d664b3a..62d664b3a 100644
--- a/drivers/freetype/src/cid/cidgload.h
+++ b/thirdparty/freetype/src/cid/cidgload.h
diff --git a/drivers/freetype/src/cid/cidload.c b/thirdparty/freetype/src/cid/cidload.c
index d4f1ad1a7..d4f1ad1a7 100644
--- a/drivers/freetype/src/cid/cidload.c
+++ b/thirdparty/freetype/src/cid/cidload.c
diff --git a/drivers/freetype/src/cid/cidload.h b/thirdparty/freetype/src/cid/cidload.h
index 680f0d8fc..680f0d8fc 100644
--- a/drivers/freetype/src/cid/cidload.h
+++ b/thirdparty/freetype/src/cid/cidload.h
diff --git a/drivers/freetype/src/cid/cidobjs.c b/thirdparty/freetype/src/cid/cidobjs.c
index 2d2600fd4..2d2600fd4 100644
--- a/drivers/freetype/src/cid/cidobjs.c
+++ b/thirdparty/freetype/src/cid/cidobjs.c
diff --git a/drivers/freetype/src/cid/cidobjs.h b/thirdparty/freetype/src/cid/cidobjs.h
index 5dd377a9f..5dd377a9f 100644
--- a/drivers/freetype/src/cid/cidobjs.h
+++ b/thirdparty/freetype/src/cid/cidobjs.h
diff --git a/drivers/freetype/src/cid/cidparse.c b/thirdparty/freetype/src/cid/cidparse.c
index 73aca2ac6..73aca2ac6 100644
--- a/drivers/freetype/src/cid/cidparse.c
+++ b/thirdparty/freetype/src/cid/cidparse.c
diff --git a/drivers/freetype/src/cid/cidparse.h b/thirdparty/freetype/src/cid/cidparse.h
index 7268dc6ae..7268dc6ae 100644
--- a/drivers/freetype/src/cid/cidparse.h
+++ b/thirdparty/freetype/src/cid/cidparse.h
diff --git a/drivers/freetype/src/cid/cidriver.c b/thirdparty/freetype/src/cid/cidriver.c
index 64141ab6b..64141ab6b 100644
--- a/drivers/freetype/src/cid/cidriver.c
+++ b/thirdparty/freetype/src/cid/cidriver.c
diff --git a/drivers/freetype/src/cid/cidriver.h b/thirdparty/freetype/src/cid/cidriver.h
index a359a7890..a359a7890 100644
--- a/drivers/freetype/src/cid/cidriver.h
+++ b/thirdparty/freetype/src/cid/cidriver.h
diff --git a/drivers/freetype/src/cid/cidtoken.h b/thirdparty/freetype/src/cid/cidtoken.h
index 9c773fd09..9c773fd09 100644
--- a/drivers/freetype/src/cid/cidtoken.h
+++ b/thirdparty/freetype/src/cid/cidtoken.h
diff --git a/drivers/freetype/src/cid/module.mk b/thirdparty/freetype/src/cid/module.mk
index d9585d781..d9585d781 100644
--- a/drivers/freetype/src/cid/module.mk
+++ b/thirdparty/freetype/src/cid/module.mk
diff --git a/drivers/freetype/src/cid/rules.mk b/thirdparty/freetype/src/cid/rules.mk
index f33aab00d..f33aab00d 100644
--- a/drivers/freetype/src/cid/rules.mk
+++ b/thirdparty/freetype/src/cid/rules.mk
diff --git a/drivers/freetype/src/cid/type1cid.c b/thirdparty/freetype/src/cid/type1cid.c
index de3bdf770..de3bdf770 100644
--- a/drivers/freetype/src/cid/type1cid.c
+++ b/thirdparty/freetype/src/cid/type1cid.c
diff --git a/drivers/freetype/src/gxvalid/README b/thirdparty/freetype/src/gxvalid/README
index d3ac49c3e..d3ac49c3e 100644
--- a/drivers/freetype/src/gxvalid/README
+++ b/thirdparty/freetype/src/gxvalid/README
diff --git a/drivers/freetype/src/gxvalid/gxvalid.c b/thirdparty/freetype/src/gxvalid/gxvalid.c
index 7fb868cad..7fb868cad 100644
--- a/drivers/freetype/src/gxvalid/gxvalid.c
+++ b/thirdparty/freetype/src/gxvalid/gxvalid.c
diff --git a/drivers/freetype/src/gxvalid/gxvalid.h b/thirdparty/freetype/src/gxvalid/gxvalid.h
index 7a3ab795e..7a3ab795e 100644
--- a/drivers/freetype/src/gxvalid/gxvalid.h
+++ b/thirdparty/freetype/src/gxvalid/gxvalid.h
diff --git a/drivers/freetype/src/gxvalid/gxvbsln.c b/thirdparty/freetype/src/gxvalid/gxvbsln.c
index 493b20c31..493b20c31 100644
--- a/drivers/freetype/src/gxvalid/gxvbsln.c
+++ b/thirdparty/freetype/src/gxvalid/gxvbsln.c
diff --git a/drivers/freetype/src/gxvalid/gxvcommn.c b/thirdparty/freetype/src/gxvalid/gxvcommn.c
index 4b5e41539..4b5e41539 100644
--- a/drivers/freetype/src/gxvalid/gxvcommn.c
+++ b/thirdparty/freetype/src/gxvalid/gxvcommn.c
diff --git a/drivers/freetype/src/gxvalid/gxvcommn.h b/thirdparty/freetype/src/gxvalid/gxvcommn.h
index 9470c8412..9470c8412 100644
--- a/drivers/freetype/src/gxvalid/gxvcommn.h
+++ b/thirdparty/freetype/src/gxvalid/gxvcommn.h
diff --git a/drivers/freetype/src/gxvalid/gxverror.h b/thirdparty/freetype/src/gxvalid/gxverror.h
index 2e53355ce..2e53355ce 100644
--- a/drivers/freetype/src/gxvalid/gxverror.h
+++ b/thirdparty/freetype/src/gxvalid/gxverror.h
diff --git a/drivers/freetype/src/gxvalid/gxvfeat.c b/thirdparty/freetype/src/gxvalid/gxvfeat.c
index 5bff7c261..5bff7c261 100644
--- a/drivers/freetype/src/gxvalid/gxvfeat.c
+++ b/thirdparty/freetype/src/gxvalid/gxvfeat.c
diff --git a/drivers/freetype/src/gxvalid/gxvfeat.h b/thirdparty/freetype/src/gxvalid/gxvfeat.h
index 284bada89..284bada89 100644
--- a/drivers/freetype/src/gxvalid/gxvfeat.h
+++ b/thirdparty/freetype/src/gxvalid/gxvfeat.h
diff --git a/drivers/freetype/src/gxvalid/gxvfgen.c b/thirdparty/freetype/src/gxvalid/gxvfgen.c
index 667dac3cd..667dac3cd 100644
--- a/drivers/freetype/src/gxvalid/gxvfgen.c
+++ b/thirdparty/freetype/src/gxvalid/gxvfgen.c
diff --git a/drivers/freetype/src/gxvalid/gxvjust.c b/thirdparty/freetype/src/gxvalid/gxvjust.c
index 20d29bfbc..20d29bfbc 100644
--- a/drivers/freetype/src/gxvalid/gxvjust.c
+++ b/thirdparty/freetype/src/gxvalid/gxvjust.c
diff --git a/drivers/freetype/src/gxvalid/gxvkern.c b/thirdparty/freetype/src/gxvalid/gxvkern.c
index ee1ab36f7..ee1ab36f7 100644
--- a/drivers/freetype/src/gxvalid/gxvkern.c
+++ b/thirdparty/freetype/src/gxvalid/gxvkern.c
diff --git a/drivers/freetype/src/gxvalid/gxvlcar.c b/thirdparty/freetype/src/gxvalid/gxvlcar.c
index d31b6410b..d31b6410b 100644
--- a/drivers/freetype/src/gxvalid/gxvlcar.c
+++ b/thirdparty/freetype/src/gxvalid/gxvlcar.c
diff --git a/drivers/freetype/src/gxvalid/gxvmod.c b/thirdparty/freetype/src/gxvalid/gxvmod.c
index e589a7fb7..e589a7fb7 100644
--- a/drivers/freetype/src/gxvalid/gxvmod.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmod.c
diff --git a/drivers/freetype/src/gxvalid/gxvmod.h b/thirdparty/freetype/src/gxvalid/gxvmod.h
index 8b82e9107..8b82e9107 100644
--- a/drivers/freetype/src/gxvalid/gxvmod.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmod.h
diff --git a/drivers/freetype/src/gxvalid/gxvmort.c b/thirdparty/freetype/src/gxvalid/gxvmort.c
index b83a2b2c0..b83a2b2c0 100644
--- a/drivers/freetype/src/gxvalid/gxvmort.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort.c
diff --git a/drivers/freetype/src/gxvalid/gxvmort.h b/thirdparty/freetype/src/gxvalid/gxvmort.h
index 5fd228212..5fd228212 100644
--- a/drivers/freetype/src/gxvalid/gxvmort.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmort.h
diff --git a/drivers/freetype/src/gxvalid/gxvmort0.c b/thirdparty/freetype/src/gxvalid/gxvmort0.c
index e11f5ddc4..e11f5ddc4 100644
--- a/drivers/freetype/src/gxvalid/gxvmort0.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort0.c
diff --git a/drivers/freetype/src/gxvalid/gxvmort1.c b/thirdparty/freetype/src/gxvalid/gxvmort1.c
index fd761d069..fd761d069 100644
--- a/drivers/freetype/src/gxvalid/gxvmort1.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort1.c
diff --git a/drivers/freetype/src/gxvalid/gxvmort2.c b/thirdparty/freetype/src/gxvalid/gxvmort2.c
index 08455dec6..08455dec6 100644
--- a/drivers/freetype/src/gxvalid/gxvmort2.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort2.c
diff --git a/drivers/freetype/src/gxvalid/gxvmort4.c b/thirdparty/freetype/src/gxvalid/gxvmort4.c
index 6f7bbb871..6f7bbb871 100644
--- a/drivers/freetype/src/gxvalid/gxvmort4.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort4.c
diff --git a/drivers/freetype/src/gxvalid/gxvmort5.c b/thirdparty/freetype/src/gxvalid/gxvmort5.c
index 54ddbe2b1..54ddbe2b1 100644
--- a/drivers/freetype/src/gxvalid/gxvmort5.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort5.c
diff --git a/drivers/freetype/src/gxvalid/gxvmorx.c b/thirdparty/freetype/src/gxvalid/gxvmorx.c
index a3abe435a..a3abe435a 100644
--- a/drivers/freetype/src/gxvalid/gxvmorx.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx.c
diff --git a/drivers/freetype/src/gxvalid/gxvmorx.h b/thirdparty/freetype/src/gxvalid/gxvmorx.h
index 9ba25c14a..9ba25c14a 100644
--- a/drivers/freetype/src/gxvalid/gxvmorx.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx.h
diff --git a/drivers/freetype/src/gxvalid/gxvmorx0.c b/thirdparty/freetype/src/gxvalid/gxvmorx0.c
index 4abb7368f..4abb7368f 100644
--- a/drivers/freetype/src/gxvalid/gxvmorx0.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx0.c
diff --git a/drivers/freetype/src/gxvalid/gxvmorx1.c b/thirdparty/freetype/src/gxvalid/gxvmorx1.c
index e581848c2..e581848c2 100644
--- a/drivers/freetype/src/gxvalid/gxvmorx1.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx1.c
diff --git a/drivers/freetype/src/gxvalid/gxvmorx2.c b/thirdparty/freetype/src/gxvalid/gxvmorx2.c
index 9495cca48..9495cca48 100644
--- a/drivers/freetype/src/gxvalid/gxvmorx2.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx2.c
diff --git a/drivers/freetype/src/gxvalid/gxvmorx4.c b/thirdparty/freetype/src/gxvalid/gxvmorx4.c
index 3b7731bbc..3b7731bbc 100644
--- a/drivers/freetype/src/gxvalid/gxvmorx4.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx4.c
diff --git a/drivers/freetype/src/gxvalid/gxvmorx5.c b/thirdparty/freetype/src/gxvalid/gxvmorx5.c
index 0e96166c0..0e96166c0 100644
--- a/drivers/freetype/src/gxvalid/gxvmorx5.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx5.c
diff --git a/drivers/freetype/src/gxvalid/gxvopbd.c b/thirdparty/freetype/src/gxvalid/gxvopbd.c
index e3ba082e1..e3ba082e1 100644
--- a/drivers/freetype/src/gxvalid/gxvopbd.c
+++ b/thirdparty/freetype/src/gxvalid/gxvopbd.c
diff --git a/drivers/freetype/src/gxvalid/gxvprop.c b/thirdparty/freetype/src/gxvalid/gxvprop.c
index 61b3aeee3..61b3aeee3 100644
--- a/drivers/freetype/src/gxvalid/gxvprop.c
+++ b/thirdparty/freetype/src/gxvalid/gxvprop.c
diff --git a/drivers/freetype/src/gxvalid/gxvtrak.c b/thirdparty/freetype/src/gxvalid/gxvtrak.c
index 0f07c04e2..0f07c04e2 100644
--- a/drivers/freetype/src/gxvalid/gxvtrak.c
+++ b/thirdparty/freetype/src/gxvalid/gxvtrak.c
diff --git a/drivers/freetype/src/gxvalid/module.mk b/thirdparty/freetype/src/gxvalid/module.mk
index b431384a5..b431384a5 100644
--- a/drivers/freetype/src/gxvalid/module.mk
+++ b/thirdparty/freetype/src/gxvalid/module.mk
diff --git a/drivers/freetype/src/gxvalid/rules.mk b/thirdparty/freetype/src/gxvalid/rules.mk
index 424f2a637..424f2a637 100644
--- a/drivers/freetype/src/gxvalid/rules.mk
+++ b/thirdparty/freetype/src/gxvalid/rules.mk
diff --git a/drivers/freetype/src/otvalid/module.mk b/thirdparty/freetype/src/otvalid/module.mk
index b929cdbab..b929cdbab 100644
--- a/drivers/freetype/src/otvalid/module.mk
+++ b/thirdparty/freetype/src/otvalid/module.mk
diff --git a/drivers/freetype/src/otvalid/otvalid.c b/thirdparty/freetype/src/otvalid/otvalid.c
index 932a974a3..932a974a3 100644
--- a/drivers/freetype/src/otvalid/otvalid.c
+++ b/thirdparty/freetype/src/otvalid/otvalid.c
diff --git a/drivers/freetype/src/otvalid/otvalid.h b/thirdparty/freetype/src/otvalid/otvalid.h
index 93438a063..93438a063 100644
--- a/drivers/freetype/src/otvalid/otvalid.h
+++ b/thirdparty/freetype/src/otvalid/otvalid.h
diff --git a/drivers/freetype/src/otvalid/otvbase.c b/thirdparty/freetype/src/otvalid/otvbase.c
index e86e8bb2f..e86e8bb2f 100644
--- a/drivers/freetype/src/otvalid/otvbase.c
+++ b/thirdparty/freetype/src/otvalid/otvbase.c
diff --git a/drivers/freetype/src/otvalid/otvcommn.c b/thirdparty/freetype/src/otvalid/otvcommn.c
index 2e88e102b..2e88e102b 100644
--- a/drivers/freetype/src/otvalid/otvcommn.c
+++ b/thirdparty/freetype/src/otvalid/otvcommn.c
diff --git a/drivers/freetype/src/otvalid/otvcommn.h b/thirdparty/freetype/src/otvalid/otvcommn.h
index 44e0c6379..44e0c6379 100644
--- a/drivers/freetype/src/otvalid/otvcommn.h
+++ b/thirdparty/freetype/src/otvalid/otvcommn.h
diff --git a/drivers/freetype/src/otvalid/otverror.h b/thirdparty/freetype/src/otvalid/otverror.h
index e7c8db0d5..e7c8db0d5 100644
--- a/drivers/freetype/src/otvalid/otverror.h
+++ b/thirdparty/freetype/src/otvalid/otverror.h
diff --git a/drivers/freetype/src/otvalid/otvgdef.c b/thirdparty/freetype/src/otvalid/otvgdef.c
index f19e300e5..f19e300e5 100644
--- a/drivers/freetype/src/otvalid/otvgdef.c
+++ b/thirdparty/freetype/src/otvalid/otvgdef.c
diff --git a/drivers/freetype/src/otvalid/otvgpos.c b/thirdparty/freetype/src/otvalid/otvgpos.c
index e904ea5d6..e904ea5d6 100644
--- a/drivers/freetype/src/otvalid/otvgpos.c
+++ b/thirdparty/freetype/src/otvalid/otvgpos.c
diff --git a/drivers/freetype/src/otvalid/otvgpos.h b/thirdparty/freetype/src/otvalid/otvgpos.h
index 2c09e64f9..2c09e64f9 100644
--- a/drivers/freetype/src/otvalid/otvgpos.h
+++ b/thirdparty/freetype/src/otvalid/otvgpos.h
diff --git a/drivers/freetype/src/otvalid/otvgsub.c b/thirdparty/freetype/src/otvalid/otvgsub.c
index c2b28569f..c2b28569f 100644
--- a/drivers/freetype/src/otvalid/otvgsub.c
+++ b/thirdparty/freetype/src/otvalid/otvgsub.c
diff --git a/drivers/freetype/src/otvalid/otvjstf.c b/thirdparty/freetype/src/otvalid/otvjstf.c
index e19c1c121..e19c1c121 100644
--- a/drivers/freetype/src/otvalid/otvjstf.c
+++ b/thirdparty/freetype/src/otvalid/otvjstf.c
diff --git a/drivers/freetype/src/otvalid/otvmath.c b/thirdparty/freetype/src/otvalid/otvmath.c
index 6c785b6fd..6c785b6fd 100644
--- a/drivers/freetype/src/otvalid/otvmath.c
+++ b/thirdparty/freetype/src/otvalid/otvmath.c
diff --git a/drivers/freetype/src/otvalid/otvmod.c b/thirdparty/freetype/src/otvalid/otvmod.c
index 972bd1baa..972bd1baa 100644
--- a/drivers/freetype/src/otvalid/otvmod.c
+++ b/thirdparty/freetype/src/otvalid/otvmod.c
diff --git a/drivers/freetype/src/otvalid/otvmod.h b/thirdparty/freetype/src/otvalid/otvmod.h
index e464030ab..e464030ab 100644
--- a/drivers/freetype/src/otvalid/otvmod.h
+++ b/thirdparty/freetype/src/otvalid/otvmod.h
diff --git a/drivers/freetype/src/otvalid/rules.mk b/thirdparty/freetype/src/otvalid/rules.mk
index 077447fcb..077447fcb 100644
--- a/drivers/freetype/src/otvalid/rules.mk
+++ b/thirdparty/freetype/src/otvalid/rules.mk
diff --git a/drivers/freetype/src/pcf/README b/thirdparty/freetype/src/pcf/README
index 10eff15fb..10eff15fb 100644
--- a/drivers/freetype/src/pcf/README
+++ b/thirdparty/freetype/src/pcf/README
diff --git a/drivers/freetype/src/pcf/module.mk b/thirdparty/freetype/src/pcf/module.mk
index df383ff0f..df383ff0f 100644
--- a/drivers/freetype/src/pcf/module.mk
+++ b/thirdparty/freetype/src/pcf/module.mk
diff --git a/drivers/freetype/src/pcf/pcf.c b/thirdparty/freetype/src/pcf/pcf.c
index 11d5b7b2a..11d5b7b2a 100644
--- a/drivers/freetype/src/pcf/pcf.c
+++ b/thirdparty/freetype/src/pcf/pcf.c
diff --git a/drivers/freetype/src/pcf/pcf.h b/thirdparty/freetype/src/pcf/pcf.h
index c726e5ec6..c726e5ec6 100644
--- a/drivers/freetype/src/pcf/pcf.h
+++ b/thirdparty/freetype/src/pcf/pcf.h
diff --git a/drivers/freetype/src/pcf/pcfdrivr.c b/thirdparty/freetype/src/pcf/pcfdrivr.c
index 0996d1079..0996d1079 100644
--- a/drivers/freetype/src/pcf/pcfdrivr.c
+++ b/thirdparty/freetype/src/pcf/pcfdrivr.c
diff --git a/drivers/freetype/src/pcf/pcfdrivr.h b/thirdparty/freetype/src/pcf/pcfdrivr.h
index 29d30497c..29d30497c 100644
--- a/drivers/freetype/src/pcf/pcfdrivr.h
+++ b/thirdparty/freetype/src/pcf/pcfdrivr.h
diff --git a/drivers/freetype/src/pcf/pcferror.h b/thirdparty/freetype/src/pcf/pcferror.h
index add8ef223..add8ef223 100644
--- a/drivers/freetype/src/pcf/pcferror.h
+++ b/thirdparty/freetype/src/pcf/pcferror.h
diff --git a/drivers/freetype/src/pcf/pcfread.c b/thirdparty/freetype/src/pcf/pcfread.c
index a86b45d6b..a86b45d6b 100644
--- a/drivers/freetype/src/pcf/pcfread.c
+++ b/thirdparty/freetype/src/pcf/pcfread.c
diff --git a/drivers/freetype/src/pcf/pcfread.h b/thirdparty/freetype/src/pcf/pcfread.h
index bed30e503..bed30e503 100644
--- a/drivers/freetype/src/pcf/pcfread.h
+++ b/thirdparty/freetype/src/pcf/pcfread.h
diff --git a/drivers/freetype/src/pcf/pcfutil.c b/thirdparty/freetype/src/pcf/pcfutil.c
index 0451ee8de..0451ee8de 100644
--- a/drivers/freetype/src/pcf/pcfutil.c
+++ b/thirdparty/freetype/src/pcf/pcfutil.c
diff --git a/drivers/freetype/src/pcf/pcfutil.h b/thirdparty/freetype/src/pcf/pcfutil.h
index be986e756..be986e756 100644
--- a/drivers/freetype/src/pcf/pcfutil.h
+++ b/thirdparty/freetype/src/pcf/pcfutil.h
diff --git a/drivers/freetype/src/pcf/rules.mk b/thirdparty/freetype/src/pcf/rules.mk
index 1b55daf4f..1b55daf4f 100644
--- a/drivers/freetype/src/pcf/rules.mk
+++ b/thirdparty/freetype/src/pcf/rules.mk
diff --git a/drivers/freetype/src/pfr/module.mk b/thirdparty/freetype/src/pfr/module.mk
index bf7808c72..bf7808c72 100644
--- a/drivers/freetype/src/pfr/module.mk
+++ b/thirdparty/freetype/src/pfr/module.mk
diff --git a/drivers/freetype/src/pfr/pfr.c b/thirdparty/freetype/src/pfr/pfr.c
index 1a433960a..1a433960a 100644
--- a/drivers/freetype/src/pfr/pfr.c
+++ b/thirdparty/freetype/src/pfr/pfr.c
diff --git a/drivers/freetype/src/pfr/pfrcmap.c b/thirdparty/freetype/src/pfr/pfrcmap.c
index a1439c2e9..a1439c2e9 100644
--- a/drivers/freetype/src/pfr/pfrcmap.c
+++ b/thirdparty/freetype/src/pfr/pfrcmap.c
diff --git a/drivers/freetype/src/pfr/pfrcmap.h b/thirdparty/freetype/src/pfr/pfrcmap.h
index 4a8a4d0a6..4a8a4d0a6 100644
--- a/drivers/freetype/src/pfr/pfrcmap.h
+++ b/thirdparty/freetype/src/pfr/pfrcmap.h
diff --git a/drivers/freetype/src/pfr/pfrdrivr.c b/thirdparty/freetype/src/pfr/pfrdrivr.c
index b81c15e56..b81c15e56 100644
--- a/drivers/freetype/src/pfr/pfrdrivr.c
+++ b/thirdparty/freetype/src/pfr/pfrdrivr.c
diff --git a/drivers/freetype/src/pfr/pfrdrivr.h b/thirdparty/freetype/src/pfr/pfrdrivr.h
index 32b2d9eab..32b2d9eab 100644
--- a/drivers/freetype/src/pfr/pfrdrivr.h
+++ b/thirdparty/freetype/src/pfr/pfrdrivr.h
diff --git a/drivers/freetype/src/pfr/pfrerror.h b/thirdparty/freetype/src/pfr/pfrerror.h
index 9305f8fb5..9305f8fb5 100644
--- a/drivers/freetype/src/pfr/pfrerror.h
+++ b/thirdparty/freetype/src/pfr/pfrerror.h
diff --git a/drivers/freetype/src/pfr/pfrgload.c b/thirdparty/freetype/src/pfr/pfrgload.c
index f9cd1f63b..f9cd1f63b 100644
--- a/drivers/freetype/src/pfr/pfrgload.c
+++ b/thirdparty/freetype/src/pfr/pfrgload.c
diff --git a/drivers/freetype/src/pfr/pfrgload.h b/thirdparty/freetype/src/pfr/pfrgload.h
index 908d4378a..908d4378a 100644
--- a/drivers/freetype/src/pfr/pfrgload.h
+++ b/thirdparty/freetype/src/pfr/pfrgload.h
diff --git a/drivers/freetype/src/pfr/pfrload.c b/thirdparty/freetype/src/pfr/pfrload.c
index e509e70b5..e509e70b5 100644
--- a/drivers/freetype/src/pfr/pfrload.c
+++ b/thirdparty/freetype/src/pfr/pfrload.c
diff --git a/drivers/freetype/src/pfr/pfrload.h b/thirdparty/freetype/src/pfr/pfrload.h
index 0f7a2bb23..0f7a2bb23 100644
--- a/drivers/freetype/src/pfr/pfrload.h
+++ b/thirdparty/freetype/src/pfr/pfrload.h
diff --git a/drivers/freetype/src/pfr/pfrobjs.c b/thirdparty/freetype/src/pfr/pfrobjs.c
index 769a3b616..769a3b616 100644
--- a/drivers/freetype/src/pfr/pfrobjs.c
+++ b/thirdparty/freetype/src/pfr/pfrobjs.c
diff --git a/drivers/freetype/src/pfr/pfrobjs.h b/thirdparty/freetype/src/pfr/pfrobjs.h
index 335aca885..335aca885 100644
--- a/drivers/freetype/src/pfr/pfrobjs.h
+++ b/thirdparty/freetype/src/pfr/pfrobjs.h
diff --git a/drivers/freetype/src/pfr/pfrsbit.c b/thirdparty/freetype/src/pfr/pfrsbit.c
index 144f50c0b..144f50c0b 100644
--- a/drivers/freetype/src/pfr/pfrsbit.c
+++ b/thirdparty/freetype/src/pfr/pfrsbit.c
diff --git a/drivers/freetype/src/pfr/pfrsbit.h b/thirdparty/freetype/src/pfr/pfrsbit.h
index 94ead28ca..94ead28ca 100644
--- a/drivers/freetype/src/pfr/pfrsbit.h
+++ b/thirdparty/freetype/src/pfr/pfrsbit.h
diff --git a/drivers/freetype/src/pfr/pfrtypes.h b/thirdparty/freetype/src/pfr/pfrtypes.h
index bd6c2cd30..bd6c2cd30 100644
--- a/drivers/freetype/src/pfr/pfrtypes.h
+++ b/thirdparty/freetype/src/pfr/pfrtypes.h
diff --git a/drivers/freetype/src/pfr/rules.mk b/thirdparty/freetype/src/pfr/rules.mk
index 39bb9e941..39bb9e941 100644
--- a/drivers/freetype/src/pfr/rules.mk
+++ b/thirdparty/freetype/src/pfr/rules.mk
diff --git a/drivers/freetype/src/psaux/afmparse.c b/thirdparty/freetype/src/psaux/afmparse.c
index 9fb0ac0e2..9fb0ac0e2 100644
--- a/drivers/freetype/src/psaux/afmparse.c
+++ b/thirdparty/freetype/src/psaux/afmparse.c
diff --git a/drivers/freetype/src/psaux/afmparse.h b/thirdparty/freetype/src/psaux/afmparse.h
index 6d8b193ff..6d8b193ff 100644
--- a/drivers/freetype/src/psaux/afmparse.h
+++ b/thirdparty/freetype/src/psaux/afmparse.h
diff --git a/drivers/freetype/src/psaux/module.mk b/thirdparty/freetype/src/psaux/module.mk
index 630c4f39d..630c4f39d 100644
--- a/drivers/freetype/src/psaux/module.mk
+++ b/thirdparty/freetype/src/psaux/module.mk
diff --git a/drivers/freetype/src/psaux/psaux.c b/thirdparty/freetype/src/psaux/psaux.c
index 33b462ef1..33b462ef1 100644
--- a/drivers/freetype/src/psaux/psaux.c
+++ b/thirdparty/freetype/src/psaux/psaux.c
diff --git a/drivers/freetype/src/psaux/psauxerr.h b/thirdparty/freetype/src/psaux/psauxerr.h
index 9739157fc..9739157fc 100644
--- a/drivers/freetype/src/psaux/psauxerr.h
+++ b/thirdparty/freetype/src/psaux/psauxerr.h
diff --git a/drivers/freetype/src/psaux/psauxmod.c b/thirdparty/freetype/src/psaux/psauxmod.c
index 80805e695..80805e695 100644
--- a/drivers/freetype/src/psaux/psauxmod.c
+++ b/thirdparty/freetype/src/psaux/psauxmod.c
diff --git a/drivers/freetype/src/psaux/psauxmod.h b/thirdparty/freetype/src/psaux/psauxmod.h
index b1dbb0690..b1dbb0690 100644
--- a/drivers/freetype/src/psaux/psauxmod.h
+++ b/thirdparty/freetype/src/psaux/psauxmod.h
diff --git a/drivers/freetype/src/psaux/psconv.c b/thirdparty/freetype/src/psaux/psconv.c
index fdaca7fb5..fdaca7fb5 100644
--- a/drivers/freetype/src/psaux/psconv.c
+++ b/thirdparty/freetype/src/psaux/psconv.c
diff --git a/drivers/freetype/src/psaux/psconv.h b/thirdparty/freetype/src/psaux/psconv.h
index 062de3641..062de3641 100644
--- a/drivers/freetype/src/psaux/psconv.h
+++ b/thirdparty/freetype/src/psaux/psconv.h
diff --git a/drivers/freetype/src/psaux/psobjs.c b/thirdparty/freetype/src/psaux/psobjs.c
index f208b5fc6..f208b5fc6 100644
--- a/drivers/freetype/src/psaux/psobjs.c
+++ b/thirdparty/freetype/src/psaux/psobjs.c
diff --git a/drivers/freetype/src/psaux/psobjs.h b/thirdparty/freetype/src/psaux/psobjs.h
index 4c7178e79..4c7178e79 100644
--- a/drivers/freetype/src/psaux/psobjs.h
+++ b/thirdparty/freetype/src/psaux/psobjs.h
diff --git a/drivers/freetype/src/psaux/rules.mk b/thirdparty/freetype/src/psaux/rules.mk
index 19787b5f8..19787b5f8 100644
--- a/drivers/freetype/src/psaux/rules.mk
+++ b/thirdparty/freetype/src/psaux/rules.mk
diff --git a/drivers/freetype/src/psaux/t1cmap.c b/thirdparty/freetype/src/psaux/t1cmap.c
index 43abb9861..43abb9861 100644
--- a/drivers/freetype/src/psaux/t1cmap.c
+++ b/thirdparty/freetype/src/psaux/t1cmap.c
diff --git a/drivers/freetype/src/psaux/t1cmap.h b/thirdparty/freetype/src/psaux/t1cmap.h
index 5e1277dc6..5e1277dc6 100644
--- a/drivers/freetype/src/psaux/t1cmap.h
+++ b/thirdparty/freetype/src/psaux/t1cmap.h
diff --git a/drivers/freetype/src/psaux/t1decode.c b/thirdparty/freetype/src/psaux/t1decode.c
index 98f6ce1c8..98f6ce1c8 100644
--- a/drivers/freetype/src/psaux/t1decode.c
+++ b/thirdparty/freetype/src/psaux/t1decode.c
diff --git a/drivers/freetype/src/psaux/t1decode.h b/thirdparty/freetype/src/psaux/t1decode.h
index 0f5adfa15..0f5adfa15 100644
--- a/drivers/freetype/src/psaux/t1decode.h
+++ b/thirdparty/freetype/src/psaux/t1decode.h
diff --git a/drivers/freetype/src/pshinter/module.mk b/thirdparty/freetype/src/pshinter/module.mk
index 63110c46a..63110c46a 100644
--- a/drivers/freetype/src/pshinter/module.mk
+++ b/thirdparty/freetype/src/pshinter/module.mk
diff --git a/drivers/freetype/src/pshinter/pshalgo.c b/thirdparty/freetype/src/pshinter/pshalgo.c
index 8f131be75..8f131be75 100644
--- a/drivers/freetype/src/pshinter/pshalgo.c
+++ b/thirdparty/freetype/src/pshinter/pshalgo.c
diff --git a/drivers/freetype/src/pshinter/pshalgo.h b/thirdparty/freetype/src/pshinter/pshalgo.h
index f1bda6501..f1bda6501 100644
--- a/drivers/freetype/src/pshinter/pshalgo.h
+++ b/thirdparty/freetype/src/pshinter/pshalgo.h
diff --git a/drivers/freetype/src/pshinter/pshglob.c b/thirdparty/freetype/src/pshinter/pshglob.c
index 2ac5ef155..2ac5ef155 100644
--- a/drivers/freetype/src/pshinter/pshglob.c
+++ b/thirdparty/freetype/src/pshinter/pshglob.c
diff --git a/drivers/freetype/src/pshinter/pshglob.h b/thirdparty/freetype/src/pshinter/pshglob.h
index 45c957b6e..45c957b6e 100644
--- a/drivers/freetype/src/pshinter/pshglob.h
+++ b/thirdparty/freetype/src/pshinter/pshglob.h
diff --git a/drivers/freetype/src/pshinter/pshinter.c b/thirdparty/freetype/src/pshinter/pshinter.c
index 614e0bb3d..614e0bb3d 100644
--- a/drivers/freetype/src/pshinter/pshinter.c
+++ b/thirdparty/freetype/src/pshinter/pshinter.c
diff --git a/drivers/freetype/src/pshinter/pshmod.c b/thirdparty/freetype/src/pshinter/pshmod.c
index fa4ad1f56..fa4ad1f56 100644
--- a/drivers/freetype/src/pshinter/pshmod.c
+++ b/thirdparty/freetype/src/pshinter/pshmod.c
diff --git a/drivers/freetype/src/pshinter/pshmod.h b/thirdparty/freetype/src/pshinter/pshmod.h
index 39112a956..39112a956 100644
--- a/drivers/freetype/src/pshinter/pshmod.h
+++ b/thirdparty/freetype/src/pshinter/pshmod.h
diff --git a/drivers/freetype/src/pshinter/pshnterr.h b/thirdparty/freetype/src/pshinter/pshnterr.h
index 7a94588b8..7a94588b8 100644
--- a/drivers/freetype/src/pshinter/pshnterr.h
+++ b/thirdparty/freetype/src/pshinter/pshnterr.h
diff --git a/drivers/freetype/src/pshinter/pshpic.c b/thirdparty/freetype/src/pshinter/pshpic.c
index d0a3d8ebc..d0a3d8ebc 100644
--- a/drivers/freetype/src/pshinter/pshpic.c
+++ b/thirdparty/freetype/src/pshinter/pshpic.c
diff --git a/drivers/freetype/src/pshinter/pshpic.h b/thirdparty/freetype/src/pshinter/pshpic.h
index 75ee57354..75ee57354 100644
--- a/drivers/freetype/src/pshinter/pshpic.h
+++ b/thirdparty/freetype/src/pshinter/pshpic.h
diff --git a/drivers/freetype/src/pshinter/pshrec.c b/thirdparty/freetype/src/pshinter/pshrec.c
index d7cc4a0d2..d7cc4a0d2 100644
--- a/drivers/freetype/src/pshinter/pshrec.c
+++ b/thirdparty/freetype/src/pshinter/pshrec.c
diff --git a/drivers/freetype/src/pshinter/pshrec.h b/thirdparty/freetype/src/pshinter/pshrec.h
index 97e6f0ed5..97e6f0ed5 100644
--- a/drivers/freetype/src/pshinter/pshrec.h
+++ b/thirdparty/freetype/src/pshinter/pshrec.h
diff --git a/drivers/freetype/src/pshinter/rules.mk b/thirdparty/freetype/src/pshinter/rules.mk
index 67ecf7862..67ecf7862 100644
--- a/drivers/freetype/src/pshinter/rules.mk
+++ b/thirdparty/freetype/src/pshinter/rules.mk
diff --git a/drivers/freetype/src/psnames/module.mk b/thirdparty/freetype/src/psnames/module.mk
index ba29af813..ba29af813 100644
--- a/drivers/freetype/src/psnames/module.mk
+++ b/thirdparty/freetype/src/psnames/module.mk
diff --git a/drivers/freetype/src/psnames/psmodule.c b/thirdparty/freetype/src/psnames/psmodule.c
index 345402d7c..345402d7c 100644
--- a/drivers/freetype/src/psnames/psmodule.c
+++ b/thirdparty/freetype/src/psnames/psmodule.c
diff --git a/drivers/freetype/src/psnames/psmodule.h b/thirdparty/freetype/src/psnames/psmodule.h
index ee3c6cb63..ee3c6cb63 100644
--- a/drivers/freetype/src/psnames/psmodule.h
+++ b/thirdparty/freetype/src/psnames/psmodule.h
diff --git a/drivers/freetype/src/psnames/psnamerr.h b/thirdparty/freetype/src/psnames/psnamerr.h
index 3a9f65323..3a9f65323 100644
--- a/drivers/freetype/src/psnames/psnamerr.h
+++ b/thirdparty/freetype/src/psnames/psnamerr.h
diff --git a/drivers/freetype/src/psnames/psnames.c b/thirdparty/freetype/src/psnames/psnames.c
index e7b2c0b5e..e7b2c0b5e 100644
--- a/drivers/freetype/src/psnames/psnames.c
+++ b/thirdparty/freetype/src/psnames/psnames.c
diff --git a/drivers/freetype/src/psnames/pspic.c b/thirdparty/freetype/src/psnames/pspic.c
index a78ec5aa8..a78ec5aa8 100644
--- a/drivers/freetype/src/psnames/pspic.c
+++ b/thirdparty/freetype/src/psnames/pspic.c
diff --git a/drivers/freetype/src/psnames/pspic.h b/thirdparty/freetype/src/psnames/pspic.h
index 48348765c..48348765c 100644
--- a/drivers/freetype/src/psnames/pspic.h
+++ b/thirdparty/freetype/src/psnames/pspic.h
diff --git a/drivers/freetype/src/psnames/pstables.h b/thirdparty/freetype/src/psnames/pstables.h
index eb827fa5e..eb827fa5e 100644
--- a/drivers/freetype/src/psnames/pstables.h
+++ b/thirdparty/freetype/src/psnames/pstables.h
diff --git a/drivers/freetype/src/psnames/rules.mk b/thirdparty/freetype/src/psnames/rules.mk
index 9849f4053..9849f4053 100644
--- a/drivers/freetype/src/psnames/rules.mk
+++ b/thirdparty/freetype/src/psnames/rules.mk
diff --git a/drivers/freetype/src/raster/ftmisc.h b/thirdparty/freetype/src/raster/ftmisc.h
index 981ce3227..981ce3227 100644
--- a/drivers/freetype/src/raster/ftmisc.h
+++ b/thirdparty/freetype/src/raster/ftmisc.h
diff --git a/drivers/freetype/src/raster/ftraster.c b/thirdparty/freetype/src/raster/ftraster.c
index 0fa2f2687..0fa2f2687 100644
--- a/drivers/freetype/src/raster/ftraster.c
+++ b/thirdparty/freetype/src/raster/ftraster.c
diff --git a/drivers/freetype/src/raster/ftraster.h b/thirdparty/freetype/src/raster/ftraster.h
index 65cd5f960..65cd5f960 100644
--- a/drivers/freetype/src/raster/ftraster.h
+++ b/thirdparty/freetype/src/raster/ftraster.h
diff --git a/drivers/freetype/src/raster/ftrend1.c b/thirdparty/freetype/src/raster/ftrend1.c
index 494f11223..494f11223 100644
--- a/drivers/freetype/src/raster/ftrend1.c
+++ b/thirdparty/freetype/src/raster/ftrend1.c
diff --git a/drivers/freetype/src/raster/ftrend1.h b/thirdparty/freetype/src/raster/ftrend1.h
index a431f185d..a431f185d 100644
--- a/drivers/freetype/src/raster/ftrend1.h
+++ b/thirdparty/freetype/src/raster/ftrend1.h
diff --git a/drivers/freetype/src/raster/module.mk b/thirdparty/freetype/src/raster/module.mk
index f4a5f8e83..f4a5f8e83 100644
--- a/drivers/freetype/src/raster/module.mk
+++ b/thirdparty/freetype/src/raster/module.mk
diff --git a/drivers/freetype/src/raster/raster.c b/thirdparty/freetype/src/raster/raster.c
index 5b21dcbc6..5b21dcbc6 100644
--- a/drivers/freetype/src/raster/raster.c
+++ b/thirdparty/freetype/src/raster/raster.c
diff --git a/drivers/freetype/src/raster/rasterrs.h b/thirdparty/freetype/src/raster/rasterrs.h
index 44da7fca5..44da7fca5 100644
--- a/drivers/freetype/src/raster/rasterrs.h
+++ b/thirdparty/freetype/src/raster/rasterrs.h
diff --git a/drivers/freetype/src/raster/rastpic.c b/thirdparty/freetype/src/raster/rastpic.c
index dcfa92eef..dcfa92eef 100644
--- a/drivers/freetype/src/raster/rastpic.c
+++ b/thirdparty/freetype/src/raster/rastpic.c
diff --git a/drivers/freetype/src/raster/rastpic.h b/thirdparty/freetype/src/raster/rastpic.h
index 781587638..781587638 100644
--- a/drivers/freetype/src/raster/rastpic.h
+++ b/thirdparty/freetype/src/raster/rastpic.h
diff --git a/drivers/freetype/src/raster/rules.mk b/thirdparty/freetype/src/raster/rules.mk
index 929faa3a9..929faa3a9 100644
--- a/drivers/freetype/src/raster/rules.mk
+++ b/thirdparty/freetype/src/raster/rules.mk
diff --git a/drivers/freetype/src/sfnt/module.mk b/thirdparty/freetype/src/sfnt/module.mk
index ca19e096a..ca19e096a 100644
--- a/drivers/freetype/src/sfnt/module.mk
+++ b/thirdparty/freetype/src/sfnt/module.mk
diff --git a/drivers/freetype/src/sfnt/pngshim.c b/thirdparty/freetype/src/sfnt/pngshim.c
index 2815759cc..2815759cc 100644
--- a/drivers/freetype/src/sfnt/pngshim.c
+++ b/thirdparty/freetype/src/sfnt/pngshim.c
diff --git a/drivers/freetype/src/sfnt/pngshim.h b/thirdparty/freetype/src/sfnt/pngshim.h
index ff0587133..ff0587133 100644
--- a/drivers/freetype/src/sfnt/pngshim.h
+++ b/thirdparty/freetype/src/sfnt/pngshim.h
diff --git a/drivers/freetype/src/sfnt/rules.mk b/thirdparty/freetype/src/sfnt/rules.mk
index e9fc42156..e9fc42156 100644
--- a/drivers/freetype/src/sfnt/rules.mk
+++ b/thirdparty/freetype/src/sfnt/rules.mk
diff --git a/drivers/freetype/src/sfnt/sfdriver.c b/thirdparty/freetype/src/sfnt/sfdriver.c
index 47e896775..47e896775 100644
--- a/drivers/freetype/src/sfnt/sfdriver.c
+++ b/thirdparty/freetype/src/sfnt/sfdriver.c
diff --git a/drivers/freetype/src/sfnt/sfdriver.h b/thirdparty/freetype/src/sfnt/sfdriver.h
index 2694488e2..2694488e2 100644
--- a/drivers/freetype/src/sfnt/sfdriver.h
+++ b/thirdparty/freetype/src/sfnt/sfdriver.h
diff --git a/drivers/freetype/src/sfnt/sferrors.h b/thirdparty/freetype/src/sfnt/sferrors.h
index c2f9fdfea..c2f9fdfea 100644
--- a/drivers/freetype/src/sfnt/sferrors.h
+++ b/thirdparty/freetype/src/sfnt/sferrors.h
diff --git a/drivers/freetype/src/sfnt/sfnt.c b/thirdparty/freetype/src/sfnt/sfnt.c
index 952d6d425..952d6d425 100644
--- a/drivers/freetype/src/sfnt/sfnt.c
+++ b/thirdparty/freetype/src/sfnt/sfnt.c
diff --git a/drivers/freetype/src/sfnt/sfntpic.c b/thirdparty/freetype/src/sfnt/sfntpic.c
index 1f596c093..1f596c093 100644
--- a/drivers/freetype/src/sfnt/sfntpic.c
+++ b/thirdparty/freetype/src/sfnt/sfntpic.c
diff --git a/drivers/freetype/src/sfnt/sfntpic.h b/thirdparty/freetype/src/sfnt/sfntpic.h
index 5ce96d393..5ce96d393 100644
--- a/drivers/freetype/src/sfnt/sfntpic.h
+++ b/thirdparty/freetype/src/sfnt/sfntpic.h
diff --git a/drivers/freetype/src/sfnt/sfobjs.c b/thirdparty/freetype/src/sfnt/sfobjs.c
index 2e8c1ecde..2e8c1ecde 100644
--- a/drivers/freetype/src/sfnt/sfobjs.c
+++ b/thirdparty/freetype/src/sfnt/sfobjs.c
diff --git a/drivers/freetype/src/sfnt/sfobjs.h b/thirdparty/freetype/src/sfnt/sfobjs.h
index 60b5698ed..60b5698ed 100644
--- a/drivers/freetype/src/sfnt/sfobjs.h
+++ b/thirdparty/freetype/src/sfnt/sfobjs.h
diff --git a/drivers/freetype/src/sfnt/ttbdf.c b/thirdparty/freetype/src/sfnt/ttbdf.c
index f89169111..f89169111 100644
--- a/drivers/freetype/src/sfnt/ttbdf.c
+++ b/thirdparty/freetype/src/sfnt/ttbdf.c
diff --git a/drivers/freetype/src/sfnt/ttbdf.h b/thirdparty/freetype/src/sfnt/ttbdf.h
index ae521c60b..ae521c60b 100644
--- a/drivers/freetype/src/sfnt/ttbdf.h
+++ b/thirdparty/freetype/src/sfnt/ttbdf.h
diff --git a/drivers/freetype/src/sfnt/ttcmap.c b/thirdparty/freetype/src/sfnt/ttcmap.c
index 01255a887..01255a887 100644
--- a/drivers/freetype/src/sfnt/ttcmap.c
+++ b/thirdparty/freetype/src/sfnt/ttcmap.c
diff --git a/drivers/freetype/src/sfnt/ttcmap.h b/thirdparty/freetype/src/sfnt/ttcmap.h
index 2273cbd96..2273cbd96 100644
--- a/drivers/freetype/src/sfnt/ttcmap.h
+++ b/thirdparty/freetype/src/sfnt/ttcmap.h
diff --git a/drivers/freetype/src/sfnt/ttcmapc.h b/thirdparty/freetype/src/sfnt/ttcmapc.h
index 7c732fbd3..7c732fbd3 100644
--- a/drivers/freetype/src/sfnt/ttcmapc.h
+++ b/thirdparty/freetype/src/sfnt/ttcmapc.h
diff --git a/drivers/freetype/src/sfnt/ttkern.c b/thirdparty/freetype/src/sfnt/ttkern.c
index 6f9fa522d..6f9fa522d 100644
--- a/drivers/freetype/src/sfnt/ttkern.c
+++ b/thirdparty/freetype/src/sfnt/ttkern.c
diff --git a/drivers/freetype/src/sfnt/ttkern.h b/thirdparty/freetype/src/sfnt/ttkern.h
index 85dd5c31a..85dd5c31a 100644
--- a/drivers/freetype/src/sfnt/ttkern.h
+++ b/thirdparty/freetype/src/sfnt/ttkern.h
diff --git a/drivers/freetype/src/sfnt/ttload.c b/thirdparty/freetype/src/sfnt/ttload.c
index 2f5b2c384..2f5b2c384 100644
--- a/drivers/freetype/src/sfnt/ttload.c
+++ b/thirdparty/freetype/src/sfnt/ttload.c
diff --git a/drivers/freetype/src/sfnt/ttload.h b/thirdparty/freetype/src/sfnt/ttload.h
index bec42b94b..bec42b94b 100644
--- a/drivers/freetype/src/sfnt/ttload.h
+++ b/thirdparty/freetype/src/sfnt/ttload.h
diff --git a/drivers/freetype/src/sfnt/ttmtx.c b/thirdparty/freetype/src/sfnt/ttmtx.c
index 186f873da..186f873da 100644
--- a/drivers/freetype/src/sfnt/ttmtx.c
+++ b/thirdparty/freetype/src/sfnt/ttmtx.c
diff --git a/drivers/freetype/src/sfnt/ttmtx.h b/thirdparty/freetype/src/sfnt/ttmtx.h
index 78395def3..78395def3 100644
--- a/drivers/freetype/src/sfnt/ttmtx.h
+++ b/thirdparty/freetype/src/sfnt/ttmtx.h
diff --git a/drivers/freetype/src/sfnt/ttpost.c b/thirdparty/freetype/src/sfnt/ttpost.c
index 3277f1ec4..3277f1ec4 100644
--- a/drivers/freetype/src/sfnt/ttpost.c
+++ b/thirdparty/freetype/src/sfnt/ttpost.c
diff --git a/drivers/freetype/src/sfnt/ttpost.h b/thirdparty/freetype/src/sfnt/ttpost.h
index ede45fd84..ede45fd84 100644
--- a/drivers/freetype/src/sfnt/ttpost.h
+++ b/thirdparty/freetype/src/sfnt/ttpost.h
diff --git a/drivers/freetype/src/sfnt/ttsbit.c b/thirdparty/freetype/src/sfnt/ttsbit.c
index e24e7d6cd..e24e7d6cd 100644
--- a/drivers/freetype/src/sfnt/ttsbit.c
+++ b/thirdparty/freetype/src/sfnt/ttsbit.c
diff --git a/drivers/freetype/src/sfnt/ttsbit.h b/thirdparty/freetype/src/sfnt/ttsbit.h
index d8a816708..d8a816708 100644
--- a/drivers/freetype/src/sfnt/ttsbit.h
+++ b/thirdparty/freetype/src/sfnt/ttsbit.h
diff --git a/drivers/freetype/src/smooth/ftgrays.c b/thirdparty/freetype/src/smooth/ftgrays.c
index 0bf3ac6ff..0bf3ac6ff 100644
--- a/drivers/freetype/src/smooth/ftgrays.c
+++ b/thirdparty/freetype/src/smooth/ftgrays.c
diff --git a/drivers/freetype/src/smooth/ftgrays.h b/thirdparty/freetype/src/smooth/ftgrays.h
index 21c2badca..21c2badca 100644
--- a/drivers/freetype/src/smooth/ftgrays.h
+++ b/thirdparty/freetype/src/smooth/ftgrays.h
diff --git a/drivers/freetype/src/smooth/ftsmerrs.h b/thirdparty/freetype/src/smooth/ftsmerrs.h
index a759b91c1..a759b91c1 100644
--- a/drivers/freetype/src/smooth/ftsmerrs.h
+++ b/thirdparty/freetype/src/smooth/ftsmerrs.h
diff --git a/drivers/freetype/src/smooth/ftsmooth.c b/thirdparty/freetype/src/smooth/ftsmooth.c
index 79276765b..79276765b 100644
--- a/drivers/freetype/src/smooth/ftsmooth.c
+++ b/thirdparty/freetype/src/smooth/ftsmooth.c
diff --git a/drivers/freetype/src/smooth/ftsmooth.h b/thirdparty/freetype/src/smooth/ftsmooth.h
index c7c28c244..c7c28c244 100644
--- a/drivers/freetype/src/smooth/ftsmooth.h
+++ b/thirdparty/freetype/src/smooth/ftsmooth.h
diff --git a/drivers/freetype/src/smooth/ftspic.c b/thirdparty/freetype/src/smooth/ftspic.c
index 6c2b2329b..6c2b2329b 100644
--- a/drivers/freetype/src/smooth/ftspic.c
+++ b/thirdparty/freetype/src/smooth/ftspic.c
diff --git a/drivers/freetype/src/smooth/ftspic.h b/thirdparty/freetype/src/smooth/ftspic.h
index fe7615277..fe7615277 100644
--- a/drivers/freetype/src/smooth/ftspic.h
+++ b/thirdparty/freetype/src/smooth/ftspic.h
diff --git a/drivers/freetype/src/smooth/module.mk b/thirdparty/freetype/src/smooth/module.mk
index f3cb04403..f3cb04403 100644
--- a/drivers/freetype/src/smooth/module.mk
+++ b/thirdparty/freetype/src/smooth/module.mk
diff --git a/drivers/freetype/src/smooth/rules.mk b/thirdparty/freetype/src/smooth/rules.mk
index 5e94f7351..5e94f7351 100644
--- a/drivers/freetype/src/smooth/rules.mk
+++ b/thirdparty/freetype/src/smooth/rules.mk
diff --git a/drivers/freetype/src/smooth/smooth.c b/thirdparty/freetype/src/smooth/smooth.c
index 97ca3e599..97ca3e599 100644
--- a/drivers/freetype/src/smooth/smooth.c
+++ b/thirdparty/freetype/src/smooth/smooth.c
diff --git a/drivers/freetype/src/truetype/module.mk b/thirdparty/freetype/src/truetype/module.mk
index 80c9832b2..80c9832b2 100644
--- a/drivers/freetype/src/truetype/module.mk
+++ b/thirdparty/freetype/src/truetype/module.mk
diff --git a/drivers/freetype/src/truetype/rules.mk b/thirdparty/freetype/src/truetype/rules.mk
index 3bf7cf770..3bf7cf770 100644
--- a/drivers/freetype/src/truetype/rules.mk
+++ b/thirdparty/freetype/src/truetype/rules.mk
diff --git a/drivers/freetype/src/truetype/truetype.c b/thirdparty/freetype/src/truetype/truetype.c
index 23e2ea00a..23e2ea00a 100644
--- a/drivers/freetype/src/truetype/truetype.c
+++ b/thirdparty/freetype/src/truetype/truetype.c
diff --git a/drivers/freetype/src/truetype/ttdriver.c b/thirdparty/freetype/src/truetype/ttdriver.c
index c9d4081ef..c9d4081ef 100644
--- a/drivers/freetype/src/truetype/ttdriver.c
+++ b/thirdparty/freetype/src/truetype/ttdriver.c
diff --git a/drivers/freetype/src/truetype/ttdriver.h b/thirdparty/freetype/src/truetype/ttdriver.h
index 74392bbd0..74392bbd0 100644
--- a/drivers/freetype/src/truetype/ttdriver.h
+++ b/thirdparty/freetype/src/truetype/ttdriver.h
diff --git a/drivers/freetype/src/truetype/tterrors.h b/thirdparty/freetype/src/truetype/tterrors.h
index 895989f5f..895989f5f 100644
--- a/drivers/freetype/src/truetype/tterrors.h
+++ b/thirdparty/freetype/src/truetype/tterrors.h
diff --git a/drivers/freetype/src/truetype/ttgload.c b/thirdparty/freetype/src/truetype/ttgload.c
index 8be9b6ae6..8be9b6ae6 100644
--- a/drivers/freetype/src/truetype/ttgload.c
+++ b/thirdparty/freetype/src/truetype/ttgload.c
diff --git a/drivers/freetype/src/truetype/ttgload.h b/thirdparty/freetype/src/truetype/ttgload.h
index bfa29e4ff..bfa29e4ff 100644
--- a/drivers/freetype/src/truetype/ttgload.h
+++ b/thirdparty/freetype/src/truetype/ttgload.h
diff --git a/drivers/freetype/src/truetype/ttgxvar.c b/thirdparty/freetype/src/truetype/ttgxvar.c
index 9a02c5a8c..9a02c5a8c 100644
--- a/drivers/freetype/src/truetype/ttgxvar.c
+++ b/thirdparty/freetype/src/truetype/ttgxvar.c
diff --git a/drivers/freetype/src/truetype/ttgxvar.h b/thirdparty/freetype/src/truetype/ttgxvar.h
index aa8f6ea59..aa8f6ea59 100644
--- a/drivers/freetype/src/truetype/ttgxvar.h
+++ b/thirdparty/freetype/src/truetype/ttgxvar.h
diff --git a/drivers/freetype/src/truetype/ttinterp.c b/thirdparty/freetype/src/truetype/ttinterp.c
index 8fe83c5ea..8fe83c5ea 100644
--- a/drivers/freetype/src/truetype/ttinterp.c
+++ b/thirdparty/freetype/src/truetype/ttinterp.c
diff --git a/drivers/freetype/src/truetype/ttinterp.h b/thirdparty/freetype/src/truetype/ttinterp.h
index df7ce51f1..df7ce51f1 100644
--- a/drivers/freetype/src/truetype/ttinterp.h
+++ b/thirdparty/freetype/src/truetype/ttinterp.h
diff --git a/drivers/freetype/src/truetype/ttobjs.c b/thirdparty/freetype/src/truetype/ttobjs.c
index ed3be2dbe..ed3be2dbe 100644
--- a/drivers/freetype/src/truetype/ttobjs.c
+++ b/thirdparty/freetype/src/truetype/ttobjs.c
diff --git a/drivers/freetype/src/truetype/ttobjs.h b/thirdparty/freetype/src/truetype/ttobjs.h
index ed61a7d51..ed61a7d51 100644
--- a/drivers/freetype/src/truetype/ttobjs.h
+++ b/thirdparty/freetype/src/truetype/ttobjs.h
diff --git a/drivers/freetype/src/truetype/ttpic.c b/thirdparty/freetype/src/truetype/ttpic.c
index 54a5b8bed..54a5b8bed 100644
--- a/drivers/freetype/src/truetype/ttpic.c
+++ b/thirdparty/freetype/src/truetype/ttpic.c
diff --git a/drivers/freetype/src/truetype/ttpic.h b/thirdparty/freetype/src/truetype/ttpic.h
index f725865c5..f725865c5 100644
--- a/drivers/freetype/src/truetype/ttpic.h
+++ b/thirdparty/freetype/src/truetype/ttpic.h
diff --git a/drivers/freetype/src/truetype/ttpload.c b/thirdparty/freetype/src/truetype/ttpload.c
index ca158ac50..ca158ac50 100644
--- a/drivers/freetype/src/truetype/ttpload.c
+++ b/thirdparty/freetype/src/truetype/ttpload.c
diff --git a/drivers/freetype/src/truetype/ttpload.h b/thirdparty/freetype/src/truetype/ttpload.h
index aa2e38e6e..aa2e38e6e 100644
--- a/drivers/freetype/src/truetype/ttpload.h
+++ b/thirdparty/freetype/src/truetype/ttpload.h
diff --git a/drivers/freetype/src/truetype/ttsubpix.c b/thirdparty/freetype/src/truetype/ttsubpix.c
index 03950960a..03950960a 100644
--- a/drivers/freetype/src/truetype/ttsubpix.c
+++ b/thirdparty/freetype/src/truetype/ttsubpix.c
diff --git a/drivers/freetype/src/truetype/ttsubpix.h b/thirdparty/freetype/src/truetype/ttsubpix.h
index 86844da66..86844da66 100644
--- a/drivers/freetype/src/truetype/ttsubpix.h
+++ b/thirdparty/freetype/src/truetype/ttsubpix.h
diff --git a/drivers/freetype/src/type1/module.mk b/thirdparty/freetype/src/type1/module.mk
index d7ab520c7..d7ab520c7 100644
--- a/drivers/freetype/src/type1/module.mk
+++ b/thirdparty/freetype/src/type1/module.mk
diff --git a/drivers/freetype/src/type1/rules.mk b/thirdparty/freetype/src/type1/rules.mk
index bdec29479..bdec29479 100644
--- a/drivers/freetype/src/type1/rules.mk
+++ b/thirdparty/freetype/src/type1/rules.mk
diff --git a/drivers/freetype/src/type1/t1afm.c b/thirdparty/freetype/src/type1/t1afm.c
index bbd843c1c..bbd843c1c 100644
--- a/drivers/freetype/src/type1/t1afm.c
+++ b/thirdparty/freetype/src/type1/t1afm.c
diff --git a/drivers/freetype/src/type1/t1afm.h b/thirdparty/freetype/src/type1/t1afm.h
index 3a864f237..3a864f237 100644
--- a/drivers/freetype/src/type1/t1afm.h
+++ b/thirdparty/freetype/src/type1/t1afm.h
diff --git a/drivers/freetype/src/type1/t1driver.c b/thirdparty/freetype/src/type1/t1driver.c
index f1e60d452..f1e60d452 100644
--- a/drivers/freetype/src/type1/t1driver.c
+++ b/thirdparty/freetype/src/type1/t1driver.c
diff --git a/drivers/freetype/src/type1/t1driver.h b/thirdparty/freetype/src/type1/t1driver.h
index 78d8e38aa..78d8e38aa 100644
--- a/drivers/freetype/src/type1/t1driver.h
+++ b/thirdparty/freetype/src/type1/t1driver.h
diff --git a/drivers/freetype/src/type1/t1errors.h b/thirdparty/freetype/src/type1/t1errors.h
index 9ba470ed6..9ba470ed6 100644
--- a/drivers/freetype/src/type1/t1errors.h
+++ b/thirdparty/freetype/src/type1/t1errors.h
diff --git a/drivers/freetype/src/type1/t1gload.c b/thirdparty/freetype/src/type1/t1gload.c
index ea36f6414..ea36f6414 100644
--- a/drivers/freetype/src/type1/t1gload.c
+++ b/thirdparty/freetype/src/type1/t1gload.c
diff --git a/drivers/freetype/src/type1/t1gload.h b/thirdparty/freetype/src/type1/t1gload.h
index 975f22785..975f22785 100644
--- a/drivers/freetype/src/type1/t1gload.h
+++ b/thirdparty/freetype/src/type1/t1gload.h
diff --git a/drivers/freetype/src/type1/t1load.c b/thirdparty/freetype/src/type1/t1load.c
index c981adcf2..c981adcf2 100644
--- a/drivers/freetype/src/type1/t1load.c
+++ b/thirdparty/freetype/src/type1/t1load.c
diff --git a/drivers/freetype/src/type1/t1load.h b/thirdparty/freetype/src/type1/t1load.h
index b96fe5a74..b96fe5a74 100644
--- a/drivers/freetype/src/type1/t1load.h
+++ b/thirdparty/freetype/src/type1/t1load.h
diff --git a/drivers/freetype/src/type1/t1objs.c b/thirdparty/freetype/src/type1/t1objs.c
index a00911713..a00911713 100644
--- a/drivers/freetype/src/type1/t1objs.c
+++ b/thirdparty/freetype/src/type1/t1objs.c
diff --git a/drivers/freetype/src/type1/t1objs.h b/thirdparty/freetype/src/type1/t1objs.h
index 94fbdee9a..94fbdee9a 100644
--- a/drivers/freetype/src/type1/t1objs.h
+++ b/thirdparty/freetype/src/type1/t1objs.h
diff --git a/drivers/freetype/src/type1/t1parse.c b/thirdparty/freetype/src/type1/t1parse.c
index 563d9f37b..563d9f37b 100644
--- a/drivers/freetype/src/type1/t1parse.c
+++ b/thirdparty/freetype/src/type1/t1parse.c
diff --git a/drivers/freetype/src/type1/t1parse.h b/thirdparty/freetype/src/type1/t1parse.h
index affa818e6..affa818e6 100644
--- a/drivers/freetype/src/type1/t1parse.h
+++ b/thirdparty/freetype/src/type1/t1parse.h
diff --git a/drivers/freetype/src/type1/t1tokens.h b/thirdparty/freetype/src/type1/t1tokens.h
index a84f291a6..a84f291a6 100644
--- a/drivers/freetype/src/type1/t1tokens.h
+++ b/thirdparty/freetype/src/type1/t1tokens.h
diff --git a/drivers/freetype/src/type1/type1.c b/thirdparty/freetype/src/type1/type1.c
index bb8aca97f..bb8aca97f 100644
--- a/drivers/freetype/src/type1/type1.c
+++ b/thirdparty/freetype/src/type1/type1.c
diff --git a/drivers/freetype/src/type42/module.mk b/thirdparty/freetype/src/type42/module.mk
index a7e27b723..a7e27b723 100644
--- a/drivers/freetype/src/type42/module.mk
+++ b/thirdparty/freetype/src/type42/module.mk
diff --git a/drivers/freetype/src/type42/rules.mk b/thirdparty/freetype/src/type42/rules.mk
index 80710eff6..80710eff6 100644
--- a/drivers/freetype/src/type42/rules.mk
+++ b/thirdparty/freetype/src/type42/rules.mk
diff --git a/drivers/freetype/src/type42/t42drivr.c b/thirdparty/freetype/src/type42/t42drivr.c
index c63ed0c81..c63ed0c81 100644
--- a/drivers/freetype/src/type42/t42drivr.c
+++ b/thirdparty/freetype/src/type42/t42drivr.c
diff --git a/drivers/freetype/src/type42/t42drivr.h b/thirdparty/freetype/src/type42/t42drivr.h
index 6ddfb639d..6ddfb639d 100644
--- a/drivers/freetype/src/type42/t42drivr.h
+++ b/thirdparty/freetype/src/type42/t42drivr.h
diff --git a/drivers/freetype/src/type42/t42error.h b/thirdparty/freetype/src/type42/t42error.h
index e1097cc81..e1097cc81 100644
--- a/drivers/freetype/src/type42/t42error.h
+++ b/thirdparty/freetype/src/type42/t42error.h
diff --git a/drivers/freetype/src/type42/t42objs.c b/thirdparty/freetype/src/type42/t42objs.c
index 4672c6e16..4672c6e16 100644
--- a/drivers/freetype/src/type42/t42objs.c
+++ b/thirdparty/freetype/src/type42/t42objs.c
diff --git a/drivers/freetype/src/type42/t42objs.h b/thirdparty/freetype/src/type42/t42objs.h
index 87a40452f..87a40452f 100644
--- a/drivers/freetype/src/type42/t42objs.h
+++ b/thirdparty/freetype/src/type42/t42objs.h
diff --git a/drivers/freetype/src/type42/t42parse.c b/thirdparty/freetype/src/type42/t42parse.c
index f948916af..f948916af 100644
--- a/drivers/freetype/src/type42/t42parse.c
+++ b/thirdparty/freetype/src/type42/t42parse.c
diff --git a/drivers/freetype/src/type42/t42parse.h b/thirdparty/freetype/src/type42/t42parse.h
index ba9e85719..ba9e85719 100644
--- a/drivers/freetype/src/type42/t42parse.h
+++ b/thirdparty/freetype/src/type42/t42parse.h
diff --git a/drivers/freetype/src/type42/t42types.h b/thirdparty/freetype/src/type42/t42types.h
index 850a156e4..850a156e4 100644
--- a/drivers/freetype/src/type42/t42types.h
+++ b/thirdparty/freetype/src/type42/t42types.h
diff --git a/drivers/freetype/src/type42/type42.c b/thirdparty/freetype/src/type42/type42.c
index 0d17a9b1d..0d17a9b1d 100644
--- a/drivers/freetype/src/type42/type42.c
+++ b/thirdparty/freetype/src/type42/type42.c
diff --git a/drivers/freetype/src/winfonts/fnterrs.h b/thirdparty/freetype/src/winfonts/fnterrs.h
index 6835d3e64..6835d3e64 100644
--- a/drivers/freetype/src/winfonts/fnterrs.h
+++ b/thirdparty/freetype/src/winfonts/fnterrs.h
diff --git a/drivers/freetype/src/winfonts/module.mk b/thirdparty/freetype/src/winfonts/module.mk
index 83da5732f..83da5732f 100644
--- a/drivers/freetype/src/winfonts/module.mk
+++ b/thirdparty/freetype/src/winfonts/module.mk
diff --git a/drivers/freetype/src/winfonts/rules.mk b/thirdparty/freetype/src/winfonts/rules.mk
index 2fd7b822a..2fd7b822a 100644
--- a/drivers/freetype/src/winfonts/rules.mk
+++ b/thirdparty/freetype/src/winfonts/rules.mk
diff --git a/drivers/freetype/src/winfonts/winfnt.c b/thirdparty/freetype/src/winfonts/winfnt.c
index 1c74ccd5a..1c74ccd5a 100644
--- a/drivers/freetype/src/winfonts/winfnt.c
+++ b/thirdparty/freetype/src/winfonts/winfnt.c
diff --git a/drivers/freetype/src/winfonts/winfnt.h b/thirdparty/freetype/src/winfonts/winfnt.h
index 9a4f32d5b..9a4f32d5b 100644
--- a/drivers/freetype/src/winfonts/winfnt.h
+++ b/thirdparty/freetype/src/winfonts/winfnt.h
diff --git a/drivers/gl_context/GL/glew.h b/thirdparty/glew/GL/glew.h
index 702265c38..702265c38 100644
--- a/drivers/gl_context/GL/glew.h
+++ b/thirdparty/glew/GL/glew.h
diff --git a/drivers/gl_context/GL/glxew.h b/thirdparty/glew/GL/glxew.h
index d803d260b..d803d260b 100644
--- a/drivers/gl_context/GL/glxew.h
+++ b/thirdparty/glew/GL/glxew.h
diff --git a/drivers/gl_context/GL/wglew.h b/thirdparty/glew/GL/wglew.h
index 23e4d3fba..23e4d3fba 100644
--- a/drivers/gl_context/GL/wglew.h
+++ b/thirdparty/glew/GL/wglew.h
diff --git a/thirdparty/glew/LICENSE.txt b/thirdparty/glew/LICENSE.txt
new file mode 100644
index 000000000..f7078042e
--- /dev/null
+++ b/thirdparty/glew/LICENSE.txt
@@ -0,0 +1,73 @@
+The OpenGL Extension Wrangler Library
+Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
+Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
+Copyright (C) 2002, Lev Povalahev
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* The name of the author may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Mesa 3-D graphics library
+Version: 7.0
+
+Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+Copyright (c) 2007 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and/or associated documentation files (the
+"Materials"), to deal in the Materials without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Materials, and to
+permit persons to whom the Materials are furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Materials.
+
+THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
diff --git a/drivers/gl_context/glew.c b/thirdparty/glew/glew.c
index 0ed5520da..0ed5520da 100644
--- a/drivers/gl_context/glew.c
+++ b/thirdparty/glew/glew.c
diff --git a/drivers/jpegd/jpgd.cpp b/thirdparty/jpeg-compressor/jpgd.cpp
index fad9a37a9..fad9a37a9 100644
--- a/drivers/jpegd/jpgd.cpp
+++ b/thirdparty/jpeg-compressor/jpgd.cpp
diff --git a/drivers/jpegd/jpgd.h b/thirdparty/jpeg-compressor/jpgd.h
index 150b9a0b2..150b9a0b2 100644
--- a/drivers/jpegd/jpgd.h
+++ b/thirdparty/jpeg-compressor/jpgd.h
diff --git a/thirdparty/libmpcdec/COPYING b/thirdparty/libmpcdec/COPYING
new file mode 100644
index 000000000..10190c014
--- /dev/null
+++ b/thirdparty/libmpcdec/COPYING
@@ -0,0 +1,31 @@
+Copyright (c) 2005, The Musepack Development Team
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/drivers/mpc/decoder.h b/thirdparty/libmpcdec/decoder.h
index 3813fc02e..3813fc02e 100644
--- a/drivers/mpc/decoder.h
+++ b/thirdparty/libmpcdec/decoder.h
diff --git a/drivers/mpc/huffman.c b/thirdparty/libmpcdec/huffman.c
index 52cdfd92c..52cdfd92c 100644
--- a/drivers/mpc/huffman.c
+++ b/thirdparty/libmpcdec/huffman.c
diff --git a/drivers/mpc/huffman.h b/thirdparty/libmpcdec/huffman.h
index 5b12bff93..5b12bff93 100644
--- a/drivers/mpc/huffman.h
+++ b/thirdparty/libmpcdec/huffman.h
diff --git a/drivers/mpc/internal.h b/thirdparty/libmpcdec/internal.h
index 7810bcc25..7810bcc25 100644
--- a/drivers/mpc/internal.h
+++ b/thirdparty/libmpcdec/internal.h
diff --git a/drivers/mpc/datatypes.h b/thirdparty/libmpcdec/mpc/datatypes.h
index 608ecfa2f..608ecfa2f 100644
--- a/drivers/mpc/datatypes.h
+++ b/thirdparty/libmpcdec/mpc/datatypes.h
diff --git a/drivers/mpc/minimax.h b/thirdparty/libmpcdec/mpc/minimax.h
index 119262656..119262656 100644
--- a/drivers/mpc/minimax.h
+++ b/thirdparty/libmpcdec/mpc/minimax.h
diff --git a/drivers/mpc/mpc_types.h b/thirdparty/libmpcdec/mpc/mpc_types.h
index a827d1572..a827d1572 100644
--- a/drivers/mpc/mpc_types.h
+++ b/thirdparty/libmpcdec/mpc/mpc_types.h
diff --git a/drivers/mpc/mpcdec.h b/thirdparty/libmpcdec/mpc/mpcdec.h
index c72359516..c72359516 100644
--- a/drivers/mpc/mpcdec.h
+++ b/thirdparty/libmpcdec/mpc/mpcdec.h
diff --git a/drivers/mpc/mpcmath.h b/thirdparty/libmpcdec/mpc/mpcmath.h
index fa83cf837..fa83cf837 100644
--- a/drivers/mpc/mpcmath.h
+++ b/thirdparty/libmpcdec/mpc/mpcmath.h
diff --git a/drivers/mpc/reader.h b/thirdparty/libmpcdec/mpc/reader.h
index 1a93e0670..1a93e0670 100644
--- a/drivers/mpc/reader.h
+++ b/thirdparty/libmpcdec/mpc/reader.h
diff --git a/drivers/mpc/streaminfo.h b/thirdparty/libmpcdec/mpc/streaminfo.h
index a0a9470be..a0a9470be 100644
--- a/drivers/mpc/streaminfo.h
+++ b/thirdparty/libmpcdec/mpc/streaminfo.h
diff --git a/drivers/mpc/mpc_bits_reader.c b/thirdparty/libmpcdec/mpc_bits_reader.c
index 5281288d2..5281288d2 100644
--- a/drivers/mpc/mpc_bits_reader.c
+++ b/thirdparty/libmpcdec/mpc_bits_reader.c
diff --git a/drivers/mpc/mpc_bits_reader.h b/thirdparty/libmpcdec/mpc_bits_reader.h
index a7d8d6690..a7d8d6690 100644
--- a/drivers/mpc/mpc_bits_reader.h
+++ b/thirdparty/libmpcdec/mpc_bits_reader.h
diff --git a/drivers/mpc/mpc_decoder.c b/thirdparty/libmpcdec/mpc_decoder.c
index 45596c601..45596c601 100644
--- a/drivers/mpc/mpc_decoder.c
+++ b/thirdparty/libmpcdec/mpc_decoder.c
diff --git a/drivers/mpc/mpc_demux.c b/thirdparty/libmpcdec/mpc_demux.c
index 03bca9c36..03bca9c36 100644
--- a/drivers/mpc/mpc_demux.c
+++ b/thirdparty/libmpcdec/mpc_demux.c
diff --git a/drivers/mpc/mpc_reader.c b/thirdparty/libmpcdec/mpc_reader.c
index 550c5ecb5..550c5ecb5 100644
--- a/drivers/mpc/mpc_reader.c
+++ b/thirdparty/libmpcdec/mpc_reader.c
diff --git a/drivers/mpc/mpcdec_math.h b/thirdparty/libmpcdec/mpcdec_math.h
index 35a5ac5a5..35a5ac5a5 100644
--- a/drivers/mpc/mpcdec_math.h
+++ b/thirdparty/libmpcdec/mpcdec_math.h
diff --git a/drivers/mpc/requant.c b/thirdparty/libmpcdec/requant.c
index ebc89a10f..ebc89a10f 100644
--- a/drivers/mpc/requant.c
+++ b/thirdparty/libmpcdec/requant.c
diff --git a/drivers/mpc/requant.h b/thirdparty/libmpcdec/requant.h
index 014e2ebab..014e2ebab 100644
--- a/drivers/mpc/requant.h
+++ b/thirdparty/libmpcdec/requant.h
diff --git a/drivers/mpc/streaminfo.c b/thirdparty/libmpcdec/streaminfo.c
index d9b76bb5e..d9b76bb5e 100644
--- a/drivers/mpc/streaminfo.c
+++ b/thirdparty/libmpcdec/streaminfo.c
diff --git a/drivers/mpc/synth_filter.c b/thirdparty/libmpcdec/synth_filter.c
index 0d0c34534..0d0c34534 100644
--- a/drivers/mpc/synth_filter.c
+++ b/thirdparty/libmpcdec/synth_filter.c
diff --git a/drivers/ogg/COPYING b/thirdparty/libogg/COPYING
index 6111c6c5a..6111c6c5a 100644
--- a/drivers/ogg/COPYING
+++ b/thirdparty/libogg/COPYING
diff --git a/drivers/ogg/bitwise.c b/thirdparty/libogg/bitwise.c
index 145901d18..145901d18 100644
--- a/drivers/ogg/bitwise.c
+++ b/thirdparty/libogg/bitwise.c
diff --git a/drivers/ogg/framing.c b/thirdparty/libogg/framing.c
index 3a2f0a605..3a2f0a605 100644
--- a/drivers/ogg/framing.c
+++ b/thirdparty/libogg/framing.c
diff --git a/drivers/ogg/config_types.h b/thirdparty/libogg/ogg/config_types.h
index 5ea49b8ab..5ea49b8ab 100644
--- a/drivers/ogg/config_types.h
+++ b/thirdparty/libogg/ogg/config_types.h
diff --git a/drivers/ogg/ogg.h b/thirdparty/libogg/ogg/ogg.h
index cea4ebed7..cea4ebed7 100644
--- a/drivers/ogg/ogg.h
+++ b/thirdparty/libogg/ogg/ogg.h
diff --git a/drivers/ogg/os_types.h b/thirdparty/libogg/ogg/os_types.h
index 8bf82107e..8bf82107e 100644
--- a/drivers/ogg/os_types.h
+++ b/thirdparty/libogg/ogg/os_types.h
diff --git a/thirdparty/libpng/LICENSE b/thirdparty/libpng/LICENSE
new file mode 100644
index 000000000..b7ad4b9ea
--- /dev/null
+++ b/thirdparty/libpng/LICENSE
@@ -0,0 +1,130 @@
+
+This copy of the libpng notices is provided for your convenience. In case of
+any discrepancy between this copy and the notices in the file png.h that is
+included in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+This code is released under the libpng license.
+
+libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 9, 2016 are
+Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
+derived from libpng-1.0.6, and are distributed according to the same
+disclaimer and license as libpng-1.0.6 with the following individuals
+added to the list of Contributing Authors:
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Mans Rullgard
+ Cosmin Truta
+ Gilles Vollant
+ James Yu
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of the
+ library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is with
+ the user.
+
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners and
+are released under other open source licenses.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+libpng-0.96, and are distributed according to the same disclaimer and
+license as libpng-0.96, with the following individuals added to the list
+of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+and are distributed according to the same disclaimer and license as
+libpng-0.88, with the following individuals added to the list of
+Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+Some files in the "scripts" directory have other copyright owners
+but are released under this license.
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose. The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented.
+
+ 2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+ 3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products. If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+
+TRADEMARK:
+
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction. However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
+
+OSI CERTIFICATION:
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
+a certification mark of the Open Source Initiative. OSI has not addressed
+the additional disclaimers inserted at version 1.0.7.
+
+EXPORT CONTROL:
+
+The Copyright owner believes that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because
+it is open source, publicly available software, that does not contain
+any encryption software. See the EAR, paragraphs 734.3(b)(3) and
+734.7(b).
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+June 9, 2016
diff --git a/drivers/png/arm/arm_init.c b/thirdparty/libpng/arm/arm_init.c
index 52c3f31fe..52c3f31fe 100644
--- a/drivers/png/arm/arm_init.c
+++ b/thirdparty/libpng/arm/arm_init.c
diff --git a/drivers/png/arm/filter_neon.S b/thirdparty/libpng/arm/filter_neon.S
index 3b061d6bb..3b061d6bb 100644
--- a/drivers/png/arm/filter_neon.S
+++ b/thirdparty/libpng/arm/filter_neon.S
diff --git a/drivers/png/arm/filter_neon_intrinsics.c b/thirdparty/libpng/arm/filter_neon_intrinsics.c
index be5ccc710..be5ccc710 100644
--- a/drivers/png/arm/filter_neon_intrinsics.c
+++ b/thirdparty/libpng/arm/filter_neon_intrinsics.c
diff --git a/drivers/png/png.c b/thirdparty/libpng/png.c
index 1720ca0ea..1720ca0ea 100644
--- a/drivers/png/png.c
+++ b/thirdparty/libpng/png.c
diff --git a/drivers/png/png.h b/thirdparty/libpng/png.h
index 1efb0b02a..1efb0b02a 100644
--- a/drivers/png/png.h
+++ b/thirdparty/libpng/png.h
diff --git a/drivers/png/pngconf.h b/thirdparty/libpng/pngconf.h
index b0ccc8c25..b0ccc8c25 100644
--- a/drivers/png/pngconf.h
+++ b/thirdparty/libpng/pngconf.h
diff --git a/drivers/png/pngdebug.h b/thirdparty/libpng/pngdebug.h
index 15a7ed0c9..15a7ed0c9 100644
--- a/drivers/png/pngdebug.h
+++ b/thirdparty/libpng/pngdebug.h
diff --git a/drivers/png/pngerror.c b/thirdparty/libpng/pngerror.c
index 3fc8092fa..3fc8092fa 100644
--- a/drivers/png/pngerror.c
+++ b/thirdparty/libpng/pngerror.c
diff --git a/drivers/png/pngget.c b/thirdparty/libpng/pngget.c
index 14fc7be52..14fc7be52 100644
--- a/drivers/png/pngget.c
+++ b/thirdparty/libpng/pngget.c
diff --git a/drivers/png/pnginfo.h b/thirdparty/libpng/pnginfo.h
index 361ed8be7..361ed8be7 100644
--- a/drivers/png/pnginfo.h
+++ b/thirdparty/libpng/pnginfo.h
diff --git a/drivers/png/pnglibconf.h b/thirdparty/libpng/pnglibconf.h
index 3e70aa117..3e70aa117 100644
--- a/drivers/png/pnglibconf.h
+++ b/thirdparty/libpng/pnglibconf.h
diff --git a/drivers/png/pngmem.c b/thirdparty/libpng/pngmem.c
index 7bcfd0050..7bcfd0050 100644
--- a/drivers/png/pngmem.c
+++ b/thirdparty/libpng/pngmem.c
diff --git a/drivers/png/pngpread.c b/thirdparty/libpng/pngpread.c
index ca300e7f1..ca300e7f1 100644
--- a/drivers/png/pngpread.c
+++ b/thirdparty/libpng/pngpread.c
diff --git a/drivers/png/pngpriv.h b/thirdparty/libpng/pngpriv.h
index 9338df314..9338df314 100644
--- a/drivers/png/pngpriv.h
+++ b/thirdparty/libpng/pngpriv.h
diff --git a/drivers/png/pngread.c b/thirdparty/libpng/pngread.c
index 0ff623802..0ff623802 100644
--- a/drivers/png/pngread.c
+++ b/thirdparty/libpng/pngread.c
diff --git a/drivers/png/pngrio.c b/thirdparty/libpng/pngrio.c
index 5101d54a6..5101d54a6 100644
--- a/drivers/png/pngrio.c
+++ b/thirdparty/libpng/pngrio.c
diff --git a/drivers/png/pngrtran.c b/thirdparty/libpng/pngrtran.c
index 3138147af..3138147af 100644
--- a/drivers/png/pngrtran.c
+++ b/thirdparty/libpng/pngrtran.c
diff --git a/drivers/png/pngrutil.c b/thirdparty/libpng/pngrutil.c
index c9747fc27..c9747fc27 100644
--- a/drivers/png/pngrutil.c
+++ b/thirdparty/libpng/pngrutil.c
diff --git a/drivers/png/pngset.c b/thirdparty/libpng/pngset.c
index 43456b729..43456b729 100644
--- a/drivers/png/pngset.c
+++ b/thirdparty/libpng/pngset.c
diff --git a/drivers/png/pngstruct.h b/thirdparty/libpng/pngstruct.h
index c1f35edef..c1f35edef 100644
--- a/drivers/png/pngstruct.h
+++ b/thirdparty/libpng/pngstruct.h
diff --git a/drivers/png/pngtrans.c b/thirdparty/libpng/pngtrans.c
index 7f8cc455d..7f8cc455d 100644
--- a/drivers/png/pngtrans.c
+++ b/thirdparty/libpng/pngtrans.c
diff --git a/drivers/png/pngwio.c b/thirdparty/libpng/pngwio.c
index 586c03b72..586c03b72 100644
--- a/drivers/png/pngwio.c
+++ b/thirdparty/libpng/pngwio.c
diff --git a/drivers/png/pngwrite.c b/thirdparty/libpng/pngwrite.c
index 181a89943..181a89943 100644
--- a/drivers/png/pngwrite.c
+++ b/thirdparty/libpng/pngwrite.c
diff --git a/drivers/png/pngwtran.c b/thirdparty/libpng/pngwtran.c
index 038a2ef5d..038a2ef5d 100644
--- a/drivers/png/pngwtran.c
+++ b/thirdparty/libpng/pngwtran.c
diff --git a/drivers/png/pngwutil.c b/thirdparty/libpng/pngwutil.c
index b47f119d2..b47f119d2 100644
--- a/drivers/png/pngwutil.c
+++ b/thirdparty/libpng/pngwutil.c
diff --git a/drivers/theora/COPYING b/thirdparty/libtheora/COPYING
index c8ccce4ff..c8ccce4ff 100644
--- a/drivers/theora/COPYING
+++ b/thirdparty/libtheora/COPYING
diff --git a/drivers/theora/LICENSE b/thirdparty/libtheora/LICENSE
index 5e5ec0846..5e5ec0846 100644
--- a/drivers/theora/LICENSE
+++ b/thirdparty/libtheora/LICENSE
diff --git a/drivers/theora/analyze.c b/thirdparty/libtheora/analyze.c
index af01b60df..af01b60df 100644
--- a/drivers/theora/analyze.c
+++ b/thirdparty/libtheora/analyze.c
diff --git a/drivers/theora/apiwrapper.c b/thirdparty/libtheora/apiwrapper.c
index dc959b8d1..dc959b8d1 100644
--- a/drivers/theora/apiwrapper.c
+++ b/thirdparty/libtheora/apiwrapper.c
diff --git a/drivers/theora/apiwrapper.h b/thirdparty/libtheora/apiwrapper.h
index 93454d7bd..93454d7bd 100644
--- a/drivers/theora/apiwrapper.h
+++ b/thirdparty/libtheora/apiwrapper.h
diff --git a/drivers/theora/bitpack.c b/thirdparty/libtheora/bitpack.c
index 8195003ba..8195003ba 100644
--- a/drivers/theora/bitpack.c
+++ b/thirdparty/libtheora/bitpack.c
diff --git a/drivers/theora/bitpack.h b/thirdparty/libtheora/bitpack.h
index a020a292f..a020a292f 100644
--- a/drivers/theora/bitpack.h
+++ b/thirdparty/libtheora/bitpack.h
diff --git a/drivers/theora/cpu.c b/thirdparty/libtheora/cpu.c
index a863aad7f..a863aad7f 100644
--- a/drivers/theora/cpu.c
+++ b/thirdparty/libtheora/cpu.c
diff --git a/drivers/theora/cpu.h b/thirdparty/libtheora/cpu.h
index a43c957a3..a43c957a3 100644
--- a/drivers/theora/cpu.h
+++ b/thirdparty/libtheora/cpu.h
diff --git a/drivers/theora/dct.h b/thirdparty/libtheora/dct.h
index 24ba6f111..24ba6f111 100644
--- a/drivers/theora/dct.h
+++ b/thirdparty/libtheora/dct.h
diff --git a/drivers/theora/decapiwrapper.c b/thirdparty/libtheora/decapiwrapper.c
index 12ea475d1..12ea475d1 100644
--- a/drivers/theora/decapiwrapper.c
+++ b/thirdparty/libtheora/decapiwrapper.c
diff --git a/drivers/theora/decinfo.c b/thirdparty/libtheora/decinfo.c
index 845eb1361..845eb1361 100644
--- a/drivers/theora/decinfo.c
+++ b/thirdparty/libtheora/decinfo.c
diff --git a/drivers/theora/decint.h b/thirdparty/libtheora/decint.h
index 261b67631..261b67631 100644
--- a/drivers/theora/decint.h
+++ b/thirdparty/libtheora/decint.h
diff --git a/drivers/theora/decode.c b/thirdparty/libtheora/decode.c
index 7be66463d..7be66463d 100644
--- a/drivers/theora/decode.c
+++ b/thirdparty/libtheora/decode.c
diff --git a/drivers/theora/dequant.c b/thirdparty/libtheora/dequant.c
index e554872d4..e554872d4 100644
--- a/drivers/theora/dequant.c
+++ b/thirdparty/libtheora/dequant.c
diff --git a/drivers/theora/dequant.h b/thirdparty/libtheora/dequant.h
index ef25838e3..ef25838e3 100644
--- a/drivers/theora/dequant.h
+++ b/thirdparty/libtheora/dequant.h
diff --git a/drivers/theora/encapiwrapper.c b/thirdparty/libtheora/encapiwrapper.c
index 874f12442..874f12442 100644
--- a/drivers/theora/encapiwrapper.c
+++ b/thirdparty/libtheora/encapiwrapper.c
diff --git a/drivers/theora/encfrag.c b/thirdparty/libtheora/encfrag.c
index bb814c8e4..bb814c8e4 100644
--- a/drivers/theora/encfrag.c
+++ b/thirdparty/libtheora/encfrag.c
diff --git a/drivers/theora/encinfo.c b/thirdparty/libtheora/encinfo.c
index 83be1dae7..83be1dae7 100644
--- a/drivers/theora/encinfo.c
+++ b/thirdparty/libtheora/encinfo.c
diff --git a/drivers/theora/encint.h b/thirdparty/libtheora/encint.h
index 97897d5a0..97897d5a0 100644
--- a/drivers/theora/encint.h
+++ b/thirdparty/libtheora/encint.h
diff --git a/drivers/theora/encode.c b/thirdparty/libtheora/encode.c
index 0c5ea6a17..0c5ea6a17 100644
--- a/drivers/theora/encode.c
+++ b/thirdparty/libtheora/encode.c
diff --git a/drivers/theora/encoder_disabled.c b/thirdparty/libtheora/encoder_disabled.c
index 0cbf6645a..0cbf6645a 100644
--- a/drivers/theora/encoder_disabled.c
+++ b/thirdparty/libtheora/encoder_disabled.c
diff --git a/drivers/theora/enquant.c b/thirdparty/libtheora/enquant.c
index 3372fed22..3372fed22 100644
--- a/drivers/theora/enquant.c
+++ b/thirdparty/libtheora/enquant.c
diff --git a/drivers/theora/enquant.h b/thirdparty/libtheora/enquant.h
index d62df10d1..d62df10d1 100644
--- a/drivers/theora/enquant.h
+++ b/thirdparty/libtheora/enquant.h
diff --git a/drivers/theora/fdct.c b/thirdparty/libtheora/fdct.c
index dc3a66f24..dc3a66f24 100644
--- a/drivers/theora/fdct.c
+++ b/thirdparty/libtheora/fdct.c
diff --git a/drivers/theora/fragment.c b/thirdparty/libtheora/fragment.c
index 15372e9d9..15372e9d9 100644
--- a/drivers/theora/fragment.c
+++ b/thirdparty/libtheora/fragment.c
diff --git a/drivers/theora/huffdec.c b/thirdparty/libtheora/huffdec.c
index 8cf27f034..8cf27f034 100644
--- a/drivers/theora/huffdec.c
+++ b/thirdparty/libtheora/huffdec.c
diff --git a/drivers/theora/huffdec.h b/thirdparty/libtheora/huffdec.h
index d7ffa0e99..d7ffa0e99 100644
--- a/drivers/theora/huffdec.h
+++ b/thirdparty/libtheora/huffdec.h
diff --git a/drivers/theora/huffenc.c b/thirdparty/libtheora/huffenc.c
index bf624e052..bf624e052 100644
--- a/drivers/theora/huffenc.c
+++ b/thirdparty/libtheora/huffenc.c
diff --git a/drivers/theora/huffenc.h b/thirdparty/libtheora/huffenc.h
index c5a3956f1..c5a3956f1 100644
--- a/drivers/theora/huffenc.h
+++ b/thirdparty/libtheora/huffenc.h
diff --git a/drivers/theora/huffman.h b/thirdparty/libtheora/huffman.h
index 36cf7572e..36cf7572e 100644
--- a/drivers/theora/huffman.h
+++ b/thirdparty/libtheora/huffman.h
diff --git a/drivers/theora/idct.c b/thirdparty/libtheora/idct.c
index 0e68ac765..0e68ac765 100644
--- a/drivers/theora/idct.c
+++ b/thirdparty/libtheora/idct.c
diff --git a/drivers/theora/info.c b/thirdparty/libtheora/info.c
index 6b9762978..6b9762978 100644
--- a/drivers/theora/info.c
+++ b/thirdparty/libtheora/info.c
diff --git a/drivers/theora/internal.c b/thirdparty/libtheora/internal.c
index 0fe4f63e7..0fe4f63e7 100644
--- a/drivers/theora/internal.c
+++ b/thirdparty/libtheora/internal.c
diff --git a/drivers/theora/internal.h b/thirdparty/libtheora/internal.h
index d81263e13..d81263e13 100644
--- a/drivers/theora/internal.h
+++ b/thirdparty/libtheora/internal.h
diff --git a/drivers/theora/mathops.c b/thirdparty/libtheora/mathops.c
index d3fb90919..d3fb90919 100644
--- a/drivers/theora/mathops.c
+++ b/thirdparty/libtheora/mathops.c
diff --git a/drivers/theora/mathops.h b/thirdparty/libtheora/mathops.h
index efbc5377b..efbc5377b 100644
--- a/drivers/theora/mathops.h
+++ b/thirdparty/libtheora/mathops.h
diff --git a/drivers/theora/mcenc.c b/thirdparty/libtheora/mcenc.c
index 797e81f4f..797e81f4f 100644
--- a/drivers/theora/mcenc.c
+++ b/thirdparty/libtheora/mcenc.c
diff --git a/drivers/theora/modedec.h b/thirdparty/libtheora/modedec.h
index ea12c64af..ea12c64af 100644
--- a/drivers/theora/modedec.h
+++ b/thirdparty/libtheora/modedec.h
diff --git a/drivers/theora/ocintrin.h b/thirdparty/libtheora/ocintrin.h
index d49ebb215..d49ebb215 100644
--- a/drivers/theora/ocintrin.h
+++ b/thirdparty/libtheora/ocintrin.h
diff --git a/drivers/theora/quant.c b/thirdparty/libtheora/quant.c
index 8359f5abe..8359f5abe 100644
--- a/drivers/theora/quant.c
+++ b/thirdparty/libtheora/quant.c
diff --git a/drivers/theora/quant.h b/thirdparty/libtheora/quant.h
index 49ce13a65..49ce13a65 100644
--- a/drivers/theora/quant.h
+++ b/thirdparty/libtheora/quant.h
diff --git a/drivers/theora/rate.c b/thirdparty/libtheora/rate.c
index 4f43bb2e5..4f43bb2e5 100644
--- a/drivers/theora/rate.c
+++ b/thirdparty/libtheora/rate.c
diff --git a/drivers/theora/state.c b/thirdparty/libtheora/state.c
index 42ed33a9a..42ed33a9a 100644
--- a/drivers/theora/state.c
+++ b/thirdparty/libtheora/state.c
diff --git a/drivers/theora/codec.h b/thirdparty/libtheora/theora/codec.h
index 5c2669630..5c2669630 100644
--- a/drivers/theora/codec.h
+++ b/thirdparty/libtheora/theora/codec.h
diff --git a/drivers/theora/theora.h b/thirdparty/libtheora/theora/theora.h
index af6eb6f38..af6eb6f38 100644
--- a/drivers/theora/theora.h
+++ b/thirdparty/libtheora/theora/theora.h
diff --git a/drivers/theora/theoradec.h b/thirdparty/libtheora/theora/theoradec.h
index b20f0e3a6..b20f0e3a6 100644
--- a/drivers/theora/theoradec.h
+++ b/thirdparty/libtheora/theora/theoradec.h
diff --git a/drivers/theora/theoraenc.h b/thirdparty/libtheora/theora/theoraenc.h
index fdf2ab21e..fdf2ab21e 100644
--- a/drivers/theora/theoraenc.h
+++ b/thirdparty/libtheora/theora/theoraenc.h
diff --git a/drivers/theora/tokenize.c b/thirdparty/libtheora/tokenize.c
index 60574c359..60574c359 100644
--- a/drivers/theora/tokenize.c
+++ b/thirdparty/libtheora/tokenize.c
diff --git a/drivers/theora/x86/mmxencfrag.c b/thirdparty/libtheora/x86/mmxencfrag.c
index c79ff01fc..c79ff01fc 100644
--- a/drivers/theora/x86/mmxencfrag.c
+++ b/thirdparty/libtheora/x86/mmxencfrag.c
diff --git a/drivers/theora/x86/mmxfdct.c b/thirdparty/libtheora/x86/mmxfdct.c
index 211875255..211875255 100644
--- a/drivers/theora/x86/mmxfdct.c
+++ b/thirdparty/libtheora/x86/mmxfdct.c
diff --git a/drivers/theora/x86/mmxfrag.c b/thirdparty/libtheora/x86/mmxfrag.c
index 2c732939c..2c732939c 100644
--- a/drivers/theora/x86/mmxfrag.c
+++ b/thirdparty/libtheora/x86/mmxfrag.c
diff --git a/drivers/theora/x86/mmxfrag.h b/thirdparty/libtheora/x86/mmxfrag.h
index a39842762..a39842762 100644
--- a/drivers/theora/x86/mmxfrag.h
+++ b/thirdparty/libtheora/x86/mmxfrag.h
diff --git a/drivers/theora/x86/mmxidct.c b/thirdparty/libtheora/x86/mmxidct.c
index 76424e636..76424e636 100644
--- a/drivers/theora/x86/mmxidct.c
+++ b/thirdparty/libtheora/x86/mmxidct.c
diff --git a/drivers/theora/x86/mmxloop.h b/thirdparty/libtheora/x86/mmxloop.h
index 2e870c795..2e870c795 100644
--- a/drivers/theora/x86/mmxloop.h
+++ b/thirdparty/libtheora/x86/mmxloop.h
diff --git a/drivers/theora/x86/mmxstate.c b/thirdparty/libtheora/x86/mmxstate.c
index 808b0a789..808b0a789 100644
--- a/drivers/theora/x86/mmxstate.c
+++ b/thirdparty/libtheora/x86/mmxstate.c
diff --git a/drivers/theora/x86/sse2fdct.c b/thirdparty/libtheora/x86/sse2fdct.c
index 86c17d68b..86c17d68b 100644
--- a/drivers/theora/x86/sse2fdct.c
+++ b/thirdparty/libtheora/x86/sse2fdct.c
diff --git a/drivers/theora/x86/x86enc.c b/thirdparty/libtheora/x86/x86enc.c
index 43b7be3ea..43b7be3ea 100644
--- a/drivers/theora/x86/x86enc.c
+++ b/thirdparty/libtheora/x86/x86enc.c
diff --git a/drivers/theora/x86/x86enc.h b/thirdparty/libtheora/x86/x86enc.h
index 06c3908bc..06c3908bc 100644
--- a/drivers/theora/x86/x86enc.h
+++ b/thirdparty/libtheora/x86/x86enc.h
diff --git a/drivers/theora/x86/x86int.h b/thirdparty/libtheora/x86/x86int.h
index ede724f5a..ede724f5a 100644
--- a/drivers/theora/x86/x86int.h
+++ b/thirdparty/libtheora/x86/x86int.h
diff --git a/drivers/theora/x86/x86state.c b/thirdparty/libtheora/x86/x86state.c
index a786bec28..a786bec28 100644
--- a/drivers/theora/x86/x86state.c
+++ b/thirdparty/libtheora/x86/x86state.c
diff --git a/drivers/theora/x86_vc/mmxencfrag.c b/thirdparty/libtheora/x86_vc/mmxencfrag.c
index ac9dacf37..ac9dacf37 100644
--- a/drivers/theora/x86_vc/mmxencfrag.c
+++ b/thirdparty/libtheora/x86_vc/mmxencfrag.c
diff --git a/drivers/theora/x86_vc/mmxfdct.c b/thirdparty/libtheora/x86_vc/mmxfdct.c
index dcf17c9fa..dcf17c9fa 100644
--- a/drivers/theora/x86_vc/mmxfdct.c
+++ b/thirdparty/libtheora/x86_vc/mmxfdct.c
diff --git a/drivers/theora/x86_vc/mmxfrag.c b/thirdparty/libtheora/x86_vc/mmxfrag.c
index 4eb2084dc..4eb2084dc 100644
--- a/drivers/theora/x86_vc/mmxfrag.c
+++ b/thirdparty/libtheora/x86_vc/mmxfrag.c
diff --git a/drivers/theora/x86_vc/mmxfrag.h b/thirdparty/libtheora/x86_vc/mmxfrag.h
index 45ee93e77..45ee93e77 100644
--- a/drivers/theora/x86_vc/mmxfrag.h
+++ b/thirdparty/libtheora/x86_vc/mmxfrag.h
diff --git a/drivers/theora/x86_vc/mmxidct.c b/thirdparty/libtheora/x86_vc/mmxidct.c
index 8f5ff6803..8f5ff6803 100644
--- a/drivers/theora/x86_vc/mmxidct.c
+++ b/thirdparty/libtheora/x86_vc/mmxidct.c
diff --git a/drivers/theora/x86_vc/mmxloop.h b/thirdparty/libtheora/x86_vc/mmxloop.h
index 2561fca2a..2561fca2a 100644
--- a/drivers/theora/x86_vc/mmxloop.h
+++ b/thirdparty/libtheora/x86_vc/mmxloop.h
diff --git a/drivers/theora/x86_vc/mmxstate.c b/thirdparty/libtheora/x86_vc/mmxstate.c
index 73bd1981c..73bd1981c 100644
--- a/drivers/theora/x86_vc/mmxstate.c
+++ b/thirdparty/libtheora/x86_vc/mmxstate.c
diff --git a/drivers/theora/x86_vc/x86enc.c b/thirdparty/libtheora/x86_vc/x86enc.c
index e1960e1f0..e1960e1f0 100644
--- a/drivers/theora/x86_vc/x86enc.c
+++ b/thirdparty/libtheora/x86_vc/x86enc.c
diff --git a/drivers/theora/x86_vc/x86enc.h b/thirdparty/libtheora/x86_vc/x86enc.h
index 581484641..581484641 100644
--- a/drivers/theora/x86_vc/x86enc.h
+++ b/thirdparty/libtheora/x86_vc/x86enc.h
diff --git a/drivers/theora/x86_vc/x86int.h b/thirdparty/libtheora/x86_vc/x86int.h
index 4cca48531..4cca48531 100644
--- a/drivers/theora/x86_vc/x86int.h
+++ b/thirdparty/libtheora/x86_vc/x86int.h
diff --git a/drivers/theora/x86_vc/x86state.c b/thirdparty/libtheora/x86_vc/x86state.c
index a786bec28..a786bec28 100644
--- a/drivers/theora/x86_vc/x86state.c
+++ b/thirdparty/libtheora/x86_vc/x86state.c
diff --git a/drivers/vorbis/COPYING b/thirdparty/libvorbis/COPYING
index 8f1d18cc2..8f1d18cc2 100644
--- a/drivers/vorbis/COPYING
+++ b/thirdparty/libvorbis/COPYING
diff --git a/drivers/vorbis/analysis.c b/thirdparty/libvorbis/analysis.c
index 01aa6f30d..01aa6f30d 100644
--- a/drivers/vorbis/analysis.c
+++ b/thirdparty/libvorbis/analysis.c
diff --git a/drivers/vorbis/backends.h b/thirdparty/libvorbis/backends.h
index ff5bcc95f..ff5bcc95f 100644
--- a/drivers/vorbis/backends.h
+++ b/thirdparty/libvorbis/backends.h
diff --git a/drivers/vorbis/barkmel.c b/thirdparty/libvorbis/barkmel.c
index 37b6c4c7b..37b6c4c7b 100644
--- a/drivers/vorbis/barkmel.c
+++ b/thirdparty/libvorbis/barkmel.c
diff --git a/drivers/vorbis/bitrate.c b/thirdparty/libvorbis/bitrate.c
index 3a71b1dc2..3a71b1dc2 100644
--- a/drivers/vorbis/bitrate.c
+++ b/thirdparty/libvorbis/bitrate.c
diff --git a/drivers/vorbis/bitrate.h b/thirdparty/libvorbis/bitrate.h
index db48fcb64..db48fcb64 100644
--- a/drivers/vorbis/bitrate.h
+++ b/thirdparty/libvorbis/bitrate.h
diff --git a/drivers/vorbis/block.c b/thirdparty/libvorbis/block.c
index 345c04276..345c04276 100644
--- a/drivers/vorbis/block.c
+++ b/thirdparty/libvorbis/block.c
diff --git a/drivers/vorbis/books/coupled/res_books_51.h b/thirdparty/libvorbis/books/coupled/res_books_51.h
index 93910ff48..93910ff48 100644
--- a/drivers/vorbis/books/coupled/res_books_51.h
+++ b/thirdparty/libvorbis/books/coupled/res_books_51.h
diff --git a/drivers/vorbis/books/coupled/res_books_stereo.h b/thirdparty/libvorbis/books/coupled/res_books_stereo.h
index 9a9049f6e..9a9049f6e 100644
--- a/drivers/vorbis/books/coupled/res_books_stereo.h
+++ b/thirdparty/libvorbis/books/coupled/res_books_stereo.h
diff --git a/drivers/vorbis/books/floor/floor_books.h b/thirdparty/libvorbis/books/floor/floor_books.h
index e925313f7..e925313f7 100644
--- a/drivers/vorbis/books/floor/floor_books.h
+++ b/thirdparty/libvorbis/books/floor/floor_books.h
diff --git a/drivers/vorbis/books/uncoupled/res_books_uncoupled.h b/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h
index 736353b67..736353b67 100644
--- a/drivers/vorbis/books/uncoupled/res_books_uncoupled.h
+++ b/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h
diff --git a/drivers/vorbis/codebook.c b/thirdparty/libvorbis/codebook.c
index 72f8a17a3..72f8a17a3 100644
--- a/drivers/vorbis/codebook.c
+++ b/thirdparty/libvorbis/codebook.c
diff --git a/drivers/vorbis/codebook.h b/thirdparty/libvorbis/codebook.h
index 537d6c12d..537d6c12d 100644
--- a/drivers/vorbis/codebook.h
+++ b/thirdparty/libvorbis/codebook.h
diff --git a/drivers/vorbis/codec_internal.h b/thirdparty/libvorbis/codec_internal.h
index de1bccaed..de1bccaed 100644
--- a/drivers/vorbis/codec_internal.h
+++ b/thirdparty/libvorbis/codec_internal.h
diff --git a/drivers/vorbis/envelope.c b/thirdparty/libvorbis/envelope.c
index 010c66e2d..010c66e2d 100644
--- a/drivers/vorbis/envelope.c
+++ b/thirdparty/libvorbis/envelope.c
diff --git a/drivers/vorbis/envelope.h b/thirdparty/libvorbis/envelope.h
index fd15fb32a..fd15fb32a 100644
--- a/drivers/vorbis/envelope.h
+++ b/thirdparty/libvorbis/envelope.h
diff --git a/drivers/vorbis/floor0.c b/thirdparty/libvorbis/floor0.c
index 213cce4ec..213cce4ec 100644
--- a/drivers/vorbis/floor0.c
+++ b/thirdparty/libvorbis/floor0.c
diff --git a/drivers/vorbis/floor1.c b/thirdparty/libvorbis/floor1.c
index d8bd4645c..d8bd4645c 100644
--- a/drivers/vorbis/floor1.c
+++ b/thirdparty/libvorbis/floor1.c
diff --git a/drivers/vorbis/highlevel.h b/thirdparty/libvorbis/highlevel.h
index e38f370fd..e38f370fd 100644
--- a/drivers/vorbis/highlevel.h
+++ b/thirdparty/libvorbis/highlevel.h
diff --git a/drivers/vorbis/info.c b/thirdparty/libvorbis/info.c
index 8a2a001f9..8a2a001f9 100644
--- a/drivers/vorbis/info.c
+++ b/thirdparty/libvorbis/info.c
diff --git a/drivers/vorbis/lookup.c b/thirdparty/libvorbis/lookup.c
index 3321ed3db..3321ed3db 100644
--- a/drivers/vorbis/lookup.c
+++ b/thirdparty/libvorbis/lookup.c
diff --git a/drivers/vorbis/lookup.h b/thirdparty/libvorbis/lookup.h
index f8b5b8273..f8b5b8273 100644
--- a/drivers/vorbis/lookup.h
+++ b/thirdparty/libvorbis/lookup.h
diff --git a/drivers/vorbis/lookup_data.h b/thirdparty/libvorbis/lookup_data.h
index 2424a1b38..2424a1b38 100644
--- a/drivers/vorbis/lookup_data.h
+++ b/thirdparty/libvorbis/lookup_data.h
diff --git a/drivers/vorbis/lpc.c b/thirdparty/libvorbis/lpc.c
index f5199ec23..f5199ec23 100644
--- a/drivers/vorbis/lpc.c
+++ b/thirdparty/libvorbis/lpc.c
diff --git a/drivers/vorbis/lpc.h b/thirdparty/libvorbis/lpc.h
index 39d237601..39d237601 100644
--- a/drivers/vorbis/lpc.h
+++ b/thirdparty/libvorbis/lpc.h
diff --git a/drivers/vorbis/lsp.c b/thirdparty/libvorbis/lsp.c
index 6a619f7b0..6a619f7b0 100644
--- a/drivers/vorbis/lsp.c
+++ b/thirdparty/libvorbis/lsp.c
diff --git a/drivers/vorbis/lsp.h b/thirdparty/libvorbis/lsp.h
index bacfb0971..bacfb0971 100644
--- a/drivers/vorbis/lsp.h
+++ b/thirdparty/libvorbis/lsp.h
diff --git a/drivers/vorbis/mapping0.c b/thirdparty/libvorbis/mapping0.c
index 85c7d22d8..85c7d22d8 100644
--- a/drivers/vorbis/mapping0.c
+++ b/thirdparty/libvorbis/mapping0.c
diff --git a/drivers/vorbis/masking.h b/thirdparty/libvorbis/masking.h
index 3576ab788..3576ab788 100644
--- a/drivers/vorbis/masking.h
+++ b/thirdparty/libvorbis/masking.h
diff --git a/drivers/vorbis/mdct.c b/thirdparty/libvorbis/mdct.c
index 081633180..081633180 100644
--- a/drivers/vorbis/mdct.c
+++ b/thirdparty/libvorbis/mdct.c
diff --git a/drivers/vorbis/mdct.h b/thirdparty/libvorbis/mdct.h
index 3ed94333c..3ed94333c 100644
--- a/drivers/vorbis/mdct.h
+++ b/thirdparty/libvorbis/mdct.h
diff --git a/drivers/vorbis/misc.h b/thirdparty/libvorbis/misc.h
index 73b451989..73b451989 100644
--- a/drivers/vorbis/misc.h
+++ b/thirdparty/libvorbis/misc.h
diff --git a/drivers/vorbis/modes/floor_all.h b/thirdparty/libvorbis/modes/floor_all.h
index 4292be326..4292be326 100644
--- a/drivers/vorbis/modes/floor_all.h
+++ b/thirdparty/libvorbis/modes/floor_all.h
diff --git a/drivers/vorbis/modes/psych_11.h b/thirdparty/libvorbis/modes/psych_11.h
index 844a8ed3c..844a8ed3c 100644
--- a/drivers/vorbis/modes/psych_11.h
+++ b/thirdparty/libvorbis/modes/psych_11.h
diff --git a/drivers/vorbis/modes/psych_16.h b/thirdparty/libvorbis/modes/psych_16.h
index 1c10b3954..1c10b3954 100644
--- a/drivers/vorbis/modes/psych_16.h
+++ b/thirdparty/libvorbis/modes/psych_16.h
diff --git a/drivers/vorbis/modes/psych_44.h b/thirdparty/libvorbis/modes/psych_44.h
index f05c03265..f05c03265 100644
--- a/drivers/vorbis/modes/psych_44.h
+++ b/thirdparty/libvorbis/modes/psych_44.h
diff --git a/drivers/vorbis/modes/psych_8.h b/thirdparty/libvorbis/modes/psych_8.h
index 0e2dd5737..0e2dd5737 100644
--- a/drivers/vorbis/modes/psych_8.h
+++ b/thirdparty/libvorbis/modes/psych_8.h
diff --git a/drivers/vorbis/modes/residue_16.h b/thirdparty/libvorbis/modes/residue_16.h
index dcaca5451..dcaca5451 100644
--- a/drivers/vorbis/modes/residue_16.h
+++ b/thirdparty/libvorbis/modes/residue_16.h
diff --git a/drivers/vorbis/modes/residue_44.h b/thirdparty/libvorbis/modes/residue_44.h
index 236c18341..236c18341 100644
--- a/drivers/vorbis/modes/residue_44.h
+++ b/thirdparty/libvorbis/modes/residue_44.h
diff --git a/drivers/vorbis/modes/residue_44p51.h b/thirdparty/libvorbis/modes/residue_44p51.h
index a52cc5245..a52cc5245 100644
--- a/drivers/vorbis/modes/residue_44p51.h
+++ b/thirdparty/libvorbis/modes/residue_44p51.h
diff --git a/drivers/vorbis/modes/residue_44u.h b/thirdparty/libvorbis/modes/residue_44u.h
index 92c4a09ce..92c4a09ce 100644
--- a/drivers/vorbis/modes/residue_44u.h
+++ b/thirdparty/libvorbis/modes/residue_44u.h
diff --git a/drivers/vorbis/modes/residue_8.h b/thirdparty/libvorbis/modes/residue_8.h
index 94c6d84c4..94c6d84c4 100644
--- a/drivers/vorbis/modes/residue_8.h
+++ b/thirdparty/libvorbis/modes/residue_8.h
diff --git a/drivers/vorbis/modes/setup_11.h b/thirdparty/libvorbis/modes/setup_11.h
index 4c2d619ca..4c2d619ca 100644
--- a/drivers/vorbis/modes/setup_11.h
+++ b/thirdparty/libvorbis/modes/setup_11.h
diff --git a/drivers/vorbis/modes/setup_16.h b/thirdparty/libvorbis/modes/setup_16.h
index 336007f98..336007f98 100644
--- a/drivers/vorbis/modes/setup_16.h
+++ b/thirdparty/libvorbis/modes/setup_16.h
diff --git a/drivers/vorbis/modes/setup_22.h b/thirdparty/libvorbis/modes/setup_22.h
index 4fd5e5711..4fd5e5711 100644
--- a/drivers/vorbis/modes/setup_22.h
+++ b/thirdparty/libvorbis/modes/setup_22.h
diff --git a/drivers/vorbis/modes/setup_32.h b/thirdparty/libvorbis/modes/setup_32.h
index 2275ac961..2275ac961 100644
--- a/drivers/vorbis/modes/setup_32.h
+++ b/thirdparty/libvorbis/modes/setup_32.h
diff --git a/drivers/vorbis/modes/setup_44.h b/thirdparty/libvorbis/modes/setup_44.h
index 3b88a89ac..3b88a89ac 100644
--- a/drivers/vorbis/modes/setup_44.h
+++ b/thirdparty/libvorbis/modes/setup_44.h
diff --git a/drivers/vorbis/modes/setup_44p51.h b/thirdparty/libvorbis/modes/setup_44p51.h
index 67d997960..67d997960 100644
--- a/drivers/vorbis/modes/setup_44p51.h
+++ b/thirdparty/libvorbis/modes/setup_44p51.h
diff --git a/drivers/vorbis/modes/setup_44u.h b/thirdparty/libvorbis/modes/setup_44u.h
index 568b5f895..568b5f895 100644
--- a/drivers/vorbis/modes/setup_44u.h
+++ b/thirdparty/libvorbis/modes/setup_44u.h
diff --git a/drivers/vorbis/modes/setup_8.h b/thirdparty/libvorbis/modes/setup_8.h
index 14c48374f..14c48374f 100644
--- a/drivers/vorbis/modes/setup_8.h
+++ b/thirdparty/libvorbis/modes/setup_8.h
diff --git a/drivers/vorbis/modes/setup_X.h b/thirdparty/libvorbis/modes/setup_X.h
index a69f5d40a..a69f5d40a 100644
--- a/drivers/vorbis/modes/setup_X.h
+++ b/thirdparty/libvorbis/modes/setup_X.h
diff --git a/drivers/vorbis/os.h b/thirdparty/libvorbis/os.h
index 8bc3e5fe9..8bc3e5fe9 100644
--- a/drivers/vorbis/os.h
+++ b/thirdparty/libvorbis/os.h
diff --git a/drivers/vorbis/psy.c b/thirdparty/libvorbis/psy.c
index f7a44c6d0..f7a44c6d0 100644
--- a/drivers/vorbis/psy.c
+++ b/thirdparty/libvorbis/psy.c
diff --git a/drivers/vorbis/psy.h b/thirdparty/libvorbis/psy.h
index c1ea82440..c1ea82440 100644
--- a/drivers/vorbis/psy.h
+++ b/thirdparty/libvorbis/psy.h
diff --git a/drivers/vorbis/psytune.c b/thirdparty/libvorbis/psytune.c
index 64c13171f..64c13171f 100644
--- a/drivers/vorbis/psytune.c
+++ b/thirdparty/libvorbis/psytune.c
diff --git a/drivers/vorbis/registry.c b/thirdparty/libvorbis/registry.c
index 3961ed140..3961ed140 100644
--- a/drivers/vorbis/registry.c
+++ b/thirdparty/libvorbis/registry.c
diff --git a/drivers/vorbis/registry.h b/thirdparty/libvorbis/registry.h
index 3ae04776d..3ae04776d 100644
--- a/drivers/vorbis/registry.h
+++ b/thirdparty/libvorbis/registry.h
diff --git a/drivers/vorbis/res0.c b/thirdparty/libvorbis/res0.c
index ec11488c2..ec11488c2 100644
--- a/drivers/vorbis/res0.c
+++ b/thirdparty/libvorbis/res0.c
diff --git a/drivers/vorbis/scales.h b/thirdparty/libvorbis/scales.h
index 613f796e7..613f796e7 100644
--- a/drivers/vorbis/scales.h
+++ b/thirdparty/libvorbis/scales.h
diff --git a/drivers/vorbis/sharedbook.c b/thirdparty/libvorbis/sharedbook.c
index 6bfdf7311..6bfdf7311 100644
--- a/drivers/vorbis/sharedbook.c
+++ b/thirdparty/libvorbis/sharedbook.c
diff --git a/drivers/vorbis/smallft.c b/thirdparty/libvorbis/smallft.c
index ae2bc41b6..ae2bc41b6 100644
--- a/drivers/vorbis/smallft.c
+++ b/thirdparty/libvorbis/smallft.c
diff --git a/drivers/vorbis/smallft.h b/thirdparty/libvorbis/smallft.h
index 456497326..456497326 100644
--- a/drivers/vorbis/smallft.h
+++ b/thirdparty/libvorbis/smallft.h
diff --git a/drivers/vorbis/synthesis.c b/thirdparty/libvorbis/synthesis.c
index 932d271a6..932d271a6 100644
--- a/drivers/vorbis/synthesis.c
+++ b/thirdparty/libvorbis/synthesis.c
diff --git a/drivers/vorbis/tone.c b/thirdparty/libvorbis/tone.c
index 73afc67d4..73afc67d4 100644
--- a/drivers/vorbis/tone.c
+++ b/thirdparty/libvorbis/tone.c
diff --git a/drivers/vorbis/codec.h b/thirdparty/libvorbis/vorbis/codec.h
index 999aa3351..999aa3351 100644
--- a/drivers/vorbis/codec.h
+++ b/thirdparty/libvorbis/vorbis/codec.h
diff --git a/drivers/vorbis/vorbisenc.h b/thirdparty/libvorbis/vorbis/vorbisenc.h
index 02332b50c..02332b50c 100644
--- a/drivers/vorbis/vorbisenc.h
+++ b/thirdparty/libvorbis/vorbis/vorbisenc.h
diff --git a/drivers/vorbis/vorbisfile.h b/thirdparty/libvorbis/vorbis/vorbisfile.h
index 9271331e7..9271331e7 100644
--- a/drivers/vorbis/vorbisfile.h
+++ b/thirdparty/libvorbis/vorbis/vorbisfile.h
diff --git a/drivers/vorbis/vorbisenc.c b/thirdparty/libvorbis/vorbisenc.c
index b5d621e90..b5d621e90 100644
--- a/drivers/vorbis/vorbisenc.c
+++ b/thirdparty/libvorbis/vorbisenc.c
diff --git a/drivers/vorbis/vorbisfile.c b/thirdparty/libvorbis/vorbisfile.c
index fc0c86ff1..fc0c86ff1 100644
--- a/drivers/vorbis/vorbisfile.c
+++ b/thirdparty/libvorbis/vorbisfile.c
diff --git a/drivers/vorbis/window.c b/thirdparty/libvorbis/window.c
index 0305b7929..0305b7929 100644
--- a/drivers/vorbis/window.c
+++ b/thirdparty/libvorbis/window.c
diff --git a/drivers/vorbis/window.h b/thirdparty/libvorbis/window.h
index 51f97599f..51f97599f 100644
--- a/drivers/vorbis/window.h
+++ b/thirdparty/libvorbis/window.h
diff --git a/drivers/webp/AUTHORS b/thirdparty/libwebp/AUTHORS
index 70423cb4d..70423cb4d 100644
--- a/drivers/webp/AUTHORS
+++ b/thirdparty/libwebp/AUTHORS
diff --git a/drivers/webp/COPYING b/thirdparty/libwebp/COPYING
index 7a6f99547..7a6f99547 100644
--- a/drivers/webp/COPYING
+++ b/thirdparty/libwebp/COPYING
diff --git a/drivers/webp/PATENTS b/thirdparty/libwebp/PATENTS
index caedf607e..caedf607e 100644
--- a/drivers/webp/PATENTS
+++ b/thirdparty/libwebp/PATENTS
diff --git a/drivers/webp/dec/alpha.c b/thirdparty/libwebp/dec/alpha.c
index 19ce548e9..028eb3d50 100644
--- a/drivers/webp/dec/alpha.c
+++ b/thirdparty/libwebp/dec/alpha.c
@@ -18,7 +18,7 @@
#include "../dsp/dsp.h"
#include "../utils/quant_levels_dec.h"
#include "../utils/utils.h"
-#include "webp/format_constants.h"
+#include "../webp/format_constants.h"
//------------------------------------------------------------------------------
// ALPHDecoder object.
diff --git a/drivers/webp/dec/alphai.h b/thirdparty/libwebp/dec/alphai.h
index 69dd7c0f5..69dd7c0f5 100644
--- a/drivers/webp/dec/alphai.h
+++ b/thirdparty/libwebp/dec/alphai.h
diff --git a/drivers/webp/dec/buffer.c b/thirdparty/libwebp/dec/buffer.c
index 547e69b43..547e69b43 100644
--- a/drivers/webp/dec/buffer.c
+++ b/thirdparty/libwebp/dec/buffer.c
diff --git a/drivers/webp/dec/common.h b/thirdparty/libwebp/dec/common.h
index 6961e2247..6961e2247 100644
--- a/drivers/webp/dec/common.h
+++ b/thirdparty/libwebp/dec/common.h
diff --git a/drivers/webp/dec/decode_vp8.h b/thirdparty/libwebp/dec/decode_vp8.h
index 2bf1bdbbf..b9337bbec 100644
--- a/drivers/webp/dec/decode_vp8.h
+++ b/thirdparty/libwebp/dec/decode_vp8.h
@@ -14,7 +14,7 @@
#ifndef WEBP_WEBP_DECODE_VP8_H_
#define WEBP_WEBP_DECODE_VP8_H_
-#include "webp/decode.h"
+#include "../webp/decode.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/dec/frame.c b/thirdparty/libwebp/dec/frame.c
index 22d291d2c..22d291d2c 100644
--- a/drivers/webp/dec/frame.c
+++ b/thirdparty/libwebp/dec/frame.c
diff --git a/drivers/webp/dec/idec.c b/thirdparty/libwebp/dec/idec.c
index 8de131916..8de131916 100644
--- a/drivers/webp/dec/idec.c
+++ b/thirdparty/libwebp/dec/idec.c
diff --git a/drivers/webp/dec/io.c b/thirdparty/libwebp/dec/io.c
index 8d5c43f32..8d5c43f32 100644
--- a/drivers/webp/dec/io.c
+++ b/thirdparty/libwebp/dec/io.c
diff --git a/drivers/webp/dec/quant.c b/thirdparty/libwebp/dec/quant.c
index 5b648f942..5b648f942 100644
--- a/drivers/webp/dec/quant.c
+++ b/thirdparty/libwebp/dec/quant.c
diff --git a/drivers/webp/dec/tree.c b/thirdparty/libwebp/dec/tree.c
index c2007ea73..c2007ea73 100644
--- a/drivers/webp/dec/tree.c
+++ b/thirdparty/libwebp/dec/tree.c
diff --git a/drivers/webp/dec/vp8.c b/thirdparty/libwebp/dec/vp8.c
index 336680c38..336680c38 100644
--- a/drivers/webp/dec/vp8.c
+++ b/thirdparty/libwebp/dec/vp8.c
diff --git a/drivers/webp/dec/vp8i.h b/thirdparty/libwebp/dec/vp8i.h
index 00da02bad..00da02bad 100644
--- a/drivers/webp/dec/vp8i.h
+++ b/thirdparty/libwebp/dec/vp8i.h
diff --git a/drivers/webp/dec/vp8l.c b/thirdparty/libwebp/dec/vp8l.c
index cb2e3176b..cb2e3176b 100644
--- a/drivers/webp/dec/vp8l.c
+++ b/thirdparty/libwebp/dec/vp8l.c
diff --git a/drivers/webp/dec/vp8li.h b/thirdparty/libwebp/dec/vp8li.h
index 9313bdc0a..9313bdc0a 100644
--- a/drivers/webp/dec/vp8li.h
+++ b/thirdparty/libwebp/dec/vp8li.h
diff --git a/drivers/webp/dec/webp.c b/thirdparty/libwebp/dec/webp.c
index dd6c090f0..d0b912f02 100644
--- a/drivers/webp/dec/webp.c
+++ b/thirdparty/libwebp/dec/webp.c
@@ -17,7 +17,7 @@
#include "./vp8li.h"
#include "./webpi.h"
#include "../utils/utils.h"
-#include "webp/mux_types.h" // ALPHA_FLAG
+#include "../webp/mux_types.h" // ALPHA_FLAG
//------------------------------------------------------------------------------
// RIFF layout is:
diff --git a/drivers/webp/dec/webpi.h b/thirdparty/libwebp/dec/webpi.h
index 991b194c2..991b194c2 100644
--- a/drivers/webp/dec/webpi.h
+++ b/thirdparty/libwebp/dec/webpi.h
diff --git a/drivers/webp/demux/anim_decode.c b/thirdparty/libwebp/demux/anim_decode.c
index 39cf3de19..1989eb4ab 100644
--- a/drivers/webp/demux/anim_decode.c
+++ b/thirdparty/libwebp/demux/anim_decode.c
@@ -11,15 +11,15 @@
//
#ifdef HAVE_CONFIG_H
-#include "webp/config.h"
+#include "../webp/config.h"
#endif
#include <assert.h>
#include <string.h>
#include "../utils/utils.h"
-#include "webp/decode.h"
-#include "webp/demux.h"
+#include "../webp/decode.h"
+#include "../webp/demux.h"
#define NUM_CHANNELS 4
diff --git a/drivers/webp/demux/demux.c b/thirdparty/libwebp/demux/demux.c
index df93c5b37..0d2989f6f 100644
--- a/drivers/webp/demux/demux.c
+++ b/thirdparty/libwebp/demux/demux.c
@@ -11,7 +11,7 @@
//
#ifdef HAVE_CONFIG_H
-#include "webp/config.h"
+#include "../webp/config.h"
#endif
#include <assert.h>
@@ -19,9 +19,9 @@
#include <string.h>
#include "../utils/utils.h"
-#include "webp/decode.h" // WebPGetFeatures
-#include "webp/demux.h"
-#include "webp/format_constants.h"
+#include "../webp/decode.h" // WebPGetFeatures
+#include "../webp/demux.h"
+#include "../webp/format_constants.h"
#define DMUX_MAJ_VERSION 0
#define DMUX_MIN_VERSION 3
diff --git a/drivers/webp/dsp/alpha_processing.c b/thirdparty/libwebp/dsp/alpha_processing.c
index 1716cace8..1716cace8 100644
--- a/drivers/webp/dsp/alpha_processing.c
+++ b/thirdparty/libwebp/dsp/alpha_processing.c
diff --git a/drivers/webp/dsp/alpha_processing_mips_dsp_r2.c b/thirdparty/libwebp/dsp/alpha_processing_mips_dsp_r2.c
index c631d7890..c631d7890 100644
--- a/drivers/webp/dsp/alpha_processing_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/alpha_processing_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/alpha_processing_sse2.c b/thirdparty/libwebp/dsp/alpha_processing_sse2.c
index 5acb481dc..5acb481dc 100644
--- a/drivers/webp/dsp/alpha_processing_sse2.c
+++ b/thirdparty/libwebp/dsp/alpha_processing_sse2.c
diff --git a/drivers/webp/dsp/alpha_processing_sse41.c b/thirdparty/libwebp/dsp/alpha_processing_sse41.c
index 986fde94e..986fde94e 100644
--- a/drivers/webp/dsp/alpha_processing_sse41.c
+++ b/thirdparty/libwebp/dsp/alpha_processing_sse41.c
diff --git a/drivers/webp/dsp/argb.c b/thirdparty/libwebp/dsp/argb.c
index cc1f9a96c..cc1f9a96c 100644
--- a/drivers/webp/dsp/argb.c
+++ b/thirdparty/libwebp/dsp/argb.c
diff --git a/drivers/webp/dsp/argb_mips_dsp_r2.c b/thirdparty/libwebp/dsp/argb_mips_dsp_r2.c
index af65acb8f..af65acb8f 100644
--- a/drivers/webp/dsp/argb_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/argb_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/argb_sse2.c b/thirdparty/libwebp/dsp/argb_sse2.c
index afcb1957e..afcb1957e 100644
--- a/drivers/webp/dsp/argb_sse2.c
+++ b/thirdparty/libwebp/dsp/argb_sse2.c
diff --git a/drivers/webp/dsp/common_sse2.h b/thirdparty/libwebp/dsp/common_sse2.h
index 7cea13fb3..7cea13fb3 100644
--- a/drivers/webp/dsp/common_sse2.h
+++ b/thirdparty/libwebp/dsp/common_sse2.h
diff --git a/drivers/webp/dsp/cost.c b/thirdparty/libwebp/dsp/cost.c
index fe72d26e7..fe72d26e7 100644
--- a/drivers/webp/dsp/cost.c
+++ b/thirdparty/libwebp/dsp/cost.c
diff --git a/drivers/webp/dsp/cost_mips32.c b/thirdparty/libwebp/dsp/cost_mips32.c
index d1e240e19..d1e240e19 100644
--- a/drivers/webp/dsp/cost_mips32.c
+++ b/thirdparty/libwebp/dsp/cost_mips32.c
diff --git a/drivers/webp/dsp/cost_mips_dsp_r2.c b/thirdparty/libwebp/dsp/cost_mips_dsp_r2.c
index ce6406775..ce6406775 100644
--- a/drivers/webp/dsp/cost_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/cost_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/cost_sse2.c b/thirdparty/libwebp/dsp/cost_sse2.c
index 0cb1c1fa0..0cb1c1fa0 100644
--- a/drivers/webp/dsp/cost_sse2.c
+++ b/thirdparty/libwebp/dsp/cost_sse2.c
diff --git a/drivers/webp/dsp/cpu.c b/thirdparty/libwebp/dsp/cpu.c
index cbb08db90..cbb08db90 100644
--- a/drivers/webp/dsp/cpu.c
+++ b/thirdparty/libwebp/dsp/cpu.c
diff --git a/drivers/webp/dsp/dec.c b/thirdparty/libwebp/dsp/dec.c
index e92d69336..e92d69336 100644
--- a/drivers/webp/dsp/dec.c
+++ b/thirdparty/libwebp/dsp/dec.c
diff --git a/drivers/webp/dsp/dec_clip_tables.c b/thirdparty/libwebp/dsp/dec_clip_tables.c
index 3b6dde86b..3b6dde86b 100644
--- a/drivers/webp/dsp/dec_clip_tables.c
+++ b/thirdparty/libwebp/dsp/dec_clip_tables.c
diff --git a/drivers/webp/dsp/dec_mips32.c b/thirdparty/libwebp/dsp/dec_mips32.c
index 4e9ef4260..4e9ef4260 100644
--- a/drivers/webp/dsp/dec_mips32.c
+++ b/thirdparty/libwebp/dsp/dec_mips32.c
diff --git a/drivers/webp/dsp/dec_mips_dsp_r2.c b/thirdparty/libwebp/dsp/dec_mips_dsp_r2.c
index db5c65722..db5c65722 100644
--- a/drivers/webp/dsp/dec_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/dec_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/dec_msa.c b/thirdparty/libwebp/dsp/dec_msa.c
index f76055cab..f76055cab 100644
--- a/drivers/webp/dsp/dec_msa.c
+++ b/thirdparty/libwebp/dsp/dec_msa.c
diff --git a/drivers/webp/dsp/dec_neon.c b/thirdparty/libwebp/dsp/dec_neon.c
index a63f43fe1..a63f43fe1 100644
--- a/drivers/webp/dsp/dec_neon.c
+++ b/thirdparty/libwebp/dsp/dec_neon.c
diff --git a/drivers/webp/dsp/dec_sse2.c b/thirdparty/libwebp/dsp/dec_sse2.c
index f0a8ddcaf..f0a8ddcaf 100644
--- a/drivers/webp/dsp/dec_sse2.c
+++ b/thirdparty/libwebp/dsp/dec_sse2.c
diff --git a/drivers/webp/dsp/dec_sse41.c b/thirdparty/libwebp/dsp/dec_sse41.c
index 8d6aed13e..8d6aed13e 100644
--- a/drivers/webp/dsp/dec_sse41.c
+++ b/thirdparty/libwebp/dsp/dec_sse41.c
diff --git a/drivers/webp/dsp/dsp.h b/thirdparty/libwebp/dsp/dsp.h
index 2469f7d3a..1faac27b2 100644
--- a/drivers/webp/dsp/dsp.h
+++ b/thirdparty/libwebp/dsp/dsp.h
@@ -15,10 +15,10 @@
#define WEBP_DSP_DSP_H_
#ifdef HAVE_CONFIG_H
-#include "webp/config.h"
+#include "../webp/config.h"
#endif
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/dsp/enc.c b/thirdparty/libwebp/dsp/enc.c
index f639f5570..f639f5570 100644
--- a/drivers/webp/dsp/enc.c
+++ b/thirdparty/libwebp/dsp/enc.c
diff --git a/drivers/webp/dsp/enc_avx2.c b/thirdparty/libwebp/dsp/enc_avx2.c
index 93efb30b1..93efb30b1 100644
--- a/drivers/webp/dsp/enc_avx2.c
+++ b/thirdparty/libwebp/dsp/enc_avx2.c
diff --git a/drivers/webp/dsp/enc_mips32.c b/thirdparty/libwebp/dsp/enc_mips32.c
index fd10143de..fd10143de 100644
--- a/drivers/webp/dsp/enc_mips32.c
+++ b/thirdparty/libwebp/dsp/enc_mips32.c
diff --git a/drivers/webp/dsp/enc_mips_dsp_r2.c b/thirdparty/libwebp/dsp/enc_mips_dsp_r2.c
index 7ab96f680..7ab96f680 100644
--- a/drivers/webp/dsp/enc_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/enc_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/enc_neon.c b/thirdparty/libwebp/dsp/enc_neon.c
index 46f6bf9a3..46f6bf9a3 100644
--- a/drivers/webp/dsp/enc_neon.c
+++ b/thirdparty/libwebp/dsp/enc_neon.c
diff --git a/drivers/webp/dsp/enc_sse2.c b/thirdparty/libwebp/dsp/enc_sse2.c
index 4a2e3ce14..4a2e3ce14 100644
--- a/drivers/webp/dsp/enc_sse2.c
+++ b/thirdparty/libwebp/dsp/enc_sse2.c
diff --git a/drivers/webp/dsp/enc_sse41.c b/thirdparty/libwebp/dsp/enc_sse41.c
index a1783901a..a1783901a 100644
--- a/drivers/webp/dsp/enc_sse41.c
+++ b/thirdparty/libwebp/dsp/enc_sse41.c
diff --git a/drivers/webp/dsp/filters.c b/thirdparty/libwebp/dsp/filters.c
index 9f04faf0c..9f04faf0c 100644
--- a/drivers/webp/dsp/filters.c
+++ b/thirdparty/libwebp/dsp/filters.c
diff --git a/drivers/webp/dsp/filters_mips_dsp_r2.c b/thirdparty/libwebp/dsp/filters_mips_dsp_r2.c
index 1d82e3c2e..1d82e3c2e 100644
--- a/drivers/webp/dsp/filters_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/filters_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/filters_sse2.c b/thirdparty/libwebp/dsp/filters_sse2.c
index 67f77999e..67f77999e 100644
--- a/drivers/webp/dsp/filters_sse2.c
+++ b/thirdparty/libwebp/dsp/filters_sse2.c
diff --git a/drivers/webp/dsp/lossless.c b/thirdparty/libwebp/dsp/lossless.c
index af913efcc..af913efcc 100644
--- a/drivers/webp/dsp/lossless.c
+++ b/thirdparty/libwebp/dsp/lossless.c
diff --git a/drivers/webp/dsp/lossless.h b/thirdparty/libwebp/dsp/lossless.h
index 7709b4fe8..9f0d7a25b 100644
--- a/drivers/webp/dsp/lossless.h
+++ b/thirdparty/libwebp/dsp/lossless.h
@@ -15,8 +15,8 @@
#ifndef WEBP_DSP_LOSSLESS_H_
#define WEBP_DSP_LOSSLESS_H_
-#include "webp/types.h"
-#include "webp/decode.h"
+#include "../webp/types.h"
+#include "../webp/decode.h"
#include "../enc/histogram.h"
#include "../utils/utils.h"
diff --git a/drivers/webp/dsp/lossless_enc.c b/thirdparty/libwebp/dsp/lossless_enc.c
index 256f6f5f8..256f6f5f8 100644
--- a/drivers/webp/dsp/lossless_enc.c
+++ b/thirdparty/libwebp/dsp/lossless_enc.c
diff --git a/drivers/webp/dsp/lossless_enc_mips32.c b/thirdparty/libwebp/dsp/lossless_enc_mips32.c
index 49c666d4f..49c666d4f 100644
--- a/drivers/webp/dsp/lossless_enc_mips32.c
+++ b/thirdparty/libwebp/dsp/lossless_enc_mips32.c
diff --git a/drivers/webp/dsp/lossless_enc_mips_dsp_r2.c b/thirdparty/libwebp/dsp/lossless_enc_mips_dsp_r2.c
index 0abf3c4f3..0abf3c4f3 100644
--- a/drivers/webp/dsp/lossless_enc_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/lossless_enc_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/lossless_enc_neon.c b/thirdparty/libwebp/dsp/lossless_enc_neon.c
index 4c56f2594..4c56f2594 100644
--- a/drivers/webp/dsp/lossless_enc_neon.c
+++ b/thirdparty/libwebp/dsp/lossless_enc_neon.c
diff --git a/drivers/webp/dsp/lossless_enc_sse2.c b/thirdparty/libwebp/dsp/lossless_enc_sse2.c
index 7c894e7ca..7c894e7ca 100644
--- a/drivers/webp/dsp/lossless_enc_sse2.c
+++ b/thirdparty/libwebp/dsp/lossless_enc_sse2.c
diff --git a/drivers/webp/dsp/lossless_enc_sse41.c b/thirdparty/libwebp/dsp/lossless_enc_sse41.c
index 3e493198d..3e493198d 100644
--- a/drivers/webp/dsp/lossless_enc_sse41.c
+++ b/thirdparty/libwebp/dsp/lossless_enc_sse41.c
diff --git a/drivers/webp/dsp/lossless_mips_dsp_r2.c b/thirdparty/libwebp/dsp/lossless_mips_dsp_r2.c
index 90aed7f15..90aed7f15 100644
--- a/drivers/webp/dsp/lossless_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/lossless_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/lossless_neon.c b/thirdparty/libwebp/dsp/lossless_neon.c
index 6faccb8f9..6faccb8f9 100644
--- a/drivers/webp/dsp/lossless_neon.c
+++ b/thirdparty/libwebp/dsp/lossless_neon.c
diff --git a/drivers/webp/dsp/lossless_sse2.c b/thirdparty/libwebp/dsp/lossless_sse2.c
index 2d016c291..2d016c291 100644
--- a/drivers/webp/dsp/lossless_sse2.c
+++ b/thirdparty/libwebp/dsp/lossless_sse2.c
diff --git a/drivers/webp/dsp/mips_macro.h b/thirdparty/libwebp/dsp/mips_macro.h
index 44aba9b71..44aba9b71 100644
--- a/drivers/webp/dsp/mips_macro.h
+++ b/thirdparty/libwebp/dsp/mips_macro.h
diff --git a/drivers/webp/dsp/msa_macro.h b/thirdparty/libwebp/dsp/msa_macro.h
index 5c707f476..5c707f476 100644
--- a/drivers/webp/dsp/msa_macro.h
+++ b/thirdparty/libwebp/dsp/msa_macro.h
diff --git a/drivers/webp/dsp/neon.h b/thirdparty/libwebp/dsp/neon.h
index 0a0626684..0a0626684 100644
--- a/drivers/webp/dsp/neon.h
+++ b/thirdparty/libwebp/dsp/neon.h
diff --git a/drivers/webp/dsp/rescaler.c b/thirdparty/libwebp/dsp/rescaler.c
index bc743d5dc..bc743d5dc 100644
--- a/drivers/webp/dsp/rescaler.c
+++ b/thirdparty/libwebp/dsp/rescaler.c
diff --git a/drivers/webp/dsp/rescaler_mips32.c b/thirdparty/libwebp/dsp/rescaler_mips32.c
index ddaa39133..ddaa39133 100644
--- a/drivers/webp/dsp/rescaler_mips32.c
+++ b/thirdparty/libwebp/dsp/rescaler_mips32.c
diff --git a/drivers/webp/dsp/rescaler_mips_dsp_r2.c b/thirdparty/libwebp/dsp/rescaler_mips_dsp_r2.c
index b457d0a30..b457d0a30 100644
--- a/drivers/webp/dsp/rescaler_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/rescaler_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/rescaler_neon.c b/thirdparty/libwebp/dsp/rescaler_neon.c
index 16fd450ea..16fd450ea 100644
--- a/drivers/webp/dsp/rescaler_neon.c
+++ b/thirdparty/libwebp/dsp/rescaler_neon.c
diff --git a/drivers/webp/dsp/rescaler_sse2.c b/thirdparty/libwebp/dsp/rescaler_sse2.c
index 5b9702817..5b9702817 100644
--- a/drivers/webp/dsp/rescaler_sse2.c
+++ b/thirdparty/libwebp/dsp/rescaler_sse2.c
diff --git a/drivers/webp/dsp/upsampling.c b/thirdparty/libwebp/dsp/upsampling.c
index 651274fce..651274fce 100644
--- a/drivers/webp/dsp/upsampling.c
+++ b/thirdparty/libwebp/dsp/upsampling.c
diff --git a/drivers/webp/dsp/upsampling_mips_dsp_r2.c b/thirdparty/libwebp/dsp/upsampling_mips_dsp_r2.c
index ed2eb7482..ed2eb7482 100644
--- a/drivers/webp/dsp/upsampling_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/upsampling_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/upsampling_neon.c b/thirdparty/libwebp/dsp/upsampling_neon.c
index 2b0c99bdd..2b0c99bdd 100644
--- a/drivers/webp/dsp/upsampling_neon.c
+++ b/thirdparty/libwebp/dsp/upsampling_neon.c
diff --git a/drivers/webp/dsp/upsampling_sse2.c b/thirdparty/libwebp/dsp/upsampling_sse2.c
index b5b668900..b5b668900 100644
--- a/drivers/webp/dsp/upsampling_sse2.c
+++ b/thirdparty/libwebp/dsp/upsampling_sse2.c
diff --git a/drivers/webp/dsp/yuv.c b/thirdparty/libwebp/dsp/yuv.c
index f50a25316..f50a25316 100644
--- a/drivers/webp/dsp/yuv.c
+++ b/thirdparty/libwebp/dsp/yuv.c
diff --git a/drivers/webp/dsp/yuv.h b/thirdparty/libwebp/dsp/yuv.h
index 01c40fcb8..01c40fcb8 100644
--- a/drivers/webp/dsp/yuv.h
+++ b/thirdparty/libwebp/dsp/yuv.h
diff --git a/drivers/webp/dsp/yuv_mips32.c b/thirdparty/libwebp/dsp/yuv_mips32.c
index e61aac571..e61aac571 100644
--- a/drivers/webp/dsp/yuv_mips32.c
+++ b/thirdparty/libwebp/dsp/yuv_mips32.c
diff --git a/drivers/webp/dsp/yuv_mips_dsp_r2.c b/thirdparty/libwebp/dsp/yuv_mips_dsp_r2.c
index 1720d4190..1720d4190 100644
--- a/drivers/webp/dsp/yuv_mips_dsp_r2.c
+++ b/thirdparty/libwebp/dsp/yuv_mips_dsp_r2.c
diff --git a/drivers/webp/dsp/yuv_sse2.c b/thirdparty/libwebp/dsp/yuv_sse2.c
index e19bddff6..e19bddff6 100644
--- a/drivers/webp/dsp/yuv_sse2.c
+++ b/thirdparty/libwebp/dsp/yuv_sse2.c
diff --git a/drivers/webp/dsp/yuv_tables_sse2.h b/thirdparty/libwebp/dsp/yuv_tables_sse2.h
index 2b0f05751..2b0f05751 100644
--- a/drivers/webp/dsp/yuv_tables_sse2.h
+++ b/thirdparty/libwebp/dsp/yuv_tables_sse2.h
diff --git a/drivers/webp/enc/alpha.c b/thirdparty/libwebp/enc/alpha.c
index 464df4db0..03e3ad07f 100644
--- a/drivers/webp/enc/alpha.c
+++ b/thirdparty/libwebp/enc/alpha.c
@@ -19,7 +19,7 @@
#include "../utils/filters.h"
#include "../utils/quant_levels.h"
#include "../utils/utils.h"
-#include "webp/format_constants.h"
+#include "../webp/format_constants.h"
// -----------------------------------------------------------------------------
// Encodes the given alpha data via specified compression method 'method'.
diff --git a/drivers/webp/enc/analysis.c b/thirdparty/libwebp/enc/analysis.c
index b55128fd4..b55128fd4 100644
--- a/drivers/webp/enc/analysis.c
+++ b/thirdparty/libwebp/enc/analysis.c
diff --git a/drivers/webp/enc/backward_references.c b/thirdparty/libwebp/enc/backward_references.c
index 136a24a8c..136a24a8c 100644
--- a/drivers/webp/enc/backward_references.c
+++ b/thirdparty/libwebp/enc/backward_references.c
diff --git a/drivers/webp/enc/backward_references.h b/thirdparty/libwebp/enc/backward_references.h
index b72a01fb0..0cadb11e1 100644
--- a/drivers/webp/enc/backward_references.h
+++ b/thirdparty/libwebp/enc/backward_references.h
@@ -15,8 +15,8 @@
#include <assert.h>
#include <stdlib.h>
-#include "webp/types.h"
-#include "webp/format_constants.h"
+#include "../webp/types.h"
+#include "../webp/format_constants.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/enc/config.c b/thirdparty/libwebp/enc/config.c
index 8fd2276cb..f9f7961d5 100644
--- a/drivers/webp/enc/config.c
+++ b/thirdparty/libwebp/enc/config.c
@@ -11,7 +11,7 @@
//
// Author: Skal (pascal.massimino@gmail.com)
-#include "webp/encode.h"
+#include "../webp/encode.h"
//------------------------------------------------------------------------------
// WebPConfig
diff --git a/drivers/webp/enc/cost.c b/thirdparty/libwebp/enc/cost.c
index ae7fe0138..ae7fe0138 100644
--- a/drivers/webp/enc/cost.c
+++ b/thirdparty/libwebp/enc/cost.c
diff --git a/drivers/webp/enc/cost.h b/thirdparty/libwebp/enc/cost.h
index 20960d6d7..20960d6d7 100644
--- a/drivers/webp/enc/cost.h
+++ b/thirdparty/libwebp/enc/cost.h
diff --git a/drivers/webp/enc/delta_palettization.c b/thirdparty/libwebp/enc/delta_palettization.c
index 8bd3a3d23..062e588d7 100644
--- a/drivers/webp/enc/delta_palettization.c
+++ b/thirdparty/libwebp/enc/delta_palettization.c
@@ -13,7 +13,7 @@
#include "./delta_palettization.h"
#ifdef WEBP_EXPERIMENTAL_FEATURES
-#include "webp/types.h"
+#include "../webp/types.h"
#include "../dsp/lossless.h"
#define MK_COL(r, g, b) (((r) << 16) + ((g) << 8) + (b))
diff --git a/drivers/webp/enc/delta_palettization.h b/thirdparty/libwebp/enc/delta_palettization.h
index 54195d452..e41c0c5ab 100644
--- a/drivers/webp/enc/delta_palettization.h
+++ b/thirdparty/libwebp/enc/delta_palettization.h
@@ -13,7 +13,7 @@
#ifndef WEBP_ENC_DELTA_PALETTIZATION_H_
#define WEBP_ENC_DELTA_PALETTIZATION_H_
-#include "webp/encode.h"
+#include "../webp/encode.h"
#include "../enc/vp8li.h"
// Replaces enc->argb_[] input by a palettizable approximation of it,
diff --git a/drivers/webp/enc/filter.c b/thirdparty/libwebp/enc/filter.c
index e8ea8b4ff..e8ea8b4ff 100644
--- a/drivers/webp/enc/filter.c
+++ b/thirdparty/libwebp/enc/filter.c
diff --git a/drivers/webp/enc/frame.c b/thirdparty/libwebp/enc/frame.c
index 65a98ada4..5b7a40b9a 100644
--- a/drivers/webp/enc/frame.c
+++ b/thirdparty/libwebp/enc/frame.c
@@ -17,7 +17,7 @@
#include "./cost.h"
#include "./vp8enci.h"
#include "../dsp/dsp.h"
-#include "webp/format_constants.h" // RIFF constants
+#include "../webp/format_constants.h" // RIFF constants
#define SEGMENT_VISU 0
#define DEBUG_SEARCH 0 // useful to track search convergence
diff --git a/drivers/webp/enc/histogram.c b/thirdparty/libwebp/enc/histogram.c
index 61544f4cc..395372b24 100644
--- a/drivers/webp/enc/histogram.c
+++ b/thirdparty/libwebp/enc/histogram.c
@@ -10,7 +10,7 @@
// Author: Jyrki Alakuijala (jyrki@google.com)
//
#ifdef HAVE_CONFIG_H
-#include "webp/config.h"
+#include "../webp/config.h"
#endif
#include <math.h>
diff --git a/drivers/webp/enc/histogram.h b/thirdparty/libwebp/enc/histogram.h
index 59de42b33..d303d1d58 100644
--- a/drivers/webp/enc/histogram.h
+++ b/thirdparty/libwebp/enc/histogram.h
@@ -17,8 +17,8 @@
#include <string.h>
#include "./backward_references.h"
-#include "webp/format_constants.h"
-#include "webp/types.h"
+#include "../webp/format_constants.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/enc/iterator.c b/thirdparty/libwebp/enc/iterator.c
index 99d960a54..99d960a54 100644
--- a/drivers/webp/enc/iterator.c
+++ b/thirdparty/libwebp/enc/iterator.c
diff --git a/drivers/webp/enc/near_lossless.c b/thirdparty/libwebp/enc/near_lossless.c
index f4ab91f57..f4ab91f57 100644
--- a/drivers/webp/enc/near_lossless.c
+++ b/thirdparty/libwebp/enc/near_lossless.c
diff --git a/drivers/webp/enc/picture.c b/thirdparty/libwebp/enc/picture.c
index d9befbc47..d9befbc47 100644
--- a/drivers/webp/enc/picture.c
+++ b/thirdparty/libwebp/enc/picture.c
diff --git a/drivers/webp/enc/picture_csp.c b/thirdparty/libwebp/enc/picture_csp.c
index 607a6240b..607a6240b 100644
--- a/drivers/webp/enc/picture_csp.c
+++ b/thirdparty/libwebp/enc/picture_csp.c
diff --git a/drivers/webp/enc/picture_psnr.c b/thirdparty/libwebp/enc/picture_psnr.c
index 81ab1b5ca..81ab1b5ca 100644
--- a/drivers/webp/enc/picture_psnr.c
+++ b/thirdparty/libwebp/enc/picture_psnr.c
diff --git a/drivers/webp/enc/picture_rescale.c b/thirdparty/libwebp/enc/picture_rescale.c
index 9f19e8e80..9f19e8e80 100644
--- a/drivers/webp/enc/picture_rescale.c
+++ b/thirdparty/libwebp/enc/picture_rescale.c
diff --git a/drivers/webp/enc/picture_tools.c b/thirdparty/libwebp/enc/picture_tools.c
index bf97af840..bf97af840 100644
--- a/drivers/webp/enc/picture_tools.c
+++ b/thirdparty/libwebp/enc/picture_tools.c
diff --git a/drivers/webp/enc/quant.c b/thirdparty/libwebp/enc/quant.c
index 549ad26f9..549ad26f9 100644
--- a/drivers/webp/enc/quant.c
+++ b/thirdparty/libwebp/enc/quant.c
diff --git a/drivers/webp/enc/syntax.c b/thirdparty/libwebp/enc/syntax.c
index 2b65f15ca..a0e79ef40 100644
--- a/drivers/webp/enc/syntax.c
+++ b/thirdparty/libwebp/enc/syntax.c
@@ -14,8 +14,8 @@
#include <assert.h>
#include "../utils/utils.h"
-#include "webp/format_constants.h" // RIFF constants
-#include "webp/mux_types.h" // ALPHA_FLAG
+#include "../webp/format_constants.h" // RIFF constants
+#include "../webp/mux_types.h" // ALPHA_FLAG
#include "./vp8enci.h"
//------------------------------------------------------------------------------
diff --git a/drivers/webp/enc/token.c b/thirdparty/libwebp/enc/token.c
index e73256b37..e73256b37 100644
--- a/drivers/webp/enc/token.c
+++ b/thirdparty/libwebp/enc/token.c
diff --git a/drivers/webp/enc/tree.c b/thirdparty/libwebp/enc/tree.c
index f141006d1..f141006d1 100644
--- a/drivers/webp/enc/tree.c
+++ b/thirdparty/libwebp/enc/tree.c
diff --git a/drivers/webp/enc/vp8enci.h b/thirdparty/libwebp/enc/vp8enci.h
index efd2f19a9..c1fbd7644 100644
--- a/drivers/webp/enc/vp8enci.h
+++ b/thirdparty/libwebp/enc/vp8enci.h
@@ -20,7 +20,7 @@
#include "../utils/bit_writer.h"
#include "../utils/thread.h"
#include "../utils/utils.h"
-#include "webp/encode.h"
+#include "../webp/encode.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/enc/vp8l.c b/thirdparty/libwebp/enc/vp8l.c
index 1f2d41ea9..c16e2560e 100644
--- a/drivers/webp/enc/vp8l.c
+++ b/thirdparty/libwebp/enc/vp8l.c
@@ -23,7 +23,7 @@
#include "../utils/bit_writer.h"
#include "../utils/huffman_encode.h"
#include "../utils/utils.h"
-#include "webp/format_constants.h"
+#include "../webp/format_constants.h"
#include "./delta_palettization.h"
diff --git a/drivers/webp/enc/vp8li.h b/thirdparty/libwebp/enc/vp8li.h
index 8e6b360d8..371e276ee 100644
--- a/drivers/webp/enc/vp8li.h
+++ b/thirdparty/libwebp/enc/vp8li.h
@@ -17,8 +17,8 @@
#include "./backward_references.h"
#include "./histogram.h"
#include "../utils/bit_writer.h"
-#include "webp/encode.h"
-#include "webp/format_constants.h"
+#include "../webp/encode.h"
+#include "../webp/format_constants.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/enc/webpenc.c b/thirdparty/libwebp/enc/webpenc.c
index a7d04ea2c..a7d04ea2c 100644
--- a/drivers/webp/enc/webpenc.c
+++ b/thirdparty/libwebp/enc/webpenc.c
diff --git a/drivers/webp/mux/anim_encode.c b/thirdparty/libwebp/mux/anim_encode.c
index 2226febf1..53e2906a8 100644
--- a/drivers/webp/mux/anim_encode.c
+++ b/thirdparty/libwebp/mux/anim_encode.c
@@ -17,10 +17,10 @@
#include <stdlib.h> // for abs()
#include "../utils/utils.h"
-#include "webp/decode.h"
-#include "webp/encode.h"
-#include "webp/format_constants.h"
-#include "webp/mux.h"
+#include "../webp/decode.h"
+#include "../webp/encode.h"
+#include "../webp/format_constants.h"
+#include "../webp/mux.h"
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
diff --git a/drivers/webp/mux/muxedit.c b/thirdparty/libwebp/mux/muxedit.c
index 9bbed42b1..9bbed42b1 100644
--- a/drivers/webp/mux/muxedit.c
+++ b/thirdparty/libwebp/mux/muxedit.c
diff --git a/drivers/webp/mux/muxi.h b/thirdparty/libwebp/mux/muxi.h
index 3f6428c4d..d4d5cbad9 100644
--- a/drivers/webp/mux/muxi.h
+++ b/thirdparty/libwebp/mux/muxi.h
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include "../dec/vp8i.h"
#include "../dec/vp8li.h"
-#include "webp/mux.h"
+#include "../webp/mux.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/mux/muxinternal.c b/thirdparty/libwebp/mux/muxinternal.c
index 4babbe82f..4babbe82f 100644
--- a/drivers/webp/mux/muxinternal.c
+++ b/thirdparty/libwebp/mux/muxinternal.c
diff --git a/drivers/webp/mux/muxread.c b/thirdparty/libwebp/mux/muxread.c
index 8957a1e46..8957a1e46 100644
--- a/drivers/webp/mux/muxread.c
+++ b/thirdparty/libwebp/mux/muxread.c
diff --git a/drivers/webp/utils/bit_reader.c b/thirdparty/libwebp/utils/bit_reader.c
index 13c6cf316..2eb46e0b4 100644
--- a/drivers/webp/utils/bit_reader.c
+++ b/thirdparty/libwebp/utils/bit_reader.c
@@ -12,7 +12,7 @@
// Author: Skal (pascal.massimino@gmail.com)
#ifdef HAVE_CONFIG_H
-#include "webp/config.h"
+#include "../webp/config.h"
#endif
#include "./bit_reader_inl.h"
@@ -41,12 +41,14 @@ void VP8InitBitReader(VP8BitReader* const br,
br->bits_ = -8; // to load the very first 8bits
br->eof_ = 0;
VP8BitReaderSetBuffer(br, start, size);
+// -- GODOT -- begin
#ifdef JAVASCRIPT_ENABLED // html5 required aligned reads
while(((uintptr_t)br->buf_ & 1) != 0 && !br->eof_)
VP8LoadFinalBytes(br);
#else
VP8LoadNewBytes(br);
#endif
+// -- GODOT -- end
}
void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset) {
diff --git a/drivers/webp/utils/bit_reader.h b/thirdparty/libwebp/utils/bit_reader.h
index c2dcc711c..ea5c584eb 100644
--- a/drivers/webp/utils/bit_reader.h
+++ b/thirdparty/libwebp/utils/bit_reader.h
@@ -19,7 +19,7 @@
#ifdef _MSC_VER
#include <stdlib.h> // _byteswap_ulong
#endif
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
@@ -37,11 +37,11 @@ extern "C" {
// BITS can be any multiple of 8 from 8 to 56 (inclusive).
// Pick values that fit natural register size.
+// -- GODOT -- start
#ifdef JAVASCRIPT_ENABLED
-
#define BITS 16
-
#else
+// -- GODOT -- end
#if defined(__i386__) || defined(_M_IX86) // x86 32bit
#define BITS 24
@@ -57,7 +57,9 @@ extern "C" {
#define BITS 24
#endif
+// -- GODOT -- start
#endif
+// -- GODOT -- end
//------------------------------------------------------------------------------
// Derived types and constants:
diff --git a/drivers/webp/utils/bit_reader_inl.h b/thirdparty/libwebp/utils/bit_reader_inl.h
index 21faf14d8..99ed3137d 100644
--- a/drivers/webp/utils/bit_reader_inl.h
+++ b/thirdparty/libwebp/utils/bit_reader_inl.h
@@ -17,7 +17,7 @@
#define WEBP_UTILS_BIT_READER_INL_H_
#ifdef HAVE_CONFIG_H
-#include "webp/config.h"
+#include "../webp/config.h"
#endif
#ifdef WEBP_FORCE_ALIGNED
diff --git a/drivers/webp/utils/bit_writer.c b/thirdparty/libwebp/utils/bit_writer.c
index 064428691..064428691 100644
--- a/drivers/webp/utils/bit_writer.c
+++ b/thirdparty/libwebp/utils/bit_writer.c
diff --git a/drivers/webp/utils/bit_writer.h b/thirdparty/libwebp/utils/bit_writer.h
index 867a5ee05..ef360d1dc 100644
--- a/drivers/webp/utils/bit_writer.h
+++ b/thirdparty/libwebp/utils/bit_writer.h
@@ -14,7 +14,7 @@
#ifndef WEBP_UTILS_BIT_WRITER_H_
#define WEBP_UTILS_BIT_WRITER_H_
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/utils/color_cache.c b/thirdparty/libwebp/utils/color_cache.c
index c34b2e7f1..c34b2e7f1 100644
--- a/drivers/webp/utils/color_cache.c
+++ b/thirdparty/libwebp/utils/color_cache.c
diff --git a/drivers/webp/utils/color_cache.h b/thirdparty/libwebp/utils/color_cache.h
index 34299e4c4..a9a9f6427 100644
--- a/drivers/webp/utils/color_cache.h
+++ b/thirdparty/libwebp/utils/color_cache.h
@@ -15,7 +15,7 @@
#ifndef WEBP_UTILS_COLOR_CACHE_H_
#define WEBP_UTILS_COLOR_CACHE_H_
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/utils/endian_inl.h b/thirdparty/libwebp/utils/endian_inl.h
index e11260ff7..e11260ff7 100644
--- a/drivers/webp/utils/endian_inl.h
+++ b/thirdparty/libwebp/utils/endian_inl.h
diff --git a/drivers/webp/utils/filters.c b/thirdparty/libwebp/utils/filters.c
index 15543b127..15543b127 100644
--- a/drivers/webp/utils/filters.c
+++ b/thirdparty/libwebp/utils/filters.c
diff --git a/drivers/webp/utils/filters.h b/thirdparty/libwebp/utils/filters.h
index 4aba3fd3b..088b132fc 100644
--- a/drivers/webp/utils/filters.h
+++ b/thirdparty/libwebp/utils/filters.h
@@ -14,7 +14,7 @@
#ifndef WEBP_UTILS_FILTERS_H_
#define WEBP_UTILS_FILTERS_H_
-#include "webp/types.h"
+#include "../webp/types.h"
#include "../dsp/dsp.h"
#ifdef __cplusplus
diff --git a/drivers/webp/utils/huffman.c b/thirdparty/libwebp/utils/huffman.c
index 7c9d83db9..36e550283 100644
--- a/drivers/webp/utils/huffman.c
+++ b/thirdparty/libwebp/utils/huffman.c
@@ -15,8 +15,8 @@
#include <stdlib.h>
#include <string.h>
#include "./huffman.h"
-#include "webp/format_constants.h"
#include "./utils.h"
+#include "../webp/format_constants.h"
// Huffman data read via DecodeImageStream is represented in two (red and green)
// bytes.
diff --git a/drivers/webp/utils/huffman.h b/thirdparty/libwebp/utils/huffman.h
index a8cc0da1c..c6dd6aaa4 100644
--- a/drivers/webp/utils/huffman.h
+++ b/thirdparty/libwebp/utils/huffman.h
@@ -15,8 +15,8 @@
#define WEBP_UTILS_HUFFMAN_H_
#include <assert.h>
-#include "webp/format_constants.h"
-#include "webp/types.h"
+#include "../webp/format_constants.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/utils/huffman_encode.c b/thirdparty/libwebp/utils/huffman_encode.c
index 0be414a8f..4e5ef6b44 100644
--- a/drivers/webp/utils/huffman_encode.c
+++ b/thirdparty/libwebp/utils/huffman_encode.c
@@ -15,8 +15,8 @@
#include <stdlib.h>
#include <string.h>
#include "./huffman_encode.h"
-#include "webp/format_constants.h"
#include "./utils.h"
+#include "../webp/format_constants.h"
// -----------------------------------------------------------------------------
// Util function to optimize the symbol map for RLE coding
diff --git a/drivers/webp/utils/huffman_encode.h b/thirdparty/libwebp/utils/huffman_encode.h
index 93610066f..a15716514 100644
--- a/drivers/webp/utils/huffman_encode.h
+++ b/thirdparty/libwebp/utils/huffman_encode.h
@@ -14,7 +14,7 @@
#ifndef WEBP_UTILS_HUFFMAN_ENCODE_H_
#define WEBP_UTILS_HUFFMAN_ENCODE_H_
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/utils/quant_levels.c b/thirdparty/libwebp/utils/quant_levels.c
index d7c8aab92..d7c8aab92 100644
--- a/drivers/webp/utils/quant_levels.c
+++ b/thirdparty/libwebp/utils/quant_levels.c
diff --git a/drivers/webp/utils/quant_levels.h b/thirdparty/libwebp/utils/quant_levels.h
index 3916b977a..1cb5a32ca 100644
--- a/drivers/webp/utils/quant_levels.h
+++ b/thirdparty/libwebp/utils/quant_levels.h
@@ -16,7 +16,7 @@
#include <stdlib.h>
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/utils/quant_levels_dec.c b/thirdparty/libwebp/utils/quant_levels_dec.c
index ee0a3fe12..ee0a3fe12 100644
--- a/drivers/webp/utils/quant_levels_dec.c
+++ b/thirdparty/libwebp/utils/quant_levels_dec.c
diff --git a/drivers/webp/utils/quant_levels_dec.h b/thirdparty/libwebp/utils/quant_levels_dec.h
index c99a47538..59a13495d 100644
--- a/drivers/webp/utils/quant_levels_dec.h
+++ b/thirdparty/libwebp/utils/quant_levels_dec.h
@@ -14,7 +14,7 @@
#ifndef WEBP_UTILS_QUANT_LEVELS_DEC_H_
#define WEBP_UTILS_QUANT_LEVELS_DEC_H_
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/utils/random.c b/thirdparty/libwebp/utils/random.c
index 24e96ad64..24e96ad64 100644
--- a/drivers/webp/utils/random.c
+++ b/thirdparty/libwebp/utils/random.c
diff --git a/drivers/webp/utils/random.h b/thirdparty/libwebp/utils/random.h
index 745f3e2e8..c392a615c 100644
--- a/drivers/webp/utils/random.h
+++ b/thirdparty/libwebp/utils/random.h
@@ -15,7 +15,7 @@
#define WEBP_UTILS_RANDOM_H_
#include <assert.h>
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/utils/rescaler.c b/thirdparty/libwebp/utils/rescaler.c
index 00c9300bf..00c9300bf 100644
--- a/drivers/webp/utils/rescaler.c
+++ b/thirdparty/libwebp/utils/rescaler.c
diff --git a/drivers/webp/utils/rescaler.h b/thirdparty/libwebp/utils/rescaler.h
index 868467b4d..98b01a76d 100644
--- a/drivers/webp/utils/rescaler.h
+++ b/thirdparty/libwebp/utils/rescaler.h
@@ -18,7 +18,7 @@
extern "C" {
#endif
-#include "webp/types.h"
+#include "../webp/types.h"
#define WEBP_RESCALER_RFIX 32 // fixed-point precision for multiplies
#define WEBP_RESCALER_ONE (1ull << WEBP_RESCALER_RFIX)
diff --git a/drivers/webp/utils/thread.c b/thirdparty/libwebp/utils/thread.c
index 93f762279..93f762279 100644
--- a/drivers/webp/utils/thread.c
+++ b/thirdparty/libwebp/utils/thread.c
diff --git a/drivers/webp/utils/thread.h b/thirdparty/libwebp/utils/thread.h
index 6008bb7c0..840831185 100644
--- a/drivers/webp/utils/thread.h
+++ b/thirdparty/libwebp/utils/thread.h
@@ -15,10 +15,10 @@
#define WEBP_UTILS_THREAD_H_
#ifdef HAVE_CONFIG_H
-#include "webp/config.h"
+#include "../webp/config.h"
#endif
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/utils/utils.c b/thirdparty/libwebp/utils/utils.c
index b2193c4b4..2602ca3c9 100644
--- a/drivers/webp/utils/utils.c
+++ b/thirdparty/libwebp/utils/utils.c
@@ -13,9 +13,9 @@
#include <stdlib.h>
#include <string.h> // for memcpy()
-#include "webp/decode.h"
-#include "webp/encode.h"
-#include "webp/format_constants.h" // for MAX_PALETTE_SIZE
+#include "../webp/decode.h"
+#include "../webp/encode.h"
+#include "../webp/format_constants.h" // for MAX_PALETTE_SIZE
#include "./utils.h"
// If PRINT_MEM_INFO is defined, extra info (like total memory used, number of
diff --git a/drivers/webp/utils/utils.h b/thirdparty/libwebp/utils/utils.h
index cef496af7..e0a81126d 100644
--- a/drivers/webp/utils/utils.h
+++ b/thirdparty/libwebp/utils/utils.h
@@ -16,13 +16,13 @@
#define WEBP_UTILS_UTILS_H_
#ifdef HAVE_CONFIG_H
-#include "webp/config.h"
+#include "../webp/config.h"
#endif
#include <assert.h>
#include "../dsp/dsp.h"
-#include "webp/types.h"
+#include "../webp/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/webp/config.h b/thirdparty/libwebp/webp/config.h
index 0ce1c7064..0ce1c7064 100644
--- a/drivers/webp/config.h
+++ b/thirdparty/libwebp/webp/config.h
diff --git a/drivers/webp/decode.h b/thirdparty/libwebp/webp/decode.h
index 7a3bed93a..7a3bed93a 100644
--- a/drivers/webp/decode.h
+++ b/thirdparty/libwebp/webp/decode.h
diff --git a/drivers/webp/demux.h b/thirdparty/libwebp/webp/demux.h
index 454f6914b..454f6914b 100644
--- a/drivers/webp/demux.h
+++ b/thirdparty/libwebp/webp/demux.h
diff --git a/drivers/webp/encode.h b/thirdparty/libwebp/webp/encode.h
index 9291b7195..9291b7195 100644
--- a/drivers/webp/encode.h
+++ b/thirdparty/libwebp/webp/encode.h
diff --git a/drivers/webp/format_constants.h b/thirdparty/libwebp/webp/format_constants.h
index b6e78a643..b6e78a643 100644
--- a/drivers/webp/format_constants.h
+++ b/thirdparty/libwebp/webp/format_constants.h
diff --git a/drivers/webp/mux.h b/thirdparty/libwebp/webp/mux.h
index b72658c74..b72658c74 100644
--- a/drivers/webp/mux.h
+++ b/thirdparty/libwebp/webp/mux.h
diff --git a/drivers/webp/mux_types.h b/thirdparty/libwebp/webp/mux_types.h
index c94043a3c..c94043a3c 100644
--- a/drivers/webp/mux_types.h
+++ b/thirdparty/libwebp/webp/mux_types.h
diff --git a/drivers/webp/types.h b/thirdparty/libwebp/webp/types.h
index 98fff35a1..98fff35a1 100644
--- a/drivers/webp/types.h
+++ b/thirdparty/libwebp/webp/types.h
diff --git a/thirdparty/openssl/LICENSE b/thirdparty/openssl/LICENSE
new file mode 100644
index 000000000..fb03713dd
--- /dev/null
+++ b/thirdparty/openssl/LICENSE
@@ -0,0 +1,127 @@
+
+ LICENSE ISSUES
+ ==============
+
+ The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
+ the OpenSSL License and the original SSLeay license apply to the toolkit.
+ See below for the actual license texts. Actually both licenses are BSD-style
+ Open Source licenses. In case of any license issues related to OpenSSL
+ please contact openssl-core@openssl.org.
+
+ OpenSSL License
+ ---------------
+
+/* ====================================================================
+ * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+ Original SSLeay License
+ -----------------------
+
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
diff --git a/drivers/builtin_openssl2/buildinf.h b/thirdparty/openssl/buildinf.h
index 2e287c42d..2e287c42d 100644
--- a/drivers/builtin_openssl2/buildinf.h
+++ b/thirdparty/openssl/buildinf.h
diff --git a/drivers/builtin_openssl2/crypto/LPdir_nyi.c b/thirdparty/openssl/crypto/LPdir_nyi.c
index 283d5b063..283d5b063 100644
--- a/drivers/builtin_openssl2/crypto/LPdir_nyi.c
+++ b/thirdparty/openssl/crypto/LPdir_nyi.c
diff --git a/drivers/builtin_openssl2/crypto/LPdir_unix.c b/thirdparty/openssl/crypto/LPdir_unix.c
index bead6abd7..bead6abd7 100644
--- a/drivers/builtin_openssl2/crypto/LPdir_unix.c
+++ b/thirdparty/openssl/crypto/LPdir_unix.c
diff --git a/drivers/builtin_openssl2/crypto/LPdir_vms.c b/thirdparty/openssl/crypto/LPdir_vms.c
index 88c7ddd85..88c7ddd85 100644
--- a/drivers/builtin_openssl2/crypto/LPdir_vms.c
+++ b/thirdparty/openssl/crypto/LPdir_vms.c
diff --git a/drivers/builtin_openssl2/crypto/LPdir_win.c b/thirdparty/openssl/crypto/LPdir_win.c
index 07e63fb42..07e63fb42 100644
--- a/drivers/builtin_openssl2/crypto/LPdir_win.c
+++ b/thirdparty/openssl/crypto/LPdir_win.c
diff --git a/drivers/builtin_openssl2/crypto/LPdir_win32.c b/thirdparty/openssl/crypto/LPdir_win32.c
index b1c983d87..b1c983d87 100644
--- a/drivers/builtin_openssl2/crypto/LPdir_win32.c
+++ b/thirdparty/openssl/crypto/LPdir_win32.c
diff --git a/drivers/builtin_openssl2/crypto/LPdir_wince.c b/thirdparty/openssl/crypto/LPdir_wince.c
index ae8a56f4b..ae8a56f4b 100644
--- a/drivers/builtin_openssl2/crypto/LPdir_wince.c
+++ b/thirdparty/openssl/crypto/LPdir_wince.c
diff --git a/drivers/builtin_openssl2/crypto/aes/README b/thirdparty/openssl/crypto/aes/README
index 0f9620a80..0f9620a80 100644
--- a/drivers/builtin_openssl2/crypto/aes/README
+++ b/thirdparty/openssl/crypto/aes/README
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_cbc.c b/thirdparty/openssl/crypto/aes/aes_cbc.c
index 805d0e260..805d0e260 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_cbc.c
+++ b/thirdparty/openssl/crypto/aes/aes_cbc.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_cfb.c b/thirdparty/openssl/crypto/aes/aes_cfb.c
index 122500096..122500096 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_cfb.c
+++ b/thirdparty/openssl/crypto/aes/aes_cfb.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_core.c b/thirdparty/openssl/crypto/aes/aes_core.c
index 7019b5d7a..7019b5d7a 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_core.c
+++ b/thirdparty/openssl/crypto/aes/aes_core.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_ctr.c b/thirdparty/openssl/crypto/aes/aes_ctr.c
index 9e760c4b1..9e760c4b1 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_ctr.c
+++ b/thirdparty/openssl/crypto/aes/aes_ctr.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_ecb.c b/thirdparty/openssl/crypto/aes/aes_ecb.c
index 52151a5c7..52151a5c7 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_ecb.c
+++ b/thirdparty/openssl/crypto/aes/aes_ecb.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_ige.c b/thirdparty/openssl/crypto/aes/aes_ige.c
index 8f2b77064..8f2b77064 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_ige.c
+++ b/thirdparty/openssl/crypto/aes/aes_ige.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_locl.h b/thirdparty/openssl/crypto/aes/aes_locl.h
index 7acd74ec1..7acd74ec1 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_locl.h
+++ b/thirdparty/openssl/crypto/aes/aes_locl.h
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_misc.c b/thirdparty/openssl/crypto/aes/aes_misc.c
index fafad4d6f..fafad4d6f 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_misc.c
+++ b/thirdparty/openssl/crypto/aes/aes_misc.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_ofb.c b/thirdparty/openssl/crypto/aes/aes_ofb.c
index 64a08caae..64a08caae 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_ofb.c
+++ b/thirdparty/openssl/crypto/aes/aes_ofb.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_wrap.c b/thirdparty/openssl/crypto/aes/aes_wrap.c
index b7b64d57a..b7b64d57a 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_wrap.c
+++ b/thirdparty/openssl/crypto/aes/aes_wrap.c
diff --git a/drivers/builtin_openssl2/crypto/aes/aes_x86core.c b/thirdparty/openssl/crypto/aes/aes_x86core.c
index b5dd69767..b5dd69767 100644
--- a/drivers/builtin_openssl2/crypto/aes/aes_x86core.c
+++ b/thirdparty/openssl/crypto/aes/aes_x86core.c
diff --git a/drivers/builtin_openssl2/crypto/arm_arch.h b/thirdparty/openssl/crypto/arm_arch.h
index 9d6e58880..9d6e58880 100644
--- a/drivers/builtin_openssl2/crypto/arm_arch.h
+++ b/thirdparty/openssl/crypto/arm_arch.h
diff --git a/drivers/builtin_openssl2/crypto/armcap.c b/thirdparty/openssl/crypto/armcap.c
index 356fa1528..356fa1528 100644
--- a/drivers/builtin_openssl2/crypto/armcap.c
+++ b/thirdparty/openssl/crypto/armcap.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_bitstr.c b/thirdparty/openssl/crypto/asn1/a_bitstr.c
index f906188b1..f906188b1 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_bitstr.c
+++ b/thirdparty/openssl/crypto/asn1/a_bitstr.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_bool.c b/thirdparty/openssl/crypto/asn1/a_bool.c
index 1b85bc9e6..1b85bc9e6 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_bool.c
+++ b/thirdparty/openssl/crypto/asn1/a_bool.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_bytes.c b/thirdparty/openssl/crypto/asn1/a_bytes.c
index 385b53986..385b53986 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_bytes.c
+++ b/thirdparty/openssl/crypto/asn1/a_bytes.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_d2i_fp.c b/thirdparty/openssl/crypto/asn1/a_d2i_fp.c
index 51b6f245a..51b6f245a 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_d2i_fp.c
+++ b/thirdparty/openssl/crypto/asn1/a_d2i_fp.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_digest.c b/thirdparty/openssl/crypto/asn1/a_digest.c
index 7cbc4751c..7cbc4751c 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_digest.c
+++ b/thirdparty/openssl/crypto/asn1/a_digest.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_dup.c b/thirdparty/openssl/crypto/asn1/a_dup.c
index 349ab5621..349ab5621 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_dup.c
+++ b/thirdparty/openssl/crypto/asn1/a_dup.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_enum.c b/thirdparty/openssl/crypto/asn1/a_enum.c
index c3498ac99..c3498ac99 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_enum.c
+++ b/thirdparty/openssl/crypto/asn1/a_enum.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_gentm.c b/thirdparty/openssl/crypto/asn1/a_gentm.c
index fa76dcac9..fa76dcac9 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_gentm.c
+++ b/thirdparty/openssl/crypto/asn1/a_gentm.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_i2d_fp.c b/thirdparty/openssl/crypto/asn1/a_i2d_fp.c
index 0f56cd4e0..0f56cd4e0 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_i2d_fp.c
+++ b/thirdparty/openssl/crypto/asn1/a_i2d_fp.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_int.c b/thirdparty/openssl/crypto/asn1/a_int.c
index 7e26704a5..7e26704a5 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_int.c
+++ b/thirdparty/openssl/crypto/asn1/a_int.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_mbstr.c b/thirdparty/openssl/crypto/asn1/a_mbstr.c
index 6935efe09..6935efe09 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_mbstr.c
+++ b/thirdparty/openssl/crypto/asn1/a_mbstr.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_object.c b/thirdparty/openssl/crypto/asn1/a_object.c
index 27f9c1691..27f9c1691 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_object.c
+++ b/thirdparty/openssl/crypto/asn1/a_object.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_octet.c b/thirdparty/openssl/crypto/asn1/a_octet.c
index 1a6e9ca9c..1a6e9ca9c 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_octet.c
+++ b/thirdparty/openssl/crypto/asn1/a_octet.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_print.c b/thirdparty/openssl/crypto/asn1/a_print.c
index d83e4ad82..d83e4ad82 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_print.c
+++ b/thirdparty/openssl/crypto/asn1/a_print.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_set.c b/thirdparty/openssl/crypto/asn1/a_set.c
index bf3f97188..bf3f97188 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_set.c
+++ b/thirdparty/openssl/crypto/asn1/a_set.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_sign.c b/thirdparty/openssl/crypto/asn1/a_sign.c
index 51c6a0c34..51c6a0c34 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_sign.c
+++ b/thirdparty/openssl/crypto/asn1/a_sign.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_strex.c b/thirdparty/openssl/crypto/asn1/a_strex.c
index 35fd44cd2..35fd44cd2 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_strex.c
+++ b/thirdparty/openssl/crypto/asn1/a_strex.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_strnid.c b/thirdparty/openssl/crypto/asn1/a_strnid.c
index 522434536..522434536 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_strnid.c
+++ b/thirdparty/openssl/crypto/asn1/a_strnid.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_time.c b/thirdparty/openssl/crypto/asn1/a_time.c
index fcb2d565c..fcb2d565c 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_time.c
+++ b/thirdparty/openssl/crypto/asn1/a_time.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_type.c b/thirdparty/openssl/crypto/asn1/a_type.c
index bb166e856..bb166e856 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_type.c
+++ b/thirdparty/openssl/crypto/asn1/a_type.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_utctm.c b/thirdparty/openssl/crypto/asn1/a_utctm.c
index 724a10be4..724a10be4 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_utctm.c
+++ b/thirdparty/openssl/crypto/asn1/a_utctm.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_utf8.c b/thirdparty/openssl/crypto/asn1/a_utf8.c
index 23dc2e828..23dc2e828 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_utf8.c
+++ b/thirdparty/openssl/crypto/asn1/a_utf8.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/a_verify.c b/thirdparty/openssl/crypto/asn1/a_verify.c
index 3ffd934cb..3ffd934cb 100644
--- a/drivers/builtin_openssl2/crypto/asn1/a_verify.c
+++ b/thirdparty/openssl/crypto/asn1/a_verify.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/ameth_lib.c b/thirdparty/openssl/crypto/asn1/ameth_lib.c
index 5389c0434..5389c0434 100644
--- a/drivers/builtin_openssl2/crypto/asn1/ameth_lib.c
+++ b/thirdparty/openssl/crypto/asn1/ameth_lib.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/asn1_err.c b/thirdparty/openssl/crypto/asn1/asn1_err.c
index fd4ac8d9d..fd4ac8d9d 100644
--- a/drivers/builtin_openssl2/crypto/asn1/asn1_err.c
+++ b/thirdparty/openssl/crypto/asn1/asn1_err.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/asn1_gen.c b/thirdparty/openssl/crypto/asn1/asn1_gen.c
index 65749239b..65749239b 100644
--- a/drivers/builtin_openssl2/crypto/asn1/asn1_gen.c
+++ b/thirdparty/openssl/crypto/asn1/asn1_gen.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/asn1_lib.c b/thirdparty/openssl/crypto/asn1/asn1_lib.c
index 874b1af8b..874b1af8b 100644
--- a/drivers/builtin_openssl2/crypto/asn1/asn1_lib.c
+++ b/thirdparty/openssl/crypto/asn1/asn1_lib.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/asn1_locl.h b/thirdparty/openssl/crypto/asn1/asn1_locl.h
index 4c004fab9..4c004fab9 100644
--- a/drivers/builtin_openssl2/crypto/asn1/asn1_locl.h
+++ b/thirdparty/openssl/crypto/asn1/asn1_locl.h
diff --git a/drivers/builtin_openssl2/crypto/asn1/asn1_par.c b/thirdparty/openssl/crypto/asn1/asn1_par.c
index e85e3398b..e85e3398b 100644
--- a/drivers/builtin_openssl2/crypto/asn1/asn1_par.c
+++ b/thirdparty/openssl/crypto/asn1/asn1_par.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/asn_mime.c b/thirdparty/openssl/crypto/asn1/asn_mime.c
index 96110c540..96110c540 100644
--- a/drivers/builtin_openssl2/crypto/asn1/asn_mime.c
+++ b/thirdparty/openssl/crypto/asn1/asn_mime.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/asn_moid.c b/thirdparty/openssl/crypto/asn1/asn_moid.c
index fab2dd92e..fab2dd92e 100644
--- a/drivers/builtin_openssl2/crypto/asn1/asn_moid.c
+++ b/thirdparty/openssl/crypto/asn1/asn_moid.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/asn_pack.c b/thirdparty/openssl/crypto/asn1/asn_pack.c
index 366caf01f..366caf01f 100644
--- a/drivers/builtin_openssl2/crypto/asn1/asn_pack.c
+++ b/thirdparty/openssl/crypto/asn1/asn_pack.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/bio_asn1.c b/thirdparty/openssl/crypto/asn1/bio_asn1.c
index 60189b3b2..60189b3b2 100644
--- a/drivers/builtin_openssl2/crypto/asn1/bio_asn1.c
+++ b/thirdparty/openssl/crypto/asn1/bio_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/bio_ndef.c b/thirdparty/openssl/crypto/asn1/bio_ndef.c
index 31949b879..31949b879 100644
--- a/drivers/builtin_openssl2/crypto/asn1/bio_ndef.c
+++ b/thirdparty/openssl/crypto/asn1/bio_ndef.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/charmap.h b/thirdparty/openssl/crypto/asn1/charmap.h
index 3305ad146..3305ad146 100644
--- a/drivers/builtin_openssl2/crypto/asn1/charmap.h
+++ b/thirdparty/openssl/crypto/asn1/charmap.h
diff --git a/drivers/builtin_openssl2/crypto/asn1/d2i_pr.c b/thirdparty/openssl/crypto/asn1/d2i_pr.c
index d21829af1..d21829af1 100644
--- a/drivers/builtin_openssl2/crypto/asn1/d2i_pr.c
+++ b/thirdparty/openssl/crypto/asn1/d2i_pr.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/d2i_pu.c b/thirdparty/openssl/crypto/asn1/d2i_pu.c
index 33542dd12..33542dd12 100644
--- a/drivers/builtin_openssl2/crypto/asn1/d2i_pu.c
+++ b/thirdparty/openssl/crypto/asn1/d2i_pu.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/evp_asn1.c b/thirdparty/openssl/crypto/asn1/evp_asn1.c
index 5876afa5e..5876afa5e 100644
--- a/drivers/builtin_openssl2/crypto/asn1/evp_asn1.c
+++ b/thirdparty/openssl/crypto/asn1/evp_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/f_enum.c b/thirdparty/openssl/crypto/asn1/f_enum.c
index 591c3b578..591c3b578 100644
--- a/drivers/builtin_openssl2/crypto/asn1/f_enum.c
+++ b/thirdparty/openssl/crypto/asn1/f_enum.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/f_int.c b/thirdparty/openssl/crypto/asn1/f_int.c
index 4a81f81c8..4a81f81c8 100644
--- a/drivers/builtin_openssl2/crypto/asn1/f_int.c
+++ b/thirdparty/openssl/crypto/asn1/f_int.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/f_string.c b/thirdparty/openssl/crypto/asn1/f_string.c
index 6a6cf3471..6a6cf3471 100644
--- a/drivers/builtin_openssl2/crypto/asn1/f_string.c
+++ b/thirdparty/openssl/crypto/asn1/f_string.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/i2d_pr.c b/thirdparty/openssl/crypto/asn1/i2d_pr.c
index 4d338ac55..4d338ac55 100644
--- a/drivers/builtin_openssl2/crypto/asn1/i2d_pr.c
+++ b/thirdparty/openssl/crypto/asn1/i2d_pr.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/i2d_pu.c b/thirdparty/openssl/crypto/asn1/i2d_pu.c
index b8ed35541..b8ed35541 100644
--- a/drivers/builtin_openssl2/crypto/asn1/i2d_pu.c
+++ b/thirdparty/openssl/crypto/asn1/i2d_pu.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/n_pkey.c b/thirdparty/openssl/crypto/asn1/n_pkey.c
index d5a55146a..d5a55146a 100644
--- a/drivers/builtin_openssl2/crypto/asn1/n_pkey.c
+++ b/thirdparty/openssl/crypto/asn1/n_pkey.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/nsseq.c b/thirdparty/openssl/crypto/asn1/nsseq.c
index f2f7cba49..f2f7cba49 100644
--- a/drivers/builtin_openssl2/crypto/asn1/nsseq.c
+++ b/thirdparty/openssl/crypto/asn1/nsseq.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/p5_pbe.c b/thirdparty/openssl/crypto/asn1/p5_pbe.c
index bdbfdcd67..bdbfdcd67 100644
--- a/drivers/builtin_openssl2/crypto/asn1/p5_pbe.c
+++ b/thirdparty/openssl/crypto/asn1/p5_pbe.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/p5_pbev2.c b/thirdparty/openssl/crypto/asn1/p5_pbev2.c
index 73ba4a3d6..73ba4a3d6 100644
--- a/drivers/builtin_openssl2/crypto/asn1/p5_pbev2.c
+++ b/thirdparty/openssl/crypto/asn1/p5_pbev2.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/p8_pkey.c b/thirdparty/openssl/crypto/asn1/p8_pkey.c
index 0a425cd29..0a425cd29 100644
--- a/drivers/builtin_openssl2/crypto/asn1/p8_pkey.c
+++ b/thirdparty/openssl/crypto/asn1/p8_pkey.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/t_bitst.c b/thirdparty/openssl/crypto/asn1/t_bitst.c
index d5cf3c773..d5cf3c773 100644
--- a/drivers/builtin_openssl2/crypto/asn1/t_bitst.c
+++ b/thirdparty/openssl/crypto/asn1/t_bitst.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/t_crl.c b/thirdparty/openssl/crypto/asn1/t_crl.c
index 0dfaf0ba2..0dfaf0ba2 100644
--- a/drivers/builtin_openssl2/crypto/asn1/t_crl.c
+++ b/thirdparty/openssl/crypto/asn1/t_crl.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/t_pkey.c b/thirdparty/openssl/crypto/asn1/t_pkey.c
index 735c34264..735c34264 100644
--- a/drivers/builtin_openssl2/crypto/asn1/t_pkey.c
+++ b/thirdparty/openssl/crypto/asn1/t_pkey.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/t_req.c b/thirdparty/openssl/crypto/asn1/t_req.c
index 024553ab1..024553ab1 100644
--- a/drivers/builtin_openssl2/crypto/asn1/t_req.c
+++ b/thirdparty/openssl/crypto/asn1/t_req.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/t_spki.c b/thirdparty/openssl/crypto/asn1/t_spki.c
index 3bf48db50..3bf48db50 100644
--- a/drivers/builtin_openssl2/crypto/asn1/t_spki.c
+++ b/thirdparty/openssl/crypto/asn1/t_spki.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/t_x509.c b/thirdparty/openssl/crypto/asn1/t_x509.c
index 8888396f8..8888396f8 100644
--- a/drivers/builtin_openssl2/crypto/asn1/t_x509.c
+++ b/thirdparty/openssl/crypto/asn1/t_x509.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/t_x509a.c b/thirdparty/openssl/crypto/asn1/t_x509a.c
index f4b8f94cb..f4b8f94cb 100644
--- a/drivers/builtin_openssl2/crypto/asn1/t_x509a.c
+++ b/thirdparty/openssl/crypto/asn1/t_x509a.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/tasn_dec.c b/thirdparty/openssl/crypto/asn1/tasn_dec.c
index 6bdcd5c54..6bdcd5c54 100644
--- a/drivers/builtin_openssl2/crypto/asn1/tasn_dec.c
+++ b/thirdparty/openssl/crypto/asn1/tasn_dec.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/tasn_enc.c b/thirdparty/openssl/crypto/asn1/tasn_enc.c
index f7f83e56a..f7f83e56a 100644
--- a/drivers/builtin_openssl2/crypto/asn1/tasn_enc.c
+++ b/thirdparty/openssl/crypto/asn1/tasn_enc.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/tasn_fre.c b/thirdparty/openssl/crypto/asn1/tasn_fre.c
index aeea4eff7..aeea4eff7 100644
--- a/drivers/builtin_openssl2/crypto/asn1/tasn_fre.c
+++ b/thirdparty/openssl/crypto/asn1/tasn_fre.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/tasn_new.c b/thirdparty/openssl/crypto/asn1/tasn_new.c
index b0c73beeb..b0c73beeb 100644
--- a/drivers/builtin_openssl2/crypto/asn1/tasn_new.c
+++ b/thirdparty/openssl/crypto/asn1/tasn_new.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/tasn_prn.c b/thirdparty/openssl/crypto/asn1/tasn_prn.c
index 5e7d53e98..5e7d53e98 100644
--- a/drivers/builtin_openssl2/crypto/asn1/tasn_prn.c
+++ b/thirdparty/openssl/crypto/asn1/tasn_prn.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/tasn_typ.c b/thirdparty/openssl/crypto/asn1/tasn_typ.c
index 740e86d5f..740e86d5f 100644
--- a/drivers/builtin_openssl2/crypto/asn1/tasn_typ.c
+++ b/thirdparty/openssl/crypto/asn1/tasn_typ.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/tasn_utl.c b/thirdparty/openssl/crypto/asn1/tasn_utl.c
index 41726d8fe..41726d8fe 100644
--- a/drivers/builtin_openssl2/crypto/asn1/tasn_utl.c
+++ b/thirdparty/openssl/crypto/asn1/tasn_utl.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_algor.c b/thirdparty/openssl/crypto/asn1/x_algor.c
index fd7d16d40..fd7d16d40 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_algor.c
+++ b/thirdparty/openssl/crypto/asn1/x_algor.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_attrib.c b/thirdparty/openssl/crypto/asn1/x_attrib.c
index 93ef53bd5..93ef53bd5 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_attrib.c
+++ b/thirdparty/openssl/crypto/asn1/x_attrib.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_bignum.c b/thirdparty/openssl/crypto/asn1/x_bignum.c
index eaf046639..eaf046639 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_bignum.c
+++ b/thirdparty/openssl/crypto/asn1/x_bignum.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_crl.c b/thirdparty/openssl/crypto/asn1/x_crl.c
index 027950330..027950330 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_crl.c
+++ b/thirdparty/openssl/crypto/asn1/x_crl.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_exten.c b/thirdparty/openssl/crypto/asn1/x_exten.c
index 00a9580aa..00a9580aa 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_exten.c
+++ b/thirdparty/openssl/crypto/asn1/x_exten.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_info.c b/thirdparty/openssl/crypto/asn1/x_info.c
index 067fd72a6..067fd72a6 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_info.c
+++ b/thirdparty/openssl/crypto/asn1/x_info.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_long.c b/thirdparty/openssl/crypto/asn1/x_long.c
index 3aed44a3d..3aed44a3d 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_long.c
+++ b/thirdparty/openssl/crypto/asn1/x_long.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_name.c b/thirdparty/openssl/crypto/asn1/x_name.c
index a858c2993..a858c2993 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_name.c
+++ b/thirdparty/openssl/crypto/asn1/x_name.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_nx509.c b/thirdparty/openssl/crypto/asn1/x_nx509.c
index 5aa0ed58b..5aa0ed58b 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_nx509.c
+++ b/thirdparty/openssl/crypto/asn1/x_nx509.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_pkey.c b/thirdparty/openssl/crypto/asn1/x_pkey.c
index 2da23e475..2da23e475 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_pkey.c
+++ b/thirdparty/openssl/crypto/asn1/x_pkey.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_pubkey.c b/thirdparty/openssl/crypto/asn1/x_pubkey.c
index 6c57a7971..6c57a7971 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_pubkey.c
+++ b/thirdparty/openssl/crypto/asn1/x_pubkey.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_req.c b/thirdparty/openssl/crypto/asn1/x_req.c
index ae293aa0c..ae293aa0c 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_req.c
+++ b/thirdparty/openssl/crypto/asn1/x_req.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_sig.c b/thirdparty/openssl/crypto/asn1/x_sig.c
index dd33720c1..dd33720c1 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_sig.c
+++ b/thirdparty/openssl/crypto/asn1/x_sig.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_spki.c b/thirdparty/openssl/crypto/asn1/x_spki.c
index 1df6b87d2..1df6b87d2 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_spki.c
+++ b/thirdparty/openssl/crypto/asn1/x_spki.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_val.c b/thirdparty/openssl/crypto/asn1/x_val.c
index ee75a1e25..ee75a1e25 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_val.c
+++ b/thirdparty/openssl/crypto/asn1/x_val.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_x509.c b/thirdparty/openssl/crypto/asn1/x_x509.c
index e31e1e750..e31e1e750 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_x509.c
+++ b/thirdparty/openssl/crypto/asn1/x_x509.c
diff --git a/drivers/builtin_openssl2/crypto/asn1/x_x509a.c b/thirdparty/openssl/crypto/asn1/x_x509a.c
index ad93592a7..ad93592a7 100644
--- a/drivers/builtin_openssl2/crypto/asn1/x_x509a.c
+++ b/thirdparty/openssl/crypto/asn1/x_x509a.c
diff --git a/drivers/builtin_openssl2/crypto/bf/COPYRIGHT b/thirdparty/openssl/crypto/bf/COPYRIGHT
index 685722350..685722350 100644
--- a/drivers/builtin_openssl2/crypto/bf/COPYRIGHT
+++ b/thirdparty/openssl/crypto/bf/COPYRIGHT
diff --git a/drivers/builtin_openssl2/crypto/bf/INSTALL b/thirdparty/openssl/crypto/bf/INSTALL
index 3b2592353..3b2592353 100644
--- a/drivers/builtin_openssl2/crypto/bf/INSTALL
+++ b/thirdparty/openssl/crypto/bf/INSTALL
diff --git a/drivers/builtin_openssl2/crypto/bf/README b/thirdparty/openssl/crypto/bf/README
index f2712fd0e..f2712fd0e 100644
--- a/drivers/builtin_openssl2/crypto/bf/README
+++ b/thirdparty/openssl/crypto/bf/README
diff --git a/drivers/builtin_openssl2/crypto/bf/VERSION b/thirdparty/openssl/crypto/bf/VERSION
index be995855e..be995855e 100644
--- a/drivers/builtin_openssl2/crypto/bf/VERSION
+++ b/thirdparty/openssl/crypto/bf/VERSION
diff --git a/drivers/builtin_openssl2/crypto/bf/asm/readme b/thirdparty/openssl/crypto/bf/asm/readme
index 2385fa381..2385fa381 100644
--- a/drivers/builtin_openssl2/crypto/bf/asm/readme
+++ b/thirdparty/openssl/crypto/bf/asm/readme
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_cbc.c b/thirdparty/openssl/crypto/bf/bf_cbc.c
index de827a1a3..de827a1a3 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_cbc.c
+++ b/thirdparty/openssl/crypto/bf/bf_cbc.c
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_cfb64.c b/thirdparty/openssl/crypto/bf/bf_cfb64.c
index ddeab6eb7..ddeab6eb7 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_cfb64.c
+++ b/thirdparty/openssl/crypto/bf/bf_cfb64.c
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_ecb.c b/thirdparty/openssl/crypto/bf/bf_ecb.c
index 967a7f550..967a7f550 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_ecb.c
+++ b/thirdparty/openssl/crypto/bf/bf_ecb.c
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_enc.c b/thirdparty/openssl/crypto/bf/bf_enc.c
index b268795f5..b268795f5 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_enc.c
+++ b/thirdparty/openssl/crypto/bf/bf_enc.c
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_locl.h b/thirdparty/openssl/crypto/bf/bf_locl.h
index 9448aed42..9448aed42 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_locl.h
+++ b/thirdparty/openssl/crypto/bf/bf_locl.h
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_ofb64.c b/thirdparty/openssl/crypto/bf/bf_ofb64.c
index a8d190b5d..a8d190b5d 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_ofb64.c
+++ b/thirdparty/openssl/crypto/bf/bf_ofb64.c
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_opts.c b/thirdparty/openssl/crypto/bf/bf_opts.c
index f85495cf9..f85495cf9 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_opts.c
+++ b/thirdparty/openssl/crypto/bf/bf_opts.c
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_pi.h b/thirdparty/openssl/crypto/bf/bf_pi.h
index 46a26739b..46a26739b 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_pi.h
+++ b/thirdparty/openssl/crypto/bf/bf_pi.h
diff --git a/drivers/builtin_openssl2/crypto/bf/bf_skey.c b/thirdparty/openssl/crypto/bf/bf_skey.c
index 2cb3c66c8..2cb3c66c8 100644
--- a/drivers/builtin_openssl2/crypto/bf/bf_skey.c
+++ b/thirdparty/openssl/crypto/bf/bf_skey.c
diff --git a/drivers/builtin_openssl2/crypto/bf/bfs.cpp b/thirdparty/openssl/crypto/bf/bfs.cpp
index d74c45776..d74c45776 100644
--- a/drivers/builtin_openssl2/crypto/bf/bfs.cpp
+++ b/thirdparty/openssl/crypto/bf/bfs.cpp
diff --git a/drivers/builtin_openssl2/crypto/bf/bfspeed.c b/thirdparty/openssl/crypto/bf/bfspeed.c
index 305ad8bcb..305ad8bcb 100644
--- a/drivers/builtin_openssl2/crypto/bf/bfspeed.c
+++ b/thirdparty/openssl/crypto/bf/bfspeed.c
diff --git a/drivers/builtin_openssl2/crypto/bio/b_dump.c b/thirdparty/openssl/crypto/bio/b_dump.c
index ccf0e287c..ccf0e287c 100644
--- a/drivers/builtin_openssl2/crypto/bio/b_dump.c
+++ b/thirdparty/openssl/crypto/bio/b_dump.c
diff --git a/drivers/builtin_openssl2/crypto/bio/b_print.c b/thirdparty/openssl/crypto/bio/b_print.c
index 90248fa2a..90248fa2a 100644
--- a/drivers/builtin_openssl2/crypto/bio/b_print.c
+++ b/thirdparty/openssl/crypto/bio/b_print.c
diff --git a/drivers/builtin_openssl2/crypto/bio/b_sock.c b/thirdparty/openssl/crypto/bio/b_sock.c
index 5bad0a2ba..5bad0a2ba 100644
--- a/drivers/builtin_openssl2/crypto/bio/b_sock.c
+++ b/thirdparty/openssl/crypto/bio/b_sock.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bf_buff.c b/thirdparty/openssl/crypto/bio/bf_buff.c
index 478fa16a0..478fa16a0 100644
--- a/drivers/builtin_openssl2/crypto/bio/bf_buff.c
+++ b/thirdparty/openssl/crypto/bio/bf_buff.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bf_lbuf.c b/thirdparty/openssl/crypto/bio/bf_lbuf.c
index 46d0d5a1e..46d0d5a1e 100644
--- a/drivers/builtin_openssl2/crypto/bio/bf_lbuf.c
+++ b/thirdparty/openssl/crypto/bio/bf_lbuf.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bf_nbio.c b/thirdparty/openssl/crypto/bio/bf_nbio.c
index a04f32a00..a04f32a00 100644
--- a/drivers/builtin_openssl2/crypto/bio/bf_nbio.c
+++ b/thirdparty/openssl/crypto/bio/bf_nbio.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bf_null.c b/thirdparty/openssl/crypto/bio/bf_null.c
index e0c79e829..e0c79e829 100644
--- a/drivers/builtin_openssl2/crypto/bio/bf_null.c
+++ b/thirdparty/openssl/crypto/bio/bf_null.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bio_cb.c b/thirdparty/openssl/crypto/bio/bio_cb.c
index d3e860686..d3e860686 100644
--- a/drivers/builtin_openssl2/crypto/bio/bio_cb.c
+++ b/thirdparty/openssl/crypto/bio/bio_cb.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bio_err.c b/thirdparty/openssl/crypto/bio/bio_err.c
index d9007aa3d..d9007aa3d 100644
--- a/drivers/builtin_openssl2/crypto/bio/bio_err.c
+++ b/thirdparty/openssl/crypto/bio/bio_err.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bio_lcl.h b/thirdparty/openssl/crypto/bio/bio_lcl.h
index 741884da8..741884da8 100644
--- a/drivers/builtin_openssl2/crypto/bio/bio_lcl.h
+++ b/thirdparty/openssl/crypto/bio/bio_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/bio/bio_lib.c b/thirdparty/openssl/crypto/bio/bio_lib.c
index 07934f8a6..07934f8a6 100644
--- a/drivers/builtin_openssl2/crypto/bio/bio_lib.c
+++ b/thirdparty/openssl/crypto/bio/bio_lib.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_acpt.c b/thirdparty/openssl/crypto/bio/bss_acpt.c
index 4a5e39bd3..4a5e39bd3 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_acpt.c
+++ b/thirdparty/openssl/crypto/bio/bss_acpt.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_bio.c b/thirdparty/openssl/crypto/bio/bss_bio.c
index 4d8727f8f..4d8727f8f 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_bio.c
+++ b/thirdparty/openssl/crypto/bio/bss_bio.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_conn.c b/thirdparty/openssl/crypto/bio/bss_conn.c
index 7d15ad29d..7d15ad29d 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_conn.c
+++ b/thirdparty/openssl/crypto/bio/bss_conn.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_dgram.c b/thirdparty/openssl/crypto/bio/bss_dgram.c
index bdd7bf88e..bdd7bf88e 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_dgram.c
+++ b/thirdparty/openssl/crypto/bio/bss_dgram.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_fd.c b/thirdparty/openssl/crypto/bio/bss_fd.c
index 5f4e34481..5f4e34481 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_fd.c
+++ b/thirdparty/openssl/crypto/bio/bss_fd.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_file.c b/thirdparty/openssl/crypto/bio/bss_file.c
index bfba93e62..bfba93e62 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_file.c
+++ b/thirdparty/openssl/crypto/bio/bss_file.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_log.c b/thirdparty/openssl/crypto/bio/bss_log.c
index 1283a525b..1283a525b 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_log.c
+++ b/thirdparty/openssl/crypto/bio/bss_log.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_mem.c b/thirdparty/openssl/crypto/bio/bss_mem.c
index b0394a960..b0394a960 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_mem.c
+++ b/thirdparty/openssl/crypto/bio/bss_mem.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_null.c b/thirdparty/openssl/crypto/bio/bss_null.c
index 6a03fa246..6a03fa246 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_null.c
+++ b/thirdparty/openssl/crypto/bio/bss_null.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_rtcp.c b/thirdparty/openssl/crypto/bio/bss_rtcp.c
index 09f14f48d..09f14f48d 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_rtcp.c
+++ b/thirdparty/openssl/crypto/bio/bss_rtcp.c
diff --git a/drivers/builtin_openssl2/crypto/bio/bss_sock.c b/thirdparty/openssl/crypto/bio/bss_sock.c
index 6194d2c03..6194d2c03 100644
--- a/drivers/builtin_openssl2/crypto/bio/bss_sock.c
+++ b/thirdparty/openssl/crypto/bio/bss_sock.c
diff --git a/drivers/builtin_openssl2/crypto/bn/asm/README b/thirdparty/openssl/crypto/bn/asm/README
index b0f3a68a0..b0f3a68a0 100644
--- a/drivers/builtin_openssl2/crypto/bn/asm/README
+++ b/thirdparty/openssl/crypto/bn/asm/README
diff --git a/drivers/builtin_openssl2/crypto/bn/asm/vms.mar b/thirdparty/openssl/crypto/bn/asm/vms.mar
index aefab15cd..aefab15cd 100644
--- a/drivers/builtin_openssl2/crypto/bn/asm/vms.mar
+++ b/thirdparty/openssl/crypto/bn/asm/vms.mar
diff --git a/drivers/builtin_openssl2/crypto/bn/asm/x86/f b/thirdparty/openssl/crypto/bn/asm/x86/f
index 22e411222..22e411222 100644
--- a/drivers/builtin_openssl2/crypto/bn/asm/x86/f
+++ b/thirdparty/openssl/crypto/bn/asm/x86/f
diff --git a/drivers/builtin_openssl2/crypto/bn/asm/x86_64-gcc.c b/thirdparty/openssl/crypto/bn/asm/x86_64-gcc.c
index d77dc433d..d77dc433d 100644
--- a/drivers/builtin_openssl2/crypto/bn/asm/x86_64-gcc.c
+++ b/thirdparty/openssl/crypto/bn/asm/x86_64-gcc.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn.mul b/thirdparty/openssl/crypto/bn/bn.mul
index 9728870d3..9728870d3 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn.mul
+++ b/thirdparty/openssl/crypto/bn/bn.mul
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_add.c b/thirdparty/openssl/crypto/bn/bn_add.c
index 2f3d11044..2f3d11044 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_add.c
+++ b/thirdparty/openssl/crypto/bn/bn_add.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_asm.c b/thirdparty/openssl/crypto/bn/bn_asm.c
index 03a33cffe..03a33cffe 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_asm.c
+++ b/thirdparty/openssl/crypto/bn/bn_asm.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_blind.c b/thirdparty/openssl/crypto/bn/bn_blind.c
index d448daa3c..d448daa3c 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_blind.c
+++ b/thirdparty/openssl/crypto/bn/bn_blind.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_const.c b/thirdparty/openssl/crypto/bn/bn_const.c
index 12c3208c2..12c3208c2 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_const.c
+++ b/thirdparty/openssl/crypto/bn/bn_const.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_ctx.c b/thirdparty/openssl/crypto/bn/bn_ctx.c
index 526c6a046..526c6a046 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_ctx.c
+++ b/thirdparty/openssl/crypto/bn/bn_ctx.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_depr.c b/thirdparty/openssl/crypto/bn/bn_depr.c
index 34895f598..34895f598 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_depr.c
+++ b/thirdparty/openssl/crypto/bn/bn_depr.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_div.c b/thirdparty/openssl/crypto/bn/bn_div.c
index 72e6ce3f7..72e6ce3f7 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_div.c
+++ b/thirdparty/openssl/crypto/bn/bn_div.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_err.c b/thirdparty/openssl/crypto/bn/bn_err.c
index e7a703826..e7a703826 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_err.c
+++ b/thirdparty/openssl/crypto/bn/bn_err.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_exp.c b/thirdparty/openssl/crypto/bn/bn_exp.c
index 1670f01d1..1670f01d1 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_exp.c
+++ b/thirdparty/openssl/crypto/bn/bn_exp.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_exp2.c b/thirdparty/openssl/crypto/bn/bn_exp2.c
index 43fd2044c..43fd2044c 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_exp2.c
+++ b/thirdparty/openssl/crypto/bn/bn_exp2.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_gcd.c b/thirdparty/openssl/crypto/bn/bn_gcd.c
index ce59fe701..ce59fe701 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_gcd.c
+++ b/thirdparty/openssl/crypto/bn/bn_gcd.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_gf2m.c b/thirdparty/openssl/crypto/bn/bn_gf2m.c
index 2c61da110..2c61da110 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_gf2m.c
+++ b/thirdparty/openssl/crypto/bn/bn_gf2m.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_kron.c b/thirdparty/openssl/crypto/bn/bn_kron.c
index 88d731ac7..88d731ac7 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_kron.c
+++ b/thirdparty/openssl/crypto/bn/bn_kron.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_lcl.h b/thirdparty/openssl/crypto/bn/bn_lcl.h
index 00f4f0994..00f4f0994 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_lcl.h
+++ b/thirdparty/openssl/crypto/bn/bn_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_lib.c b/thirdparty/openssl/crypto/bn/bn_lib.c
index 80105fff4..80105fff4 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_lib.c
+++ b/thirdparty/openssl/crypto/bn/bn_lib.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_mod.c b/thirdparty/openssl/crypto/bn/bn_mod.c
index ffbce890c..ffbce890c 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_mod.c
+++ b/thirdparty/openssl/crypto/bn/bn_mod.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_mont.c b/thirdparty/openssl/crypto/bn/bn_mont.c
index be95bd55d..be95bd55d 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_mont.c
+++ b/thirdparty/openssl/crypto/bn/bn_mont.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_mpi.c b/thirdparty/openssl/crypto/bn/bn_mpi.c
index 3bd40bbd2..3bd40bbd2 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_mpi.c
+++ b/thirdparty/openssl/crypto/bn/bn_mpi.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_mul.c b/thirdparty/openssl/crypto/bn/bn_mul.c
index b174850b6..b174850b6 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_mul.c
+++ b/thirdparty/openssl/crypto/bn/bn_mul.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_nist.c b/thirdparty/openssl/crypto/bn/bn_nist.c
index 4a45404c6..4a45404c6 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_nist.c
+++ b/thirdparty/openssl/crypto/bn/bn_nist.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_prime.c b/thirdparty/openssl/crypto/bn/bn_prime.c
index 1d256874c..1d256874c 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_prime.c
+++ b/thirdparty/openssl/crypto/bn/bn_prime.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_prime.h b/thirdparty/openssl/crypto/bn/bn_prime.h
index 5cf0de169..5cf0de169 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_prime.h
+++ b/thirdparty/openssl/crypto/bn/bn_prime.h
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_print.c b/thirdparty/openssl/crypto/bn/bn_print.c
index bfa31efc5..bfa31efc5 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_print.c
+++ b/thirdparty/openssl/crypto/bn/bn_print.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_rand.c b/thirdparty/openssl/crypto/bn/bn_rand.c
index f9fb2e9e4..f9fb2e9e4 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_rand.c
+++ b/thirdparty/openssl/crypto/bn/bn_rand.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_recp.c b/thirdparty/openssl/crypto/bn/bn_recp.c
index f047040ef..f047040ef 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_recp.c
+++ b/thirdparty/openssl/crypto/bn/bn_recp.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_shift.c b/thirdparty/openssl/crypto/bn/bn_shift.c
index 9673d9a30..9673d9a30 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_shift.c
+++ b/thirdparty/openssl/crypto/bn/bn_shift.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_sqr.c b/thirdparty/openssl/crypto/bn/bn_sqr.c
index 3ca69879e..3ca69879e 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_sqr.c
+++ b/thirdparty/openssl/crypto/bn/bn_sqr.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_sqrt.c b/thirdparty/openssl/crypto/bn/bn_sqrt.c
index 232af99a2..232af99a2 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_sqrt.c
+++ b/thirdparty/openssl/crypto/bn/bn_sqrt.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_word.c b/thirdparty/openssl/crypto/bn/bn_word.c
index b031a60b5..b031a60b5 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_word.c
+++ b/thirdparty/openssl/crypto/bn/bn_word.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bn_x931p.c b/thirdparty/openssl/crypto/bn/bn_x931p.c
index efa48bdf8..efa48bdf8 100644
--- a/drivers/builtin_openssl2/crypto/bn/bn_x931p.c
+++ b/thirdparty/openssl/crypto/bn/bn_x931p.c
diff --git a/drivers/builtin_openssl2/crypto/bn/bnspeed.c b/thirdparty/openssl/crypto/bn/bnspeed.c
index e387fdfbc..e387fdfbc 100644
--- a/drivers/builtin_openssl2/crypto/bn/bnspeed.c
+++ b/thirdparty/openssl/crypto/bn/bnspeed.c
diff --git a/drivers/builtin_openssl2/crypto/bn/exp.c b/thirdparty/openssl/crypto/bn/exp.c
index fbce28c5b..fbce28c5b 100644
--- a/drivers/builtin_openssl2/crypto/bn/exp.c
+++ b/thirdparty/openssl/crypto/bn/exp.c
diff --git a/drivers/builtin_openssl2/crypto/bn/expspeed.c b/thirdparty/openssl/crypto/bn/expspeed.c
index 513a568a4..513a568a4 100644
--- a/drivers/builtin_openssl2/crypto/bn/expspeed.c
+++ b/thirdparty/openssl/crypto/bn/expspeed.c
diff --git a/drivers/builtin_openssl2/crypto/bn/rsaz_exp.c b/thirdparty/openssl/crypto/bn/rsaz_exp.c
index c54c6feb5..c54c6feb5 100644
--- a/drivers/builtin_openssl2/crypto/bn/rsaz_exp.c
+++ b/thirdparty/openssl/crypto/bn/rsaz_exp.c
diff --git a/drivers/builtin_openssl2/crypto/bn/rsaz_exp.h b/thirdparty/openssl/crypto/bn/rsaz_exp.h
index 229e181f6..229e181f6 100644
--- a/drivers/builtin_openssl2/crypto/bn/rsaz_exp.h
+++ b/thirdparty/openssl/crypto/bn/rsaz_exp.h
diff --git a/drivers/builtin_openssl2/crypto/bn/todo b/thirdparty/openssl/crypto/bn/todo
index e47e381ae..e47e381ae 100644
--- a/drivers/builtin_openssl2/crypto/bn/todo
+++ b/thirdparty/openssl/crypto/bn/todo
diff --git a/drivers/builtin_openssl2/crypto/bn/vms-helper.c b/thirdparty/openssl/crypto/bn/vms-helper.c
index f342e90cb..f342e90cb 100644
--- a/drivers/builtin_openssl2/crypto/bn/vms-helper.c
+++ b/thirdparty/openssl/crypto/bn/vms-helper.c
diff --git a/drivers/builtin_openssl2/crypto/buffer/buf_err.c b/thirdparty/openssl/crypto/buffer/buf_err.c
index 631eec38d..631eec38d 100644
--- a/drivers/builtin_openssl2/crypto/buffer/buf_err.c
+++ b/thirdparty/openssl/crypto/buffer/buf_err.c
diff --git a/drivers/builtin_openssl2/crypto/buffer/buf_str.c b/thirdparty/openssl/crypto/buffer/buf_str.c
index fa0d608e7..fa0d608e7 100644
--- a/drivers/builtin_openssl2/crypto/buffer/buf_str.c
+++ b/thirdparty/openssl/crypto/buffer/buf_str.c
diff --git a/drivers/builtin_openssl2/crypto/buffer/buffer.c b/thirdparty/openssl/crypto/buffer/buffer.c
index eff3e0815..eff3e0815 100644
--- a/drivers/builtin_openssl2/crypto/buffer/buffer.c
+++ b/thirdparty/openssl/crypto/buffer/buffer.c
diff --git a/drivers/builtin_openssl2/crypto/camellia/camellia.c b/thirdparty/openssl/crypto/camellia/camellia.c
index 719fa61cf..719fa61cf 100644
--- a/drivers/builtin_openssl2/crypto/camellia/camellia.c
+++ b/thirdparty/openssl/crypto/camellia/camellia.c
diff --git a/drivers/builtin_openssl2/crypto/camellia/cmll_cbc.c b/thirdparty/openssl/crypto/camellia/cmll_cbc.c
index 4017e00d9..4017e00d9 100644
--- a/drivers/builtin_openssl2/crypto/camellia/cmll_cbc.c
+++ b/thirdparty/openssl/crypto/camellia/cmll_cbc.c
diff --git a/drivers/builtin_openssl2/crypto/camellia/cmll_cfb.c b/thirdparty/openssl/crypto/camellia/cmll_cfb.c
index 78f2ae456..78f2ae456 100644
--- a/drivers/builtin_openssl2/crypto/camellia/cmll_cfb.c
+++ b/thirdparty/openssl/crypto/camellia/cmll_cfb.c
diff --git a/drivers/builtin_openssl2/crypto/camellia/cmll_ctr.c b/thirdparty/openssl/crypto/camellia/cmll_ctr.c
index 95e26621b..95e26621b 100644
--- a/drivers/builtin_openssl2/crypto/camellia/cmll_ctr.c
+++ b/thirdparty/openssl/crypto/camellia/cmll_ctr.c
diff --git a/drivers/builtin_openssl2/crypto/camellia/cmll_ecb.c b/thirdparty/openssl/crypto/camellia/cmll_ecb.c
index b030791b2..b030791b2 100644
--- a/drivers/builtin_openssl2/crypto/camellia/cmll_ecb.c
+++ b/thirdparty/openssl/crypto/camellia/cmll_ecb.c
diff --git a/drivers/builtin_openssl2/crypto/camellia/cmll_locl.h b/thirdparty/openssl/crypto/camellia/cmll_locl.h
index 2bd79b8c4..2bd79b8c4 100644
--- a/drivers/builtin_openssl2/crypto/camellia/cmll_locl.h
+++ b/thirdparty/openssl/crypto/camellia/cmll_locl.h
diff --git a/drivers/builtin_openssl2/crypto/camellia/cmll_misc.c b/thirdparty/openssl/crypto/camellia/cmll_misc.c
index 694d2fac8..694d2fac8 100644
--- a/drivers/builtin_openssl2/crypto/camellia/cmll_misc.c
+++ b/thirdparty/openssl/crypto/camellia/cmll_misc.c
diff --git a/drivers/builtin_openssl2/crypto/camellia/cmll_ofb.c b/thirdparty/openssl/crypto/camellia/cmll_ofb.c
index 85eb89215..85eb89215 100644
--- a/drivers/builtin_openssl2/crypto/camellia/cmll_ofb.c
+++ b/thirdparty/openssl/crypto/camellia/cmll_ofb.c
diff --git a/drivers/builtin_openssl2/crypto/camellia/cmll_utl.c b/thirdparty/openssl/crypto/camellia/cmll_utl.c
index d5eb6b4d6..d5eb6b4d6 100644
--- a/drivers/builtin_openssl2/crypto/camellia/cmll_utl.c
+++ b/thirdparty/openssl/crypto/camellia/cmll_utl.c
diff --git a/drivers/builtin_openssl2/crypto/cast/asm/readme b/thirdparty/openssl/crypto/cast/asm/readme
index fbcd76289..fbcd76289 100644
--- a/drivers/builtin_openssl2/crypto/cast/asm/readme
+++ b/thirdparty/openssl/crypto/cast/asm/readme
diff --git a/drivers/builtin_openssl2/crypto/cast/c_cfb64.c b/thirdparty/openssl/crypto/cast/c_cfb64.c
index f2f16e5d7..f2f16e5d7 100644
--- a/drivers/builtin_openssl2/crypto/cast/c_cfb64.c
+++ b/thirdparty/openssl/crypto/cast/c_cfb64.c
diff --git a/drivers/builtin_openssl2/crypto/cast/c_ecb.c b/thirdparty/openssl/crypto/cast/c_ecb.c
index 4793f28ed..4793f28ed 100644
--- a/drivers/builtin_openssl2/crypto/cast/c_ecb.c
+++ b/thirdparty/openssl/crypto/cast/c_ecb.c
diff --git a/drivers/builtin_openssl2/crypto/cast/c_enc.c b/thirdparty/openssl/crypto/cast/c_enc.c
index 6e1d50f10..6e1d50f10 100644
--- a/drivers/builtin_openssl2/crypto/cast/c_enc.c
+++ b/thirdparty/openssl/crypto/cast/c_enc.c
diff --git a/drivers/builtin_openssl2/crypto/cast/c_ofb64.c b/thirdparty/openssl/crypto/cast/c_ofb64.c
index 4e0a7c2e6..4e0a7c2e6 100644
--- a/drivers/builtin_openssl2/crypto/cast/c_ofb64.c
+++ b/thirdparty/openssl/crypto/cast/c_ofb64.c
diff --git a/drivers/builtin_openssl2/crypto/cast/c_skey.c b/thirdparty/openssl/crypto/cast/c_skey.c
index bbb6d5609..bbb6d5609 100644
--- a/drivers/builtin_openssl2/crypto/cast/c_skey.c
+++ b/thirdparty/openssl/crypto/cast/c_skey.c
diff --git a/drivers/builtin_openssl2/crypto/cast/cast_lcl.h b/thirdparty/openssl/crypto/cast/cast_lcl.h
index b0f08294e..b0f08294e 100644
--- a/drivers/builtin_openssl2/crypto/cast/cast_lcl.h
+++ b/thirdparty/openssl/crypto/cast/cast_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/cast/cast_s.h b/thirdparty/openssl/crypto/cast/cast_s.h
index 380dc81ae..380dc81ae 100644
--- a/drivers/builtin_openssl2/crypto/cast/cast_s.h
+++ b/thirdparty/openssl/crypto/cast/cast_s.h
diff --git a/drivers/builtin_openssl2/crypto/cast/cast_spd.c b/thirdparty/openssl/crypto/cast/cast_spd.c
index 91d2ce23f..91d2ce23f 100644
--- a/drivers/builtin_openssl2/crypto/cast/cast_spd.c
+++ b/thirdparty/openssl/crypto/cast/cast_spd.c
diff --git a/drivers/builtin_openssl2/crypto/cast/castopts.c b/thirdparty/openssl/crypto/cast/castopts.c
index 42687f288..42687f288 100644
--- a/drivers/builtin_openssl2/crypto/cast/castopts.c
+++ b/thirdparty/openssl/crypto/cast/castopts.c
diff --git a/drivers/builtin_openssl2/crypto/cast/casts.cpp b/thirdparty/openssl/crypto/cast/casts.cpp
index 8d7bd468d..8d7bd468d 100644
--- a/drivers/builtin_openssl2/crypto/cast/casts.cpp
+++ b/thirdparty/openssl/crypto/cast/casts.cpp
diff --git a/drivers/builtin_openssl2/crypto/cmac/cm_ameth.c b/thirdparty/openssl/crypto/cmac/cm_ameth.c
index bf933e086..bf933e086 100644
--- a/drivers/builtin_openssl2/crypto/cmac/cm_ameth.c
+++ b/thirdparty/openssl/crypto/cmac/cm_ameth.c
diff --git a/drivers/builtin_openssl2/crypto/cmac/cm_pmeth.c b/thirdparty/openssl/crypto/cmac/cm_pmeth.c
index a2300df18..a2300df18 100644
--- a/drivers/builtin_openssl2/crypto/cmac/cm_pmeth.c
+++ b/thirdparty/openssl/crypto/cmac/cm_pmeth.c
diff --git a/drivers/builtin_openssl2/crypto/cmac/cmac.c b/thirdparty/openssl/crypto/cmac/cmac.c
index 2954b6eb7..2954b6eb7 100644
--- a/drivers/builtin_openssl2/crypto/cmac/cmac.c
+++ b/thirdparty/openssl/crypto/cmac/cmac.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_asn1.c b/thirdparty/openssl/crypto/cms/cms_asn1.c
index 81a3407f1..81a3407f1 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_asn1.c
+++ b/thirdparty/openssl/crypto/cms/cms_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_att.c b/thirdparty/openssl/crypto/cms/cms_att.c
index f79a49d51..f79a49d51 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_att.c
+++ b/thirdparty/openssl/crypto/cms/cms_att.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_cd.c b/thirdparty/openssl/crypto/cms/cms_cd.c
index aa3238f58..aa3238f58 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_cd.c
+++ b/thirdparty/openssl/crypto/cms/cms_cd.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_dd.c b/thirdparty/openssl/crypto/cms/cms_dd.c
index 23e9f2d3a..23e9f2d3a 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_dd.c
+++ b/thirdparty/openssl/crypto/cms/cms_dd.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_enc.c b/thirdparty/openssl/crypto/cms/cms_enc.c
index b14b4b68b..b14b4b68b 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_enc.c
+++ b/thirdparty/openssl/crypto/cms/cms_enc.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_env.c b/thirdparty/openssl/crypto/cms/cms_env.c
index 93c06cb00..93c06cb00 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_env.c
+++ b/thirdparty/openssl/crypto/cms/cms_env.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_err.c b/thirdparty/openssl/crypto/cms/cms_err.c
index 15572ea34..15572ea34 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_err.c
+++ b/thirdparty/openssl/crypto/cms/cms_err.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_ess.c b/thirdparty/openssl/crypto/cms/cms_ess.c
index 8631a2eb2..8631a2eb2 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_ess.c
+++ b/thirdparty/openssl/crypto/cms/cms_ess.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_io.c b/thirdparty/openssl/crypto/cms/cms_io.c
index ec51f8e68..ec51f8e68 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_io.c
+++ b/thirdparty/openssl/crypto/cms/cms_io.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_kari.c b/thirdparty/openssl/crypto/cms/cms_kari.c
index 2cfcdb29c..2cfcdb29c 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_kari.c
+++ b/thirdparty/openssl/crypto/cms/cms_kari.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_lcl.h b/thirdparty/openssl/crypto/cms/cms_lcl.h
index 20f2c25f5..20f2c25f5 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_lcl.h
+++ b/thirdparty/openssl/crypto/cms/cms_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_lib.c b/thirdparty/openssl/crypto/cms/cms_lib.c
index d6cb60d02..d6cb60d02 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_lib.c
+++ b/thirdparty/openssl/crypto/cms/cms_lib.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_pwri.c b/thirdparty/openssl/crypto/cms/cms_pwri.c
index b91c01691..b91c01691 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_pwri.c
+++ b/thirdparty/openssl/crypto/cms/cms_pwri.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_sd.c b/thirdparty/openssl/crypto/cms/cms_sd.c
index a41aca8e1..a41aca8e1 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_sd.c
+++ b/thirdparty/openssl/crypto/cms/cms_sd.c
diff --git a/drivers/builtin_openssl2/crypto/cms/cms_smime.c b/thirdparty/openssl/crypto/cms/cms_smime.c
index 07e3472e1..07e3472e1 100644
--- a/drivers/builtin_openssl2/crypto/cms/cms_smime.c
+++ b/thirdparty/openssl/crypto/cms/cms_smime.c
diff --git a/drivers/builtin_openssl2/crypto/comp/c_rle.c b/thirdparty/openssl/crypto/comp/c_rle.c
index e9aabbd16..e9aabbd16 100644
--- a/drivers/builtin_openssl2/crypto/comp/c_rle.c
+++ b/thirdparty/openssl/crypto/comp/c_rle.c
diff --git a/drivers/builtin_openssl2/crypto/comp/c_zlib.c b/thirdparty/openssl/crypto/comp/c_zlib.c
index 9c32614d3..9c32614d3 100644
--- a/drivers/builtin_openssl2/crypto/comp/c_zlib.c
+++ b/thirdparty/openssl/crypto/comp/c_zlib.c
diff --git a/drivers/builtin_openssl2/crypto/comp/comp_err.c b/thirdparty/openssl/crypto/comp/comp_err.c
index 8ca159b60..8ca159b60 100644
--- a/drivers/builtin_openssl2/crypto/comp/comp_err.c
+++ b/thirdparty/openssl/crypto/comp/comp_err.c
diff --git a/drivers/builtin_openssl2/crypto/comp/comp_lib.c b/thirdparty/openssl/crypto/comp/comp_lib.c
index bd4eb7a1a..bd4eb7a1a 100644
--- a/drivers/builtin_openssl2/crypto/comp/comp_lib.c
+++ b/thirdparty/openssl/crypto/comp/comp_lib.c
diff --git a/drivers/builtin_openssl2/crypto/conf/README b/thirdparty/openssl/crypto/conf/README
index 96e53b34e..96e53b34e 100644
--- a/drivers/builtin_openssl2/crypto/conf/README
+++ b/thirdparty/openssl/crypto/conf/README
diff --git a/drivers/builtin_openssl2/crypto/conf/cnf_save.c b/thirdparty/openssl/crypto/conf/cnf_save.c
index 71c431742..71c431742 100644
--- a/drivers/builtin_openssl2/crypto/conf/cnf_save.c
+++ b/thirdparty/openssl/crypto/conf/cnf_save.c
diff --git a/drivers/builtin_openssl2/crypto/conf/conf_api.c b/thirdparty/openssl/crypto/conf/conf_api.c
index 4cf755337..4cf755337 100644
--- a/drivers/builtin_openssl2/crypto/conf/conf_api.c
+++ b/thirdparty/openssl/crypto/conf/conf_api.c
diff --git a/drivers/builtin_openssl2/crypto/conf/conf_def.c b/thirdparty/openssl/crypto/conf/conf_def.c
index 68c77cec7..68c77cec7 100644
--- a/drivers/builtin_openssl2/crypto/conf/conf_def.c
+++ b/thirdparty/openssl/crypto/conf/conf_def.c
diff --git a/drivers/builtin_openssl2/crypto/conf/conf_def.h b/thirdparty/openssl/crypto/conf/conf_def.h
index 7d897b89f..7d897b89f 100644
--- a/drivers/builtin_openssl2/crypto/conf/conf_def.h
+++ b/thirdparty/openssl/crypto/conf/conf_def.h
diff --git a/drivers/builtin_openssl2/crypto/conf/conf_err.c b/thirdparty/openssl/crypto/conf/conf_err.c
index bb5e2fe25..bb5e2fe25 100644
--- a/drivers/builtin_openssl2/crypto/conf/conf_err.c
+++ b/thirdparty/openssl/crypto/conf/conf_err.c
diff --git a/drivers/builtin_openssl2/crypto/conf/conf_lib.c b/thirdparty/openssl/crypto/conf/conf_lib.c
index 528138480..528138480 100644
--- a/drivers/builtin_openssl2/crypto/conf/conf_lib.c
+++ b/thirdparty/openssl/crypto/conf/conf_lib.c
diff --git a/drivers/builtin_openssl2/crypto/conf/conf_mall.c b/thirdparty/openssl/crypto/conf/conf_mall.c
index b4dbd662d..b4dbd662d 100644
--- a/drivers/builtin_openssl2/crypto/conf/conf_mall.c
+++ b/thirdparty/openssl/crypto/conf/conf_mall.c
diff --git a/drivers/builtin_openssl2/crypto/conf/conf_mod.c b/thirdparty/openssl/crypto/conf/conf_mod.c
index 9acfca4f7..9acfca4f7 100644
--- a/drivers/builtin_openssl2/crypto/conf/conf_mod.c
+++ b/thirdparty/openssl/crypto/conf/conf_mod.c
diff --git a/drivers/builtin_openssl2/crypto/conf/conf_sap.c b/thirdparty/openssl/crypto/conf/conf_sap.c
index c042cf222..c042cf222 100644
--- a/drivers/builtin_openssl2/crypto/conf/conf_sap.c
+++ b/thirdparty/openssl/crypto/conf/conf_sap.c
diff --git a/drivers/builtin_openssl2/crypto/conf/ssleay.cnf b/thirdparty/openssl/crypto/conf/ssleay.cnf
index ed33af601..ed33af601 100644
--- a/drivers/builtin_openssl2/crypto/conf/ssleay.cnf
+++ b/thirdparty/openssl/crypto/conf/ssleay.cnf
diff --git a/drivers/builtin_openssl2/crypto/constant_time_locl.h b/thirdparty/openssl/crypto/constant_time_locl.h
index c786aea94..c786aea94 100644
--- a/drivers/builtin_openssl2/crypto/constant_time_locl.h
+++ b/thirdparty/openssl/crypto/constant_time_locl.h
diff --git a/drivers/builtin_openssl2/crypto/cpt_err.c b/thirdparty/openssl/crypto/cpt_err.c
index a5138381a..a5138381a 100644
--- a/drivers/builtin_openssl2/crypto/cpt_err.c
+++ b/thirdparty/openssl/crypto/cpt_err.c
diff --git a/drivers/builtin_openssl2/crypto/cryptlib.c b/thirdparty/openssl/crypto/cryptlib.c
index 1925428f5..1925428f5 100644
--- a/drivers/builtin_openssl2/crypto/cryptlib.c
+++ b/thirdparty/openssl/crypto/cryptlib.c
diff --git a/drivers/builtin_openssl2/crypto/cryptlib.h b/thirdparty/openssl/crypto/cryptlib.h
index fba180a6b..fba180a6b 100644
--- a/drivers/builtin_openssl2/crypto/cryptlib.h
+++ b/thirdparty/openssl/crypto/cryptlib.h
diff --git a/drivers/builtin_openssl2/crypto/crypto-lib.com b/thirdparty/openssl/crypto/crypto-lib.com
index 1423cac28..1423cac28 100644
--- a/drivers/builtin_openssl2/crypto/crypto-lib.com
+++ b/thirdparty/openssl/crypto/crypto-lib.com
diff --git a/drivers/builtin_openssl2/crypto/cversion.c b/thirdparty/openssl/crypto/cversion.c
index bfff6995c..bfff6995c 100644
--- a/drivers/builtin_openssl2/crypto/cversion.c
+++ b/thirdparty/openssl/crypto/cversion.c
diff --git a/drivers/builtin_openssl2/crypto/des/COPYRIGHT b/thirdparty/openssl/crypto/des/COPYRIGHT
index 5469e1e46..5469e1e46 100644
--- a/drivers/builtin_openssl2/crypto/des/COPYRIGHT
+++ b/thirdparty/openssl/crypto/des/COPYRIGHT
diff --git a/drivers/builtin_openssl2/crypto/des/DES.pm b/thirdparty/openssl/crypto/des/DES.pm
index 6a175b6ca..6a175b6ca 100644
--- a/drivers/builtin_openssl2/crypto/des/DES.pm
+++ b/thirdparty/openssl/crypto/des/DES.pm
diff --git a/drivers/builtin_openssl2/crypto/des/DES.xs b/thirdparty/openssl/crypto/des/DES.xs
index b8050b9ed..b8050b9ed 100644
--- a/drivers/builtin_openssl2/crypto/des/DES.xs
+++ b/thirdparty/openssl/crypto/des/DES.xs
diff --git a/drivers/builtin_openssl2/crypto/des/FILES0 b/thirdparty/openssl/crypto/des/FILES0
index 4c7ea2de7..4c7ea2de7 100644
--- a/drivers/builtin_openssl2/crypto/des/FILES0
+++ b/thirdparty/openssl/crypto/des/FILES0
diff --git a/drivers/builtin_openssl2/crypto/des/INSTALL b/thirdparty/openssl/crypto/des/INSTALL
index 8aebdfe11..8aebdfe11 100644
--- a/drivers/builtin_openssl2/crypto/des/INSTALL
+++ b/thirdparty/openssl/crypto/des/INSTALL
diff --git a/drivers/builtin_openssl2/crypto/des/Imakefile b/thirdparty/openssl/crypto/des/Imakefile
index 1b9b5629e..1b9b5629e 100644
--- a/drivers/builtin_openssl2/crypto/des/Imakefile
+++ b/thirdparty/openssl/crypto/des/Imakefile
diff --git a/drivers/builtin_openssl2/crypto/des/KERBEROS b/thirdparty/openssl/crypto/des/KERBEROS
index f401b1001..f401b1001 100644
--- a/drivers/builtin_openssl2/crypto/des/KERBEROS
+++ b/thirdparty/openssl/crypto/des/KERBEROS
diff --git a/drivers/builtin_openssl2/crypto/des/README b/thirdparty/openssl/crypto/des/README
index 621a5ab46..621a5ab46 100644
--- a/drivers/builtin_openssl2/crypto/des/README
+++ b/thirdparty/openssl/crypto/des/README
diff --git a/drivers/builtin_openssl2/crypto/des/VERSION b/thirdparty/openssl/crypto/des/VERSION
index c7d01542b..c7d01542b 100644
--- a/drivers/builtin_openssl2/crypto/des/VERSION
+++ b/thirdparty/openssl/crypto/des/VERSION
diff --git a/drivers/builtin_openssl2/crypto/des/asm/des_enc.m4 b/thirdparty/openssl/crypto/des/asm/des_enc.m4
index dda08e126..dda08e126 100644
--- a/drivers/builtin_openssl2/crypto/des/asm/des_enc.m4
+++ b/thirdparty/openssl/crypto/des/asm/des_enc.m4
diff --git a/drivers/builtin_openssl2/crypto/des/asm/readme b/thirdparty/openssl/crypto/des/asm/readme
index 1beafe253..1beafe253 100644
--- a/drivers/builtin_openssl2/crypto/des/asm/readme
+++ b/thirdparty/openssl/crypto/des/asm/readme
diff --git a/drivers/builtin_openssl2/crypto/des/cbc3_enc.c b/thirdparty/openssl/crypto/des/cbc3_enc.c
index 249518a6a..249518a6a 100644
--- a/drivers/builtin_openssl2/crypto/des/cbc3_enc.c
+++ b/thirdparty/openssl/crypto/des/cbc3_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/cbc_cksm.c b/thirdparty/openssl/crypto/des/cbc_cksm.c
index f89b5b98e..f89b5b98e 100644
--- a/drivers/builtin_openssl2/crypto/des/cbc_cksm.c
+++ b/thirdparty/openssl/crypto/des/cbc_cksm.c
diff --git a/drivers/builtin_openssl2/crypto/des/cbc_enc.c b/thirdparty/openssl/crypto/des/cbc_enc.c
index 7ee359928..7ee359928 100644
--- a/drivers/builtin_openssl2/crypto/des/cbc_enc.c
+++ b/thirdparty/openssl/crypto/des/cbc_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/cfb64ede.c b/thirdparty/openssl/crypto/des/cfb64ede.c
index 5d709c12d..5d709c12d 100644
--- a/drivers/builtin_openssl2/crypto/des/cfb64ede.c
+++ b/thirdparty/openssl/crypto/des/cfb64ede.c
diff --git a/drivers/builtin_openssl2/crypto/des/cfb64enc.c b/thirdparty/openssl/crypto/des/cfb64enc.c
index 7346774eb..7346774eb 100644
--- a/drivers/builtin_openssl2/crypto/des/cfb64enc.c
+++ b/thirdparty/openssl/crypto/des/cfb64enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/cfb_enc.c b/thirdparty/openssl/crypto/des/cfb_enc.c
index bd0e29971..bd0e29971 100644
--- a/drivers/builtin_openssl2/crypto/des/cfb_enc.c
+++ b/thirdparty/openssl/crypto/des/cfb_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/des-lib.com b/thirdparty/openssl/crypto/des/des-lib.com
index 348f1c047..348f1c047 100644
--- a/drivers/builtin_openssl2/crypto/des/des-lib.com
+++ b/thirdparty/openssl/crypto/des/des-lib.com
diff --git a/drivers/builtin_openssl2/crypto/des/des.c b/thirdparty/openssl/crypto/des/des.c
index 586aed723..586aed723 100644
--- a/drivers/builtin_openssl2/crypto/des/des.c
+++ b/thirdparty/openssl/crypto/des/des.c
diff --git a/drivers/builtin_openssl2/crypto/des/des3s.cpp b/thirdparty/openssl/crypto/des/des3s.cpp
index 02d527c05..02d527c05 100644
--- a/drivers/builtin_openssl2/crypto/des/des3s.cpp
+++ b/thirdparty/openssl/crypto/des/des3s.cpp
diff --git a/drivers/builtin_openssl2/crypto/des/des_enc.c b/thirdparty/openssl/crypto/des/des_enc.c
index c0b062da3..c0b062da3 100644
--- a/drivers/builtin_openssl2/crypto/des/des_enc.c
+++ b/thirdparty/openssl/crypto/des/des_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/des_locl.h b/thirdparty/openssl/crypto/des/des_locl.h
index 23ea9d32a..23ea9d32a 100644
--- a/drivers/builtin_openssl2/crypto/des/des_locl.h
+++ b/thirdparty/openssl/crypto/des/des_locl.h
diff --git a/drivers/builtin_openssl2/crypto/des/des_old.c b/thirdparty/openssl/crypto/des/des_old.c
index c5c5a00f0..c5c5a00f0 100644
--- a/drivers/builtin_openssl2/crypto/des/des_old.c
+++ b/thirdparty/openssl/crypto/des/des_old.c
diff --git a/drivers/builtin_openssl2/crypto/des/des_old2.c b/thirdparty/openssl/crypto/des/des_old2.c
index 247ff8dcf..247ff8dcf 100644
--- a/drivers/builtin_openssl2/crypto/des/des_old2.c
+++ b/thirdparty/openssl/crypto/des/des_old2.c
diff --git a/drivers/builtin_openssl2/crypto/des/des_opts.c b/thirdparty/openssl/crypto/des/des_opts.c
index ec50e94f5..ec50e94f5 100644
--- a/drivers/builtin_openssl2/crypto/des/des_opts.c
+++ b/thirdparty/openssl/crypto/des/des_opts.c
diff --git a/drivers/builtin_openssl2/crypto/des/des_ver.h b/thirdparty/openssl/crypto/des/des_ver.h
index 276de2b61..276de2b61 100644
--- a/drivers/builtin_openssl2/crypto/des/des_ver.h
+++ b/thirdparty/openssl/crypto/des/des_ver.h
diff --git a/drivers/builtin_openssl2/crypto/des/dess.cpp b/thirdparty/openssl/crypto/des/dess.cpp
index 5549bab90..5549bab90 100644
--- a/drivers/builtin_openssl2/crypto/des/dess.cpp
+++ b/thirdparty/openssl/crypto/des/dess.cpp
diff --git a/drivers/builtin_openssl2/crypto/des/ecb3_enc.c b/thirdparty/openssl/crypto/des/ecb3_enc.c
index c49fbd41e..c49fbd41e 100644
--- a/drivers/builtin_openssl2/crypto/des/ecb3_enc.c
+++ b/thirdparty/openssl/crypto/des/ecb3_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/ecb_enc.c b/thirdparty/openssl/crypto/des/ecb_enc.c
index f97fd971d..f97fd971d 100644
--- a/drivers/builtin_openssl2/crypto/des/ecb_enc.c
+++ b/thirdparty/openssl/crypto/des/ecb_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/ede_cbcm_enc.c b/thirdparty/openssl/crypto/des/ede_cbcm_enc.c
index 86f27d077..86f27d077 100644
--- a/drivers/builtin_openssl2/crypto/des/ede_cbcm_enc.c
+++ b/thirdparty/openssl/crypto/des/ede_cbcm_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/enc_read.c b/thirdparty/openssl/crypto/des/enc_read.c
index fcb66541b..fcb66541b 100644
--- a/drivers/builtin_openssl2/crypto/des/enc_read.c
+++ b/thirdparty/openssl/crypto/des/enc_read.c
diff --git a/drivers/builtin_openssl2/crypto/des/enc_writ.c b/thirdparty/openssl/crypto/des/enc_writ.c
index bfaabde51..bfaabde51 100644
--- a/drivers/builtin_openssl2/crypto/des/enc_writ.c
+++ b/thirdparty/openssl/crypto/des/enc_writ.c
diff --git a/drivers/builtin_openssl2/crypto/des/fcrypt.c b/thirdparty/openssl/crypto/des/fcrypt.c
index 111f1e461..111f1e461 100644
--- a/drivers/builtin_openssl2/crypto/des/fcrypt.c
+++ b/thirdparty/openssl/crypto/des/fcrypt.c
diff --git a/drivers/builtin_openssl2/crypto/des/fcrypt_b.c b/thirdparty/openssl/crypto/des/fcrypt_b.c
index b9e87383d..b9e87383d 100644
--- a/drivers/builtin_openssl2/crypto/des/fcrypt_b.c
+++ b/thirdparty/openssl/crypto/des/fcrypt_b.c
diff --git a/drivers/builtin_openssl2/crypto/des/makefile.bc b/thirdparty/openssl/crypto/des/makefile.bc
index 1fe6d4915..1fe6d4915 100644
--- a/drivers/builtin_openssl2/crypto/des/makefile.bc
+++ b/thirdparty/openssl/crypto/des/makefile.bc
diff --git a/drivers/builtin_openssl2/crypto/des/ncbc_enc.c b/thirdparty/openssl/crypto/des/ncbc_enc.c
index ab267cbf3..ab267cbf3 100644
--- a/drivers/builtin_openssl2/crypto/des/ncbc_enc.c
+++ b/thirdparty/openssl/crypto/des/ncbc_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/ofb64ede.c b/thirdparty/openssl/crypto/des/ofb64ede.c
index 45c67505a..45c67505a 100644
--- a/drivers/builtin_openssl2/crypto/des/ofb64ede.c
+++ b/thirdparty/openssl/crypto/des/ofb64ede.c
diff --git a/drivers/builtin_openssl2/crypto/des/ofb64enc.c b/thirdparty/openssl/crypto/des/ofb64enc.c
index 8e72dece5..8e72dece5 100644
--- a/drivers/builtin_openssl2/crypto/des/ofb64enc.c
+++ b/thirdparty/openssl/crypto/des/ofb64enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/ofb_enc.c b/thirdparty/openssl/crypto/des/ofb_enc.c
index 02a787752..02a787752 100644
--- a/drivers/builtin_openssl2/crypto/des/ofb_enc.c
+++ b/thirdparty/openssl/crypto/des/ofb_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/options.txt b/thirdparty/openssl/crypto/des/options.txt
index 6e2b50f76..6e2b50f76 100644
--- a/drivers/builtin_openssl2/crypto/des/options.txt
+++ b/thirdparty/openssl/crypto/des/options.txt
diff --git a/drivers/builtin_openssl2/crypto/des/pcbc_enc.c b/thirdparty/openssl/crypto/des/pcbc_enc.c
index 144d5ed88..144d5ed88 100644
--- a/drivers/builtin_openssl2/crypto/des/pcbc_enc.c
+++ b/thirdparty/openssl/crypto/des/pcbc_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/qud_cksm.c b/thirdparty/openssl/crypto/des/qud_cksm.c
index 2a168a576..2a168a576 100644
--- a/drivers/builtin_openssl2/crypto/des/qud_cksm.c
+++ b/thirdparty/openssl/crypto/des/qud_cksm.c
diff --git a/drivers/builtin_openssl2/crypto/des/rand_key.c b/thirdparty/openssl/crypto/des/rand_key.c
index b75cc5f9b..b75cc5f9b 100644
--- a/drivers/builtin_openssl2/crypto/des/rand_key.c
+++ b/thirdparty/openssl/crypto/des/rand_key.c
diff --git a/drivers/builtin_openssl2/crypto/des/read2pwd.c b/thirdparty/openssl/crypto/des/read2pwd.c
index 01e275f33..01e275f33 100644
--- a/drivers/builtin_openssl2/crypto/des/read2pwd.c
+++ b/thirdparty/openssl/crypto/des/read2pwd.c
diff --git a/drivers/builtin_openssl2/crypto/des/read_pwd.c b/thirdparty/openssl/crypto/des/read_pwd.c
index 514a7063b..514a7063b 100644
--- a/drivers/builtin_openssl2/crypto/des/read_pwd.c
+++ b/thirdparty/openssl/crypto/des/read_pwd.c
diff --git a/drivers/builtin_openssl2/crypto/des/rpc_des.h b/thirdparty/openssl/crypto/des/rpc_des.h
index 4db9062d9..4db9062d9 100644
--- a/drivers/builtin_openssl2/crypto/des/rpc_des.h
+++ b/thirdparty/openssl/crypto/des/rpc_des.h
diff --git a/drivers/builtin_openssl2/crypto/des/rpc_enc.c b/thirdparty/openssl/crypto/des/rpc_enc.c
index f5a84c5b0..f5a84c5b0 100644
--- a/drivers/builtin_openssl2/crypto/des/rpc_enc.c
+++ b/thirdparty/openssl/crypto/des/rpc_enc.c
diff --git a/drivers/builtin_openssl2/crypto/des/rpw.c b/thirdparty/openssl/crypto/des/rpw.c
index ab65eacae..ab65eacae 100644
--- a/drivers/builtin_openssl2/crypto/des/rpw.c
+++ b/thirdparty/openssl/crypto/des/rpw.c
diff --git a/drivers/builtin_openssl2/crypto/des/set_key.c b/thirdparty/openssl/crypto/des/set_key.c
index 8fd8fe14b..8fd8fe14b 100644
--- a/drivers/builtin_openssl2/crypto/des/set_key.c
+++ b/thirdparty/openssl/crypto/des/set_key.c
diff --git a/drivers/builtin_openssl2/crypto/des/speed.c b/thirdparty/openssl/crypto/des/speed.c
index 9a3d929d2..9a3d929d2 100644
--- a/drivers/builtin_openssl2/crypto/des/speed.c
+++ b/thirdparty/openssl/crypto/des/speed.c
diff --git a/drivers/builtin_openssl2/crypto/des/spr.h b/thirdparty/openssl/crypto/des/spr.h
index e85d31005..e85d31005 100644
--- a/drivers/builtin_openssl2/crypto/des/spr.h
+++ b/thirdparty/openssl/crypto/des/spr.h
diff --git a/drivers/builtin_openssl2/crypto/des/str2key.c b/thirdparty/openssl/crypto/des/str2key.c
index 38a478cf4..38a478cf4 100644
--- a/drivers/builtin_openssl2/crypto/des/str2key.c
+++ b/thirdparty/openssl/crypto/des/str2key.c
diff --git a/drivers/builtin_openssl2/crypto/des/t/test b/thirdparty/openssl/crypto/des/t/test
index 97acd0552..97acd0552 100644
--- a/drivers/builtin_openssl2/crypto/des/t/test
+++ b/thirdparty/openssl/crypto/des/t/test
diff --git a/drivers/builtin_openssl2/crypto/des/times/486-50.sol b/thirdparty/openssl/crypto/des/times/486-50.sol
index 0de62d6db..0de62d6db 100644
--- a/drivers/builtin_openssl2/crypto/des/times/486-50.sol
+++ b/thirdparty/openssl/crypto/des/times/486-50.sol
diff --git a/drivers/builtin_openssl2/crypto/des/times/586-100.lnx b/thirdparty/openssl/crypto/des/times/586-100.lnx
index 4323914a1..4323914a1 100644
--- a/drivers/builtin_openssl2/crypto/des/times/586-100.lnx
+++ b/thirdparty/openssl/crypto/des/times/586-100.lnx
diff --git a/drivers/builtin_openssl2/crypto/des/times/686-200.fre b/thirdparty/openssl/crypto/des/times/686-200.fre
index 7d83f6ade..7d83f6ade 100644
--- a/drivers/builtin_openssl2/crypto/des/times/686-200.fre
+++ b/thirdparty/openssl/crypto/des/times/686-200.fre
diff --git a/drivers/builtin_openssl2/crypto/des/times/aix.cc b/thirdparty/openssl/crypto/des/times/aix.cc
index d96b74e2c..d96b74e2c 100644
--- a/drivers/builtin_openssl2/crypto/des/times/aix.cc
+++ b/thirdparty/openssl/crypto/des/times/aix.cc
diff --git a/drivers/builtin_openssl2/crypto/des/times/alpha.cc b/thirdparty/openssl/crypto/des/times/alpha.cc
index 95c17efae..95c17efae 100644
--- a/drivers/builtin_openssl2/crypto/des/times/alpha.cc
+++ b/thirdparty/openssl/crypto/des/times/alpha.cc
diff --git a/drivers/builtin_openssl2/crypto/des/times/hpux.cc b/thirdparty/openssl/crypto/des/times/hpux.cc
index 3de856dda..3de856dda 100644
--- a/drivers/builtin_openssl2/crypto/des/times/hpux.cc
+++ b/thirdparty/openssl/crypto/des/times/hpux.cc
diff --git a/drivers/builtin_openssl2/crypto/des/times/sparc.gcc b/thirdparty/openssl/crypto/des/times/sparc.gcc
index 8eaa04210..8eaa04210 100644
--- a/drivers/builtin_openssl2/crypto/des/times/sparc.gcc
+++ b/thirdparty/openssl/crypto/des/times/sparc.gcc
diff --git a/drivers/builtin_openssl2/crypto/des/times/usparc.cc b/thirdparty/openssl/crypto/des/times/usparc.cc
index 0864285ef..0864285ef 100644
--- a/drivers/builtin_openssl2/crypto/des/times/usparc.cc
+++ b/thirdparty/openssl/crypto/des/times/usparc.cc
diff --git a/drivers/builtin_openssl2/crypto/des/typemap b/thirdparty/openssl/crypto/des/typemap
index a524f5363..a524f5363 100644
--- a/drivers/builtin_openssl2/crypto/des/typemap
+++ b/thirdparty/openssl/crypto/des/typemap
diff --git a/drivers/builtin_openssl2/crypto/des/xcbc_enc.c b/thirdparty/openssl/crypto/des/xcbc_enc.c
index 6fe021be7..6fe021be7 100644
--- a/drivers/builtin_openssl2/crypto/des/xcbc_enc.c
+++ b/thirdparty/openssl/crypto/des/xcbc_enc.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh1024.pem b/thirdparty/openssl/crypto/dh/dh1024.pem
index 81d43f6a3..81d43f6a3 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh1024.pem
+++ b/thirdparty/openssl/crypto/dh/dh1024.pem
diff --git a/drivers/builtin_openssl2/crypto/dh/dh192.pem b/thirdparty/openssl/crypto/dh/dh192.pem
index 521c07271..521c07271 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh192.pem
+++ b/thirdparty/openssl/crypto/dh/dh192.pem
diff --git a/drivers/builtin_openssl2/crypto/dh/dh2048.pem b/thirdparty/openssl/crypto/dh/dh2048.pem
index 295460f50..295460f50 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh2048.pem
+++ b/thirdparty/openssl/crypto/dh/dh2048.pem
diff --git a/drivers/builtin_openssl2/crypto/dh/dh4096.pem b/thirdparty/openssl/crypto/dh/dh4096.pem
index 390943a21..390943a21 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh4096.pem
+++ b/thirdparty/openssl/crypto/dh/dh4096.pem
diff --git a/drivers/builtin_openssl2/crypto/dh/dh512.pem b/thirdparty/openssl/crypto/dh/dh512.pem
index 0a4d863eb..0a4d863eb 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh512.pem
+++ b/thirdparty/openssl/crypto/dh/dh512.pem
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_ameth.c b/thirdparty/openssl/crypto/dh/dh_ameth.c
index ac72468bd..ac72468bd 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_ameth.c
+++ b/thirdparty/openssl/crypto/dh/dh_ameth.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_asn1.c b/thirdparty/openssl/crypto/dh/dh_asn1.c
index f47021439..f47021439 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_asn1.c
+++ b/thirdparty/openssl/crypto/dh/dh_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_check.c b/thirdparty/openssl/crypto/dh/dh_check.c
index 027704111..027704111 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_check.c
+++ b/thirdparty/openssl/crypto/dh/dh_check.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_depr.c b/thirdparty/openssl/crypto/dh/dh_depr.c
index b62211993..b62211993 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_depr.c
+++ b/thirdparty/openssl/crypto/dh/dh_depr.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_err.c b/thirdparty/openssl/crypto/dh/dh_err.c
index b890cca81..b890cca81 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_err.c
+++ b/thirdparty/openssl/crypto/dh/dh_err.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_gen.c b/thirdparty/openssl/crypto/dh/dh_gen.c
index 5bedb665f..5bedb665f 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_gen.c
+++ b/thirdparty/openssl/crypto/dh/dh_gen.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_kdf.c b/thirdparty/openssl/crypto/dh/dh_kdf.c
index a882cb286..a882cb286 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_kdf.c
+++ b/thirdparty/openssl/crypto/dh/dh_kdf.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_key.c b/thirdparty/openssl/crypto/dh/dh_key.c
index 1d80fb2c5..1d80fb2c5 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_key.c
+++ b/thirdparty/openssl/crypto/dh/dh_key.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_lib.c b/thirdparty/openssl/crypto/dh/dh_lib.c
index bebc160ed..bebc160ed 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_lib.c
+++ b/thirdparty/openssl/crypto/dh/dh_lib.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_pmeth.c b/thirdparty/openssl/crypto/dh/dh_pmeth.c
index b58e3fa86..b58e3fa86 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_pmeth.c
+++ b/thirdparty/openssl/crypto/dh/dh_pmeth.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_prn.c b/thirdparty/openssl/crypto/dh/dh_prn.c
index 5d6c3a37e..5d6c3a37e 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_prn.c
+++ b/thirdparty/openssl/crypto/dh/dh_prn.c
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_rfc5114.c b/thirdparty/openssl/crypto/dh/dh_rfc5114.c
index e96e2aa3f..e96e2aa3f 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_rfc5114.c
+++ b/thirdparty/openssl/crypto/dh/dh_rfc5114.c
diff --git a/drivers/builtin_openssl2/crypto/dh/example b/thirdparty/openssl/crypto/dh/example
index 16a33d291..16a33d291 100644
--- a/drivers/builtin_openssl2/crypto/dh/example
+++ b/thirdparty/openssl/crypto/dh/example
diff --git a/drivers/builtin_openssl2/crypto/dh/generate b/thirdparty/openssl/crypto/dh/generate
index 5d407231d..5d407231d 100644
--- a/drivers/builtin_openssl2/crypto/dh/generate
+++ b/thirdparty/openssl/crypto/dh/generate
diff --git a/drivers/builtin_openssl2/crypto/dh/p1024.c b/thirdparty/openssl/crypto/dh/p1024.c
index a4b014b6a..a4b014b6a 100644
--- a/drivers/builtin_openssl2/crypto/dh/p1024.c
+++ b/thirdparty/openssl/crypto/dh/p1024.c
diff --git a/drivers/builtin_openssl2/crypto/dh/p192.c b/thirdparty/openssl/crypto/dh/p192.c
index 9f49f7683..9f49f7683 100644
--- a/drivers/builtin_openssl2/crypto/dh/p192.c
+++ b/thirdparty/openssl/crypto/dh/p192.c
diff --git a/drivers/builtin_openssl2/crypto/dh/p512.c b/thirdparty/openssl/crypto/dh/p512.c
index 606fa4d6c..606fa4d6c 100644
--- a/drivers/builtin_openssl2/crypto/dh/p512.c
+++ b/thirdparty/openssl/crypto/dh/p512.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/README b/thirdparty/openssl/crypto/dsa/README
index 6a7e9c170..6a7e9c170 100644
--- a/drivers/builtin_openssl2/crypto/dsa/README
+++ b/thirdparty/openssl/crypto/dsa/README
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_ameth.c b/thirdparty/openssl/crypto/dsa/dsa_ameth.c
index cc83d6e6a..cc83d6e6a 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_ameth.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_ameth.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_asn1.c b/thirdparty/openssl/crypto/dsa/dsa_asn1.c
index 3283a2295..3283a2295 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_asn1.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_depr.c b/thirdparty/openssl/crypto/dsa/dsa_depr.c
index 54f88bc44..54f88bc44 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_depr.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_depr.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_err.c b/thirdparty/openssl/crypto/dsa/dsa_err.c
index f5ddc66b8..f5ddc66b8 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_err.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_err.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_gen.c b/thirdparty/openssl/crypto/dsa/dsa_gen.c
index 15f3bb4f3..15f3bb4f3 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_gen.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_gen.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_key.c b/thirdparty/openssl/crypto/dsa/dsa_key.c
index e8c8d2e6a..e8c8d2e6a 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_key.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_key.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_lib.c b/thirdparty/openssl/crypto/dsa/dsa_lib.c
index eb9d21d9a..eb9d21d9a 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_lib.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_lib.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_locl.h b/thirdparty/openssl/crypto/dsa/dsa_locl.h
index 9c23c3ef9..9c23c3ef9 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_locl.h
+++ b/thirdparty/openssl/crypto/dsa/dsa_locl.h
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_ossl.c b/thirdparty/openssl/crypto/dsa/dsa_ossl.c
index efc4f1b6a..efc4f1b6a 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_ossl.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_ossl.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_pmeth.c b/thirdparty/openssl/crypto/dsa/dsa_pmeth.c
index 42b8bb086..42b8bb086 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_pmeth.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_pmeth.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_prn.c b/thirdparty/openssl/crypto/dsa/dsa_prn.c
index ce690dfcf..ce690dfcf 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_prn.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_prn.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_sign.c b/thirdparty/openssl/crypto/dsa/dsa_sign.c
index c2b71d856..c2b71d856 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_sign.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_sign.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsa_vrf.c b/thirdparty/openssl/crypto/dsa/dsa_vrf.c
index 7dbd0ca27..7dbd0ca27 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsa_vrf.c
+++ b/thirdparty/openssl/crypto/dsa/dsa_vrf.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/dsagen.c b/thirdparty/openssl/crypto/dsa/dsagen.c
index e7d346b1e..e7d346b1e 100644
--- a/drivers/builtin_openssl2/crypto/dsa/dsagen.c
+++ b/thirdparty/openssl/crypto/dsa/dsagen.c
diff --git a/drivers/builtin_openssl2/crypto/dsa/fips186a.txt b/thirdparty/openssl/crypto/dsa/fips186a.txt
index 3a2e0a0d5..3a2e0a0d5 100644
--- a/drivers/builtin_openssl2/crypto/dsa/fips186a.txt
+++ b/thirdparty/openssl/crypto/dsa/fips186a.txt
diff --git a/drivers/builtin_openssl2/crypto/dso/README b/thirdparty/openssl/crypto/dso/README
index d0bc9a89f..d0bc9a89f 100644
--- a/drivers/builtin_openssl2/crypto/dso/README
+++ b/thirdparty/openssl/crypto/dso/README
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_beos.c b/thirdparty/openssl/crypto/dso/dso_beos.c
index 68ebcd8a2..68ebcd8a2 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_beos.c
+++ b/thirdparty/openssl/crypto/dso/dso_beos.c
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_dl.c b/thirdparty/openssl/crypto/dso/dso_dl.c
index ceedf66e8..ceedf66e8 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_dl.c
+++ b/thirdparty/openssl/crypto/dso/dso_dl.c
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_dlfcn.c b/thirdparty/openssl/crypto/dso/dso_dlfcn.c
index 78df723ff..78df723ff 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_dlfcn.c
+++ b/thirdparty/openssl/crypto/dso/dso_dlfcn.c
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_err.c b/thirdparty/openssl/crypto/dso/dso_err.c
index e143cc01f..e143cc01f 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_err.c
+++ b/thirdparty/openssl/crypto/dso/dso_err.c
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_lib.c b/thirdparty/openssl/crypto/dso/dso_lib.c
index 2beb7c1ba..2beb7c1ba 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_lib.c
+++ b/thirdparty/openssl/crypto/dso/dso_lib.c
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_null.c b/thirdparty/openssl/crypto/dso/dso_null.c
index 20122d1ca..20122d1ca 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_null.c
+++ b/thirdparty/openssl/crypto/dso/dso_null.c
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_openssl.c b/thirdparty/openssl/crypto/dso/dso_openssl.c
index 087e989e1..087e989e1 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_openssl.c
+++ b/thirdparty/openssl/crypto/dso/dso_openssl.c
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_vms.c b/thirdparty/openssl/crypto/dso/dso_vms.c
index 1efd84b94..1efd84b94 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_vms.c
+++ b/thirdparty/openssl/crypto/dso/dso_vms.c
diff --git a/drivers/builtin_openssl2/crypto/dso/dso_win32.c b/thirdparty/openssl/crypto/dso/dso_win32.c
index 706e754a3..706e754a3 100644
--- a/drivers/builtin_openssl2/crypto/dso/dso_win32.c
+++ b/thirdparty/openssl/crypto/dso/dso_win32.c
diff --git a/drivers/builtin_openssl2/crypto/ebcdic.c b/thirdparty/openssl/crypto/ebcdic.c
index fd6df92b4..fd6df92b4 100644
--- a/drivers/builtin_openssl2/crypto/ebcdic.c
+++ b/thirdparty/openssl/crypto/ebcdic.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec2_mult.c b/thirdparty/openssl/crypto/ec/ec2_mult.c
index 68cc8771d..68cc8771d 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec2_mult.c
+++ b/thirdparty/openssl/crypto/ec/ec2_mult.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec2_oct.c b/thirdparty/openssl/crypto/ec/ec2_oct.c
index 0d04cc692..0d04cc692 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec2_oct.c
+++ b/thirdparty/openssl/crypto/ec/ec2_oct.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec2_smpl.c b/thirdparty/openssl/crypto/ec/ec2_smpl.c
index 5b27b91fc..5b27b91fc 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec2_smpl.c
+++ b/thirdparty/openssl/crypto/ec/ec2_smpl.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_ameth.c b/thirdparty/openssl/crypto/ec/ec_ameth.c
index 83e208cfe..83e208cfe 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_ameth.c
+++ b/thirdparty/openssl/crypto/ec/ec_ameth.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_asn1.c b/thirdparty/openssl/crypto/ec/ec_asn1.c
index 33abf61f4..33abf61f4 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_asn1.c
+++ b/thirdparty/openssl/crypto/ec/ec_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_check.c b/thirdparty/openssl/crypto/ec/ec_check.c
index dd6f0ac40..dd6f0ac40 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_check.c
+++ b/thirdparty/openssl/crypto/ec/ec_check.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_curve.c b/thirdparty/openssl/crypto/ec/ec_curve.c
index 6dbe9d825..6dbe9d825 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_curve.c
+++ b/thirdparty/openssl/crypto/ec/ec_curve.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_cvt.c b/thirdparty/openssl/crypto/ec/ec_cvt.c
index 5a832ba1c..5a832ba1c 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_cvt.c
+++ b/thirdparty/openssl/crypto/ec/ec_cvt.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_err.c b/thirdparty/openssl/crypto/ec/ec_err.c
index 6fe5baafd..6fe5baafd 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_err.c
+++ b/thirdparty/openssl/crypto/ec/ec_err.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_key.c b/thirdparty/openssl/crypto/ec/ec_key.c
index bc94ab566..bc94ab566 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_key.c
+++ b/thirdparty/openssl/crypto/ec/ec_key.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_lcl.h b/thirdparty/openssl/crypto/ec/ec_lcl.h
index 969fd147e..969fd147e 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_lcl.h
+++ b/thirdparty/openssl/crypto/ec/ec_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_lib.c b/thirdparty/openssl/crypto/ec/ec_lib.c
index 3ffa112cc..3ffa112cc 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_lib.c
+++ b/thirdparty/openssl/crypto/ec/ec_lib.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_mult.c b/thirdparty/openssl/crypto/ec/ec_mult.c
index 23b8c3089..23b8c3089 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_mult.c
+++ b/thirdparty/openssl/crypto/ec/ec_mult.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_oct.c b/thirdparty/openssl/crypto/ec/ec_oct.c
index 040c414a3..040c414a3 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_oct.c
+++ b/thirdparty/openssl/crypto/ec/ec_oct.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_pmeth.c b/thirdparty/openssl/crypto/ec/ec_pmeth.c
index b76749010..b76749010 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_pmeth.c
+++ b/thirdparty/openssl/crypto/ec/ec_pmeth.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ec_print.c b/thirdparty/openssl/crypto/ec/ec_print.c
index 96b294d87..96b294d87 100644
--- a/drivers/builtin_openssl2/crypto/ec/ec_print.c
+++ b/thirdparty/openssl/crypto/ec/ec_print.c
diff --git a/drivers/builtin_openssl2/crypto/ec/eck_prn.c b/thirdparty/openssl/crypto/ec/eck_prn.c
index df9b37a75..df9b37a75 100644
--- a/drivers/builtin_openssl2/crypto/ec/eck_prn.c
+++ b/thirdparty/openssl/crypto/ec/eck_prn.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_mont.c b/thirdparty/openssl/crypto/ec/ecp_mont.c
index b2de7faea..b2de7faea 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_mont.c
+++ b/thirdparty/openssl/crypto/ec/ecp_mont.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_nist.c b/thirdparty/openssl/crypto/ec/ecp_nist.c
index 3944e2493..3944e2493 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_nist.c
+++ b/thirdparty/openssl/crypto/ec/ecp_nist.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_nistp224.c b/thirdparty/openssl/crypto/ec/ecp_nistp224.c
index d81cc9ce6..d81cc9ce6 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_nistp224.c
+++ b/thirdparty/openssl/crypto/ec/ecp_nistp224.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_nistp256.c b/thirdparty/openssl/crypto/ec/ecp_nistp256.c
index 78d191aac..78d191aac 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_nistp256.c
+++ b/thirdparty/openssl/crypto/ec/ecp_nistp256.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_nistp521.c b/thirdparty/openssl/crypto/ec/ecp_nistp521.c
index c53a61bbf..c53a61bbf 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_nistp521.c
+++ b/thirdparty/openssl/crypto/ec/ecp_nistp521.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_nistputil.c b/thirdparty/openssl/crypto/ec/ecp_nistputil.c
index 8ba2a25e9..8ba2a25e9 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_nistputil.c
+++ b/thirdparty/openssl/crypto/ec/ecp_nistputil.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_nistz256.c b/thirdparty/openssl/crypto/ec/ecp_nistz256.c
index ca44d0aae..ca44d0aae 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_nistz256.c
+++ b/thirdparty/openssl/crypto/ec/ecp_nistz256.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_nistz256_table.c b/thirdparty/openssl/crypto/ec/ecp_nistz256_table.c
index 2f0797db6..2f0797db6 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_nistz256_table.c
+++ b/thirdparty/openssl/crypto/ec/ecp_nistz256_table.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_oct.c b/thirdparty/openssl/crypto/ec/ecp_oct.c
index 1bc3f39ad..1bc3f39ad 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_oct.c
+++ b/thirdparty/openssl/crypto/ec/ecp_oct.c
diff --git a/drivers/builtin_openssl2/crypto/ec/ecp_smpl.c b/thirdparty/openssl/crypto/ec/ecp_smpl.c
index 2b848216d..2b848216d 100644
--- a/drivers/builtin_openssl2/crypto/ec/ecp_smpl.c
+++ b/thirdparty/openssl/crypto/ec/ecp_smpl.c
diff --git a/drivers/builtin_openssl2/crypto/ecdh/ech_err.c b/thirdparty/openssl/crypto/ecdh/ech_err.c
index af9f625b4..af9f625b4 100644
--- a/drivers/builtin_openssl2/crypto/ecdh/ech_err.c
+++ b/thirdparty/openssl/crypto/ecdh/ech_err.c
diff --git a/drivers/builtin_openssl2/crypto/ecdh/ech_kdf.c b/thirdparty/openssl/crypto/ecdh/ech_kdf.c
index ac722ac9e..ac722ac9e 100644
--- a/drivers/builtin_openssl2/crypto/ecdh/ech_kdf.c
+++ b/thirdparty/openssl/crypto/ecdh/ech_kdf.c
diff --git a/drivers/builtin_openssl2/crypto/ecdh/ech_key.c b/thirdparty/openssl/crypto/ecdh/ech_key.c
index 4f1449896..4f1449896 100644
--- a/drivers/builtin_openssl2/crypto/ecdh/ech_key.c
+++ b/thirdparty/openssl/crypto/ecdh/ech_key.c
diff --git a/drivers/builtin_openssl2/crypto/ecdh/ech_lib.c b/thirdparty/openssl/crypto/ecdh/ech_lib.c
index cbc21d1a2..cbc21d1a2 100644
--- a/drivers/builtin_openssl2/crypto/ecdh/ech_lib.c
+++ b/thirdparty/openssl/crypto/ecdh/ech_lib.c
diff --git a/drivers/builtin_openssl2/crypto/ecdh/ech_locl.h b/thirdparty/openssl/crypto/ecdh/ech_locl.h
index 4e66024c7..4e66024c7 100644
--- a/drivers/builtin_openssl2/crypto/ecdh/ech_locl.h
+++ b/thirdparty/openssl/crypto/ecdh/ech_locl.h
diff --git a/drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c b/thirdparty/openssl/crypto/ecdh/ech_ossl.c
index df115cc26..df115cc26 100644
--- a/drivers/builtin_openssl2/crypto/ecdh/ech_ossl.c
+++ b/thirdparty/openssl/crypto/ecdh/ech_ossl.c
diff --git a/drivers/builtin_openssl2/crypto/ecdsa/ecs_asn1.c b/thirdparty/openssl/crypto/ecdsa/ecs_asn1.c
index 508b079f2..508b079f2 100644
--- a/drivers/builtin_openssl2/crypto/ecdsa/ecs_asn1.c
+++ b/thirdparty/openssl/crypto/ecdsa/ecs_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/ecdsa/ecs_err.c b/thirdparty/openssl/crypto/ecdsa/ecs_err.c
index f1fa7b55f..f1fa7b55f 100644
--- a/drivers/builtin_openssl2/crypto/ecdsa/ecs_err.c
+++ b/thirdparty/openssl/crypto/ecdsa/ecs_err.c
diff --git a/drivers/builtin_openssl2/crypto/ecdsa/ecs_lib.c b/thirdparty/openssl/crypto/ecdsa/ecs_lib.c
index 8dc1dda46..8dc1dda46 100644
--- a/drivers/builtin_openssl2/crypto/ecdsa/ecs_lib.c
+++ b/thirdparty/openssl/crypto/ecdsa/ecs_lib.c
diff --git a/drivers/builtin_openssl2/crypto/ecdsa/ecs_locl.h b/thirdparty/openssl/crypto/ecdsa/ecs_locl.h
index d3a5efc54..d3a5efc54 100644
--- a/drivers/builtin_openssl2/crypto/ecdsa/ecs_locl.h
+++ b/thirdparty/openssl/crypto/ecdsa/ecs_locl.h
diff --git a/drivers/builtin_openssl2/crypto/ecdsa/ecs_ossl.c b/thirdparty/openssl/crypto/ecdsa/ecs_ossl.c
index dd769609b..dd769609b 100644
--- a/drivers/builtin_openssl2/crypto/ecdsa/ecs_ossl.c
+++ b/thirdparty/openssl/crypto/ecdsa/ecs_ossl.c
diff --git a/drivers/builtin_openssl2/crypto/ecdsa/ecs_sign.c b/thirdparty/openssl/crypto/ecdsa/ecs_sign.c
index 28652d455..28652d455 100644
--- a/drivers/builtin_openssl2/crypto/ecdsa/ecs_sign.c
+++ b/thirdparty/openssl/crypto/ecdsa/ecs_sign.c
diff --git a/drivers/builtin_openssl2/crypto/ecdsa/ecs_vrf.c b/thirdparty/openssl/crypto/ecdsa/ecs_vrf.c
index e909aeb40..e909aeb40 100644
--- a/drivers/builtin_openssl2/crypto/ecdsa/ecs_vrf.c
+++ b/thirdparty/openssl/crypto/ecdsa/ecs_vrf.c
diff --git a/drivers/builtin_openssl2/crypto/engine/README b/thirdparty/openssl/crypto/engine/README
index 6b69b70f5..6b69b70f5 100644
--- a/drivers/builtin_openssl2/crypto/engine/README
+++ b/thirdparty/openssl/crypto/engine/README
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_all.c b/thirdparty/openssl/crypto/engine/eng_all.c
index 48ad0d26b..48ad0d26b 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_all.c
+++ b/thirdparty/openssl/crypto/engine/eng_all.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_cnf.c b/thirdparty/openssl/crypto/engine/eng_cnf.c
index f09bec4e9..f09bec4e9 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_cnf.c
+++ b/thirdparty/openssl/crypto/engine/eng_cnf.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_cryptodev.c b/thirdparty/openssl/crypto/engine/eng_cryptodev.c
index 8fb9c3373..8fb9c3373 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_cryptodev.c
+++ b/thirdparty/openssl/crypto/engine/eng_cryptodev.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_ctrl.c b/thirdparty/openssl/crypto/engine/eng_ctrl.c
index e6c0dfb01..e6c0dfb01 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_ctrl.c
+++ b/thirdparty/openssl/crypto/engine/eng_ctrl.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_dyn.c b/thirdparty/openssl/crypto/engine/eng_dyn.c
index 40f30e9d5..40f30e9d5 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_dyn.c
+++ b/thirdparty/openssl/crypto/engine/eng_dyn.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_err.c b/thirdparty/openssl/crypto/engine/eng_err.c
index bcc234852..bcc234852 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_err.c
+++ b/thirdparty/openssl/crypto/engine/eng_err.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_fat.c b/thirdparty/openssl/crypto/engine/eng_fat.c
index 4279dd94b..4279dd94b 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_fat.c
+++ b/thirdparty/openssl/crypto/engine/eng_fat.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_init.c b/thirdparty/openssl/crypto/engine/eng_init.c
index 4ea7fe633..4ea7fe633 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_init.c
+++ b/thirdparty/openssl/crypto/engine/eng_init.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_int.h b/thirdparty/openssl/crypto/engine/eng_int.h
index 46f163b1f..46f163b1f 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_int.h
+++ b/thirdparty/openssl/crypto/engine/eng_int.h
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_lib.c b/thirdparty/openssl/crypto/engine/eng_lib.c
index dc2abd28e..dc2abd28e 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_lib.c
+++ b/thirdparty/openssl/crypto/engine/eng_lib.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_list.c b/thirdparty/openssl/crypto/engine/eng_list.c
index 83c95d56f..83c95d56f 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_list.c
+++ b/thirdparty/openssl/crypto/engine/eng_list.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_openssl.c b/thirdparty/openssl/crypto/engine/eng_openssl.c
index 34b002950..34b002950 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_openssl.c
+++ b/thirdparty/openssl/crypto/engine/eng_openssl.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_pkey.c b/thirdparty/openssl/crypto/engine/eng_pkey.c
index 23580d9ec..23580d9ec 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_pkey.c
+++ b/thirdparty/openssl/crypto/engine/eng_pkey.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_rdrand.c b/thirdparty/openssl/crypto/engine/eng_rdrand.c
index 9316d6fe2..9316d6fe2 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_rdrand.c
+++ b/thirdparty/openssl/crypto/engine/eng_rdrand.c
diff --git a/drivers/builtin_openssl2/crypto/engine/eng_table.c b/thirdparty/openssl/crypto/engine/eng_table.c
index 27d31f70c..27d31f70c 100644
--- a/drivers/builtin_openssl2/crypto/engine/eng_table.c
+++ b/thirdparty/openssl/crypto/engine/eng_table.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_asnmth.c b/thirdparty/openssl/crypto/engine/tb_asnmth.c
index a1a9b88c4..a1a9b88c4 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_asnmth.c
+++ b/thirdparty/openssl/crypto/engine/tb_asnmth.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_cipher.c b/thirdparty/openssl/crypto/engine/tb_cipher.c
index fcfb2efd8..fcfb2efd8 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_cipher.c
+++ b/thirdparty/openssl/crypto/engine/tb_cipher.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_dh.c b/thirdparty/openssl/crypto/engine/tb_dh.c
index 8114afa63..8114afa63 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_dh.c
+++ b/thirdparty/openssl/crypto/engine/tb_dh.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_digest.c b/thirdparty/openssl/crypto/engine/tb_digest.c
index de1ad9c01..de1ad9c01 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_digest.c
+++ b/thirdparty/openssl/crypto/engine/tb_digest.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_dsa.c b/thirdparty/openssl/crypto/engine/tb_dsa.c
index c1f57f146..c1f57f146 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_dsa.c
+++ b/thirdparty/openssl/crypto/engine/tb_dsa.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_ecdh.c b/thirdparty/openssl/crypto/engine/tb_ecdh.c
index c51441be8..c51441be8 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_ecdh.c
+++ b/thirdparty/openssl/crypto/engine/tb_ecdh.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_ecdsa.c b/thirdparty/openssl/crypto/engine/tb_ecdsa.c
index a8b9be60d..a8b9be60d 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_ecdsa.c
+++ b/thirdparty/openssl/crypto/engine/tb_ecdsa.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_pkmeth.c b/thirdparty/openssl/crypto/engine/tb_pkmeth.c
index 29e65be1a..29e65be1a 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_pkmeth.c
+++ b/thirdparty/openssl/crypto/engine/tb_pkmeth.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_rand.c b/thirdparty/openssl/crypto/engine/tb_rand.c
index a522264d0..a522264d0 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_rand.c
+++ b/thirdparty/openssl/crypto/engine/tb_rand.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_rsa.c b/thirdparty/openssl/crypto/engine/tb_rsa.c
index 2790a8219..2790a8219 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_rsa.c
+++ b/thirdparty/openssl/crypto/engine/tb_rsa.c
diff --git a/drivers/builtin_openssl2/crypto/engine/tb_store.c b/thirdparty/openssl/crypto/engine/tb_store.c
index 1eab49d74..1eab49d74 100644
--- a/drivers/builtin_openssl2/crypto/engine/tb_store.c
+++ b/thirdparty/openssl/crypto/engine/tb_store.c
diff --git a/drivers/builtin_openssl2/crypto/err/err.c b/thirdparty/openssl/crypto/err/err.c
index e77d963b6..e77d963b6 100644
--- a/drivers/builtin_openssl2/crypto/err/err.c
+++ b/thirdparty/openssl/crypto/err/err.c
diff --git a/drivers/builtin_openssl2/crypto/err/err_all.c b/thirdparty/openssl/crypto/err/err_all.c
index d7575a7ef..d7575a7ef 100644
--- a/drivers/builtin_openssl2/crypto/err/err_all.c
+++ b/thirdparty/openssl/crypto/err/err_all.c
diff --git a/drivers/builtin_openssl2/crypto/err/err_prn.c b/thirdparty/openssl/crypto/err/err_prn.c
index 6e352effe..6e352effe 100644
--- a/drivers/builtin_openssl2/crypto/err/err_prn.c
+++ b/thirdparty/openssl/crypto/err/err_prn.c
diff --git a/drivers/builtin_openssl2/crypto/err/openssl.ec b/thirdparty/openssl/crypto/err/openssl.ec
index 139afe323..139afe323 100644
--- a/drivers/builtin_openssl2/crypto/err/openssl.ec
+++ b/thirdparty/openssl/crypto/err/openssl.ec
diff --git a/drivers/builtin_openssl2/crypto/evp/bio_b64.c b/thirdparty/openssl/crypto/evp/bio_b64.c
index 538b52026..538b52026 100644
--- a/drivers/builtin_openssl2/crypto/evp/bio_b64.c
+++ b/thirdparty/openssl/crypto/evp/bio_b64.c
diff --git a/drivers/builtin_openssl2/crypto/evp/bio_enc.c b/thirdparty/openssl/crypto/evp/bio_enc.c
index 363e0246a..363e0246a 100644
--- a/drivers/builtin_openssl2/crypto/evp/bio_enc.c
+++ b/thirdparty/openssl/crypto/evp/bio_enc.c
diff --git a/drivers/builtin_openssl2/crypto/evp/bio_md.c b/thirdparty/openssl/crypto/evp/bio_md.c
index f0b0c0c0a..f0b0c0c0a 100644
--- a/drivers/builtin_openssl2/crypto/evp/bio_md.c
+++ b/thirdparty/openssl/crypto/evp/bio_md.c
diff --git a/drivers/builtin_openssl2/crypto/evp/bio_ok.c b/thirdparty/openssl/crypto/evp/bio_ok.c
index 5c32e35e1..5c32e35e1 100644
--- a/drivers/builtin_openssl2/crypto/evp/bio_ok.c
+++ b/thirdparty/openssl/crypto/evp/bio_ok.c
diff --git a/drivers/builtin_openssl2/crypto/evp/c_all.c b/thirdparty/openssl/crypto/evp/c_all.c
index a3ed00d4c..a3ed00d4c 100644
--- a/drivers/builtin_openssl2/crypto/evp/c_all.c
+++ b/thirdparty/openssl/crypto/evp/c_all.c
diff --git a/drivers/builtin_openssl2/crypto/evp/c_allc.c b/thirdparty/openssl/crypto/evp/c_allc.c
index 280e58408..280e58408 100644
--- a/drivers/builtin_openssl2/crypto/evp/c_allc.c
+++ b/thirdparty/openssl/crypto/evp/c_allc.c
diff --git a/drivers/builtin_openssl2/crypto/evp/c_alld.c b/thirdparty/openssl/crypto/evp/c_alld.c
index fdbe3ee04..fdbe3ee04 100644
--- a/drivers/builtin_openssl2/crypto/evp/c_alld.c
+++ b/thirdparty/openssl/crypto/evp/c_alld.c
diff --git a/drivers/builtin_openssl2/crypto/evp/digest.c b/thirdparty/openssl/crypto/evp/digest.c
index 5b642b23f..5b642b23f 100644
--- a/drivers/builtin_openssl2/crypto/evp/digest.c
+++ b/thirdparty/openssl/crypto/evp/digest.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_aes.c b/thirdparty/openssl/crypto/evp/e_aes.c
index 1734a823c..1734a823c 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_aes.c
+++ b/thirdparty/openssl/crypto/evp/e_aes.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_aes_cbc_hmac_sha1.c b/thirdparty/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c
index 6dfd590a4..6dfd590a4 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/thirdparty/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_aes_cbc_hmac_sha256.c b/thirdparty/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c
index 46c9d0338..46c9d0338 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_aes_cbc_hmac_sha256.c
+++ b/thirdparty/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_bf.c b/thirdparty/openssl/crypto/evp/e_bf.c
index d6a017826..d6a017826 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_bf.c
+++ b/thirdparty/openssl/crypto/evp/e_bf.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_camellia.c b/thirdparty/openssl/crypto/evp/e_camellia.c
index f273f9c94..f273f9c94 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_camellia.c
+++ b/thirdparty/openssl/crypto/evp/e_camellia.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_cast.c b/thirdparty/openssl/crypto/evp/e_cast.c
index 3f7454856..3f7454856 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_cast.c
+++ b/thirdparty/openssl/crypto/evp/e_cast.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_des.c b/thirdparty/openssl/crypto/evp/e_des.c
index 8ca65cd03..8ca65cd03 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_des.c
+++ b/thirdparty/openssl/crypto/evp/e_des.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_des3.c b/thirdparty/openssl/crypto/evp/e_des3.c
index 0e910d6d8..0e910d6d8 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_des3.c
+++ b/thirdparty/openssl/crypto/evp/e_des3.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_dsa.c b/thirdparty/openssl/crypto/evp/e_dsa.c
index 523993f4d..523993f4d 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_dsa.c
+++ b/thirdparty/openssl/crypto/evp/e_dsa.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_idea.c b/thirdparty/openssl/crypto/evp/e_idea.c
index cac72b33b..cac72b33b 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_idea.c
+++ b/thirdparty/openssl/crypto/evp/e_idea.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_null.c b/thirdparty/openssl/crypto/evp/e_null.c
index 599fcb808..599fcb808 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_null.c
+++ b/thirdparty/openssl/crypto/evp/e_null.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_old.c b/thirdparty/openssl/crypto/evp/e_old.c
index a23d143b7..a23d143b7 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_old.c
+++ b/thirdparty/openssl/crypto/evp/e_old.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_rc2.c b/thirdparty/openssl/crypto/evp/e_rc2.c
index 718cc8694..718cc8694 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_rc2.c
+++ b/thirdparty/openssl/crypto/evp/e_rc2.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_rc4.c b/thirdparty/openssl/crypto/evp/e_rc4.c
index 08e48f391..08e48f391 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_rc4.c
+++ b/thirdparty/openssl/crypto/evp/e_rc4.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_rc4_hmac_md5.c b/thirdparty/openssl/crypto/evp/e_rc4_hmac_md5.c
index 2da111782..2da111782 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_rc4_hmac_md5.c
+++ b/thirdparty/openssl/crypto/evp/e_rc4_hmac_md5.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_rc5.c b/thirdparty/openssl/crypto/evp/e_rc5.c
index f17e99d0c..f17e99d0c 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_rc5.c
+++ b/thirdparty/openssl/crypto/evp/e_rc5.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_seed.c b/thirdparty/openssl/crypto/evp/e_seed.c
index 7249d1b1e..7249d1b1e 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_seed.c
+++ b/thirdparty/openssl/crypto/evp/e_seed.c
diff --git a/drivers/builtin_openssl2/crypto/evp/e_xcbc_d.c b/thirdparty/openssl/crypto/evp/e_xcbc_d.c
index 3430df9e8..3430df9e8 100644
--- a/drivers/builtin_openssl2/crypto/evp/e_xcbc_d.c
+++ b/thirdparty/openssl/crypto/evp/e_xcbc_d.c
diff --git a/drivers/builtin_openssl2/crypto/evp/encode.c b/thirdparty/openssl/crypto/evp/encode.c
index c6c775e0a..c6c775e0a 100644
--- a/drivers/builtin_openssl2/crypto/evp/encode.c
+++ b/thirdparty/openssl/crypto/evp/encode.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_acnf.c b/thirdparty/openssl/crypto/evp/evp_acnf.c
index 9703116e0..9703116e0 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_acnf.c
+++ b/thirdparty/openssl/crypto/evp/evp_acnf.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_cnf.c b/thirdparty/openssl/crypto/evp/evp_cnf.c
index 6fd3a6da0..6fd3a6da0 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_cnf.c
+++ b/thirdparty/openssl/crypto/evp/evp_cnf.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_enc.c b/thirdparty/openssl/crypto/evp/evp_enc.c
index 7d7be245b..7d7be245b 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_enc.c
+++ b/thirdparty/openssl/crypto/evp/evp_enc.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_err.c b/thirdparty/openssl/crypto/evp/evp_err.c
index 15cf5532b..15cf5532b 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_err.c
+++ b/thirdparty/openssl/crypto/evp/evp_err.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_key.c b/thirdparty/openssl/crypto/evp/evp_key.c
index 5be9e336f..5be9e336f 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_key.c
+++ b/thirdparty/openssl/crypto/evp/evp_key.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_lib.c b/thirdparty/openssl/crypto/evp/evp_lib.c
index 7e0bab90d..7e0bab90d 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_lib.c
+++ b/thirdparty/openssl/crypto/evp/evp_lib.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_locl.h b/thirdparty/openssl/crypto/evp/evp_locl.h
index 2bb709a06..2bb709a06 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_locl.h
+++ b/thirdparty/openssl/crypto/evp/evp_locl.h
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_pbe.c b/thirdparty/openssl/crypto/evp/evp_pbe.c
index 7934c95fa..7934c95fa 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_pbe.c
+++ b/thirdparty/openssl/crypto/evp/evp_pbe.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evp_pkey.c b/thirdparty/openssl/crypto/evp/evp_pkey.c
index 6a456297b..6a456297b 100644
--- a/drivers/builtin_openssl2/crypto/evp/evp_pkey.c
+++ b/thirdparty/openssl/crypto/evp/evp_pkey.c
diff --git a/drivers/builtin_openssl2/crypto/evp/evptests.txt b/thirdparty/openssl/crypto/evp/evptests.txt
index 4e9958b3b..4e9958b3b 100644
--- a/drivers/builtin_openssl2/crypto/evp/evptests.txt
+++ b/thirdparty/openssl/crypto/evp/evptests.txt
diff --git a/drivers/builtin_openssl2/crypto/evp/m_dss.c b/thirdparty/openssl/crypto/evp/m_dss.c
index 147844862..147844862 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_dss.c
+++ b/thirdparty/openssl/crypto/evp/m_dss.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_dss1.c b/thirdparty/openssl/crypto/evp/m_dss1.c
index e36fabff7..e36fabff7 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_dss1.c
+++ b/thirdparty/openssl/crypto/evp/m_dss1.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_ecdsa.c b/thirdparty/openssl/crypto/evp/m_ecdsa.c
index 803d31495..803d31495 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_ecdsa.c
+++ b/thirdparty/openssl/crypto/evp/m_ecdsa.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_md2.c b/thirdparty/openssl/crypto/evp/m_md2.c
index 3c4cd7bf8..3c4cd7bf8 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_md2.c
+++ b/thirdparty/openssl/crypto/evp/m_md2.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_md4.c b/thirdparty/openssl/crypto/evp/m_md4.c
index 851de69f8..851de69f8 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_md4.c
+++ b/thirdparty/openssl/crypto/evp/m_md4.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_md5.c b/thirdparty/openssl/crypto/evp/m_md5.c
index e5d5f71b8..e5d5f71b8 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_md5.c
+++ b/thirdparty/openssl/crypto/evp/m_md5.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_mdc2.c b/thirdparty/openssl/crypto/evp/m_mdc2.c
index 94e12a6bd..94e12a6bd 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_mdc2.c
+++ b/thirdparty/openssl/crypto/evp/m_mdc2.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_null.c b/thirdparty/openssl/crypto/evp/m_null.c
index 017e1feb0..017e1feb0 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_null.c
+++ b/thirdparty/openssl/crypto/evp/m_null.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_ripemd.c b/thirdparty/openssl/crypto/evp/m_ripemd.c
index 81de0ef4e..81de0ef4e 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_ripemd.c
+++ b/thirdparty/openssl/crypto/evp/m_ripemd.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_sha.c b/thirdparty/openssl/crypto/evp/m_sha.c
index e1e22e0c1..e1e22e0c1 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_sha.c
+++ b/thirdparty/openssl/crypto/evp/m_sha.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_sha1.c b/thirdparty/openssl/crypto/evp/m_sha1.c
index a74e6b779..a74e6b779 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_sha1.c
+++ b/thirdparty/openssl/crypto/evp/m_sha1.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_sigver.c b/thirdparty/openssl/crypto/evp/m_sigver.c
index 4492d207f..4492d207f 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_sigver.c
+++ b/thirdparty/openssl/crypto/evp/m_sigver.c
diff --git a/drivers/builtin_openssl2/crypto/evp/m_wp.c b/thirdparty/openssl/crypto/evp/m_wp.c
index a890939ec..a890939ec 100644
--- a/drivers/builtin_openssl2/crypto/evp/m_wp.c
+++ b/thirdparty/openssl/crypto/evp/m_wp.c
diff --git a/drivers/builtin_openssl2/crypto/evp/names.c b/thirdparty/openssl/crypto/evp/names.c
index ff115a31c..ff115a31c 100644
--- a/drivers/builtin_openssl2/crypto/evp/names.c
+++ b/thirdparty/openssl/crypto/evp/names.c
diff --git a/drivers/builtin_openssl2/crypto/evp/openbsd_hw.c b/thirdparty/openssl/crypto/evp/openbsd_hw.c
index 75d12e233..75d12e233 100644
--- a/drivers/builtin_openssl2/crypto/evp/openbsd_hw.c
+++ b/thirdparty/openssl/crypto/evp/openbsd_hw.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p5_crpt.c b/thirdparty/openssl/crypto/evp/p5_crpt.c
index d06ab90a3..d06ab90a3 100644
--- a/drivers/builtin_openssl2/crypto/evp/p5_crpt.c
+++ b/thirdparty/openssl/crypto/evp/p5_crpt.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p5_crpt2.c b/thirdparty/openssl/crypto/evp/p5_crpt2.c
index f2ae1e579..f2ae1e579 100644
--- a/drivers/builtin_openssl2/crypto/evp/p5_crpt2.c
+++ b/thirdparty/openssl/crypto/evp/p5_crpt2.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p_dec.c b/thirdparty/openssl/crypto/evp/p_dec.c
index 225b8b45e..225b8b45e 100644
--- a/drivers/builtin_openssl2/crypto/evp/p_dec.c
+++ b/thirdparty/openssl/crypto/evp/p_dec.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p_enc.c b/thirdparty/openssl/crypto/evp/p_enc.c
index f565f33fb..f565f33fb 100644
--- a/drivers/builtin_openssl2/crypto/evp/p_enc.c
+++ b/thirdparty/openssl/crypto/evp/p_enc.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p_lib.c b/thirdparty/openssl/crypto/evp/p_lib.c
index c0171244d..c0171244d 100644
--- a/drivers/builtin_openssl2/crypto/evp/p_lib.c
+++ b/thirdparty/openssl/crypto/evp/p_lib.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p_open.c b/thirdparty/openssl/crypto/evp/p_open.c
index 229eb6417..229eb6417 100644
--- a/drivers/builtin_openssl2/crypto/evp/p_open.c
+++ b/thirdparty/openssl/crypto/evp/p_open.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p_seal.c b/thirdparty/openssl/crypto/evp/p_seal.c
index ba9dfff21..ba9dfff21 100644
--- a/drivers/builtin_openssl2/crypto/evp/p_seal.c
+++ b/thirdparty/openssl/crypto/evp/p_seal.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p_sign.c b/thirdparty/openssl/crypto/evp/p_sign.c
index 1b9ba060d..1b9ba060d 100644
--- a/drivers/builtin_openssl2/crypto/evp/p_sign.c
+++ b/thirdparty/openssl/crypto/evp/p_sign.c
diff --git a/drivers/builtin_openssl2/crypto/evp/p_verify.c b/thirdparty/openssl/crypto/evp/p_verify.c
index 65e1e2169..65e1e2169 100644
--- a/drivers/builtin_openssl2/crypto/evp/p_verify.c
+++ b/thirdparty/openssl/crypto/evp/p_verify.c
diff --git a/drivers/builtin_openssl2/crypto/evp/pmeth_fn.c b/thirdparty/openssl/crypto/evp/pmeth_fn.c
index a8b7f2f6d..a8b7f2f6d 100644
--- a/drivers/builtin_openssl2/crypto/evp/pmeth_fn.c
+++ b/thirdparty/openssl/crypto/evp/pmeth_fn.c
diff --git a/drivers/builtin_openssl2/crypto/evp/pmeth_gn.c b/thirdparty/openssl/crypto/evp/pmeth_gn.c
index 6435f1b63..6435f1b63 100644
--- a/drivers/builtin_openssl2/crypto/evp/pmeth_gn.c
+++ b/thirdparty/openssl/crypto/evp/pmeth_gn.c
diff --git a/drivers/builtin_openssl2/crypto/evp/pmeth_lib.c b/thirdparty/openssl/crypto/evp/pmeth_lib.c
index 9f81d1002..9f81d1002 100644
--- a/drivers/builtin_openssl2/crypto/evp/pmeth_lib.c
+++ b/thirdparty/openssl/crypto/evp/pmeth_lib.c
diff --git a/drivers/builtin_openssl2/crypto/ex_data.c b/thirdparty/openssl/crypto/ex_data.c
index f96a51781..f96a51781 100644
--- a/drivers/builtin_openssl2/crypto/ex_data.c
+++ b/thirdparty/openssl/crypto/ex_data.c
diff --git a/drivers/builtin_openssl2/crypto/fips_err.h b/thirdparty/openssl/crypto/fips_err.h
index 0308b63bb..0308b63bb 100644
--- a/drivers/builtin_openssl2/crypto/fips_err.h
+++ b/thirdparty/openssl/crypto/fips_err.h
diff --git a/drivers/builtin_openssl2/crypto/fips_ers.c b/thirdparty/openssl/crypto/fips_ers.c
index 1788ed288..1788ed288 100644
--- a/drivers/builtin_openssl2/crypto/fips_ers.c
+++ b/thirdparty/openssl/crypto/fips_ers.c
diff --git a/drivers/builtin_openssl2/crypto/hmac/hm_ameth.c b/thirdparty/openssl/crypto/hmac/hm_ameth.c
index 944c6c857..944c6c857 100644
--- a/drivers/builtin_openssl2/crypto/hmac/hm_ameth.c
+++ b/thirdparty/openssl/crypto/hmac/hm_ameth.c
diff --git a/drivers/builtin_openssl2/crypto/hmac/hm_pmeth.c b/thirdparty/openssl/crypto/hmac/hm_pmeth.c
index 0ffff79cc..0ffff79cc 100644
--- a/drivers/builtin_openssl2/crypto/hmac/hm_pmeth.c
+++ b/thirdparty/openssl/crypto/hmac/hm_pmeth.c
diff --git a/drivers/builtin_openssl2/crypto/hmac/hmac.c b/thirdparty/openssl/crypto/hmac/hmac.c
index 51a0a3efc..51a0a3efc 100644
--- a/drivers/builtin_openssl2/crypto/hmac/hmac.c
+++ b/thirdparty/openssl/crypto/hmac/hmac.c
diff --git a/drivers/builtin_openssl2/crypto/idea/i_cbc.c b/thirdparty/openssl/crypto/idea/i_cbc.c
index 950df98c9..950df98c9 100644
--- a/drivers/builtin_openssl2/crypto/idea/i_cbc.c
+++ b/thirdparty/openssl/crypto/idea/i_cbc.c
diff --git a/drivers/builtin_openssl2/crypto/idea/i_cfb64.c b/thirdparty/openssl/crypto/idea/i_cfb64.c
index a1547ed5d..a1547ed5d 100644
--- a/drivers/builtin_openssl2/crypto/idea/i_cfb64.c
+++ b/thirdparty/openssl/crypto/idea/i_cfb64.c
diff --git a/drivers/builtin_openssl2/crypto/idea/i_ecb.c b/thirdparty/openssl/crypto/idea/i_ecb.c
index a6b879a92..a6b879a92 100644
--- a/drivers/builtin_openssl2/crypto/idea/i_ecb.c
+++ b/thirdparty/openssl/crypto/idea/i_ecb.c
diff --git a/drivers/builtin_openssl2/crypto/idea/i_ofb64.c b/thirdparty/openssl/crypto/idea/i_ofb64.c
index aa5948801..aa5948801 100644
--- a/drivers/builtin_openssl2/crypto/idea/i_ofb64.c
+++ b/thirdparty/openssl/crypto/idea/i_ofb64.c
diff --git a/drivers/builtin_openssl2/crypto/idea/i_skey.c b/thirdparty/openssl/crypto/idea/i_skey.c
index 536515133..536515133 100644
--- a/drivers/builtin_openssl2/crypto/idea/i_skey.c
+++ b/thirdparty/openssl/crypto/idea/i_skey.c
diff --git a/drivers/builtin_openssl2/crypto/idea/idea_lcl.h b/thirdparty/openssl/crypto/idea/idea_lcl.h
index e40695384..e40695384 100644
--- a/drivers/builtin_openssl2/crypto/idea/idea_lcl.h
+++ b/thirdparty/openssl/crypto/idea/idea_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/idea/idea_spd.c b/thirdparty/openssl/crypto/idea/idea_spd.c
index 59acc407d..59acc407d 100644
--- a/drivers/builtin_openssl2/crypto/idea/idea_spd.c
+++ b/thirdparty/openssl/crypto/idea/idea_spd.c
diff --git a/drivers/builtin_openssl2/crypto/idea/version b/thirdparty/openssl/crypto/idea/version
index 3f2229379..3f2229379 100644
--- a/drivers/builtin_openssl2/crypto/idea/version
+++ b/thirdparty/openssl/crypto/idea/version
diff --git a/drivers/builtin_openssl2/crypto/install-crypto.com b/thirdparty/openssl/crypto/install-crypto.com
index af1d75b52..af1d75b52 100755
--- a/drivers/builtin_openssl2/crypto/install-crypto.com
+++ b/thirdparty/openssl/crypto/install-crypto.com
diff --git a/drivers/builtin_openssl2/crypto/jpake/jpake.c b/thirdparty/openssl/crypto/jpake/jpake.c
index ebc097557..ebc097557 100644
--- a/drivers/builtin_openssl2/crypto/jpake/jpake.c
+++ b/thirdparty/openssl/crypto/jpake/jpake.c
diff --git a/drivers/builtin_openssl2/crypto/jpake/jpake.h b/thirdparty/openssl/crypto/jpake/jpake.h
index 371eed679..371eed679 100644
--- a/drivers/builtin_openssl2/crypto/jpake/jpake.h
+++ b/thirdparty/openssl/crypto/jpake/jpake.h
diff --git a/drivers/builtin_openssl2/crypto/jpake/jpake_err.c b/thirdparty/openssl/crypto/jpake/jpake_err.c
index be236d9ea..be236d9ea 100644
--- a/drivers/builtin_openssl2/crypto/jpake/jpake_err.c
+++ b/thirdparty/openssl/crypto/jpake/jpake_err.c
diff --git a/drivers/builtin_openssl2/crypto/krb5/krb5_asn.c b/thirdparty/openssl/crypto/krb5/krb5_asn.c
index d9851e973..d9851e973 100644
--- a/drivers/builtin_openssl2/crypto/krb5/krb5_asn.c
+++ b/thirdparty/openssl/crypto/krb5/krb5_asn.c
diff --git a/drivers/builtin_openssl2/crypto/lhash/lh_stats.c b/thirdparty/openssl/crypto/lhash/lh_stats.c
index 0bfec2322..0bfec2322 100644
--- a/drivers/builtin_openssl2/crypto/lhash/lh_stats.c
+++ b/thirdparty/openssl/crypto/lhash/lh_stats.c
diff --git a/drivers/builtin_openssl2/crypto/lhash/lhash.c b/thirdparty/openssl/crypto/lhash/lhash.c
index 53c5c138b..53c5c138b 100644
--- a/drivers/builtin_openssl2/crypto/lhash/lhash.c
+++ b/thirdparty/openssl/crypto/lhash/lhash.c
diff --git a/drivers/builtin_openssl2/crypto/md2/md2.c b/thirdparty/openssl/crypto/md2/md2.c
index 584e34a64..584e34a64 100644
--- a/drivers/builtin_openssl2/crypto/md2/md2.c
+++ b/thirdparty/openssl/crypto/md2/md2.c
diff --git a/drivers/builtin_openssl2/crypto/md2/md2.h b/thirdparty/openssl/crypto/md2/md2.h
index b568d3f98..b568d3f98 100644
--- a/drivers/builtin_openssl2/crypto/md2/md2.h
+++ b/thirdparty/openssl/crypto/md2/md2.h
diff --git a/drivers/builtin_openssl2/crypto/md2/md2_dgst.c b/thirdparty/openssl/crypto/md2/md2_dgst.c
index 9cd79f8d7..9cd79f8d7 100644
--- a/drivers/builtin_openssl2/crypto/md2/md2_dgst.c
+++ b/thirdparty/openssl/crypto/md2/md2_dgst.c
diff --git a/drivers/builtin_openssl2/crypto/md2/md2_one.c b/thirdparty/openssl/crypto/md2/md2_one.c
index cd2631b26..cd2631b26 100644
--- a/drivers/builtin_openssl2/crypto/md2/md2_one.c
+++ b/thirdparty/openssl/crypto/md2/md2_one.c
diff --git a/drivers/builtin_openssl2/crypto/md32_common.h b/thirdparty/openssl/crypto/md32_common.h
index 96828d269..96828d269 100644
--- a/drivers/builtin_openssl2/crypto/md32_common.h
+++ b/thirdparty/openssl/crypto/md32_common.h
diff --git a/drivers/builtin_openssl2/crypto/md4/md4.c b/thirdparty/openssl/crypto/md4/md4.c
index c9fab6669..c9fab6669 100644
--- a/drivers/builtin_openssl2/crypto/md4/md4.c
+++ b/thirdparty/openssl/crypto/md4/md4.c
diff --git a/drivers/builtin_openssl2/crypto/md4/md4_dgst.c b/thirdparty/openssl/crypto/md4/md4_dgst.c
index 614fca005..614fca005 100644
--- a/drivers/builtin_openssl2/crypto/md4/md4_dgst.c
+++ b/thirdparty/openssl/crypto/md4/md4_dgst.c
diff --git a/drivers/builtin_openssl2/crypto/md4/md4_locl.h b/thirdparty/openssl/crypto/md4/md4_locl.h
index dc86a86c5..dc86a86c5 100644
--- a/drivers/builtin_openssl2/crypto/md4/md4_locl.h
+++ b/thirdparty/openssl/crypto/md4/md4_locl.h
diff --git a/drivers/builtin_openssl2/crypto/md4/md4_one.c b/thirdparty/openssl/crypto/md4/md4_one.c
index 32ebd5fac..32ebd5fac 100644
--- a/drivers/builtin_openssl2/crypto/md4/md4_one.c
+++ b/thirdparty/openssl/crypto/md4/md4_one.c
diff --git a/drivers/builtin_openssl2/crypto/md4/md4s.cpp b/thirdparty/openssl/crypto/md4/md4s.cpp
index c0ec97fc9..c0ec97fc9 100644
--- a/drivers/builtin_openssl2/crypto/md4/md4s.cpp
+++ b/thirdparty/openssl/crypto/md4/md4s.cpp
diff --git a/drivers/builtin_openssl2/crypto/md5/md5.c b/thirdparty/openssl/crypto/md5/md5.c
index f0282c507..f0282c507 100644
--- a/drivers/builtin_openssl2/crypto/md5/md5.c
+++ b/thirdparty/openssl/crypto/md5/md5.c
diff --git a/drivers/builtin_openssl2/crypto/md5/md5_dgst.c b/thirdparty/openssl/crypto/md5/md5_dgst.c
index 2b5194670..2b5194670 100644
--- a/drivers/builtin_openssl2/crypto/md5/md5_dgst.c
+++ b/thirdparty/openssl/crypto/md5/md5_dgst.c
diff --git a/drivers/builtin_openssl2/crypto/md5/md5_locl.h b/thirdparty/openssl/crypto/md5/md5_locl.h
index 82e69218d..82e69218d 100644
--- a/drivers/builtin_openssl2/crypto/md5/md5_locl.h
+++ b/thirdparty/openssl/crypto/md5/md5_locl.h
diff --git a/drivers/builtin_openssl2/crypto/md5/md5_one.c b/thirdparty/openssl/crypto/md5/md5_one.c
index 4ac882e73..4ac882e73 100644
--- a/drivers/builtin_openssl2/crypto/md5/md5_one.c
+++ b/thirdparty/openssl/crypto/md5/md5_one.c
diff --git a/drivers/builtin_openssl2/crypto/md5/md5s.cpp b/thirdparty/openssl/crypto/md5/md5s.cpp
index dd343fd4e..dd343fd4e 100644
--- a/drivers/builtin_openssl2/crypto/md5/md5s.cpp
+++ b/thirdparty/openssl/crypto/md5/md5s.cpp
diff --git a/drivers/builtin_openssl2/crypto/mdc2/mdc2_one.c b/thirdparty/openssl/crypto/mdc2/mdc2_one.c
index 790775c6f..790775c6f 100644
--- a/drivers/builtin_openssl2/crypto/mdc2/mdc2_one.c
+++ b/thirdparty/openssl/crypto/mdc2/mdc2_one.c
diff --git a/drivers/builtin_openssl2/crypto/mdc2/mdc2dgst.c b/thirdparty/openssl/crypto/mdc2/mdc2dgst.c
index 6615cf84d..6615cf84d 100644
--- a/drivers/builtin_openssl2/crypto/mdc2/mdc2dgst.c
+++ b/thirdparty/openssl/crypto/mdc2/mdc2dgst.c
diff --git a/drivers/builtin_openssl2/crypto/mem.c b/thirdparty/openssl/crypto/mem.c
index fdad49b76..fdad49b76 100644
--- a/drivers/builtin_openssl2/crypto/mem.c
+++ b/thirdparty/openssl/crypto/mem.c
diff --git a/drivers/builtin_openssl2/crypto/mem_clr.c b/thirdparty/openssl/crypto/mem_clr.c
index ab85344ee..ab85344ee 100644
--- a/drivers/builtin_openssl2/crypto/mem_clr.c
+++ b/thirdparty/openssl/crypto/mem_clr.c
diff --git a/drivers/builtin_openssl2/crypto/mem_dbg.c b/thirdparty/openssl/crypto/mem_dbg.c
index 8525ded78..8525ded78 100644
--- a/drivers/builtin_openssl2/crypto/mem_dbg.c
+++ b/thirdparty/openssl/crypto/mem_dbg.c
diff --git a/drivers/builtin_openssl2/crypto/modes/cbc128.c b/thirdparty/openssl/crypto/modes/cbc128.c
index c13caea53..c13caea53 100644
--- a/drivers/builtin_openssl2/crypto/modes/cbc128.c
+++ b/thirdparty/openssl/crypto/modes/cbc128.c
diff --git a/drivers/builtin_openssl2/crypto/modes/ccm128.c b/thirdparty/openssl/crypto/modes/ccm128.c
index c1ded0f91..c1ded0f91 100644
--- a/drivers/builtin_openssl2/crypto/modes/ccm128.c
+++ b/thirdparty/openssl/crypto/modes/ccm128.c
diff --git a/drivers/builtin_openssl2/crypto/modes/cfb128.c b/thirdparty/openssl/crypto/modes/cfb128.c
index d4ecbd08e..d4ecbd08e 100644
--- a/drivers/builtin_openssl2/crypto/modes/cfb128.c
+++ b/thirdparty/openssl/crypto/modes/cfb128.c
diff --git a/drivers/builtin_openssl2/crypto/modes/ctr128.c b/thirdparty/openssl/crypto/modes/ctr128.c
index bcafd6b6b..bcafd6b6b 100644
--- a/drivers/builtin_openssl2/crypto/modes/ctr128.c
+++ b/thirdparty/openssl/crypto/modes/ctr128.c
diff --git a/drivers/builtin_openssl2/crypto/modes/cts128.c b/thirdparty/openssl/crypto/modes/cts128.c
index 137be595a..137be595a 100644
--- a/drivers/builtin_openssl2/crypto/modes/cts128.c
+++ b/thirdparty/openssl/crypto/modes/cts128.c
diff --git a/drivers/builtin_openssl2/crypto/modes/gcm128.c b/thirdparty/openssl/crypto/modes/gcm128.c
index e299131c1..e299131c1 100644
--- a/drivers/builtin_openssl2/crypto/modes/gcm128.c
+++ b/thirdparty/openssl/crypto/modes/gcm128.c
diff --git a/drivers/builtin_openssl2/crypto/modes/modes_lcl.h b/thirdparty/openssl/crypto/modes/modes_lcl.h
index fe14ec700..fe14ec700 100644
--- a/drivers/builtin_openssl2/crypto/modes/modes_lcl.h
+++ b/thirdparty/openssl/crypto/modes/modes_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/modes/ofb128.c b/thirdparty/openssl/crypto/modes/ofb128.c
index 4dbaccd7a..4dbaccd7a 100644
--- a/drivers/builtin_openssl2/crypto/modes/ofb128.c
+++ b/thirdparty/openssl/crypto/modes/ofb128.c
diff --git a/drivers/builtin_openssl2/crypto/modes/wrap128.c b/thirdparty/openssl/crypto/modes/wrap128.c
index 384978371..384978371 100644
--- a/drivers/builtin_openssl2/crypto/modes/wrap128.c
+++ b/thirdparty/openssl/crypto/modes/wrap128.c
diff --git a/drivers/builtin_openssl2/crypto/modes/xts128.c b/thirdparty/openssl/crypto/modes/xts128.c
index 8f2af588b..8f2af588b 100644
--- a/drivers/builtin_openssl2/crypto/modes/xts128.c
+++ b/thirdparty/openssl/crypto/modes/xts128.c
diff --git a/drivers/builtin_openssl2/crypto/o_dir.c b/thirdparty/openssl/crypto/o_dir.c
index f9dbed871..f9dbed871 100644
--- a/drivers/builtin_openssl2/crypto/o_dir.c
+++ b/thirdparty/openssl/crypto/o_dir.c
diff --git a/drivers/builtin_openssl2/crypto/o_dir.h b/thirdparty/openssl/crypto/o_dir.h
index bf45a14d0..bf45a14d0 100644
--- a/drivers/builtin_openssl2/crypto/o_dir.h
+++ b/thirdparty/openssl/crypto/o_dir.h
diff --git a/drivers/builtin_openssl2/crypto/o_fips.c b/thirdparty/openssl/crypto/o_fips.c
index f56d5bb79..f56d5bb79 100644
--- a/drivers/builtin_openssl2/crypto/o_fips.c
+++ b/thirdparty/openssl/crypto/o_fips.c
diff --git a/drivers/builtin_openssl2/crypto/o_init.c b/thirdparty/openssl/crypto/o_init.c
index 208838812..208838812 100644
--- a/drivers/builtin_openssl2/crypto/o_init.c
+++ b/thirdparty/openssl/crypto/o_init.c
diff --git a/drivers/builtin_openssl2/crypto/o_str.c b/thirdparty/openssl/crypto/o_str.c
index c10842300..c10842300 100644
--- a/drivers/builtin_openssl2/crypto/o_str.c
+++ b/thirdparty/openssl/crypto/o_str.c
diff --git a/drivers/builtin_openssl2/crypto/o_str.h b/thirdparty/openssl/crypto/o_str.h
index fa512eb39..fa512eb39 100644
--- a/drivers/builtin_openssl2/crypto/o_str.h
+++ b/thirdparty/openssl/crypto/o_str.h
diff --git a/drivers/builtin_openssl2/crypto/o_time.c b/thirdparty/openssl/crypto/o_time.c
index 635dae184..635dae184 100644
--- a/drivers/builtin_openssl2/crypto/o_time.c
+++ b/thirdparty/openssl/crypto/o_time.c
diff --git a/drivers/builtin_openssl2/crypto/o_time.h b/thirdparty/openssl/crypto/o_time.h
index f192c6dcc..f192c6dcc 100644
--- a/drivers/builtin_openssl2/crypto/o_time.h
+++ b/thirdparty/openssl/crypto/o_time.h
diff --git a/drivers/builtin_openssl2/crypto/objects/o_names.c b/thirdparty/openssl/crypto/objects/o_names.c
index 24859926a..24859926a 100644
--- a/drivers/builtin_openssl2/crypto/objects/o_names.c
+++ b/thirdparty/openssl/crypto/objects/o_names.c
diff --git a/drivers/builtin_openssl2/crypto/objects/obj_dat.c b/thirdparty/openssl/crypto/objects/obj_dat.c
index aca382a6e..aca382a6e 100644
--- a/drivers/builtin_openssl2/crypto/objects/obj_dat.c
+++ b/thirdparty/openssl/crypto/objects/obj_dat.c
diff --git a/drivers/builtin_openssl2/crypto/objects/obj_dat.h b/thirdparty/openssl/crypto/objects/obj_dat.h
index b7e3cf280..b7e3cf280 100644
--- a/drivers/builtin_openssl2/crypto/objects/obj_dat.h
+++ b/thirdparty/openssl/crypto/objects/obj_dat.h
diff --git a/drivers/builtin_openssl2/crypto/objects/obj_err.c b/thirdparty/openssl/crypto/objects/obj_err.c
index 238aaa59f..238aaa59f 100644
--- a/drivers/builtin_openssl2/crypto/objects/obj_err.c
+++ b/thirdparty/openssl/crypto/objects/obj_err.c
diff --git a/drivers/builtin_openssl2/crypto/objects/obj_lib.c b/thirdparty/openssl/crypto/objects/obj_lib.c
index 8851baffb..8851baffb 100644
--- a/drivers/builtin_openssl2/crypto/objects/obj_lib.c
+++ b/thirdparty/openssl/crypto/objects/obj_lib.c
diff --git a/drivers/builtin_openssl2/crypto/objects/obj_mac.num b/thirdparty/openssl/crypto/objects/obj_mac.num
index 8e5ea8336..8e5ea8336 100644
--- a/drivers/builtin_openssl2/crypto/objects/obj_mac.num
+++ b/thirdparty/openssl/crypto/objects/obj_mac.num
diff --git a/drivers/builtin_openssl2/crypto/objects/obj_xref.c b/thirdparty/openssl/crypto/objects/obj_xref.c
index 97b305d21..97b305d21 100644
--- a/drivers/builtin_openssl2/crypto/objects/obj_xref.c
+++ b/thirdparty/openssl/crypto/objects/obj_xref.c
diff --git a/drivers/builtin_openssl2/crypto/objects/obj_xref.h b/thirdparty/openssl/crypto/objects/obj_xref.h
index e453e99f8..e453e99f8 100644
--- a/drivers/builtin_openssl2/crypto/objects/obj_xref.h
+++ b/thirdparty/openssl/crypto/objects/obj_xref.h
diff --git a/drivers/builtin_openssl2/crypto/objects/obj_xref.txt b/thirdparty/openssl/crypto/objects/obj_xref.txt
index 19c94226b..19c94226b 100644
--- a/drivers/builtin_openssl2/crypto/objects/obj_xref.txt
+++ b/thirdparty/openssl/crypto/objects/obj_xref.txt
diff --git a/drivers/builtin_openssl2/crypto/objects/objects.README b/thirdparty/openssl/crypto/objects/objects.README
index cb1d216ce..cb1d216ce 100644
--- a/drivers/builtin_openssl2/crypto/objects/objects.README
+++ b/thirdparty/openssl/crypto/objects/objects.README
diff --git a/drivers/builtin_openssl2/crypto/objects/objects.txt b/thirdparty/openssl/crypto/objects/objects.txt
index b57aabb22..b57aabb22 100644
--- a/drivers/builtin_openssl2/crypto/objects/objects.txt
+++ b/thirdparty/openssl/crypto/objects/objects.txt
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_asn.c b/thirdparty/openssl/crypto/ocsp/ocsp_asn.c
index e2e52e77a..e2e52e77a 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_asn.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_asn.c
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_cl.c b/thirdparty/openssl/crypto/ocsp/ocsp_cl.c
index b3612c8df..b3612c8df 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_cl.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_cl.c
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_err.c b/thirdparty/openssl/crypto/ocsp/ocsp_err.c
index 722043c0f..722043c0f 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_err.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_err.c
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_ext.c b/thirdparty/openssl/crypto/ocsp/ocsp_ext.c
index c19648c73..c19648c73 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_ext.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_ext.c
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_ht.c b/thirdparty/openssl/crypto/ocsp/ocsp_ht.c
index 88b26b38e..88b26b38e 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_ht.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_ht.c
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_lib.c b/thirdparty/openssl/crypto/ocsp/ocsp_lib.c
index cabf53933..cabf53933 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_lib.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_lib.c
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_prn.c b/thirdparty/openssl/crypto/ocsp/ocsp_prn.c
index 47d5f83ef..47d5f83ef 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_prn.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_prn.c
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_srv.c b/thirdparty/openssl/crypto/ocsp/ocsp_srv.c
index 2ec2c6361..2ec2c6361 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_srv.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_srv.c
diff --git a/drivers/builtin_openssl2/crypto/ocsp/ocsp_vfy.c b/thirdparty/openssl/crypto/ocsp/ocsp_vfy.c
index d4a257c33..d4a257c33 100644
--- a/drivers/builtin_openssl2/crypto/ocsp/ocsp_vfy.c
+++ b/thirdparty/openssl/crypto/ocsp/ocsp_vfy.c
diff --git a/drivers/builtin_openssl2/crypto/opensslconf.h.in b/thirdparty/openssl/crypto/opensslconf.h.in
index 7a1c85d6e..7a1c85d6e 100644
--- a/drivers/builtin_openssl2/crypto/opensslconf.h.in
+++ b/thirdparty/openssl/crypto/opensslconf.h.in
diff --git a/drivers/builtin_openssl2/crypto/pem/message b/thirdparty/openssl/crypto/pem/message
index e8bf9d759..e8bf9d759 100644
--- a/drivers/builtin_openssl2/crypto/pem/message
+++ b/thirdparty/openssl/crypto/pem/message
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_all.c b/thirdparty/openssl/crypto/pem/pem_all.c
index 0e5be63ef..0e5be63ef 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_all.c
+++ b/thirdparty/openssl/crypto/pem/pem_all.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_err.c b/thirdparty/openssl/crypto/pem/pem_err.c
index e1f4fdb43..e1f4fdb43 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_err.c
+++ b/thirdparty/openssl/crypto/pem/pem_err.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_info.c b/thirdparty/openssl/crypto/pem/pem_info.c
index 4d736a1d0..4d736a1d0 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_info.c
+++ b/thirdparty/openssl/crypto/pem/pem_info.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_lib.c b/thirdparty/openssl/crypto/pem/pem_lib.c
index fe881d664..fe881d664 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_lib.c
+++ b/thirdparty/openssl/crypto/pem/pem_lib.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_oth.c b/thirdparty/openssl/crypto/pem/pem_oth.c
index 1dd3bd7a1..1dd3bd7a1 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_oth.c
+++ b/thirdparty/openssl/crypto/pem/pem_oth.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_pk8.c b/thirdparty/openssl/crypto/pem/pem_pk8.c
index 5747c7366..5747c7366 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_pk8.c
+++ b/thirdparty/openssl/crypto/pem/pem_pk8.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_pkey.c b/thirdparty/openssl/crypto/pem/pem_pkey.c
index 04d6319a2..04d6319a2 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_pkey.c
+++ b/thirdparty/openssl/crypto/pem/pem_pkey.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_seal.c b/thirdparty/openssl/crypto/pem/pem_seal.c
index a5c181257..a5c181257 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_seal.c
+++ b/thirdparty/openssl/crypto/pem/pem_seal.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_sign.c b/thirdparty/openssl/crypto/pem/pem_sign.c
index b5e5c29b0..b5e5c29b0 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_sign.c
+++ b/thirdparty/openssl/crypto/pem/pem_sign.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_x509.c b/thirdparty/openssl/crypto/pem/pem_x509.c
index 3c20ff28a..3c20ff28a 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_x509.c
+++ b/thirdparty/openssl/crypto/pem/pem_x509.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pem_xaux.c b/thirdparty/openssl/crypto/pem/pem_xaux.c
index c52343018..c52343018 100644
--- a/drivers/builtin_openssl2/crypto/pem/pem_xaux.c
+++ b/thirdparty/openssl/crypto/pem/pem_xaux.c
diff --git a/drivers/builtin_openssl2/crypto/pem/pkcs7.lis b/thirdparty/openssl/crypto/pem/pkcs7.lis
index be90c5d87..be90c5d87 100644
--- a/drivers/builtin_openssl2/crypto/pem/pkcs7.lis
+++ b/thirdparty/openssl/crypto/pem/pkcs7.lis
diff --git a/drivers/builtin_openssl2/crypto/pem/pvkfmt.c b/thirdparty/openssl/crypto/pem/pvkfmt.c
index 61864468f..61864468f 100644
--- a/drivers/builtin_openssl2/crypto/pem/pvkfmt.c
+++ b/thirdparty/openssl/crypto/pem/pvkfmt.c
diff --git a/drivers/builtin_openssl2/crypto/perlasm/readme b/thirdparty/openssl/crypto/perlasm/readme
index f02bbee75..f02bbee75 100644
--- a/drivers/builtin_openssl2/crypto/perlasm/readme
+++ b/thirdparty/openssl/crypto/perlasm/readme
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_add.c b/thirdparty/openssl/crypto/pkcs12/p12_add.c
index d9f03a39f..d9f03a39f 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_add.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_add.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_asn.c b/thirdparty/openssl/crypto/pkcs12/p12_asn.c
index 370ddbd6e..370ddbd6e 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_asn.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_asn.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_attr.c b/thirdparty/openssl/crypto/pkcs12/p12_attr.c
index fff3ba1ec..fff3ba1ec 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_attr.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_attr.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_crpt.c b/thirdparty/openssl/crypto/pkcs12/p12_crpt.c
index 9c2dcab02..9c2dcab02 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_crpt.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_crpt.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_crt.c b/thirdparty/openssl/crypto/pkcs12/p12_crt.c
index 7d2aeefac..7d2aeefac 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_crt.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_crt.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_decr.c b/thirdparty/openssl/crypto/pkcs12/p12_decr.c
index b40ea10cc..b40ea10cc 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_decr.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_decr.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_init.c b/thirdparty/openssl/crypto/pkcs12/p12_init.c
index 0322df944..0322df944 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_init.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_init.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_key.c b/thirdparty/openssl/crypto/pkcs12/p12_key.c
index 99b8260c9..99b8260c9 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_key.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_key.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_kiss.c b/thirdparty/openssl/crypto/pkcs12/p12_kiss.c
index 9aa3c90c4..9aa3c90c4 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_kiss.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_kiss.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_mutl.c b/thirdparty/openssl/crypto/pkcs12/p12_mutl.c
index a9277827f..a9277827f 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_mutl.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_mutl.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_npas.c b/thirdparty/openssl/crypto/pkcs12/p12_npas.c
index a89b61aba..a89b61aba 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_npas.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_npas.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_p8d.c b/thirdparty/openssl/crypto/pkcs12/p12_p8d.c
index 3cc7a9f40..3cc7a9f40 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_p8d.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_p8d.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c b/thirdparty/openssl/crypto/pkcs12/p12_p8e.c
index 861a087f8..861a087f8 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_p8e.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_utl.c b/thirdparty/openssl/crypto/pkcs12/p12_utl.c
index a0b992eab..a0b992eab 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_utl.c
+++ b/thirdparty/openssl/crypto/pkcs12/p12_utl.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/pk12err.c b/thirdparty/openssl/crypto/pkcs12/pk12err.c
index e58710b25..e58710b25 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/pk12err.c
+++ b/thirdparty/openssl/crypto/pkcs12/pk12err.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/bio_pk7.c b/thirdparty/openssl/crypto/pkcs7/bio_pk7.c
index fae1c564c..fae1c564c 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/bio_pk7.c
+++ b/thirdparty/openssl/crypto/pkcs7/bio_pk7.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pk7_asn1.c b/thirdparty/openssl/crypto/pkcs7/pk7_asn1.c
index 9c0a43981..9c0a43981 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pk7_asn1.c
+++ b/thirdparty/openssl/crypto/pkcs7/pk7_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pk7_attr.c b/thirdparty/openssl/crypto/pkcs7/pk7_attr.c
index 88922efe2..88922efe2 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pk7_attr.c
+++ b/thirdparty/openssl/crypto/pkcs7/pk7_attr.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pk7_dgst.c b/thirdparty/openssl/crypto/pkcs7/pk7_dgst.c
index 6b57f97ab..6b57f97ab 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pk7_dgst.c
+++ b/thirdparty/openssl/crypto/pkcs7/pk7_dgst.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pk7_doit.c b/thirdparty/openssl/crypto/pkcs7/pk7_doit.c
index 946aaa654..946aaa654 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pk7_doit.c
+++ b/thirdparty/openssl/crypto/pkcs7/pk7_doit.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pk7_enc.c b/thirdparty/openssl/crypto/pkcs7/pk7_enc.c
index 6983e014c..6983e014c 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pk7_enc.c
+++ b/thirdparty/openssl/crypto/pkcs7/pk7_enc.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pk7_lib.c b/thirdparty/openssl/crypto/pkcs7/pk7_lib.c
index 0c5fcaa6a..0c5fcaa6a 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pk7_lib.c
+++ b/thirdparty/openssl/crypto/pkcs7/pk7_lib.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pk7_mime.c b/thirdparty/openssl/crypto/pkcs7/pk7_mime.c
index 62fb2997e..62fb2997e 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pk7_mime.c
+++ b/thirdparty/openssl/crypto/pkcs7/pk7_mime.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pk7_smime.c b/thirdparty/openssl/crypto/pkcs7/pk7_smime.c
index dc9b48407..dc9b48407 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pk7_smime.c
+++ b/thirdparty/openssl/crypto/pkcs7/pk7_smime.c
diff --git a/drivers/builtin_openssl2/crypto/pkcs7/pkcs7err.c b/thirdparty/openssl/crypto/pkcs7/pkcs7err.c
index 323513fe8..323513fe8 100644
--- a/drivers/builtin_openssl2/crypto/pkcs7/pkcs7err.c
+++ b/thirdparty/openssl/crypto/pkcs7/pkcs7err.c
diff --git a/drivers/builtin_openssl2/crypto/ppc_arch.h b/thirdparty/openssl/crypto/ppc_arch.h
index b50ec996a..b50ec996a 100644
--- a/drivers/builtin_openssl2/crypto/ppc_arch.h
+++ b/thirdparty/openssl/crypto/ppc_arch.h
diff --git a/drivers/builtin_openssl2/crypto/ppccap.c b/thirdparty/openssl/crypto/ppccap.c
index 74af4732b..74af4732b 100644
--- a/drivers/builtin_openssl2/crypto/ppccap.c
+++ b/thirdparty/openssl/crypto/ppccap.c
diff --git a/drivers/builtin_openssl2/crypto/pqueue/pqueue.c b/thirdparty/openssl/crypto/pqueue/pqueue.c
index 75f973493..75f973493 100644
--- a/drivers/builtin_openssl2/crypto/pqueue/pqueue.c
+++ b/thirdparty/openssl/crypto/pqueue/pqueue.c
diff --git a/drivers/builtin_openssl2/crypto/rand/md_rand.c b/thirdparty/openssl/crypto/rand/md_rand.c
index 5c13d5776..5c13d5776 100644
--- a/drivers/builtin_openssl2/crypto/rand/md_rand.c
+++ b/thirdparty/openssl/crypto/rand/md_rand.c
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_egd.c b/thirdparty/openssl/crypto/rand/rand_egd.c
index 737aebfa2..737aebfa2 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_egd.c
+++ b/thirdparty/openssl/crypto/rand/rand_egd.c
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_err.c b/thirdparty/openssl/crypto/rand/rand_err.c
index 55d86ea8a..55d86ea8a 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_err.c
+++ b/thirdparty/openssl/crypto/rand/rand_err.c
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_lcl.h b/thirdparty/openssl/crypto/rand/rand_lcl.h
index f9fda3eb8..f9fda3eb8 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_lcl.h
+++ b/thirdparty/openssl/crypto/rand/rand_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_lib.c b/thirdparty/openssl/crypto/rand/rand_lib.c
index 88a78d350..88a78d350 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_lib.c
+++ b/thirdparty/openssl/crypto/rand/rand_lib.c
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_nw.c b/thirdparty/openssl/crypto/rand/rand_nw.c
index 55ffe9ad5..55ffe9ad5 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_nw.c
+++ b/thirdparty/openssl/crypto/rand/rand_nw.c
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_os2.c b/thirdparty/openssl/crypto/rand/rand_os2.c
index 706ab1e81..706ab1e81 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_os2.c
+++ b/thirdparty/openssl/crypto/rand/rand_os2.c
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_unix.c b/thirdparty/openssl/crypto/rand/rand_unix.c
index 266111edd..266111edd 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_unix.c
+++ b/thirdparty/openssl/crypto/rand/rand_unix.c
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_vms.c b/thirdparty/openssl/crypto/rand/rand_vms.c
index 0e10c363e..0e10c363e 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_vms.c
+++ b/thirdparty/openssl/crypto/rand/rand_vms.c
diff --git a/drivers/builtin_openssl2/crypto/rand/rand_win.c b/thirdparty/openssl/crypto/rand/rand_win.c
index 70fd52a7a..70fd52a7a 100644
--- a/drivers/builtin_openssl2/crypto/rand/rand_win.c
+++ b/thirdparty/openssl/crypto/rand/rand_win.c
diff --git a/drivers/builtin_openssl2/crypto/rand/randfile.c b/thirdparty/openssl/crypto/rand/randfile.c
index 9537c56a7..9537c56a7 100644
--- a/drivers/builtin_openssl2/crypto/rand/randfile.c
+++ b/thirdparty/openssl/crypto/rand/randfile.c
diff --git a/drivers/builtin_openssl2/crypto/rc2/rc2_cbc.c b/thirdparty/openssl/crypto/rc2/rc2_cbc.c
index 5eaf01d2e..5eaf01d2e 100644
--- a/drivers/builtin_openssl2/crypto/rc2/rc2_cbc.c
+++ b/thirdparty/openssl/crypto/rc2/rc2_cbc.c
diff --git a/drivers/builtin_openssl2/crypto/rc2/rc2_ecb.c b/thirdparty/openssl/crypto/rc2/rc2_ecb.c
index 48442a3f3..48442a3f3 100644
--- a/drivers/builtin_openssl2/crypto/rc2/rc2_ecb.c
+++ b/thirdparty/openssl/crypto/rc2/rc2_ecb.c
diff --git a/drivers/builtin_openssl2/crypto/rc2/rc2_locl.h b/thirdparty/openssl/crypto/rc2/rc2_locl.h
index e72a20c0c..e72a20c0c 100644
--- a/drivers/builtin_openssl2/crypto/rc2/rc2_locl.h
+++ b/thirdparty/openssl/crypto/rc2/rc2_locl.h
diff --git a/drivers/builtin_openssl2/crypto/rc2/rc2_skey.c b/thirdparty/openssl/crypto/rc2/rc2_skey.c
index bcec0a85d..bcec0a85d 100644
--- a/drivers/builtin_openssl2/crypto/rc2/rc2_skey.c
+++ b/thirdparty/openssl/crypto/rc2/rc2_skey.c
diff --git a/drivers/builtin_openssl2/crypto/rc2/rc2cfb64.c b/thirdparty/openssl/crypto/rc2/rc2cfb64.c
index 8b5929fde..8b5929fde 100644
--- a/drivers/builtin_openssl2/crypto/rc2/rc2cfb64.c
+++ b/thirdparty/openssl/crypto/rc2/rc2cfb64.c
diff --git a/drivers/builtin_openssl2/crypto/rc2/rc2ofb64.c b/thirdparty/openssl/crypto/rc2/rc2ofb64.c
index b9f4d8c35..b9f4d8c35 100644
--- a/drivers/builtin_openssl2/crypto/rc2/rc2ofb64.c
+++ b/thirdparty/openssl/crypto/rc2/rc2ofb64.c
diff --git a/drivers/builtin_openssl2/crypto/rc2/rc2speed.c b/thirdparty/openssl/crypto/rc2/rc2speed.c
index 3e45eb084..3e45eb084 100644
--- a/drivers/builtin_openssl2/crypto/rc2/rc2speed.c
+++ b/thirdparty/openssl/crypto/rc2/rc2speed.c
diff --git a/drivers/builtin_openssl2/crypto/rc2/rrc2.doc b/thirdparty/openssl/crypto/rc2/rrc2.doc
index f93ee003d..f93ee003d 100644
--- a/drivers/builtin_openssl2/crypto/rc2/rrc2.doc
+++ b/thirdparty/openssl/crypto/rc2/rrc2.doc
diff --git a/drivers/builtin_openssl2/crypto/rc2/tab.c b/thirdparty/openssl/crypto/rc2/tab.c
index 0534e3750..0534e3750 100644
--- a/drivers/builtin_openssl2/crypto/rc2/tab.c
+++ b/thirdparty/openssl/crypto/rc2/tab.c
diff --git a/drivers/builtin_openssl2/crypto/rc2/version b/thirdparty/openssl/crypto/rc2/version
index 6f89d595f..6f89d595f 100644
--- a/drivers/builtin_openssl2/crypto/rc2/version
+++ b/thirdparty/openssl/crypto/rc2/version
diff --git a/drivers/builtin_openssl2/crypto/rc4/rc4.c b/thirdparty/openssl/crypto/rc4/rc4.c
index 99082e891..99082e891 100644
--- a/drivers/builtin_openssl2/crypto/rc4/rc4.c
+++ b/thirdparty/openssl/crypto/rc4/rc4.c
diff --git a/drivers/builtin_openssl2/crypto/rc4/rc4_enc.c b/thirdparty/openssl/crypto/rc4/rc4_enc.c
index 0f0a2487a..0f0a2487a 100644
--- a/drivers/builtin_openssl2/crypto/rc4/rc4_enc.c
+++ b/thirdparty/openssl/crypto/rc4/rc4_enc.c
diff --git a/drivers/builtin_openssl2/crypto/rc4/rc4_locl.h b/thirdparty/openssl/crypto/rc4/rc4_locl.h
index faf8742f0..faf8742f0 100644
--- a/drivers/builtin_openssl2/crypto/rc4/rc4_locl.h
+++ b/thirdparty/openssl/crypto/rc4/rc4_locl.h
diff --git a/drivers/builtin_openssl2/crypto/rc4/rc4_skey.c b/thirdparty/openssl/crypto/rc4/rc4_skey.c
index 06890d16a..06890d16a 100644
--- a/drivers/builtin_openssl2/crypto/rc4/rc4_skey.c
+++ b/thirdparty/openssl/crypto/rc4/rc4_skey.c
diff --git a/drivers/builtin_openssl2/crypto/rc4/rc4_utl.c b/thirdparty/openssl/crypto/rc4/rc4_utl.c
index cbd4a24e4..cbd4a24e4 100644
--- a/drivers/builtin_openssl2/crypto/rc4/rc4_utl.c
+++ b/thirdparty/openssl/crypto/rc4/rc4_utl.c
diff --git a/drivers/builtin_openssl2/crypto/rc4/rc4s.cpp b/thirdparty/openssl/crypto/rc4/rc4s.cpp
index 3814fde99..3814fde99 100644
--- a/drivers/builtin_openssl2/crypto/rc4/rc4s.cpp
+++ b/thirdparty/openssl/crypto/rc4/rc4s.cpp
diff --git a/drivers/builtin_openssl2/crypto/rc4/rc4speed.c b/thirdparty/openssl/crypto/rc4/rc4speed.c
index 3f13a2b2b..3f13a2b2b 100644
--- a/drivers/builtin_openssl2/crypto/rc4/rc4speed.c
+++ b/thirdparty/openssl/crypto/rc4/rc4speed.c
diff --git a/drivers/builtin_openssl2/crypto/rc4/rrc4.doc b/thirdparty/openssl/crypto/rc4/rrc4.doc
index 2f9a953c1..2f9a953c1 100644
--- a/drivers/builtin_openssl2/crypto/rc4/rrc4.doc
+++ b/thirdparty/openssl/crypto/rc4/rrc4.doc
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5.h b/thirdparty/openssl/crypto/rc5/rc5.h
index fba613713..fba613713 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5.h
+++ b/thirdparty/openssl/crypto/rc5/rc5.h
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5_ecb.c b/thirdparty/openssl/crypto/rc5/rc5_ecb.c
index e657a93b9..e657a93b9 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5_ecb.c
+++ b/thirdparty/openssl/crypto/rc5/rc5_ecb.c
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5_enc.c b/thirdparty/openssl/crypto/rc5/rc5_enc.c
index 06b89d83a..06b89d83a 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5_enc.c
+++ b/thirdparty/openssl/crypto/rc5/rc5_enc.c
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5_locl.h b/thirdparty/openssl/crypto/rc5/rc5_locl.h
index ee757e647..ee757e647 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5_locl.h
+++ b/thirdparty/openssl/crypto/rc5/rc5_locl.h
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5_skey.c b/thirdparty/openssl/crypto/rc5/rc5_skey.c
index 5dd4a5274..5dd4a5274 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5_skey.c
+++ b/thirdparty/openssl/crypto/rc5/rc5_skey.c
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5cfb64.c b/thirdparty/openssl/crypto/rc5/rc5cfb64.c
index a3813e030..a3813e030 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5cfb64.c
+++ b/thirdparty/openssl/crypto/rc5/rc5cfb64.c
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5ofb64.c b/thirdparty/openssl/crypto/rc5/rc5ofb64.c
index d3c63067b..d3c63067b 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5ofb64.c
+++ b/thirdparty/openssl/crypto/rc5/rc5ofb64.c
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5s.cpp b/thirdparty/openssl/crypto/rc5/rc5s.cpp
index 1c5518bc8..1c5518bc8 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5s.cpp
+++ b/thirdparty/openssl/crypto/rc5/rc5s.cpp
diff --git a/drivers/builtin_openssl2/crypto/rc5/rc5speed.c b/thirdparty/openssl/crypto/rc5/rc5speed.c
index 3f595704a..3f595704a 100644
--- a/drivers/builtin_openssl2/crypto/rc5/rc5speed.c
+++ b/thirdparty/openssl/crypto/rc5/rc5speed.c
diff --git a/drivers/builtin_openssl2/crypto/ripemd/README b/thirdparty/openssl/crypto/ripemd/README
index f1ffc8b13..f1ffc8b13 100644
--- a/drivers/builtin_openssl2/crypto/ripemd/README
+++ b/thirdparty/openssl/crypto/ripemd/README
diff --git a/drivers/builtin_openssl2/crypto/ripemd/asm/rips.cpp b/thirdparty/openssl/crypto/ripemd/asm/rips.cpp
index f7a13677a..f7a13677a 100644
--- a/drivers/builtin_openssl2/crypto/ripemd/asm/rips.cpp
+++ b/thirdparty/openssl/crypto/ripemd/asm/rips.cpp
diff --git a/drivers/builtin_openssl2/crypto/ripemd/rmd160.c b/thirdparty/openssl/crypto/ripemd/rmd160.c
index a4f800704..a4f800704 100644
--- a/drivers/builtin_openssl2/crypto/ripemd/rmd160.c
+++ b/thirdparty/openssl/crypto/ripemd/rmd160.c
diff --git a/drivers/builtin_openssl2/crypto/ripemd/rmd_dgst.c b/thirdparty/openssl/crypto/ripemd/rmd_dgst.c
index 4ddd939fc..4ddd939fc 100644
--- a/drivers/builtin_openssl2/crypto/ripemd/rmd_dgst.c
+++ b/thirdparty/openssl/crypto/ripemd/rmd_dgst.c
diff --git a/drivers/builtin_openssl2/crypto/ripemd/rmd_locl.h b/thirdparty/openssl/crypto/ripemd/rmd_locl.h
index 26e025633..26e025633 100644
--- a/drivers/builtin_openssl2/crypto/ripemd/rmd_locl.h
+++ b/thirdparty/openssl/crypto/ripemd/rmd_locl.h
diff --git a/drivers/builtin_openssl2/crypto/ripemd/rmd_one.c b/thirdparty/openssl/crypto/ripemd/rmd_one.c
index 666e01a41..666e01a41 100644
--- a/drivers/builtin_openssl2/crypto/ripemd/rmd_one.c
+++ b/thirdparty/openssl/crypto/ripemd/rmd_one.c
diff --git a/drivers/builtin_openssl2/crypto/ripemd/rmdconst.h b/thirdparty/openssl/crypto/ripemd/rmdconst.h
index 8fe33de14..8fe33de14 100644
--- a/drivers/builtin_openssl2/crypto/ripemd/rmdconst.h
+++ b/thirdparty/openssl/crypto/ripemd/rmdconst.h
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_ameth.c b/thirdparty/openssl/crypto/rsa/rsa_ameth.c
index 4e0621827..4e0621827 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_ameth.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_ameth.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_asn1.c b/thirdparty/openssl/crypto/rsa/rsa_asn1.c
index aff8b583f..aff8b583f 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_asn1.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_chk.c b/thirdparty/openssl/crypto/rsa/rsa_chk.c
index 607faa001..607faa001 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_chk.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_chk.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_crpt.c b/thirdparty/openssl/crypto/rsa/rsa_crpt.c
index 5c416b53f..5c416b53f 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_crpt.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_crpt.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_depr.c b/thirdparty/openssl/crypto/rsa/rsa_depr.c
index 32f0c8887..32f0c8887 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_depr.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_depr.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_eay.c b/thirdparty/openssl/crypto/rsa/rsa_eay.c
index b147fff8b..b147fff8b 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_eay.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_eay.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_err.c b/thirdparty/openssl/crypto/rsa/rsa_err.c
index 0bab05efc..0bab05efc 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_err.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_err.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_gen.c b/thirdparty/openssl/crypto/rsa/rsa_gen.c
index 7f7dca39f..7f7dca39f 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_gen.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_gen.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_lib.c b/thirdparty/openssl/crypto/rsa/rsa_lib.c
index a6805debc..a6805debc 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_lib.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_lib.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_locl.h b/thirdparty/openssl/crypto/rsa/rsa_locl.h
index 3e88187d9..3e88187d9 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_locl.h
+++ b/thirdparty/openssl/crypto/rsa/rsa_locl.h
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_none.c b/thirdparty/openssl/crypto/rsa/rsa_none.c
index 982b31f28..982b31f28 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_none.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_none.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_null.c b/thirdparty/openssl/crypto/rsa/rsa_null.c
index 241b431ad..241b431ad 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_null.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_null.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_oaep.c b/thirdparty/openssl/crypto/rsa/rsa_oaep.c
index 9c2a943cf..9c2a943cf 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_oaep.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_oaep.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_pk1.c b/thirdparty/openssl/crypto/rsa/rsa_pk1.c
index efa1fd3e9..efa1fd3e9 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_pk1.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_pk1.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_pmeth.c b/thirdparty/openssl/crypto/rsa/rsa_pmeth.c
index 203635595..203635595 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_pmeth.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_pmeth.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_prn.c b/thirdparty/openssl/crypto/rsa/rsa_prn.c
index 076f871b3..076f871b3 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_prn.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_prn.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_pss.c b/thirdparty/openssl/crypto/rsa/rsa_pss.c
index 41bc0844e..41bc0844e 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_pss.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_pss.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_saos.c b/thirdparty/openssl/crypto/rsa/rsa_saos.c
index e40023605..e40023605 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_saos.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_saos.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_sign.c b/thirdparty/openssl/crypto/rsa/rsa_sign.c
index 82ca8324d..82ca8324d 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_sign.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_sign.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_ssl.c b/thirdparty/openssl/crypto/rsa/rsa_ssl.c
index 746e01f64..746e01f64 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_ssl.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_ssl.c
diff --git a/drivers/builtin_openssl2/crypto/rsa/rsa_x931.c b/thirdparty/openssl/crypto/rsa/rsa_x931.c
index 725ead049..725ead049 100644
--- a/drivers/builtin_openssl2/crypto/rsa/rsa_x931.c
+++ b/thirdparty/openssl/crypto/rsa/rsa_x931.c
diff --git a/drivers/builtin_openssl2/crypto/s390xcap.c b/thirdparty/openssl/crypto/s390xcap.c
index 47d6b6ff5..47d6b6ff5 100644
--- a/drivers/builtin_openssl2/crypto/s390xcap.c
+++ b/thirdparty/openssl/crypto/s390xcap.c
diff --git a/drivers/builtin_openssl2/crypto/seed/seed.c b/thirdparty/openssl/crypto/seed/seed.c
index a90587227..a90587227 100644
--- a/drivers/builtin_openssl2/crypto/seed/seed.c
+++ b/thirdparty/openssl/crypto/seed/seed.c
diff --git a/drivers/builtin_openssl2/crypto/seed/seed_cbc.c b/thirdparty/openssl/crypto/seed/seed_cbc.c
index ee1115b4c..ee1115b4c 100644
--- a/drivers/builtin_openssl2/crypto/seed/seed_cbc.c
+++ b/thirdparty/openssl/crypto/seed/seed_cbc.c
diff --git a/drivers/builtin_openssl2/crypto/seed/seed_cfb.c b/thirdparty/openssl/crypto/seed/seed_cfb.c
index b6a5648b3..b6a5648b3 100644
--- a/drivers/builtin_openssl2/crypto/seed/seed_cfb.c
+++ b/thirdparty/openssl/crypto/seed/seed_cfb.c
diff --git a/drivers/builtin_openssl2/crypto/seed/seed_ecb.c b/thirdparty/openssl/crypto/seed/seed_ecb.c
index 9363d5508..9363d5508 100644
--- a/drivers/builtin_openssl2/crypto/seed/seed_ecb.c
+++ b/thirdparty/openssl/crypto/seed/seed_ecb.c
diff --git a/drivers/builtin_openssl2/crypto/seed/seed_locl.h b/thirdparty/openssl/crypto/seed/seed_locl.h
index 96ec43022..96ec43022 100644
--- a/drivers/builtin_openssl2/crypto/seed/seed_locl.h
+++ b/thirdparty/openssl/crypto/seed/seed_locl.h
diff --git a/drivers/builtin_openssl2/crypto/seed/seed_ofb.c b/thirdparty/openssl/crypto/seed/seed_ofb.c
index 48b71224c..48b71224c 100644
--- a/drivers/builtin_openssl2/crypto/seed/seed_ofb.c
+++ b/thirdparty/openssl/crypto/seed/seed_ofb.c
diff --git a/drivers/builtin_openssl2/crypto/sha/asm/README b/thirdparty/openssl/crypto/sha/asm/README
index b7e755765..b7e755765 100644
--- a/drivers/builtin_openssl2/crypto/sha/asm/README
+++ b/thirdparty/openssl/crypto/sha/asm/README
diff --git a/drivers/builtin_openssl2/crypto/sha/sha.c b/thirdparty/openssl/crypto/sha/sha.c
index cfc12f3ed..cfc12f3ed 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha.c
+++ b/thirdparty/openssl/crypto/sha/sha.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha1.c b/thirdparty/openssl/crypto/sha/sha1.c
index 8dd19431b..8dd19431b 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha1.c
+++ b/thirdparty/openssl/crypto/sha/sha1.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha1_one.c b/thirdparty/openssl/crypto/sha/sha1_one.c
index a6dd760a1..a6dd760a1 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha1_one.c
+++ b/thirdparty/openssl/crypto/sha/sha1_one.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha1dgst.c b/thirdparty/openssl/crypto/sha/sha1dgst.c
index a67f1fe36..a67f1fe36 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha1dgst.c
+++ b/thirdparty/openssl/crypto/sha/sha1dgst.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha256.c b/thirdparty/openssl/crypto/sha/sha256.c
index 72a115936..72a115936 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha256.c
+++ b/thirdparty/openssl/crypto/sha/sha256.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha256t.c b/thirdparty/openssl/crypto/sha/sha256t.c
index 35dbbc2a9..35dbbc2a9 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha256t.c
+++ b/thirdparty/openssl/crypto/sha/sha256t.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha512.c b/thirdparty/openssl/crypto/sha/sha512.c
index 3bf66ae19..3bf66ae19 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha512.c
+++ b/thirdparty/openssl/crypto/sha/sha512.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha512t.c b/thirdparty/openssl/crypto/sha/sha512t.c
index 178882fc7..178882fc7 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha512t.c
+++ b/thirdparty/openssl/crypto/sha/sha512t.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha_dgst.c b/thirdparty/openssl/crypto/sha/sha_dgst.c
index f77cf5e38..f77cf5e38 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha_dgst.c
+++ b/thirdparty/openssl/crypto/sha/sha_dgst.c
diff --git a/drivers/builtin_openssl2/crypto/sha/sha_locl.h b/thirdparty/openssl/crypto/sha/sha_locl.h
index 03bd411ed..03bd411ed 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha_locl.h
+++ b/thirdparty/openssl/crypto/sha/sha_locl.h
diff --git a/drivers/builtin_openssl2/crypto/sha/sha_one.c b/thirdparty/openssl/crypto/sha/sha_one.c
index 0930b98a6..0930b98a6 100644
--- a/drivers/builtin_openssl2/crypto/sha/sha_one.c
+++ b/thirdparty/openssl/crypto/sha/sha_one.c
diff --git a/drivers/builtin_openssl2/crypto/sparc_arch.h b/thirdparty/openssl/crypto/sparc_arch.h
index e30d322a4..e30d322a4 100644
--- a/drivers/builtin_openssl2/crypto/sparc_arch.h
+++ b/thirdparty/openssl/crypto/sparc_arch.h
diff --git a/drivers/builtin_openssl2/crypto/sparcv9cap.c b/thirdparty/openssl/crypto/sparcv9cap.c
index a36e46179..a36e46179 100644
--- a/drivers/builtin_openssl2/crypto/sparcv9cap.c
+++ b/thirdparty/openssl/crypto/sparcv9cap.c
diff --git a/drivers/builtin_openssl2/crypto/srp/srp_grps.h b/thirdparty/openssl/crypto/srp/srp_grps.h
index 31312de15..31312de15 100644
--- a/drivers/builtin_openssl2/crypto/srp/srp_grps.h
+++ b/thirdparty/openssl/crypto/srp/srp_grps.h
diff --git a/drivers/builtin_openssl2/crypto/srp/srp_lcl.h b/thirdparty/openssl/crypto/srp/srp_lcl.h
index 9a7fce1b4..9a7fce1b4 100644
--- a/drivers/builtin_openssl2/crypto/srp/srp_lcl.h
+++ b/thirdparty/openssl/crypto/srp/srp_lcl.h
diff --git a/drivers/builtin_openssl2/crypto/srp/srp_lib.c b/thirdparty/openssl/crypto/srp/srp_lib.c
index e9a2e058f..e9a2e058f 100644
--- a/drivers/builtin_openssl2/crypto/srp/srp_lib.c
+++ b/thirdparty/openssl/crypto/srp/srp_lib.c
diff --git a/drivers/builtin_openssl2/crypto/srp/srp_vfy.c b/thirdparty/openssl/crypto/srp/srp_vfy.c
index 26ad3e07b..26ad3e07b 100644
--- a/drivers/builtin_openssl2/crypto/srp/srp_vfy.c
+++ b/thirdparty/openssl/crypto/srp/srp_vfy.c
diff --git a/drivers/builtin_openssl2/crypto/stack/stack.c b/thirdparty/openssl/crypto/stack/stack.c
index fa50083e2..fa50083e2 100644
--- a/drivers/builtin_openssl2/crypto/stack/stack.c
+++ b/thirdparty/openssl/crypto/stack/stack.c
diff --git a/drivers/builtin_openssl2/crypto/store/README b/thirdparty/openssl/crypto/store/README
index 966168f6a..966168f6a 100644
--- a/drivers/builtin_openssl2/crypto/store/README
+++ b/thirdparty/openssl/crypto/store/README
diff --git a/drivers/builtin_openssl2/crypto/store/store.h b/thirdparty/openssl/crypto/store/store.h
index ce3709d9f..ce3709d9f 100644
--- a/drivers/builtin_openssl2/crypto/store/store.h
+++ b/thirdparty/openssl/crypto/store/store.h
diff --git a/drivers/builtin_openssl2/crypto/store/str_err.c b/thirdparty/openssl/crypto/store/str_err.c
index 9858e606e..9858e606e 100644
--- a/drivers/builtin_openssl2/crypto/store/str_err.c
+++ b/thirdparty/openssl/crypto/store/str_err.c
diff --git a/drivers/builtin_openssl2/crypto/store/str_lib.c b/thirdparty/openssl/crypto/store/str_lib.c
index e3d5da938..e3d5da938 100644
--- a/drivers/builtin_openssl2/crypto/store/str_lib.c
+++ b/thirdparty/openssl/crypto/store/str_lib.c
diff --git a/drivers/builtin_openssl2/crypto/store/str_locl.h b/thirdparty/openssl/crypto/store/str_locl.h
index c0b40f0db..c0b40f0db 100644
--- a/drivers/builtin_openssl2/crypto/store/str_locl.h
+++ b/thirdparty/openssl/crypto/store/str_locl.h
diff --git a/drivers/builtin_openssl2/crypto/store/str_mem.c b/thirdparty/openssl/crypto/store/str_mem.c
index 6eee5bba2..6eee5bba2 100644
--- a/drivers/builtin_openssl2/crypto/store/str_mem.c
+++ b/thirdparty/openssl/crypto/store/str_mem.c
diff --git a/drivers/builtin_openssl2/crypto/store/str_meth.c b/thirdparty/openssl/crypto/store/str_meth.c
index c83fbc565..c83fbc565 100644
--- a/drivers/builtin_openssl2/crypto/store/str_meth.c
+++ b/thirdparty/openssl/crypto/store/str_meth.c
diff --git a/drivers/builtin_openssl2/crypto/threads/README b/thirdparty/openssl/crypto/threads/README
index df6b26e14..df6b26e14 100644
--- a/drivers/builtin_openssl2/crypto/threads/README
+++ b/thirdparty/openssl/crypto/threads/README
diff --git a/drivers/builtin_openssl2/crypto/threads/netware.bat b/thirdparty/openssl/crypto/threads/netware.bat
index 0b3eca3ca..0b3eca3ca 100644
--- a/drivers/builtin_openssl2/crypto/threads/netware.bat
+++ b/thirdparty/openssl/crypto/threads/netware.bat
diff --git a/drivers/builtin_openssl2/crypto/threads/profile.sh b/thirdparty/openssl/crypto/threads/profile.sh
index 6e3e342fc..6e3e342fc 100644
--- a/drivers/builtin_openssl2/crypto/threads/profile.sh
+++ b/thirdparty/openssl/crypto/threads/profile.sh
diff --git a/drivers/builtin_openssl2/crypto/threads/ptest.bat b/thirdparty/openssl/crypto/threads/ptest.bat
index 4071b5ffe..4071b5ffe 100755
--- a/drivers/builtin_openssl2/crypto/threads/ptest.bat
+++ b/thirdparty/openssl/crypto/threads/ptest.bat
diff --git a/drivers/builtin_openssl2/crypto/threads/pthread.sh b/thirdparty/openssl/crypto/threads/pthread.sh
index f1c49821d..f1c49821d 100644
--- a/drivers/builtin_openssl2/crypto/threads/pthread.sh
+++ b/thirdparty/openssl/crypto/threads/pthread.sh
diff --git a/drivers/builtin_openssl2/crypto/threads/pthread2.sh b/thirdparty/openssl/crypto/threads/pthread2.sh
index ec945c451..ec945c451 100755
--- a/drivers/builtin_openssl2/crypto/threads/pthread2.sh
+++ b/thirdparty/openssl/crypto/threads/pthread2.sh
diff --git a/drivers/builtin_openssl2/crypto/threads/pthreads-vms.com b/thirdparty/openssl/crypto/threads/pthreads-vms.com
index 1cf92bdf5..1cf92bdf5 100644
--- a/drivers/builtin_openssl2/crypto/threads/pthreads-vms.com
+++ b/thirdparty/openssl/crypto/threads/pthreads-vms.com
diff --git a/drivers/builtin_openssl2/crypto/threads/purify.sh b/thirdparty/openssl/crypto/threads/purify.sh
index 6d44fe26b..6d44fe26b 100644
--- a/drivers/builtin_openssl2/crypto/threads/purify.sh
+++ b/thirdparty/openssl/crypto/threads/purify.sh
diff --git a/drivers/builtin_openssl2/crypto/threads/solaris.sh b/thirdparty/openssl/crypto/threads/solaris.sh
index bc93094a2..bc93094a2 100644
--- a/drivers/builtin_openssl2/crypto/threads/solaris.sh
+++ b/thirdparty/openssl/crypto/threads/solaris.sh
diff --git a/drivers/builtin_openssl2/crypto/threads/th-lock.c b/thirdparty/openssl/crypto/threads/th-lock.c
index cc8cf2581..cc8cf2581 100644
--- a/drivers/builtin_openssl2/crypto/threads/th-lock.c
+++ b/thirdparty/openssl/crypto/threads/th-lock.c
diff --git a/drivers/builtin_openssl2/crypto/threads/win32.bat b/thirdparty/openssl/crypto/threads/win32.bat
index ee6da80a0..ee6da80a0 100755
--- a/drivers/builtin_openssl2/crypto/threads/win32.bat
+++ b/thirdparty/openssl/crypto/threads/win32.bat
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_asn1.c b/thirdparty/openssl/crypto/ts/ts_asn1.c
index 657dc4ca4..657dc4ca4 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_asn1.c
+++ b/thirdparty/openssl/crypto/ts/ts_asn1.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_conf.c b/thirdparty/openssl/crypto/ts/ts_conf.c
index 4716b2336..4716b2336 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_conf.c
+++ b/thirdparty/openssl/crypto/ts/ts_conf.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_err.c b/thirdparty/openssl/crypto/ts/ts_err.c
index ff1abf453..ff1abf453 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_err.c
+++ b/thirdparty/openssl/crypto/ts/ts_err.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_lib.c b/thirdparty/openssl/crypto/ts/ts_lib.c
index c51538a17..c51538a17 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_lib.c
+++ b/thirdparty/openssl/crypto/ts/ts_lib.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_req_print.c b/thirdparty/openssl/crypto/ts/ts_req_print.c
index 31940eef5..31940eef5 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_req_print.c
+++ b/thirdparty/openssl/crypto/ts/ts_req_print.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_req_utils.c b/thirdparty/openssl/crypto/ts/ts_req_utils.c
index 362e5e589..362e5e589 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_req_utils.c
+++ b/thirdparty/openssl/crypto/ts/ts_req_utils.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_rsp_print.c b/thirdparty/openssl/crypto/ts/ts_rsp_print.c
index e706a5687..e706a5687 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_rsp_print.c
+++ b/thirdparty/openssl/crypto/ts/ts_rsp_print.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_rsp_sign.c b/thirdparty/openssl/crypto/ts/ts_rsp_sign.c
index db6ce3241..db6ce3241 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_rsp_sign.c
+++ b/thirdparty/openssl/crypto/ts/ts_rsp_sign.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_rsp_utils.c b/thirdparty/openssl/crypto/ts/ts_rsp_utils.c
index f6f63329a..f6f63329a 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_rsp_utils.c
+++ b/thirdparty/openssl/crypto/ts/ts_rsp_utils.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_rsp_verify.c b/thirdparty/openssl/crypto/ts/ts_rsp_verify.c
index 29aa5a497..29aa5a497 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_rsp_verify.c
+++ b/thirdparty/openssl/crypto/ts/ts_rsp_verify.c
diff --git a/drivers/builtin_openssl2/crypto/ts/ts_verify_ctx.c b/thirdparty/openssl/crypto/ts/ts_verify_ctx.c
index 3e6fcb57b..3e6fcb57b 100644
--- a/drivers/builtin_openssl2/crypto/ts/ts_verify_ctx.c
+++ b/thirdparty/openssl/crypto/ts/ts_verify_ctx.c
diff --git a/drivers/builtin_openssl2/crypto/txt_db/txt_db.c b/thirdparty/openssl/crypto/txt_db/txt_db.c
index f9b42ac6e..f9b42ac6e 100644
--- a/drivers/builtin_openssl2/crypto/txt_db/txt_db.c
+++ b/thirdparty/openssl/crypto/txt_db/txt_db.c
diff --git a/drivers/builtin_openssl2/crypto/ui/ui_compat.c b/thirdparty/openssl/crypto/ui/ui_compat.c
index e79d54eea..e79d54eea 100644
--- a/drivers/builtin_openssl2/crypto/ui/ui_compat.c
+++ b/thirdparty/openssl/crypto/ui/ui_compat.c
diff --git a/drivers/builtin_openssl2/crypto/ui/ui_err.c b/thirdparty/openssl/crypto/ui/ui_err.c
index 8097da836..8097da836 100644
--- a/drivers/builtin_openssl2/crypto/ui/ui_err.c
+++ b/thirdparty/openssl/crypto/ui/ui_err.c
diff --git a/drivers/builtin_openssl2/crypto/ui/ui_lib.c b/thirdparty/openssl/crypto/ui/ui_lib.c
index 2f580352c..2f580352c 100644
--- a/drivers/builtin_openssl2/crypto/ui/ui_lib.c
+++ b/thirdparty/openssl/crypto/ui/ui_lib.c
diff --git a/drivers/builtin_openssl2/crypto/ui/ui_locl.h b/thirdparty/openssl/crypto/ui/ui_locl.h
index bebc13abf..bebc13abf 100644
--- a/drivers/builtin_openssl2/crypto/ui/ui_locl.h
+++ b/thirdparty/openssl/crypto/ui/ui_locl.h
diff --git a/drivers/builtin_openssl2/crypto/ui/ui_openssl.c b/thirdparty/openssl/crypto/ui/ui_openssl.c
index 9ab259b8f..9ab259b8f 100644
--- a/drivers/builtin_openssl2/crypto/ui/ui_openssl.c
+++ b/thirdparty/openssl/crypto/ui/ui_openssl.c
diff --git a/drivers/builtin_openssl2/crypto/ui/ui_util.c b/thirdparty/openssl/crypto/ui/ui_util.c
index 0f290115d..0f290115d 100644
--- a/drivers/builtin_openssl2/crypto/ui/ui_util.c
+++ b/thirdparty/openssl/crypto/ui/ui_util.c
diff --git a/drivers/builtin_openssl2/crypto/uid.c b/thirdparty/openssl/crypto/uid.c
index 90694c672..90694c672 100644
--- a/drivers/builtin_openssl2/crypto/uid.c
+++ b/thirdparty/openssl/crypto/uid.c
diff --git a/drivers/builtin_openssl2/crypto/vms_rms.h b/thirdparty/openssl/crypto/vms_rms.h
index 09c280e87..09c280e87 100644
--- a/drivers/builtin_openssl2/crypto/vms_rms.h
+++ b/thirdparty/openssl/crypto/vms_rms.h
diff --git a/drivers/builtin_openssl2/crypto/whrlpool/wp_block.c b/thirdparty/openssl/crypto/whrlpool/wp_block.c
index 920430bd6..920430bd6 100644
--- a/drivers/builtin_openssl2/crypto/whrlpool/wp_block.c
+++ b/thirdparty/openssl/crypto/whrlpool/wp_block.c
diff --git a/drivers/builtin_openssl2/crypto/whrlpool/wp_dgst.c b/thirdparty/openssl/crypto/whrlpool/wp_dgst.c
index e33bb4f83..e33bb4f83 100644
--- a/drivers/builtin_openssl2/crypto/whrlpool/wp_dgst.c
+++ b/thirdparty/openssl/crypto/whrlpool/wp_dgst.c
diff --git a/drivers/builtin_openssl2/crypto/whrlpool/wp_locl.h b/thirdparty/openssl/crypto/whrlpool/wp_locl.h
index 6e7b549e1..6e7b549e1 100644
--- a/drivers/builtin_openssl2/crypto/whrlpool/wp_locl.h
+++ b/thirdparty/openssl/crypto/whrlpool/wp_locl.h
diff --git a/drivers/builtin_openssl2/crypto/x509/by_dir.c b/thirdparty/openssl/crypto/x509/by_dir.c
index 9ee8f8d85..9ee8f8d85 100644
--- a/drivers/builtin_openssl2/crypto/x509/by_dir.c
+++ b/thirdparty/openssl/crypto/x509/by_dir.c
diff --git a/drivers/builtin_openssl2/crypto/x509/by_file.c b/thirdparty/openssl/crypto/x509/by_file.c
index 43a073003..43a073003 100644
--- a/drivers/builtin_openssl2/crypto/x509/by_file.c
+++ b/thirdparty/openssl/crypto/x509/by_file.c
diff --git a/drivers/builtin_openssl2/crypto/x509/vpm_int.h b/thirdparty/openssl/crypto/x509/vpm_int.h
index 9c55defc5..9c55defc5 100644
--- a/drivers/builtin_openssl2/crypto/x509/vpm_int.h
+++ b/thirdparty/openssl/crypto/x509/vpm_int.h
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_att.c b/thirdparty/openssl/crypto/x509/x509_att.c
index bd59281f9..bd59281f9 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_att.c
+++ b/thirdparty/openssl/crypto/x509/x509_att.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_cmp.c b/thirdparty/openssl/crypto/x509/x509_cmp.c
index 49c71b912..49c71b912 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_cmp.c
+++ b/thirdparty/openssl/crypto/x509/x509_cmp.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_d2.c b/thirdparty/openssl/crypto/x509/x509_d2.c
index 50ca2a6d1..50ca2a6d1 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_d2.c
+++ b/thirdparty/openssl/crypto/x509/x509_d2.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_def.c b/thirdparty/openssl/crypto/x509/x509_def.c
index 25c553755..25c553755 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_def.c
+++ b/thirdparty/openssl/crypto/x509/x509_def.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_err.c b/thirdparty/openssl/crypto/x509/x509_err.c
index 1e779fefd..1e779fefd 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_err.c
+++ b/thirdparty/openssl/crypto/x509/x509_err.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_ext.c b/thirdparty/openssl/crypto/x509/x509_ext.c
index fb4e311d7..fb4e311d7 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_ext.c
+++ b/thirdparty/openssl/crypto/x509/x509_ext.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_lu.c b/thirdparty/openssl/crypto/x509/x509_lu.c
index 50120a4d7..50120a4d7 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_lu.c
+++ b/thirdparty/openssl/crypto/x509/x509_lu.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_obj.c b/thirdparty/openssl/crypto/x509/x509_obj.c
index 3de3ac720..3de3ac720 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_obj.c
+++ b/thirdparty/openssl/crypto/x509/x509_obj.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_r2x.c b/thirdparty/openssl/crypto/x509/x509_r2x.c
index 0ff439c99..0ff439c99 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_r2x.c
+++ b/thirdparty/openssl/crypto/x509/x509_r2x.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_req.c b/thirdparty/openssl/crypto/x509/x509_req.c
index 01795f4b3..01795f4b3 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_req.c
+++ b/thirdparty/openssl/crypto/x509/x509_req.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_set.c b/thirdparty/openssl/crypto/x509/x509_set.c
index 5b802bd6c..5b802bd6c 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_set.c
+++ b/thirdparty/openssl/crypto/x509/x509_set.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_trs.c b/thirdparty/openssl/crypto/x509/x509_trs.c
index 11e076340..11e076340 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_trs.c
+++ b/thirdparty/openssl/crypto/x509/x509_trs.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_txt.c b/thirdparty/openssl/crypto/x509/x509_txt.c
index 3d46d3ff8..3d46d3ff8 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_txt.c
+++ b/thirdparty/openssl/crypto/x509/x509_txt.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_v3.c b/thirdparty/openssl/crypto/x509/x509_v3.c
index 4a03445a6..4a03445a6 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_v3.c
+++ b/thirdparty/openssl/crypto/x509/x509_v3.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_vfy.c b/thirdparty/openssl/crypto/x509/x509_vfy.c
index 4d34dbac9..4d34dbac9 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_vfy.c
+++ b/thirdparty/openssl/crypto/x509/x509_vfy.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509_vpm.c b/thirdparty/openssl/crypto/x509/x509_vpm.c
index 1ac15a881..1ac15a881 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509_vpm.c
+++ b/thirdparty/openssl/crypto/x509/x509_vpm.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509cset.c b/thirdparty/openssl/crypto/x509/x509cset.c
index 24ca35b58..24ca35b58 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509cset.c
+++ b/thirdparty/openssl/crypto/x509/x509cset.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509name.c b/thirdparty/openssl/crypto/x509/x509name.c
index 6ea601f96..6ea601f96 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509name.c
+++ b/thirdparty/openssl/crypto/x509/x509name.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509rset.c b/thirdparty/openssl/crypto/x509/x509rset.c
index 80e273e64..80e273e64 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509rset.c
+++ b/thirdparty/openssl/crypto/x509/x509rset.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509spki.c b/thirdparty/openssl/crypto/x509/x509spki.c
index 2df84ead9..2df84ead9 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509spki.c
+++ b/thirdparty/openssl/crypto/x509/x509spki.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x509type.c b/thirdparty/openssl/crypto/x509/x509type.c
index 9219f753b..9219f753b 100644
--- a/drivers/builtin_openssl2/crypto/x509/x509type.c
+++ b/thirdparty/openssl/crypto/x509/x509type.c
diff --git a/drivers/builtin_openssl2/crypto/x509/x_all.c b/thirdparty/openssl/crypto/x509/x_all.c
index 0f26c546d..0f26c546d 100644
--- a/drivers/builtin_openssl2/crypto/x509/x_all.c
+++ b/thirdparty/openssl/crypto/x509/x_all.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/ext_dat.h b/thirdparty/openssl/crypto/x509v3/ext_dat.h
index c3a6fce75..c3a6fce75 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/ext_dat.h
+++ b/thirdparty/openssl/crypto/x509v3/ext_dat.h
diff --git a/drivers/builtin_openssl2/crypto/x509v3/pcy_cache.c b/thirdparty/openssl/crypto/x509v3/pcy_cache.c
index c8f41f24b..c8f41f24b 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/pcy_cache.c
+++ b/thirdparty/openssl/crypto/x509v3/pcy_cache.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/pcy_data.c b/thirdparty/openssl/crypto/x509v3/pcy_data.c
index 90e9970e4..90e9970e4 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/pcy_data.c
+++ b/thirdparty/openssl/crypto/x509v3/pcy_data.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/pcy_int.h b/thirdparty/openssl/crypto/x509v3/pcy_int.h
index b5075f9ed..b5075f9ed 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/pcy_int.h
+++ b/thirdparty/openssl/crypto/x509v3/pcy_int.h
diff --git a/drivers/builtin_openssl2/crypto/x509v3/pcy_lib.c b/thirdparty/openssl/crypto/x509v3/pcy_lib.c
index dbb29835f..dbb29835f 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/pcy_lib.c
+++ b/thirdparty/openssl/crypto/x509v3/pcy_lib.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/pcy_map.c b/thirdparty/openssl/crypto/x509v3/pcy_map.c
index b99eb91cf..b99eb91cf 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/pcy_map.c
+++ b/thirdparty/openssl/crypto/x509v3/pcy_map.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/pcy_node.c b/thirdparty/openssl/crypto/x509v3/pcy_node.c
index d6c917650..d6c917650 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/pcy_node.c
+++ b/thirdparty/openssl/crypto/x509v3/pcy_node.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/pcy_tree.c b/thirdparty/openssl/crypto/x509v3/pcy_tree.c
index 09b8691c8..09b8691c8 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/pcy_tree.c
+++ b/thirdparty/openssl/crypto/x509v3/pcy_tree.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_addr.c b/thirdparty/openssl/crypto/x509v3/v3_addr.c
index 94cfed050..94cfed050 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_addr.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_addr.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_akey.c b/thirdparty/openssl/crypto/x509v3/v3_akey.c
index e920270e1..e920270e1 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_akey.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_akey.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_akeya.c b/thirdparty/openssl/crypto/x509v3/v3_akeya.c
index 2cc85b762..2cc85b762 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_akeya.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_akeya.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_alt.c b/thirdparty/openssl/crypto/x509v3/v3_alt.c
index 22ec20284..22ec20284 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_alt.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_alt.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_asid.c b/thirdparty/openssl/crypto/x509v3/v3_asid.c
index 2a32c9d0c..2a32c9d0c 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_asid.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_asid.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_bcons.c b/thirdparty/openssl/crypto/x509v3/v3_bcons.c
index dc00b9cb0..dc00b9cb0 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_bcons.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_bcons.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_bitst.c b/thirdparty/openssl/crypto/x509v3/v3_bitst.c
index b7bb3b556..b7bb3b556 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_bitst.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_bitst.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_conf.c b/thirdparty/openssl/crypto/x509v3/v3_conf.c
index eeff8bd18..eeff8bd18 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_conf.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_conf.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_cpols.c b/thirdparty/openssl/crypto/x509v3/v3_cpols.c
index d97f6226b..d97f6226b 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_cpols.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_cpols.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_crld.c b/thirdparty/openssl/crypto/x509v3/v3_crld.c
index d3e1d1b05..d3e1d1b05 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_crld.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_crld.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_enum.c b/thirdparty/openssl/crypto/x509v3/v3_enum.c
index 7678664fc..7678664fc 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_enum.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_enum.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_extku.c b/thirdparty/openssl/crypto/x509v3/v3_extku.c
index 6092c2e4b..6092c2e4b 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_extku.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_extku.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_genn.c b/thirdparty/openssl/crypto/x509v3/v3_genn.c
index 7f40bfabe..7f40bfabe 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_genn.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_genn.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_ia5.c b/thirdparty/openssl/crypto/x509v3/v3_ia5.c
index c170a55ff..c170a55ff 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_ia5.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_ia5.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_info.c b/thirdparty/openssl/crypto/x509v3/v3_info.c
index e052a34b9..e052a34b9 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_info.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_info.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_int.c b/thirdparty/openssl/crypto/x509v3/v3_int.c
index 8bfdb37e7..8bfdb37e7 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_int.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_int.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_lib.c b/thirdparty/openssl/crypto/x509v3/v3_lib.c
index 8350429aa..8350429aa 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_lib.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_lib.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_ncons.c b/thirdparty/openssl/crypto/x509v3/v3_ncons.c
index 285526966..285526966 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_ncons.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_ncons.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_ocsp.c b/thirdparty/openssl/crypto/x509v3/v3_ocsp.c
index b151eaccb..b151eaccb 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_ocsp.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_ocsp.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_pci.c b/thirdparty/openssl/crypto/x509v3/v3_pci.c
index 34cad53cb..34cad53cb 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_pci.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_pci.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_pcia.c b/thirdparty/openssl/crypto/x509v3/v3_pcia.c
index e53c82e8d..e53c82e8d 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_pcia.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_pcia.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_pcons.c b/thirdparty/openssl/crypto/x509v3/v3_pcons.c
index cfccb97de..cfccb97de 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_pcons.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_pcons.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_pku.c b/thirdparty/openssl/crypto/x509v3/v3_pku.c
index dd01c4416..dd01c4416 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_pku.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_pku.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_pmaps.c b/thirdparty/openssl/crypto/x509v3/v3_pmaps.c
index a168343b8..a168343b8 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_pmaps.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_pmaps.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_prn.c b/thirdparty/openssl/crypto/x509v3/v3_prn.c
index acc9c6d99..acc9c6d99 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_prn.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_prn.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_purp.c b/thirdparty/openssl/crypto/x509v3/v3_purp.c
index 845be673b..845be673b 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_purp.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_purp.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_scts.c b/thirdparty/openssl/crypto/x509v3/v3_scts.c
index 0b7c68180..0b7c68180 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_scts.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_scts.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_skey.c b/thirdparty/openssl/crypto/x509v3/v3_skey.c
index 1cede0472..1cede0472 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_skey.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_skey.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_sxnet.c b/thirdparty/openssl/crypto/x509v3/v3_sxnet.c
index a4e6a93e0..a4e6a93e0 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_sxnet.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_sxnet.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3_utl.c b/thirdparty/openssl/crypto/x509v3/v3_utl.c
index 43b9cb9c5..43b9cb9c5 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3_utl.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_utl.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3conf.c b/thirdparty/openssl/crypto/x509v3/v3conf.c
index 41aa26694..41aa26694 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3conf.c
+++ b/thirdparty/openssl/crypto/x509v3/v3conf.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3err.c b/thirdparty/openssl/crypto/x509v3/v3err.c
index bcc1be722..bcc1be722 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3err.c
+++ b/thirdparty/openssl/crypto/x509v3/v3err.c
diff --git a/drivers/builtin_openssl2/crypto/x509v3/v3prin.c b/thirdparty/openssl/crypto/x509v3/v3prin.c
index cbc357079..cbc357079 100644
--- a/drivers/builtin_openssl2/crypto/x509v3/v3prin.c
+++ b/thirdparty/openssl/crypto/x509v3/v3prin.c
diff --git a/drivers/builtin_openssl2/e_os.h b/thirdparty/openssl/e_os.h
index 1fa36c171..1fa36c171 100644
--- a/drivers/builtin_openssl2/e_os.h
+++ b/thirdparty/openssl/e_os.h
diff --git a/drivers/builtin_openssl2/openssl/aes.h b/thirdparty/openssl/openssl/aes.h
index faa66c491..faa66c491 100644
--- a/drivers/builtin_openssl2/openssl/aes.h
+++ b/thirdparty/openssl/openssl/aes.h
diff --git a/drivers/builtin_openssl2/openssl/asn1.h b/thirdparty/openssl/openssl/asn1.h
index 68e791fcd..68e791fcd 100644
--- a/drivers/builtin_openssl2/openssl/asn1.h
+++ b/thirdparty/openssl/openssl/asn1.h
diff --git a/drivers/builtin_openssl2/openssl/asn1_mac.h b/thirdparty/openssl/openssl/asn1_mac.h
index abc6dc35c..abc6dc35c 100644
--- a/drivers/builtin_openssl2/openssl/asn1_mac.h
+++ b/thirdparty/openssl/openssl/asn1_mac.h
diff --git a/drivers/builtin_openssl2/openssl/asn1t.h b/thirdparty/openssl/openssl/asn1t.h
index 99bc0eecf..99bc0eecf 100644
--- a/drivers/builtin_openssl2/openssl/asn1t.h
+++ b/thirdparty/openssl/openssl/asn1t.h
diff --git a/drivers/builtin_openssl2/openssl/bio.h b/thirdparty/openssl/openssl/bio.h
index 6790aed28..6790aed28 100644
--- a/drivers/builtin_openssl2/openssl/bio.h
+++ b/thirdparty/openssl/openssl/bio.h
diff --git a/drivers/builtin_openssl2/openssl/blowfish.h b/thirdparty/openssl/openssl/blowfish.h
index 832930272..832930272 100644
--- a/drivers/builtin_openssl2/openssl/blowfish.h
+++ b/thirdparty/openssl/openssl/blowfish.h
diff --git a/drivers/builtin_openssl2/openssl/bn.h b/thirdparty/openssl/openssl/bn.h
index 86264ae63..86264ae63 100644
--- a/drivers/builtin_openssl2/openssl/bn.h
+++ b/thirdparty/openssl/openssl/bn.h
diff --git a/drivers/builtin_openssl2/openssl/buffer.h b/thirdparty/openssl/openssl/buffer.h
index efd240a5f..efd240a5f 100644
--- a/drivers/builtin_openssl2/openssl/buffer.h
+++ b/thirdparty/openssl/openssl/buffer.h
diff --git a/drivers/builtin_openssl2/openssl/camellia.h b/thirdparty/openssl/openssl/camellia.h
index 45e8d25b1..45e8d25b1 100644
--- a/drivers/builtin_openssl2/openssl/camellia.h
+++ b/thirdparty/openssl/openssl/camellia.h
diff --git a/drivers/builtin_openssl2/openssl/cast.h b/thirdparty/openssl/openssl/cast.h
index 0003ec9c7..0003ec9c7 100644
--- a/drivers/builtin_openssl2/openssl/cast.h
+++ b/thirdparty/openssl/openssl/cast.h
diff --git a/drivers/builtin_openssl2/openssl/cmac.h b/thirdparty/openssl/openssl/cmac.h
index 175be8348..175be8348 100644
--- a/drivers/builtin_openssl2/openssl/cmac.h
+++ b/thirdparty/openssl/openssl/cmac.h
diff --git a/drivers/builtin_openssl2/openssl/cms.h b/thirdparty/openssl/openssl/cms.h
index e6c7f964b..e6c7f964b 100644
--- a/drivers/builtin_openssl2/openssl/cms.h
+++ b/thirdparty/openssl/openssl/cms.h
diff --git a/drivers/builtin_openssl2/openssl/comp.h b/thirdparty/openssl/openssl/comp.h
index 60a073404..60a073404 100644
--- a/drivers/builtin_openssl2/openssl/comp.h
+++ b/thirdparty/openssl/openssl/comp.h
diff --git a/drivers/builtin_openssl2/openssl/conf.h b/thirdparty/openssl/openssl/conf.h
index 8d926d5d8..8d926d5d8 100644
--- a/drivers/builtin_openssl2/openssl/conf.h
+++ b/thirdparty/openssl/openssl/conf.h
diff --git a/drivers/builtin_openssl2/openssl/conf_api.h b/thirdparty/openssl/openssl/conf_api.h
index e478f7df4..e478f7df4 100644
--- a/drivers/builtin_openssl2/openssl/conf_api.h
+++ b/thirdparty/openssl/openssl/conf_api.h
diff --git a/drivers/builtin_openssl2/openssl/crypto.h b/thirdparty/openssl/openssl/crypto.h
index 6c644ce12..6c644ce12 100644
--- a/drivers/builtin_openssl2/openssl/crypto.h
+++ b/thirdparty/openssl/openssl/crypto.h
diff --git a/drivers/builtin_openssl2/openssl/des.h b/thirdparty/openssl/openssl/des.h
index 1b40144e1..1b40144e1 100644
--- a/drivers/builtin_openssl2/openssl/des.h
+++ b/thirdparty/openssl/openssl/des.h
diff --git a/drivers/builtin_openssl2/openssl/des_old.h b/thirdparty/openssl/openssl/des_old.h
index ee7607a24..ee7607a24 100644
--- a/drivers/builtin_openssl2/openssl/des_old.h
+++ b/thirdparty/openssl/openssl/des_old.h
diff --git a/drivers/builtin_openssl2/openssl/dh.h b/thirdparty/openssl/openssl/dh.h
index a5bd9016a..a5bd9016a 100644
--- a/drivers/builtin_openssl2/openssl/dh.h
+++ b/thirdparty/openssl/openssl/dh.h
diff --git a/drivers/builtin_openssl2/openssl/dsa.h b/thirdparty/openssl/openssl/dsa.h
index 545358fd0..545358fd0 100644
--- a/drivers/builtin_openssl2/openssl/dsa.h
+++ b/thirdparty/openssl/openssl/dsa.h
diff --git a/drivers/builtin_openssl2/openssl/dso.h b/thirdparty/openssl/openssl/dso.h
index c9013f5ce..c9013f5ce 100644
--- a/drivers/builtin_openssl2/openssl/dso.h
+++ b/thirdparty/openssl/openssl/dso.h
diff --git a/drivers/builtin_openssl2/openssl/dtls1.h b/thirdparty/openssl/openssl/dtls1.h
index a58aca248..a58aca248 100644
--- a/drivers/builtin_openssl2/openssl/dtls1.h
+++ b/thirdparty/openssl/openssl/dtls1.h
diff --git a/drivers/builtin_openssl2/openssl/e_os2.h b/thirdparty/openssl/openssl/e_os2.h
index 7be9989ac..7be9989ac 100644
--- a/drivers/builtin_openssl2/openssl/e_os2.h
+++ b/thirdparty/openssl/openssl/e_os2.h
diff --git a/drivers/builtin_openssl2/openssl/ebcdic.h b/thirdparty/openssl/openssl/ebcdic.h
index 4cbdfeb7a..4cbdfeb7a 100644
--- a/drivers/builtin_openssl2/openssl/ebcdic.h
+++ b/thirdparty/openssl/openssl/ebcdic.h
diff --git a/drivers/builtin_openssl2/openssl/ec.h b/thirdparty/openssl/openssl/ec.h
index 81e6faf6c..81e6faf6c 100644
--- a/drivers/builtin_openssl2/openssl/ec.h
+++ b/thirdparty/openssl/openssl/ec.h
diff --git a/drivers/builtin_openssl2/openssl/ecdh.h b/thirdparty/openssl/openssl/ecdh.h
index 25348b30f..25348b30f 100644
--- a/drivers/builtin_openssl2/openssl/ecdh.h
+++ b/thirdparty/openssl/openssl/ecdh.h
diff --git a/drivers/builtin_openssl2/openssl/ecdsa.h b/thirdparty/openssl/openssl/ecdsa.h
index a6f0930f8..a6f0930f8 100644
--- a/drivers/builtin_openssl2/openssl/ecdsa.h
+++ b/thirdparty/openssl/openssl/ecdsa.h
diff --git a/drivers/builtin_openssl2/openssl/engine.h b/thirdparty/openssl/openssl/engine.h
index bd7b59144..bd7b59144 100644
--- a/drivers/builtin_openssl2/openssl/engine.h
+++ b/thirdparty/openssl/openssl/engine.h
diff --git a/drivers/builtin_openssl2/openssl/err.h b/thirdparty/openssl/openssl/err.h
index 585aa8ba3..585aa8ba3 100644
--- a/drivers/builtin_openssl2/openssl/err.h
+++ b/thirdparty/openssl/openssl/err.h
diff --git a/drivers/builtin_openssl2/openssl/evp.h b/thirdparty/openssl/openssl/evp.h
index 39ab7937d..39ab7937d 100644
--- a/drivers/builtin_openssl2/openssl/evp.h
+++ b/thirdparty/openssl/openssl/evp.h
diff --git a/drivers/builtin_openssl2/openssl/hmac.h b/thirdparty/openssl/openssl/hmac.h
index b8b55cda7..b8b55cda7 100644
--- a/drivers/builtin_openssl2/openssl/hmac.h
+++ b/thirdparty/openssl/openssl/hmac.h
diff --git a/drivers/builtin_openssl2/openssl/idea.h b/thirdparty/openssl/openssl/idea.h
index 607598403..607598403 100644
--- a/drivers/builtin_openssl2/openssl/idea.h
+++ b/thirdparty/openssl/openssl/idea.h
diff --git a/drivers/builtin_openssl2/openssl/krb5_asn.h b/thirdparty/openssl/openssl/krb5_asn.h
index 9cf5a26dd..9cf5a26dd 100644
--- a/drivers/builtin_openssl2/openssl/krb5_asn.h
+++ b/thirdparty/openssl/openssl/krb5_asn.h
diff --git a/drivers/builtin_openssl2/openssl/kssl.h b/thirdparty/openssl/openssl/kssl.h
index ae8a51f47..ae8a51f47 100644
--- a/drivers/builtin_openssl2/openssl/kssl.h
+++ b/thirdparty/openssl/openssl/kssl.h
diff --git a/drivers/builtin_openssl2/openssl/lhash.h b/thirdparty/openssl/openssl/lhash.h
index b6c328bff..b6c328bff 100644
--- a/drivers/builtin_openssl2/openssl/lhash.h
+++ b/thirdparty/openssl/openssl/lhash.h
diff --git a/drivers/builtin_openssl2/openssl/md4.h b/thirdparty/openssl/openssl/md4.h
index 11fd71295..11fd71295 100644
--- a/drivers/builtin_openssl2/openssl/md4.h
+++ b/thirdparty/openssl/openssl/md4.h
diff --git a/drivers/builtin_openssl2/openssl/md5.h b/thirdparty/openssl/openssl/md5.h
index 300d3f346..300d3f346 100644
--- a/drivers/builtin_openssl2/openssl/md5.h
+++ b/thirdparty/openssl/openssl/md5.h
diff --git a/drivers/builtin_openssl2/openssl/mdc2.h b/thirdparty/openssl/openssl/mdc2.h
index 7efe53bc2..7efe53bc2 100644
--- a/drivers/builtin_openssl2/openssl/mdc2.h
+++ b/thirdparty/openssl/openssl/mdc2.h
diff --git a/drivers/builtin_openssl2/openssl/modes.h b/thirdparty/openssl/openssl/modes.h
index fd488499a..fd488499a 100644
--- a/drivers/builtin_openssl2/openssl/modes.h
+++ b/thirdparty/openssl/openssl/modes.h
diff --git a/drivers/builtin_openssl2/openssl/obj_mac.h b/thirdparty/openssl/openssl/obj_mac.h
index 779c309b8..779c309b8 100644
--- a/drivers/builtin_openssl2/openssl/obj_mac.h
+++ b/thirdparty/openssl/openssl/obj_mac.h
diff --git a/drivers/builtin_openssl2/openssl/objects.h b/thirdparty/openssl/openssl/objects.h
index b8dafa89c..b8dafa89c 100644
--- a/drivers/builtin_openssl2/openssl/objects.h
+++ b/thirdparty/openssl/openssl/objects.h
diff --git a/drivers/builtin_openssl2/openssl/ocsp.h b/thirdparty/openssl/openssl/ocsp.h
index ca2ee76dc..ca2ee76dc 100644
--- a/drivers/builtin_openssl2/openssl/ocsp.h
+++ b/thirdparty/openssl/openssl/ocsp.h
diff --git a/drivers/builtin_openssl2/openssl/opensslconf.h b/thirdparty/openssl/openssl/opensslconf.h
index c86bb60b9..c86bb60b9 100644
--- a/drivers/builtin_openssl2/openssl/opensslconf.h
+++ b/thirdparty/openssl/openssl/opensslconf.h
diff --git a/drivers/builtin_openssl2/openssl/opensslv.h b/thirdparty/openssl/openssl/opensslv.h
index 13fe44023..13fe44023 100644
--- a/drivers/builtin_openssl2/openssl/opensslv.h
+++ b/thirdparty/openssl/openssl/opensslv.h
diff --git a/drivers/builtin_openssl2/openssl/ossl_typ.h b/thirdparty/openssl/openssl/ossl_typ.h
index 9144ea2cf..9144ea2cf 100644
--- a/drivers/builtin_openssl2/openssl/ossl_typ.h
+++ b/thirdparty/openssl/openssl/ossl_typ.h
diff --git a/drivers/builtin_openssl2/openssl/pem.h b/thirdparty/openssl/openssl/pem.h
index d3b23fc99..d3b23fc99 100644
--- a/drivers/builtin_openssl2/openssl/pem.h
+++ b/thirdparty/openssl/openssl/pem.h
diff --git a/drivers/builtin_openssl2/openssl/pem2.h b/thirdparty/openssl/openssl/pem2.h
index 84897d5ec..84897d5ec 100644
--- a/drivers/builtin_openssl2/openssl/pem2.h
+++ b/thirdparty/openssl/openssl/pem2.h
diff --git a/drivers/builtin_openssl2/openssl/pkcs12.h b/thirdparty/openssl/openssl/pkcs12.h
index a39adf5eb..a39adf5eb 100644
--- a/drivers/builtin_openssl2/openssl/pkcs12.h
+++ b/thirdparty/openssl/openssl/pkcs12.h
diff --git a/drivers/builtin_openssl2/openssl/pkcs7.h b/thirdparty/openssl/openssl/pkcs7.h
index b51b3863e..b51b3863e 100644
--- a/drivers/builtin_openssl2/openssl/pkcs7.h
+++ b/thirdparty/openssl/openssl/pkcs7.h
diff --git a/drivers/builtin_openssl2/openssl/pqueue.h b/thirdparty/openssl/openssl/pqueue.h
index d40d9c7d8..d40d9c7d8 100644
--- a/drivers/builtin_openssl2/openssl/pqueue.h
+++ b/thirdparty/openssl/openssl/pqueue.h
diff --git a/drivers/builtin_openssl2/openssl/rand.h b/thirdparty/openssl/openssl/rand.h
index 66068834e..66068834e 100644
--- a/drivers/builtin_openssl2/openssl/rand.h
+++ b/thirdparty/openssl/openssl/rand.h
diff --git a/drivers/builtin_openssl2/openssl/rc2.h b/thirdparty/openssl/openssl/rc2.h
index 29d02d732..29d02d732 100644
--- a/drivers/builtin_openssl2/openssl/rc2.h
+++ b/thirdparty/openssl/openssl/rc2.h
diff --git a/drivers/builtin_openssl2/openssl/rc4.h b/thirdparty/openssl/openssl/rc4.h
index 39162b164..39162b164 100644
--- a/drivers/builtin_openssl2/openssl/rc4.h
+++ b/thirdparty/openssl/openssl/rc4.h
diff --git a/drivers/builtin_openssl2/openssl/ripemd.h b/thirdparty/openssl/openssl/ripemd.h
index b88ef25e7..b88ef25e7 100644
--- a/drivers/builtin_openssl2/openssl/ripemd.h
+++ b/thirdparty/openssl/openssl/ripemd.h
diff --git a/drivers/builtin_openssl2/openssl/rsa.h b/thirdparty/openssl/openssl/rsa.h
index d2ee37406..d2ee37406 100644
--- a/drivers/builtin_openssl2/openssl/rsa.h
+++ b/thirdparty/openssl/openssl/rsa.h
diff --git a/drivers/builtin_openssl2/openssl/safestack.h b/thirdparty/openssl/openssl/safestack.h
index 1d4f87eab..1d4f87eab 100644
--- a/drivers/builtin_openssl2/openssl/safestack.h
+++ b/thirdparty/openssl/openssl/safestack.h
diff --git a/drivers/builtin_openssl2/openssl/seed.h b/thirdparty/openssl/openssl/seed.h
index 8cbf0d928..8cbf0d928 100644
--- a/drivers/builtin_openssl2/openssl/seed.h
+++ b/thirdparty/openssl/openssl/seed.h
diff --git a/drivers/builtin_openssl2/openssl/sha.h b/thirdparty/openssl/openssl/sha.h
index e5169e4fe..e5169e4fe 100644
--- a/drivers/builtin_openssl2/openssl/sha.h
+++ b/thirdparty/openssl/openssl/sha.h
diff --git a/drivers/builtin_openssl2/openssl/srp.h b/thirdparty/openssl/openssl/srp.h
index 028892a1f..028892a1f 100644
--- a/drivers/builtin_openssl2/openssl/srp.h
+++ b/thirdparty/openssl/openssl/srp.h
diff --git a/drivers/builtin_openssl2/openssl/srtp.h b/thirdparty/openssl/openssl/srtp.h
index 2279c32b8..2279c32b8 100644
--- a/drivers/builtin_openssl2/openssl/srtp.h
+++ b/thirdparty/openssl/openssl/srtp.h
diff --git a/drivers/builtin_openssl2/openssl/ssl.h b/thirdparty/openssl/openssl/ssl.h
index 5ef56faa5..5ef56faa5 100644
--- a/drivers/builtin_openssl2/openssl/ssl.h
+++ b/thirdparty/openssl/openssl/ssl.h
diff --git a/drivers/builtin_openssl2/openssl/ssl2.h b/thirdparty/openssl/openssl/ssl2.h
index 03c7dd8ca..03c7dd8ca 100644
--- a/drivers/builtin_openssl2/openssl/ssl2.h
+++ b/thirdparty/openssl/openssl/ssl2.h
diff --git a/drivers/builtin_openssl2/openssl/ssl23.h b/thirdparty/openssl/openssl/ssl23.h
index 9de4685af..9de4685af 100644
--- a/drivers/builtin_openssl2/openssl/ssl23.h
+++ b/thirdparty/openssl/openssl/ssl23.h
diff --git a/drivers/builtin_openssl2/openssl/ssl3.h b/thirdparty/openssl/openssl/ssl3.h
index e681d50a9..e681d50a9 100644
--- a/drivers/builtin_openssl2/openssl/ssl3.h
+++ b/thirdparty/openssl/openssl/ssl3.h
diff --git a/drivers/builtin_openssl2/openssl/stack.h b/thirdparty/openssl/openssl/stack.h
index eb0721665..eb0721665 100644
--- a/drivers/builtin_openssl2/openssl/stack.h
+++ b/thirdparty/openssl/openssl/stack.h
diff --git a/drivers/builtin_openssl2/openssl/symhacks.h b/thirdparty/openssl/openssl/symhacks.h
index 239fa4fb1..239fa4fb1 100644
--- a/drivers/builtin_openssl2/openssl/symhacks.h
+++ b/thirdparty/openssl/openssl/symhacks.h
diff --git a/drivers/builtin_openssl2/openssl/tls1.h b/thirdparty/openssl/openssl/tls1.h
index 7e237d063..7e237d063 100644
--- a/drivers/builtin_openssl2/openssl/tls1.h
+++ b/thirdparty/openssl/openssl/tls1.h
diff --git a/drivers/builtin_openssl2/openssl/ts.h b/thirdparty/openssl/openssl/ts.h
index 16eccbb38..16eccbb38 100644
--- a/drivers/builtin_openssl2/openssl/ts.h
+++ b/thirdparty/openssl/openssl/ts.h
diff --git a/drivers/builtin_openssl2/openssl/txt_db.h b/thirdparty/openssl/openssl/txt_db.h
index 98e23a200..98e23a200 100644
--- a/drivers/builtin_openssl2/openssl/txt_db.h
+++ b/thirdparty/openssl/openssl/txt_db.h
diff --git a/drivers/builtin_openssl2/openssl/ui.h b/thirdparty/openssl/openssl/ui.h
index 0dc16330b..0dc16330b 100644
--- a/drivers/builtin_openssl2/openssl/ui.h
+++ b/thirdparty/openssl/openssl/ui.h
diff --git a/drivers/builtin_openssl2/openssl/ui_compat.h b/thirdparty/openssl/openssl/ui_compat.h
index bf541542c..bf541542c 100644
--- a/drivers/builtin_openssl2/openssl/ui_compat.h
+++ b/thirdparty/openssl/openssl/ui_compat.h
diff --git a/drivers/builtin_openssl2/openssl/whrlpool.h b/thirdparty/openssl/openssl/whrlpool.h
index 73c749da8..73c749da8 100644
--- a/drivers/builtin_openssl2/openssl/whrlpool.h
+++ b/thirdparty/openssl/openssl/whrlpool.h
diff --git a/drivers/builtin_openssl2/openssl/x509.h b/thirdparty/openssl/openssl/x509.h
index fc613ce63..fc613ce63 100644
--- a/drivers/builtin_openssl2/openssl/x509.h
+++ b/thirdparty/openssl/openssl/x509.h
diff --git a/drivers/builtin_openssl2/openssl/x509_vfy.h b/thirdparty/openssl/openssl/x509_vfy.h
index 2663e1c0a..2663e1c0a 100644
--- a/drivers/builtin_openssl2/openssl/x509_vfy.h
+++ b/thirdparty/openssl/openssl/x509_vfy.h
diff --git a/drivers/builtin_openssl2/openssl/x509v3.h b/thirdparty/openssl/openssl/x509v3.h
index f5c61560a..f5c61560a 100644
--- a/drivers/builtin_openssl2/openssl/x509v3.h
+++ b/thirdparty/openssl/openssl/x509v3.h
diff --git a/drivers/builtin_openssl2/ssl/bio_ssl.c b/thirdparty/openssl/ssl/bio_ssl.c
index d2d4d2ea2..d2d4d2ea2 100644
--- a/drivers/builtin_openssl2/ssl/bio_ssl.c
+++ b/thirdparty/openssl/ssl/bio_ssl.c
diff --git a/drivers/builtin_openssl2/ssl/d1_both.c b/thirdparty/openssl/ssl/d1_both.c
index 5d26c9492..5d26c9492 100644
--- a/drivers/builtin_openssl2/ssl/d1_both.c
+++ b/thirdparty/openssl/ssl/d1_both.c
diff --git a/drivers/builtin_openssl2/ssl/d1_clnt.c b/thirdparty/openssl/ssl/d1_clnt.c
index 3ddfa7bca..3ddfa7bca 100644
--- a/drivers/builtin_openssl2/ssl/d1_clnt.c
+++ b/thirdparty/openssl/ssl/d1_clnt.c
diff --git a/drivers/builtin_openssl2/ssl/d1_lib.c b/thirdparty/openssl/ssl/d1_lib.c
index ee78921ba..ee78921ba 100644
--- a/drivers/builtin_openssl2/ssl/d1_lib.c
+++ b/thirdparty/openssl/ssl/d1_lib.c
diff --git a/drivers/builtin_openssl2/ssl/d1_meth.c b/thirdparty/openssl/ssl/d1_meth.c
index 899010e98..899010e98 100644
--- a/drivers/builtin_openssl2/ssl/d1_meth.c
+++ b/thirdparty/openssl/ssl/d1_meth.c
diff --git a/drivers/builtin_openssl2/ssl/d1_pkt.c b/thirdparty/openssl/ssl/d1_pkt.c
index fe30ec7d0..fe30ec7d0 100644
--- a/drivers/builtin_openssl2/ssl/d1_pkt.c
+++ b/thirdparty/openssl/ssl/d1_pkt.c
diff --git a/drivers/builtin_openssl2/ssl/d1_srtp.c b/thirdparty/openssl/ssl/d1_srtp.c
index 64d0634a3..64d0634a3 100644
--- a/drivers/builtin_openssl2/ssl/d1_srtp.c
+++ b/thirdparty/openssl/ssl/d1_srtp.c
diff --git a/drivers/builtin_openssl2/ssl/d1_srvr.c b/thirdparty/openssl/ssl/d1_srvr.c
index e677d880f..e677d880f 100644
--- a/drivers/builtin_openssl2/ssl/d1_srvr.c
+++ b/thirdparty/openssl/ssl/d1_srvr.c
diff --git a/drivers/builtin_openssl2/ssl/install-ssl.com b/thirdparty/openssl/ssl/install-ssl.com
index afe6967f8..afe6967f8 100755
--- a/drivers/builtin_openssl2/ssl/install-ssl.com
+++ b/thirdparty/openssl/ssl/install-ssl.com
diff --git a/drivers/builtin_openssl2/ssl/kssl.c b/thirdparty/openssl/ssl/kssl.c
index f2839bdcd..f2839bdcd 100644
--- a/drivers/builtin_openssl2/ssl/kssl.c
+++ b/thirdparty/openssl/ssl/kssl.c
diff --git a/drivers/builtin_openssl2/ssl/kssl_lcl.h b/thirdparty/openssl/ssl/kssl_lcl.h
index 8e6a6d69e..8e6a6d69e 100644
--- a/drivers/builtin_openssl2/ssl/kssl_lcl.h
+++ b/thirdparty/openssl/ssl/kssl_lcl.h
diff --git a/drivers/builtin_openssl2/ssl/s23_clnt.c b/thirdparty/openssl/ssl/s23_clnt.c
index f782010c4..f782010c4 100644
--- a/drivers/builtin_openssl2/ssl/s23_clnt.c
+++ b/thirdparty/openssl/ssl/s23_clnt.c
diff --git a/drivers/builtin_openssl2/ssl/s23_lib.c b/thirdparty/openssl/ssl/s23_lib.c
index 9056d39e8..9056d39e8 100644
--- a/drivers/builtin_openssl2/ssl/s23_lib.c
+++ b/thirdparty/openssl/ssl/s23_lib.c
diff --git a/drivers/builtin_openssl2/ssl/s23_meth.c b/thirdparty/openssl/ssl/s23_meth.c
index eb7609879..eb7609879 100644
--- a/drivers/builtin_openssl2/ssl/s23_meth.c
+++ b/thirdparty/openssl/ssl/s23_meth.c
diff --git a/drivers/builtin_openssl2/ssl/s23_pkt.c b/thirdparty/openssl/ssl/s23_pkt.c
index efc864784..efc864784 100644
--- a/drivers/builtin_openssl2/ssl/s23_pkt.c
+++ b/thirdparty/openssl/ssl/s23_pkt.c
diff --git a/drivers/builtin_openssl2/ssl/s23_srvr.c b/thirdparty/openssl/ssl/s23_srvr.c
index 470bd3d94..470bd3d94 100644
--- a/drivers/builtin_openssl2/ssl/s23_srvr.c
+++ b/thirdparty/openssl/ssl/s23_srvr.c
diff --git a/drivers/builtin_openssl2/ssl/s2_clnt.c b/thirdparty/openssl/ssl/s2_clnt.c
index 69da6b142..69da6b142 100644
--- a/drivers/builtin_openssl2/ssl/s2_clnt.c
+++ b/thirdparty/openssl/ssl/s2_clnt.c
diff --git a/drivers/builtin_openssl2/ssl/s2_enc.c b/thirdparty/openssl/ssl/s2_enc.c
index 23eef72aa..23eef72aa 100644
--- a/drivers/builtin_openssl2/ssl/s2_enc.c
+++ b/thirdparty/openssl/ssl/s2_enc.c
diff --git a/drivers/builtin_openssl2/ssl/s2_lib.c b/thirdparty/openssl/ssl/s2_lib.c
index 88e67f083..88e67f083 100644
--- a/drivers/builtin_openssl2/ssl/s2_lib.c
+++ b/thirdparty/openssl/ssl/s2_lib.c
diff --git a/drivers/builtin_openssl2/ssl/s2_meth.c b/thirdparty/openssl/ssl/s2_meth.c
index 73885b7ec..73885b7ec 100644
--- a/drivers/builtin_openssl2/ssl/s2_meth.c
+++ b/thirdparty/openssl/ssl/s2_meth.c
diff --git a/drivers/builtin_openssl2/ssl/s2_pkt.c b/thirdparty/openssl/ssl/s2_pkt.c
index 7a6188813..7a6188813 100644
--- a/drivers/builtin_openssl2/ssl/s2_pkt.c
+++ b/thirdparty/openssl/ssl/s2_pkt.c
diff --git a/drivers/builtin_openssl2/ssl/s2_srvr.c b/thirdparty/openssl/ssl/s2_srvr.c
index 07e9df828..07e9df828 100644
--- a/drivers/builtin_openssl2/ssl/s2_srvr.c
+++ b/thirdparty/openssl/ssl/s2_srvr.c
diff --git a/drivers/builtin_openssl2/ssl/s3_both.c b/thirdparty/openssl/ssl/s3_both.c
index 09d0661e8..09d0661e8 100644
--- a/drivers/builtin_openssl2/ssl/s3_both.c
+++ b/thirdparty/openssl/ssl/s3_both.c
diff --git a/drivers/builtin_openssl2/ssl/s3_cbc.c b/thirdparty/openssl/ssl/s3_cbc.c
index 557622f51..557622f51 100644
--- a/drivers/builtin_openssl2/ssl/s3_cbc.c
+++ b/thirdparty/openssl/ssl/s3_cbc.c
diff --git a/drivers/builtin_openssl2/ssl/s3_clnt.c b/thirdparty/openssl/ssl/s3_clnt.c
index 19dc8648b..19dc8648b 100644
--- a/drivers/builtin_openssl2/ssl/s3_clnt.c
+++ b/thirdparty/openssl/ssl/s3_clnt.c
diff --git a/drivers/builtin_openssl2/ssl/s3_enc.c b/thirdparty/openssl/ssl/s3_enc.c
index 47a0ec9fe..47a0ec9fe 100644
--- a/drivers/builtin_openssl2/ssl/s3_enc.c
+++ b/thirdparty/openssl/ssl/s3_enc.c
diff --git a/drivers/builtin_openssl2/ssl/s3_lib.c b/thirdparty/openssl/ssl/s3_lib.c
index 872e636af..872e636af 100644
--- a/drivers/builtin_openssl2/ssl/s3_lib.c
+++ b/thirdparty/openssl/ssl/s3_lib.c
diff --git a/drivers/builtin_openssl2/ssl/s3_meth.c b/thirdparty/openssl/ssl/s3_meth.c
index e5a52993f..e5a52993f 100644
--- a/drivers/builtin_openssl2/ssl/s3_meth.c
+++ b/thirdparty/openssl/ssl/s3_meth.c
diff --git a/drivers/builtin_openssl2/ssl/s3_pkt.c b/thirdparty/openssl/ssl/s3_pkt.c
index 379890237..379890237 100644
--- a/drivers/builtin_openssl2/ssl/s3_pkt.c
+++ b/thirdparty/openssl/ssl/s3_pkt.c
diff --git a/drivers/builtin_openssl2/ssl/s3_srvr.c b/thirdparty/openssl/ssl/s3_srvr.c
index ab28702ee..ab28702ee 100644
--- a/drivers/builtin_openssl2/ssl/s3_srvr.c
+++ b/thirdparty/openssl/ssl/s3_srvr.c
diff --git a/drivers/builtin_openssl2/ssl/ssl-lib.com b/thirdparty/openssl/ssl/ssl-lib.com
index 43fea1754..43fea1754 100644
--- a/drivers/builtin_openssl2/ssl/ssl-lib.com
+++ b/thirdparty/openssl/ssl/ssl-lib.com
diff --git a/drivers/builtin_openssl2/ssl/ssl_algs.c b/thirdparty/openssl/ssl/ssl_algs.c
index e6f515ff6..e6f515ff6 100644
--- a/drivers/builtin_openssl2/ssl/ssl_algs.c
+++ b/thirdparty/openssl/ssl/ssl_algs.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_asn1.c b/thirdparty/openssl/ssl/ssl_asn1.c
index 35cc27c5e..35cc27c5e 100644
--- a/drivers/builtin_openssl2/ssl/ssl_asn1.c
+++ b/thirdparty/openssl/ssl/ssl_asn1.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_cert.c b/thirdparty/openssl/ssl/ssl_cert.c
index f48ebaecc..f48ebaecc 100644
--- a/drivers/builtin_openssl2/ssl/ssl_cert.c
+++ b/thirdparty/openssl/ssl/ssl_cert.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_ciph.c b/thirdparty/openssl/ssl/ssl_ciph.c
index 302464e64..302464e64 100644
--- a/drivers/builtin_openssl2/ssl/ssl_ciph.c
+++ b/thirdparty/openssl/ssl/ssl_ciph.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_conf.c b/thirdparty/openssl/ssl/ssl_conf.c
index 8d3709d2b..8d3709d2b 100644
--- a/drivers/builtin_openssl2/ssl/ssl_conf.c
+++ b/thirdparty/openssl/ssl/ssl_conf.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_err.c b/thirdparty/openssl/ssl/ssl_err.c
index 704088dc4..704088dc4 100644
--- a/drivers/builtin_openssl2/ssl/ssl_err.c
+++ b/thirdparty/openssl/ssl/ssl_err.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_err2.c b/thirdparty/openssl/ssl/ssl_err2.c
index 14e48221f..14e48221f 100644
--- a/drivers/builtin_openssl2/ssl/ssl_err2.c
+++ b/thirdparty/openssl/ssl/ssl_err2.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_lib.c b/thirdparty/openssl/ssl/ssl_lib.c
index fd94325bb..fd94325bb 100644
--- a/drivers/builtin_openssl2/ssl/ssl_lib.c
+++ b/thirdparty/openssl/ssl/ssl_lib.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_locl.h b/thirdparty/openssl/ssl/ssl_locl.h
index 747e718a5..747e718a5 100644
--- a/drivers/builtin_openssl2/ssl/ssl_locl.h
+++ b/thirdparty/openssl/ssl/ssl_locl.h
diff --git a/drivers/builtin_openssl2/ssl/ssl_rsa.c b/thirdparty/openssl/ssl/ssl_rsa.c
index 82022470b..82022470b 100644
--- a/drivers/builtin_openssl2/ssl/ssl_rsa.c
+++ b/thirdparty/openssl/ssl/ssl_rsa.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_sess.c b/thirdparty/openssl/ssl/ssl_sess.c
index b18299834..b18299834 100644
--- a/drivers/builtin_openssl2/ssl/ssl_sess.c
+++ b/thirdparty/openssl/ssl/ssl_sess.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_stat.c b/thirdparty/openssl/ssl/ssl_stat.c
index 1b9069f97..1b9069f97 100644
--- a/drivers/builtin_openssl2/ssl/ssl_stat.c
+++ b/thirdparty/openssl/ssl/ssl_stat.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_task.c b/thirdparty/openssl/ssl/ssl_task.c
index fb770753e..fb770753e 100644
--- a/drivers/builtin_openssl2/ssl/ssl_task.c
+++ b/thirdparty/openssl/ssl/ssl_task.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_txt.c b/thirdparty/openssl/ssl/ssl_txt.c
index 45308d8b6..45308d8b6 100644
--- a/drivers/builtin_openssl2/ssl/ssl_txt.c
+++ b/thirdparty/openssl/ssl/ssl_txt.c
diff --git a/drivers/builtin_openssl2/ssl/ssl_utst.c b/thirdparty/openssl/ssl/ssl_utst.c
index 53bdde330..53bdde330 100644
--- a/drivers/builtin_openssl2/ssl/ssl_utst.c
+++ b/thirdparty/openssl/ssl/ssl_utst.c
diff --git a/drivers/builtin_openssl2/ssl/t1_clnt.c b/thirdparty/openssl/ssl/t1_clnt.c
index 746b4e6b7..746b4e6b7 100644
--- a/drivers/builtin_openssl2/ssl/t1_clnt.c
+++ b/thirdparty/openssl/ssl/t1_clnt.c
diff --git a/drivers/builtin_openssl2/ssl/t1_enc.c b/thirdparty/openssl/ssl/t1_enc.c
index 514fcb3e4..514fcb3e4 100644
--- a/drivers/builtin_openssl2/ssl/t1_enc.c
+++ b/thirdparty/openssl/ssl/t1_enc.c
diff --git a/drivers/builtin_openssl2/ssl/t1_ext.c b/thirdparty/openssl/ssl/t1_ext.c
index 724ddf76a..724ddf76a 100644
--- a/drivers/builtin_openssl2/ssl/t1_ext.c
+++ b/thirdparty/openssl/ssl/t1_ext.c
diff --git a/drivers/builtin_openssl2/ssl/t1_lib.c b/thirdparty/openssl/ssl/t1_lib.c
index dd5bd0050..dd5bd0050 100644
--- a/drivers/builtin_openssl2/ssl/t1_lib.c
+++ b/thirdparty/openssl/ssl/t1_lib.c
diff --git a/drivers/builtin_openssl2/ssl/t1_meth.c b/thirdparty/openssl/ssl/t1_meth.c
index 335d57b53..335d57b53 100644
--- a/drivers/builtin_openssl2/ssl/t1_meth.c
+++ b/thirdparty/openssl/ssl/t1_meth.c
diff --git a/drivers/builtin_openssl2/ssl/t1_reneg.c b/thirdparty/openssl/ssl/t1_reneg.c
index b9a35c7fc..b9a35c7fc 100644
--- a/drivers/builtin_openssl2/ssl/t1_reneg.c
+++ b/thirdparty/openssl/ssl/t1_reneg.c
diff --git a/drivers/builtin_openssl2/ssl/t1_srvr.c b/thirdparty/openssl/ssl/t1_srvr.c
index 8c6b3dff2..8c6b3dff2 100644
--- a/drivers/builtin_openssl2/ssl/t1_srvr.c
+++ b/thirdparty/openssl/ssl/t1_srvr.c
diff --git a/drivers/builtin_openssl2/ssl/t1_trce.c b/thirdparty/openssl/ssl/t1_trce.c
index c5e21df77..c5e21df77 100644
--- a/drivers/builtin_openssl2/ssl/t1_trce.c
+++ b/thirdparty/openssl/ssl/t1_trce.c
diff --git a/drivers/builtin_openssl2/ssl/tls_srp.c b/thirdparty/openssl/ssl/tls_srp.c
index bb719ba4c..bb719ba4c 100644
--- a/drivers/builtin_openssl2/ssl/tls_srp.c
+++ b/thirdparty/openssl/ssl/tls_srp.c
diff --git a/drivers/builtin_openssl2/winrt.cpp b/thirdparty/openssl/winrt.cpp
index c3a6f8bfc..c3a6f8bfc 100644
--- a/drivers/builtin_openssl2/winrt.cpp
+++ b/thirdparty/openssl/winrt.cpp
diff --git a/drivers/builtin_openssl2/winrt_fix.patch b/thirdparty/openssl/winrt_fix.patch
index caf180a75..caf180a75 100644
--- a/drivers/builtin_openssl2/winrt_fix.patch
+++ b/thirdparty/openssl/winrt_fix.patch
diff --git a/drivers/opus/COPYING b/thirdparty/opus/COPYING
index 7b53d665d..7b53d665d 100644
--- a/drivers/opus/COPYING
+++ b/thirdparty/opus/COPYING
diff --git a/drivers/opus/analysis.c b/thirdparty/opus/analysis.c
index 6a0cd3011..360ebcc8d 100644
--- a/drivers/opus/analysis.c
+++ b/thirdparty/opus/analysis.c
@@ -24,17 +24,20 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/kiss_fft.h"
-#include "opus/celt/celt.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/quant_bands.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "kiss_fft.h"
+#include "celt.h"
+#include "modes.h"
+#include "arch.h"
+#include "quant_bands.h"
#include <stdio.h>
-#include "opus/analysis.h"
-#include "opus/mlp.h"
-#include "opus/celt/stack_alloc.h"
+#include "analysis.h"
+#include "mlp.h"
+#include "stack_alloc.h"
#ifndef M_PI
#define M_PI 3.141592653
@@ -273,7 +276,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
downmix(x, &tonal->inmem[240], remaining, offset+ANALYSIS_BUF_SIZE-tonal->mem_fill, c1, c2, C);
tonal->mem_fill = 240 + remaining;
opus_fft(kfft, in, out, tonal->arch);
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
/* If there's any NaN on the input, the entire output will be NaN, so we only need to check one value. */
if (celt_isnan(out[0].r))
{
@@ -345,7 +348,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
{
float binE = out[i].r*(float)out[i].r + out[N-i].r*(float)out[N-i].r
+ out[i].i*(float)out[i].i + out[N-i].i*(float)out[N-i].i;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* FIXME: It's probably best to change the BFCC filter initial state instead */
binE *= 5.55e-17f;
#endif
@@ -353,7 +356,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
tE += binE*tonality[i];
nE += binE*2.f*(.5f-noisiness[i]);
}
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
/* Check for extreme band energies that could cause NaNs later. */
if (!(E<1e9f) || celt_isnan(E))
{
@@ -411,7 +414,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
bandwidth = 0;
maxE = 0;
noise_floor = 5.7e-4f/(1<<(IMAX(0,lsb_depth-8)));
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
noise_floor *= 1<<(15+SIG_SHIFT);
#endif
noise_floor *= noise_floor;
diff --git a/drivers/opus/analysis.h b/thirdparty/opus/analysis.h
index 9d81164e2..9eae56a52 100644
--- a/drivers/opus/analysis.h
+++ b/thirdparty/opus/analysis.h
@@ -28,8 +28,8 @@
#ifndef ANALYSIS_H
#define ANALYSIS_H
-#include "opus/celt/celt.h"
-#include "opus/opus_private.h"
+#include "celt.h"
+#include "opus_private.h"
#define NB_FRAMES 8
#define NB_TBANDS 18
diff --git a/drivers/opus/celt/_kiss_fft_guts.h b/thirdparty/opus/celt/_kiss_fft_guts.h
index a41f9a1a0..5e3d58fd6 100644
--- a/drivers/opus/celt/_kiss_fft_guts.h
+++ b/thirdparty/opus/celt/_kiss_fft_guts.h
@@ -33,7 +33,7 @@
defines kiss_fft_scalar as either short or a float type
and defines
typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
-#include "opus/celt/kiss_fft.h"
+#include "kiss_fft.h"
/*
Explanation of macros dealing with complex math:
@@ -44,8 +44,8 @@
C_SUBFROM( res , a) : res -= a
C_ADDTO( res , a) : res += a
* */
-#ifdef OPUS_FIXED_POINT
-#include "opus/celt/arch.h"
+#ifdef FIXED_POINT
+#include "arch.h"
#define SAMP_MAX 2147483647
@@ -91,14 +91,14 @@
}while(0)
#if defined(OPUS_ARM_INLINE_ASM)
-#include "opus/celt/arm/kiss_fft_armv4.h"
+#include "arm/kiss_fft_armv4.h"
#endif
#if defined(OPUS_ARM_INLINE_EDSP)
-#include "opus/celt/arm/kiss_fft_armv5e.h"
+#include "arm/kiss_fft_armv5e.h"
#endif
#if defined(MIPSr1_ASM)
-#include "opus/celt/mips/kiss_fft_mipsr1.h"
+#include "mips/kiss_fft_mipsr1.h"
#endif
#else /* not FIXED_POINT*/
@@ -151,7 +151,7 @@
}while(0)
#endif /* C_ADD defined */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/*# define KISS_FFT_COS(phase) TRIG_UPSCALE*floor(MIN(32767,MAX(-32767,.5+32768 * cos (phase))))
# define KISS_FFT_SIN(phase) TRIG_UPSCALE*floor(MIN(32767,MAX(-32767,.5+32768 * sin (phase))))*/
# define KISS_FFT_COS(phase) floor(.5+TWID_MAX*cos (phase))
diff --git a/drivers/opus/celt/arch.h b/thirdparty/opus/celt/arch.h
index 7fb036e9f..9f74ddd26 100644
--- a/drivers/opus/celt/arch.h
+++ b/thirdparty/opus/celt/arch.h
@@ -34,8 +34,8 @@
#ifndef ARCH_H
#define ARCH_H
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#include "opus_types.h"
+#include "opus_defines.h"
# if !defined(__GNUC_PREREQ)
# if defined(__GNUC__)&&defined(__GNUC_MINOR__)
@@ -80,7 +80,7 @@ static OPUS_INLINE void _celt_fatal(const char *str, const char *file, int line)
#define PRINT_MIPS(file)
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
typedef opus_int16 opus_val16;
typedef opus_int32 opus_val32;
@@ -113,15 +113,15 @@ static OPUS_INLINE opus_int16 SAT16(opus_int32 x) {
}
#ifdef FIXED_DEBUG
-#include "opus/celt/fixed_debug.h"
+#include "fixed_debug.h"
#else
-#include "opus/celt/fixed_generic.h"
+#include "fixed_generic.h"
#ifdef OPUS_ARM_INLINE_EDSP
-#include "opus/celt/arm/fixed_armv5e.h"
+#include "arm/fixed_armv5e.h"
#elif defined (OPUS_ARM_INLINE_ASM)
-#include "opus/celt/arm/fixed_armv4.h"
+#include "arm/fixed_armv4.h"
#elif defined (BFIN_ASM)
#include "fixed_bfin.h"
#elif defined (TI_C5X_ASM)
@@ -231,7 +231,7 @@ static OPUS_INLINE int celt_isnan(float x)
#endif /* !FIXED_POINT */
#ifndef GLOBAL_STACK_SIZE
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
#define GLOBAL_STACK_SIZE 100000
#else
#define GLOBAL_STACK_SIZE 100000
diff --git a/drivers/opus/celt/arm/arm2gnu.pl b/thirdparty/opus/celt/arm/arm2gnu.pl
index 6c922ac81..6c922ac81 100755
--- a/drivers/opus/celt/arm/arm2gnu.pl
+++ b/thirdparty/opus/celt/arm/arm2gnu.pl
diff --git a/drivers/opus/celt/arm/arm_celt_map.c b/thirdparty/opus/celt/arm/arm_celt_map.c
index 92c83c176..ee6c24478 100644
--- a/drivers/opus/celt/arm/arm_celt_map.c
+++ b/thirdparty/opus/celt/arm/arm_celt_map.c
@@ -24,11 +24,14 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/kiss_fft.h"
-#include "opus/celt/mdct.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pitch.h"
+#include "kiss_fft.h"
+#include "mdct.h"
#if defined(OPUS_HAVE_RTCD)
diff --git a/drivers/opus/celt/arm/armcpu.c b/thirdparty/opus/celt/arm/armcpu.c
index ac8ad2ec1..5e5d10c34 100644
--- a/drivers/opus/celt/arm/armcpu.c
+++ b/thirdparty/opus/celt/arm/armcpu.c
@@ -26,14 +26,17 @@
*/
/* Original code from libtheora modified to suit to Opus */
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#ifdef OPUS_HAVE_RTCD
-#include "opus/celt/arm/armcpu.h"
-#include "opus/celt/cpu_support.h"
-#include "opus/celt/os_support.h"
-#include "opus/opus_types.h"
+#include "armcpu.h"
+#include "cpu_support.h"
+#include "os_support.h"
+#include "opus_types.h"
#define OPUS_CPU_ARM_V4 (1)
#define OPUS_CPU_ARM_EDSP (1<<1)
diff --git a/drivers/opus/celt/arm/armcpu.h b/thirdparty/opus/celt/arm/armcpu.h
index ac5744606..ac5744606 100644
--- a/drivers/opus/celt/arm/armcpu.h
+++ b/thirdparty/opus/celt/arm/armcpu.h
diff --git a/drivers/opus/celt/arm/armopts.s.in b/thirdparty/opus/celt/arm/armopts.s.in
index 3d8aaf275..3d8aaf275 100644
--- a/drivers/opus/celt/arm/armopts.s.in
+++ b/thirdparty/opus/celt/arm/armopts.s.in
diff --git a/drivers/opus/celt/arm/celt_ne10_fft.c b/thirdparty/opus/celt/arm/celt_ne10_fft.c
index e57d23ee1..42d96a711 100644
--- a/drivers/opus/celt/arm/celt_ne10_fft.c
+++ b/thirdparty/opus/celt/arm/celt_ne10_fft.c
@@ -31,14 +31,16 @@
*/
#ifndef SKIP_CONFIG_H
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#endif
#include <NE10_init.h>
#include <NE10_dsp.h>
-#include "opus/celt/os_support.h"
-#include "opus/celt/kiss_fft.h"
-#include "opus/celt/stack_alloc.h"
+#include "os_support.h"
+#include "kiss_fft.h"
+#include "stack_alloc.h"
#if !defined(FIXED_POINT)
# define NE10_FFT_ALLOC_C2C_TYPE_NEON ne10_fft_alloc_c2c_float32_neon
diff --git a/drivers/opus/celt/arm/celt_ne10_mdct.c b/thirdparty/opus/celt/arm/celt_ne10_mdct.c
index eb407b674..293c3efd7 100644
--- a/drivers/opus/celt/arm/celt_ne10_mdct.c
+++ b/thirdparty/opus/celt/arm/celt_ne10_mdct.c
@@ -31,13 +31,15 @@
*/
#ifndef SKIP_CONFIG_H
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#endif
-#include "opus/celt/kiss_fft.h"
-#include "opus/celt/_kiss_fft_guts.h"
-#include "opus/celt/mdct.h"
-#include "opus/celt/stack_alloc.h"
+#include "kiss_fft.h"
+#include "_kiss_fft_guts.h"
+#include "mdct.h"
+#include "stack_alloc.h"
void clt_mdct_forward_neon(const mdct_lookup *l,
kiss_fft_scalar *in,
diff --git a/drivers/opus/celt/arm/celt_neon_intr.c b/thirdparty/opus/celt/arm/celt_neon_intr.c
index 82b695864..47dce15ba 100644
--- a/drivers/opus/celt/arm/celt_neon_intr.c
+++ b/thirdparty/opus/celt/arm/celt_neon_intr.c
@@ -29,10 +29,13 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <arm_neon.h>
-#include "opus/celt/pitch.h"
+#include "../pitch.h"
#if !defined(FIXED_POINT)
/*
diff --git a/drivers/opus/celt/arm/celt_pitch_xcorr_arm-gnu.S b/thirdparty/opus/celt/arm/celt_pitch_xcorr_arm-gnu.S
index 5b2ee55a1..5b2ee55a1 100644
--- a/drivers/opus/celt/arm/celt_pitch_xcorr_arm-gnu.S
+++ b/thirdparty/opus/celt/arm/celt_pitch_xcorr_arm-gnu.S
diff --git a/drivers/opus/celt/arm/celt_pitch_xcorr_arm.s b/thirdparty/opus/celt/arm/celt_pitch_xcorr_arm.s
index f96e0a88b..f96e0a88b 100644
--- a/drivers/opus/celt/arm/celt_pitch_xcorr_arm.s
+++ b/thirdparty/opus/celt/arm/celt_pitch_xcorr_arm.s
diff --git a/drivers/opus/celt/arm/fft_arm.h b/thirdparty/opus/celt/arm/fft_arm.h
index c99458b4a..0cb55d8e2 100644
--- a/drivers/opus/celt/arm/fft_arm.h
+++ b/thirdparty/opus/celt/arm/fft_arm.h
@@ -34,8 +34,8 @@
#if !defined(FFT_ARM_H)
#define FFT_ARM_H
-#include "opus/opus_config.h"
-#include "opus/celt/kiss_fft.h"
+#include "config.h"
+#include "kiss_fft.h"
#if defined(HAVE_ARM_NE10)
diff --git a/drivers/speex/config.h b/thirdparty/opus/celt/arm/fixed_arm64.h
index 8c48e3b99..c6fbd3db2 100644
--- a/drivers/speex/config.h
+++ b/thirdparty/opus/celt/arm/fixed_arm64.h
@@ -1,7 +1,5 @@
+/* Copyright (C) 2015 Vidyo */
/*
- Copyright (C) 2003 Commonwealth Scientific and Industrial Research
- Organisation (CSIRO) Australia
-
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
@@ -13,15 +11,11 @@
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- - Neither the name of CSIRO Australia nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
@@ -30,23 +24,12 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CONFIG_H
-#define CONFIG_H
-
-/* An inline macro is required for use of the inline keyword as not all C compilers support */
-/* inline. It is officially C99 and C++ only */
+#ifndef FIXED_ARM64_H
+#define FIXED_ARM64_H
+#include <arm_neon.h>
-/* Use only fixed point arithmetic */
+#undef SIG2WORD16
+#define SIG2WORD16(x) (vqmovns_s32(PSHR32((x), SIG_SHIFT)))
-//#ifdef _MSC_VER
-//#define inline _inline
-//#endif
-
-#define FIXED_POINT 1
-
-#ifdef _MSC_VER
-#define inline __inline
#endif
-
-#endif /* ! CONFIG_H */
diff --git a/drivers/opus/celt/arm/fixed_armv4.h b/thirdparty/opus/celt/arm/fixed_armv4.h
index efb3b1896..efb3b1896 100644
--- a/drivers/opus/celt/arm/fixed_armv4.h
+++ b/thirdparty/opus/celt/arm/fixed_armv4.h
diff --git a/drivers/opus/celt/arm/fixed_armv5e.h b/thirdparty/opus/celt/arm/fixed_armv5e.h
index 2db23262e..36a632110 100644
--- a/drivers/opus/celt/arm/fixed_armv5e.h
+++ b/thirdparty/opus/celt/arm/fixed_armv5e.h
@@ -30,7 +30,7 @@
#ifndef FIXED_ARMv5E_H
#define FIXED_ARMv5E_H
-#include "opus/celt/arm/fixed_armv4.h"
+#include "fixed_armv4.h"
/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
#undef MULT16_32_Q16
diff --git a/drivers/opus/celt/arm/kiss_fft_armv4.h b/thirdparty/opus/celt/arm/kiss_fft_armv4.h
index 0f5617324..e4faad6f2 100644
--- a/drivers/opus/celt/arm/kiss_fft_armv4.h
+++ b/thirdparty/opus/celt/arm/kiss_fft_armv4.h
@@ -30,7 +30,7 @@
#error "This file should only be included from _kiss_fft_guts.h"
#endif
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
#undef C_MUL
#define C_MUL(m,a,b) \
diff --git a/drivers/opus/celt/arm/kiss_fft_armv5e.h b/thirdparty/opus/celt/arm/kiss_fft_armv5e.h
index 0ab75fbc5..9eca183d7 100644
--- a/drivers/opus/celt/arm/kiss_fft_armv5e.h
+++ b/thirdparty/opus/celt/arm/kiss_fft_armv5e.h
@@ -30,7 +30,7 @@
#error "This file should only be included from _kiss_fft_guts.h"
#endif
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
#if defined(__thumb__)||defined(__thumb2__)
#define LDRD_CONS "Q"
diff --git a/drivers/opus/celt/arm/mdct_arm.h b/thirdparty/opus/celt/arm/mdct_arm.h
index faf3c8aca..49cbb4457 100644
--- a/drivers/opus/celt/arm/mdct_arm.h
+++ b/thirdparty/opus/celt/arm/mdct_arm.h
@@ -33,8 +33,8 @@
#if !defined(MDCT_ARM_H)
#define MDCT_ARM_H
-#include "opus/opus_config.h"
-#include "opus/celt/mdct.h"
+#include "config.h"
+#include "mdct.h"
#if defined(HAVE_ARM_NE10)
/** Compute a forward MDCT and scale by 4/N, trashes the input array */
diff --git a/drivers/opus/celt/arm/pitch_arm.h b/thirdparty/opus/celt/arm/pitch_arm.h
index 996fbc7fd..8626ed75b 100644
--- a/drivers/opus/celt/arm/pitch_arm.h
+++ b/thirdparty/opus/celt/arm/pitch_arm.h
@@ -28,7 +28,7 @@
#if !defined(PITCH_ARM_H)
# define PITCH_ARM_H
-# include "opus/celt/arm/armcpu.h"
+# include "armcpu.h"
# if defined(FIXED_POINT)
diff --git a/drivers/opus/celt/bands.c b/thirdparty/opus/celt/bands.c
index bdd87dd32..25f229e26 100644
--- a/drivers/opus/celt/bands.c
+++ b/thirdparty/opus/celt/bands.c
@@ -26,19 +26,22 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <math.h>
-#include "opus/celt/bands.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/vq.h"
-#include "opus/celt/cwrs.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/rate.h"
-#include "opus/celt/quant_bands.h"
-#include "opus/celt/pitch.h"
+#include "bands.h"
+#include "modes.h"
+#include "vq.h"
+#include "cwrs.h"
+#include "stack_alloc.h"
+#include "os_support.h"
+#include "mathops.h"
+#include "rate.h"
+#include "quant_bands.h"
+#include "pitch.h"
int hysteresis_decision(opus_val16 val, const opus_val16 *thresholds, const opus_val16 *hysteresis, int N, int prev)
{
@@ -87,7 +90,7 @@ static int bitexact_log2tan(int isin,int icos)
-FRAC_MUL16(icos, FRAC_MUL16(icos, -2597) + 7932);
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Compute the amplitude (sqrt energy) in each of the bands */
void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bandE, int end, int C, int LM)
{
@@ -216,13 +219,13 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X,
int j, band_end;
opus_val16 g;
opus_val16 lg;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int shift;
#endif
j=M*eBands[i];
band_end = M*eBands[i+1];
lg = ADD16(bandLogE[i], SHL16((opus_val16)eMeans[i],6));
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
g = celt_exp2(lg);
#else
/* Handle the integer part of the log energy */
@@ -271,7 +274,7 @@ void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_mas
int N0;
opus_val16 thresh, sqrt_1;
int depth;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int shift;
opus_val32 thresh32;
#endif
@@ -281,7 +284,7 @@ void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_mas
celt_assert(pulses[i]>=0);
depth = celt_udiv(1+pulses[i], (m->eBands[i+1]-m->eBands[i]))>>LM;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
thresh32 = SHR32(celt_exp2(-SHL16(depth, 10-BITRES)),1);
thresh = MULT16_32_Q15(QCONST16(0.5f, 15), MIN32(32767,thresh32));
{
@@ -314,7 +317,7 @@ void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_mas
Ediff = EXTEND32(logE[c*m->nbEBands+i])-EXTEND32(MIN16(prev1,prev2));
Ediff = MAX32(0, Ediff);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (Ediff < 16384)
{
opus_val32 r32 = SHR32(celt_exp2(-EXTRACT16(Ediff)),1);
@@ -364,7 +367,7 @@ static void intensity_stereo(const CELTMode *m, celt_norm * OPUS_RESTRICT X, con
opus_val16 a1, a2;
opus_val16 left, right;
opus_val16 norm;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int shift = celt_zlog2(MAX32(bandE[i], bandE[i+m->nbEBands]))-13;
#endif
left = VSHR32(bandE[i],shift);
@@ -401,7 +404,7 @@ static void stereo_merge(celt_norm * OPUS_RESTRICT X, celt_norm * OPUS_RESTRICT
opus_val32 xp=0, side=0;
opus_val32 El, Er;
opus_val16 mid2;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int kl, kr;
#endif
opus_val32 t, lgain, rgain;
@@ -420,7 +423,7 @@ static void stereo_merge(celt_norm * OPUS_RESTRICT X, celt_norm * OPUS_RESTRICT
return;
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
kl = celt_ilog2(El)>>1;
kr = celt_ilog2(Er)>>1;
#endif
@@ -429,7 +432,7 @@ static void stereo_merge(celt_norm * OPUS_RESTRICT X, celt_norm * OPUS_RESTRICT
t = VSHR32(Er, (kr-7)<<1);
rgain = celt_rsqrt_norm(t);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (kl < 7)
kl = 7;
if (kr < 7)
@@ -939,7 +942,7 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
delta = sctx.delta;
itheta = sctx.itheta;
qalloc = sctx.qalloc;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
mid = imid;
side = iside;
#else
@@ -1237,7 +1240,7 @@ static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm
delta = sctx.delta;
itheta = sctx.itheta;
qalloc = sctx.qalloc;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
mid = imid;
side = iside;
#else
diff --git a/drivers/opus/celt/bands.h b/thirdparty/opus/celt/bands.h
index eb7ea4cc2..e8bef4bad 100644
--- a/drivers/opus/celt/bands.h
+++ b/thirdparty/opus/celt/bands.h
@@ -30,11 +30,11 @@
#ifndef BANDS_H
#define BANDS_H
-#include "opus/celt/arch.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
-#include "opus/celt/rate.h"
+#include "arch.h"
+#include "modes.h"
+#include "entenc.h"
+#include "entdec.h"
+#include "rate.h"
/** Compute the amplitude (sqrt energy) in each of the bands
* @param m Mode data
diff --git a/drivers/opus/celt/celt.c b/thirdparty/opus/celt/celt.c
index 4a1665144..b121c51a1 100644
--- a/drivers/opus/celt/celt.c
+++ b/thirdparty/opus/celt/celt.c
@@ -26,33 +26,36 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#define CELT_C
-#include "opus/celt/os_support.h"
-#include "opus/celt/mdct.h"
+#include "os_support.h"
+#include "mdct.h"
#include <math.h>
-#include "opus/celt/celt.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/bands.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/entcode.h"
-#include "opus/celt/quant_bands.h"
-#include "opus/celt/rate.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/float_cast.h"
+#include "celt.h"
+#include "pitch.h"
+#include "bands.h"
+#include "modes.h"
+#include "entcode.h"
+#include "quant_bands.h"
+#include "rate.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "float_cast.h"
#include <stdarg.h>
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/vq.h"
+#include "celt_lpc.h"
+#include "vq.h"
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "unknown"
#endif
#if defined(MIPSr1_ASM)
-#include "opus/celt/mips/celt_mipsr1.h"
+#include "mips/celt_mipsr1.h"
#endif
@@ -286,7 +289,7 @@ const char *opus_get_version_string(void)
/* Applications may rely on the presence of this substring in the version
string to determine if they have a fixed-point or floating-point build
at runtime. */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
"-fixed"
#endif
#ifdef FUZZING
diff --git a/drivers/opus/celt/celt.h b/thirdparty/opus/celt/celt.h
index 72814dc0d..a423b9504 100644
--- a/drivers/opus/celt/celt.h
+++ b/thirdparty/opus/celt/celt.h
@@ -35,12 +35,12 @@
#ifndef CELT_H
#define CELT_H
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
-#include "opus/opus_custom.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
-#include "opus/celt/arch.h"
+#include "opus_types.h"
+#include "opus_defines.h"
+#include "opus_custom.h"
+#include "entenc.h"
+#include "entdec.h"
+#include "arch.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/opus/celt/celt_decoder.c b/thirdparty/opus/celt/celt_decoder.c
index 88072ed11..b688f2a4e 100644
--- a/drivers/opus/celt/celt_decoder.c
+++ b/thirdparty/opus/celt/celt_decoder.c
@@ -26,27 +26,30 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#define CELT_DECODER_C
-#include "opus/celt/cpu_support.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/mdct.h"
+#include "cpu_support.h"
+#include "os_support.h"
+#include "mdct.h"
#include <math.h>
-#include "opus/celt/celt.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/bands.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/entcode.h"
-#include "opus/celt/quant_bands.h"
-#include "opus/celt/rate.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/float_cast.h"
+#include "celt.h"
+#include "pitch.h"
+#include "bands.h"
+#include "modes.h"
+#include "entcode.h"
+#include "quant_bands.h"
+#include "rate.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "float_cast.h"
#include <stdarg.h>
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/vq.h"
+#include "celt_lpc.h"
+#include "vq.h"
#if defined(SMALL_FOOTPRINT) && defined(FIXED_POINT)
#define NORM_ALIASING_HACK
@@ -188,7 +191,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
opus_val16 coef0;
VARDECL(celt_sig, scratch);
SAVE_STACK;
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
(void)accum;
celt_assert(accum==0);
#endif
@@ -230,7 +233,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
apply_downsampling=1;
} else {
/* Shortcut for the standard (non-custom modes) case */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (accum)
{
for (j=0;j<N;j++)
@@ -255,7 +258,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
if (apply_downsampling)
{
/* Perform down-sampling */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (accum)
{
for (j=0;j<Nd;j++)
@@ -543,7 +546,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
_celt_autocorr(exc, ac, window, overlap,
LPC_ORDER, MAX_PERIOD, st->arch);
/* Add a noise floor of -40 dB. */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
ac[0] += SHR32(ac[0],13);
#else
ac[0] *= 1.0001f;
@@ -552,7 +555,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
for (i=1;i<=LPC_ORDER;i++)
{
/*ac[i] *= exp(-.5*(2*M_PI*.002*i)*(2*M_PI*.002*i));*/
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
ac[i] -= MULT16_32_Q15(2*i*i, ac[i]);
#else
ac[i] -= ac[i]*(0.008f*0.008f)*i*i;
@@ -583,7 +586,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
{
opus_val32 E1=1, E2=1;
int decay_length;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int shift = IMAX(0,2*celt_zlog2(celt_maxabs16(&exc[MAX_PERIOD-exc_length], exc_length))-20);
#endif
decay_length = exc_length>>1;
@@ -655,7 +658,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
S2 += SHR32(MULT16_16(tmp, tmp), 8);
}
/* This checks for an "explosion" in the synthesis. */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (!(S1 > SHR32(S2,2)))
#else
/* The float test is written this way to catch NaNs in the output
@@ -1071,7 +1074,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
#ifdef CUSTOM_MODES
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int opus_custom_decode(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, int len, opus_int16 * OPUS_RESTRICT pcm, int frame_size)
{
return celt_decode_with_ec(st, data, len, pcm, frame_size, NULL, 0);
diff --git a/drivers/opus/celt/celt_encoder.c b/thirdparty/opus/celt/celt_encoder.c
index 9099bcd27..41fbfd49c 100644
--- a/drivers/opus/celt/celt_encoder.c
+++ b/thirdparty/opus/celt/celt_encoder.c
@@ -26,27 +26,30 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#define CELT_ENCODER_C
-#include "opus/celt/cpu_support.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/mdct.h"
+#include "cpu_support.h"
+#include "os_support.h"
+#include "mdct.h"
#include <math.h>
-#include "opus/celt/celt.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/bands.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/entcode.h"
-#include "opus/celt/quant_bands.h"
-#include "opus/celt/rate.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/float_cast.h"
+#include "celt.h"
+#include "pitch.h"
+#include "bands.h"
+#include "modes.h"
+#include "entcode.h"
+#include "quant_bands.h"
+#include "rate.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "float_cast.h"
#include <stdarg.h>
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/vq.h"
+#include "celt_lpc.h"
+#include "vq.h"
/** Encoder state
@@ -259,7 +262,7 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int
opus_val32 x,y;
x = SHR32(in[i+c*len],SIG_SHIFT);
y = ADD32(mem0, x);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
mem0 = mem1 + y - SHL32(x,1);
mem1 = x - SHR32(y,1);
#else
@@ -273,7 +276,7 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int
/* First few samples are bad because we don't propagate the memory */
OPUS_CLEAR(tmp, 12);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Normalize tmp to max range */
{
int shift=0;
@@ -294,7 +297,7 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int
{
opus_val16 x2 = PSHR32(MULT16_16(tmp[2*i],tmp[2*i]) + MULT16_16(tmp[2*i+1],tmp[2*i+1]),16);
mean += x2;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* FIXME: Use PSHR16() instead */
tmp[i] = mem0 + PSHR32(x2-mem0,4);
#else
@@ -308,7 +311,7 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int
/* Backward pass to compute the pre-echo threshold */
for (i=len2-1;i>=0;i--)
{
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* FIXME: Use PSHR16() instead */
tmp[i] = mem0 + PSHR32(tmp[i]-mem0,3);
#else
@@ -325,7 +328,7 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int
/* As a compromise with the old transient detector, frame energy is the
geometric mean of the energy and half the max */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Costs two sqrt() to avoid overflows */
mean = MULT16_16(celt_sqrt(mean), celt_sqrt(MULT16_16(maxE,len2>>1)));
#else
@@ -339,7 +342,7 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int
for (i=12;i<len2-5;i+=4)
{
int id;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
id = MAX32(0,MIN32(127,MULT16_32_Q15(tmp[i]+EPSILON,norm))); /* Do not round to nearest */
#else
id = (int)MAX32(0,MIN32(127,floor(64*norm*(tmp[i]+EPSILON)))); /* Do not round to nearest */
@@ -490,7 +493,7 @@ void celt_preemphasis(const opus_val16 * OPUS_RESTRICT pcmp, celt_sig * OPUS_RES
for (i=0;i<Nu;i++)
inp[i*upsample] = SCALEIN(pcmp[CC*i]);
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
if (clip)
{
/* Clip input to avoid encoding non-portable files */
@@ -787,7 +790,7 @@ static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X,
logXC = celt_log2(QCONST32(1.001f, 20)-MULT16_16(sum, sum));
/* mid-side savings estimations based on min correlation */
logXC2 = MAX16(HALF16(logXC), celt_log2(QCONST32(1.001f, 20)-MULT16_16(minXC, minXC)));
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Compensate for Q20 vs Q14 input and convert output to Q8 */
logXC = PSHR32(logXC-QCONST16(6.f, DB_SHIFT),DB_SHIFT-8);
logXC2 = PSHR32(logXC2-QCONST16(6.f, DB_SHIFT),DB_SHIFT-8);
@@ -819,7 +822,7 @@ static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X,
(void)analysis;
#endif
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
trim_index = PSHR32(trim, 8);
#else
trim_index = (int)floor(.5f+trim);
@@ -1145,7 +1148,7 @@ static int run_prefilter(CELTEncoder *st, celt_sig *in, celt_sig *prefilter_mem,
if (ABS16(gain1-st->prefilter_gain)<QCONST16(.1f,15))
gain1=st->prefilter_gain;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
qg = ((gain1+1536)>>10)/3-1;
#else
qg = (int)floor(.5f+gain1*32/3)-1;
@@ -1279,7 +1282,7 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32
if ((!has_surround_mask||lfe) && (constrained_vbr || bitrate<64000))
{
opus_val16 rate_factor;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
rate_factor = MAX16(0,(bitrate-32000));
#else
rate_factor = MAX16(0,(1.f/32768)*(bitrate-32000));
@@ -1509,7 +1512,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
sample_max=MAX32(st->overlap_max, celt_maxabs16(pcm, C*(N-overlap)/st->upsample));
st->overlap_max=celt_maxabs16(pcm+C*(N-overlap)/st->upsample, C*overlap/st->upsample);
sample_max=MAX32(sample_max, st->overlap_max);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
silence = (sample_max==0);
#else
silence = (sample_max <= (opus_val16)1/(1<<st->lsb_depth));
@@ -1539,7 +1542,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
}
c=0; do {
int need_clip=0;
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
need_clip = st->clip && sample_max>65536.f;
#endif
celt_preemphasis(pcm+c, in+c*(N+overlap)+overlap, N, CC, st->upsample,
@@ -2156,7 +2159,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
#ifdef CUSTOM_MODES
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int opus_custom_encode(CELTEncoder * OPUS_RESTRICT st, const opus_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes)
{
return celt_encode_with_ec(st, pcm, frame_size, compressed, nbCompressedBytes, NULL);
diff --git a/drivers/opus/celt/celt_lpc.c b/thirdparty/opus/celt/celt_lpc.c
index 5b8c01021..f02145af0 100644
--- a/drivers/opus/celt/celt_lpc.c
+++ b/thirdparty/opus/celt/celt_lpc.c
@@ -24,12 +24,15 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/pitch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "celt_lpc.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "pitch.h"
void _celt_lpc(
opus_val16 *_lpc, /* out: [0...p-1] LPC coefficients */
@@ -40,7 +43,7 @@ int p
int i, j;
opus_val32 r;
opus_val32 error = ac[0];
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_val32 lpc[LPC_ORDER];
#else
float *lpc = _lpc;
@@ -70,7 +73,7 @@ int p
error = error - MULT32_32_Q31(MULT32_32_Q31(r,r),error);
/* Bail out once we get 30 dB gain */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (error<SHR32(ac[0],10))
break;
#else
@@ -79,7 +82,7 @@ int p
#endif
}
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
for (i=0;i<p;i++)
_lpc[i] = ROUND16(lpc[i],16);
#endif
@@ -257,7 +260,7 @@ int _celt_autocorr(
xptr = xx;
}
shift=0;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
{
opus_val32 ac0;
ac0 = 1+(n<<7);
@@ -286,7 +289,7 @@ int _celt_autocorr(
d = MAC16_16(d, xptr[i], xptr[i-k]);
ac[k] += d;
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
shift = 2*shift;
if (shift<=0)
ac[0] += SHL32((opus_int32)1, -shift);
diff --git a/drivers/opus/celt/celt_lpc.h b/thirdparty/opus/celt/celt_lpc.h
index dc0352d46..323459eb1 100644
--- a/drivers/opus/celt/celt_lpc.h
+++ b/thirdparty/opus/celt/celt_lpc.h
@@ -28,11 +28,11 @@
#ifndef PLC_H
#define PLC_H
-#include "opus/celt/arch.h"
-#include "opus/celt/cpu_support.h"
+#include "arch.h"
+#include "cpu_support.h"
#if defined(OPUS_X86_MAY_HAVE_SSE4_1)
-#include "opus/celt/x86/celt_lpc_sse.h"
+#include "x86/celt_lpc_sse.h"
#endif
#define LPC_ORDER 24
diff --git a/drivers/opus/celt/cpu_support.h b/thirdparty/opus/celt/cpu_support.h
index 2507e1861..68fc60678 100644
--- a/drivers/opus/celt/cpu_support.h
+++ b/thirdparty/opus/celt/cpu_support.h
@@ -28,12 +28,12 @@
#ifndef CPU_SUPPORT_H
#define CPU_SUPPORT_H
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#include "opus_types.h"
+#include "opus_defines.h"
#if defined(OPUS_HAVE_RTCD) && \
(defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR))
-#include "opus/celt/arm/armcpu.h"
+#include "arm/armcpu.h"
/* We currently support 4 ARM variants:
* arch[0] -> ARMv4
@@ -48,7 +48,7 @@
(defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)) || \
(defined(OPUS_X86_MAY_HAVE_AVX) && !defined(OPUS_X86_PRESUME_AVX))
-#include "opus/celt/x86/x86cpu.h"
+#include "x86/x86cpu.h"
/* We currently support 5 x86 variants:
* arch[0] -> non-sse
* arch[1] -> sse
diff --git a/drivers/opus/celt/cwrs.c b/thirdparty/opus/celt/cwrs.c
index 983d4580a..2fa9f89cd 100644
--- a/drivers/opus/celt/cwrs.c
+++ b/thirdparty/opus/celt/cwrs.c
@@ -26,12 +26,15 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/cwrs.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/arch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "os_support.h"
+#include "cwrs.h"
+#include "mathops.h"
+#include "arch.h"
#ifdef CUSTOM_MODES
diff --git a/drivers/opus/celt/cwrs.h b/thirdparty/opus/celt/cwrs.h
index f0ea844e5..7cd471745 100644
--- a/drivers/opus/celt/cwrs.h
+++ b/thirdparty/opus/celt/cwrs.h
@@ -30,10 +30,10 @@
#ifndef CWRS_H
#define CWRS_H
-#include "opus/celt/arch.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
+#include "arch.h"
+#include "stack_alloc.h"
+#include "entenc.h"
+#include "entdec.h"
#ifdef CUSTOM_MODES
int log2_frac(opus_uint32 val, int frac);
diff --git a/drivers/opus/celt/ecintrin.h b/thirdparty/opus/celt/ecintrin.h
index 6ed8fb280..2263cff6b 100644
--- a/drivers/opus/celt/ecintrin.h
+++ b/thirdparty/opus/celt/ecintrin.h
@@ -26,10 +26,10 @@
*/
/*Some common macros for potential platform-specific optimization.*/
-#include "opus/opus_types.h"
+#include "opus_types.h"
#include <math.h>
#include <limits.h>
-#include "opus/celt/arch.h"
+#include "arch.h"
#if !defined(_ecintrin_H)
# define _ecintrin_H (1)
diff --git a/drivers/opus/celt/entcode.c b/thirdparty/opus/celt/entcode.c
index d1c6b25c7..70f32016e 100644
--- a/drivers/opus/celt/entcode.c
+++ b/thirdparty/opus/celt/entcode.c
@@ -24,10 +24,13 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/entcode.h"
-#include "opus/celt/arch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "entcode.h"
+#include "arch.h"
#if !defined(EC_CLZ)
/*This is a fallback for systems where we don't know how to access
diff --git a/drivers/opus/celt/entcode.h b/thirdparty/opus/celt/entcode.h
index 4d736d4dc..13d6c84ef 100644
--- a/drivers/opus/celt/entcode.h
+++ b/thirdparty/opus/celt/entcode.h
@@ -25,14 +25,14 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#include "opus_types.h"
+#include "opus_defines.h"
#if !defined(_entcode_H)
# define _entcode_H (1)
# include <limits.h>
# include <stddef.h>
-# include "opus/celt/ecintrin.h"
+# include "ecintrin.h"
extern const opus_uint32 SMALL_DIV_TABLE[129];
diff --git a/drivers/opus/celt/entdec.c b/thirdparty/opus/celt/entdec.c
index fdc49c92c..0b3433ed8 100644
--- a/drivers/opus/celt/entdec.c
+++ b/thirdparty/opus/celt/entdec.c
@@ -24,13 +24,16 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stddef.h>
-#include "opus/celt/os_support.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/entdec.h"
-#include "opus/celt/mfrngcod.h"
+#include "os_support.h"
+#include "arch.h"
+#include "entdec.h"
+#include "mfrngcod.h"
/*A range decoder.
This is an entropy decoder based upon \cite{Mar79}, which is itself a
diff --git a/drivers/opus/celt/entdec.h b/thirdparty/opus/celt/entdec.h
index fda60ab32..d8ab31873 100644
--- a/drivers/opus/celt/entdec.h
+++ b/thirdparty/opus/celt/entdec.h
@@ -28,7 +28,7 @@
#if !defined(_entdec_H)
# define _entdec_H (1)
# include <limits.h>
-# include "opus/celt/entcode.h"
+# include "entcode.h"
/*Initializes the decoder.
_buf: The input buffer to use.
diff --git a/drivers/opus/celt/entenc.c b/thirdparty/opus/celt/entenc.c
index da7f2c8e6..f1750d25b 100644
--- a/drivers/opus/celt/entenc.c
+++ b/thirdparty/opus/celt/entenc.c
@@ -24,11 +24,14 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/mfrngcod.h"
+
+#if defined(HAVE_CONFIG_H)
+# include "config.h"
+#endif
+#include "os_support.h"
+#include "arch.h"
+#include "entenc.h"
+#include "mfrngcod.h"
/*A range encoder.
See entdec.c and the references for implementation details \cite{Mar79,MNW98}.
diff --git a/drivers/opus/celt/entenc.h b/thirdparty/opus/celt/entenc.h
index 3f4a3acc9..796bc4d57 100644
--- a/drivers/opus/celt/entenc.h
+++ b/thirdparty/opus/celt/entenc.h
@@ -28,7 +28,7 @@
#if !defined(_entenc_H)
# define _entenc_H (1)
# include <stddef.h>
-# include "opus/celt/entcode.h"
+# include "entcode.h"
/*Initializes the encoder.
_buf: The buffer to store output bytes in.
diff --git a/drivers/opus/celt/fixed_debug.h b/thirdparty/opus/celt/fixed_debug.h
index 3b8d5ef7a..d28227f5d 100644
--- a/drivers/opus/celt/fixed_debug.h
+++ b/thirdparty/opus/celt/fixed_debug.h
@@ -33,7 +33,7 @@
#define FIXED_DEBUG_H
#include <stdio.h>
-#include "opus/opus_defines.h"
+#include "opus_defines.h"
#ifdef CELT_C
OPUS_EXPORT opus_int64 celt_mips=0;
diff --git a/drivers/opus/celt/fixed_generic.h b/thirdparty/opus/celt/fixed_generic.h
index 71ab048e4..ac67d37ce 100644
--- a/drivers/opus/celt/fixed_generic.h
+++ b/thirdparty/opus/celt/fixed_generic.h
@@ -136,7 +136,7 @@
#define DIV32(a,b) (((opus_val32)(a))/((opus_val32)(b)))
#if defined(MIPSr1_ASM)
-#include "opus/celt/mips/fixed_generic_mipsr1.h"
+#include "mips/fixed_generic_mipsr1.h"
#endif
static OPUS_INLINE opus_val16 SIG2WORD16_generic(celt_sig x)
diff --git a/drivers/opus/celt/float_cast.h b/thirdparty/opus/celt/float_cast.h
index 36a1bfe67..ed5a39b54 100644
--- a/drivers/opus/celt/float_cast.h
+++ b/thirdparty/opus/celt/float_cast.h
@@ -30,7 +30,7 @@
#define FLOAT_CAST_H
-#include "opus/celt/arch.h"
+#include "arch.h"
/*============================================================================
** On Intel Pentium processors (especially PIII and probably P4), converting
diff --git a/drivers/opus/celt/kiss_fft.c b/thirdparty/opus/celt/kiss_fft.c
index cf8d049fa..4ed37d2bb 100644
--- a/drivers/opus/celt/kiss_fft.c
+++ b/thirdparty/opus/celt/kiss_fft.c
@@ -30,14 +30,16 @@
heavily modified to better suit Opus */
#ifndef SKIP_CONFIG_H
-#include "opus/opus_config.h"
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
#endif
-#include "opus/celt/_kiss_fft_guts.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/stack_alloc.h"
+#include "_kiss_fft_guts.h"
+#include "arch.h"
+#include "os_support.h"
+#include "mathops.h"
+#include "stack_alloc.h"
/* The guts header contains all the multiplication and addition macros that are defined for
complex numbers. It also delares the kf_ internal functions.
@@ -188,7 +190,7 @@ static void kf_bfly3(
kiss_twiddle_cpx epi3;
kiss_fft_cpx * Fout_beg = Fout;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
epi3.r = -16384;
epi3.i = -28378;
#else
@@ -246,7 +248,7 @@ static void kf_bfly5(
kiss_twiddle_cpx ya,yb;
kiss_fft_cpx * Fout_beg = Fout;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
ya.r = 10126;
ya.i = -31164;
yb.r = -26510;
@@ -407,7 +409,7 @@ int kf_factor(int n,opus_int16 * facbuf)
static void compute_twiddles(kiss_twiddle_cpx *twiddles, int nfft)
{
int i;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
for (i=0;i<nfft;++i) {
opus_val32 phase = -i;
kf_cexp2(twiddles+i, DIV32(SHL32(phase,17),nfft));
@@ -450,7 +452,7 @@ kiss_fft_state *opus_fft_alloc_twiddles(int nfft,void * mem,size_t * lenmem,
kiss_twiddle_cpx *twiddles;
st->nfft=nfft;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
st->scale_shift = celt_ilog2(st->nfft);
if (st->nfft == 1<<st->scale_shift)
st->scale = Q15ONE;
@@ -568,7 +570,7 @@ void opus_fft_c(const kiss_fft_state *st,const kiss_fft_cpx *fin,kiss_fft_cpx *f
{
int i;
opus_val16 scale;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Allows us to scale with MULT16_32_Q16(), which is faster than
MULT16_32_Q15() on ARM. */
int scale_shift = st->scale_shift-1;
diff --git a/drivers/opus/celt/kiss_fft.h b/thirdparty/opus/celt/kiss_fft.h
index 6229044c4..bffa2bfad 100644
--- a/drivers/opus/celt/kiss_fft.h
+++ b/thirdparty/opus/celt/kiss_fft.h
@@ -31,8 +31,8 @@
#include <stdlib.h>
#include <math.h>
-#include "opus/celt/arch.h"
-#include "opus/celt/cpu_support.h"
+#include "arch.h"
+#include "cpu_support.h"
#ifdef __cplusplus
extern "C" {
@@ -46,8 +46,8 @@ extern "C" {
#define KISS_FFT_MALLOC opus_alloc
#endif
-#ifdef OPUS_FIXED_POINT
-#include "opus/celt/arch.h"
+#ifdef FIXED_POINT
+#include "arch.h"
# define kiss_fft_scalar opus_int32
# define kiss_twiddle_scalar opus_int16
@@ -86,7 +86,7 @@ typedef struct arch_fft_state{
typedef struct kiss_fft_state{
int nfft;
opus_val16 scale;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int scale_shift;
#endif
int shift;
@@ -97,7 +97,7 @@ typedef struct kiss_fft_state{
} kiss_fft_state;
#if defined(HAVE_ARM_NE10)
-#include "opus/celt/arm/fft_arm.h"
+#include "arm/fft_arm.h"
#endif
/*typedef struct kiss_fft_state* kiss_fft_cfg;*/
diff --git a/drivers/opus/celt/laplace.c b/thirdparty/opus/celt/laplace.c
index 5bc956af4..a7bca874b 100644
--- a/drivers/opus/celt/laplace.c
+++ b/thirdparty/opus/celt/laplace.c
@@ -25,10 +25,13 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/laplace.h"
-#include "opus/celt/mathops.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "laplace.h"
+#include "mathops.h"
/* The minimum probability of an energy delta (out of 32768). */
#define LAPLACE_LOG_MINP (0)
diff --git a/drivers/opus/celt/laplace.h b/thirdparty/opus/celt/laplace.h
index 9efcc73aa..46c14b5da 100644
--- a/drivers/opus/celt/laplace.h
+++ b/thirdparty/opus/celt/laplace.h
@@ -26,8 +26,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
+#include "entenc.h"
+#include "entdec.h"
/** Encode a value that is assumed to be the realisation of a
Laplace-distributed random process
diff --git a/drivers/opus/celt/mathops.c b/thirdparty/opus/celt/mathops.c
index 3f7c1a8bd..3f8c5dcc0 100644
--- a/drivers/opus/celt/mathops.c
+++ b/thirdparty/opus/celt/mathops.c
@@ -30,9 +30,12 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/mathops.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "mathops.h"
/*Compute floor(sqrt(_val)) with exact arithmetic.
This has been tested on all possible 32-bit inputs.*/
@@ -61,7 +64,7 @@ unsigned isqrt32(opus_uint32 _val){
return g;
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_val32 frac_div32(opus_val32 a, opus_val32 b)
{
diff --git a/drivers/opus/celt/mathops.h b/thirdparty/opus/celt/mathops.h
index a008d71e1..a0525a961 100644
--- a/drivers/opus/celt/mathops.h
+++ b/thirdparty/opus/celt/mathops.h
@@ -34,9 +34,9 @@
#ifndef MATHOPS_H
#define MATHOPS_H
-#include "opus/celt/arch.h"
-#include "opus/celt/entcode.h"
-#include "opus/celt/os_support.h"
+#include "arch.h"
+#include "entcode.h"
+#include "os_support.h"
/* Multiplies two 16-bit fractional values. Bit-exactness of this macro is important */
#define FRAC_MUL16(a,b) ((16384+((opus_int32)(opus_int16)(a)*(opus_int16)(b)))>>15)
@@ -59,7 +59,7 @@ static OPUS_INLINE opus_val32 celt_maxabs16(const opus_val16 *x, int len)
#endif
#ifndef OVERRIDE_CELT_MAXABS32
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
static OPUS_INLINE opus_val32 celt_maxabs32(const opus_val32 *x, int len)
{
int i;
@@ -78,7 +78,7 @@ static OPUS_INLINE opus_val32 celt_maxabs32(const opus_val32 *x, int len)
#endif
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
#define PI 3.141592653f
#define celt_sqrt(x) ((float)sqrt(x))
@@ -139,9 +139,9 @@ static OPUS_INLINE float celt_exp2(float x)
#endif
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
-#include "opus/celt/os_support.h"
+#include "os_support.h"
#ifndef OVERRIDE_CELT_ILOG2
/** Integer log in base2. Undefined for zero and negative numbers */
diff --git a/drivers/opus/celt/mdct.c b/thirdparty/opus/celt/mdct.c
index 641a20e49..5315ad11a 100644
--- a/drivers/opus/celt/mdct.c
+++ b/thirdparty/opus/celt/mdct.c
@@ -40,19 +40,21 @@
*/
#ifndef SKIP_CONFIG_H
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#endif
-#include "opus/celt/mdct.h"
-#include "opus/celt/kiss_fft.h"
-#include "opus/celt/_kiss_fft_guts.h"
+#include "mdct.h"
+#include "kiss_fft.h"
+#include "_kiss_fft_guts.h"
#include <math.h>
-#include "opus/celt/os_support.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/stack_alloc.h"
+#include "os_support.h"
+#include "mathops.h"
+#include "stack_alloc.h"
#if defined(MIPSr1_ASM)
-#include "opus/celt/mips/mdct_mipsr1.h"
+#include "mips/mdct_mipsr1.h"
#endif
@@ -124,7 +126,7 @@ void clt_mdct_forward_c(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scal
const kiss_fft_state *st = l->kfft[shift];
const kiss_twiddle_scalar *trig;
opus_val16 scale;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Allows us to scale with MULT16_32_Q16(), which is faster than
MULT16_32_Q15() on ARM. */
int scale_shift = st->scale_shift-1;
diff --git a/drivers/opus/celt/mdct.h b/thirdparty/opus/celt/mdct.h
index 2ec98a92e..160ae4e0f 100644
--- a/drivers/opus/celt/mdct.h
+++ b/thirdparty/opus/celt/mdct.h
@@ -42,9 +42,9 @@
#ifndef MDCT_H
#define MDCT_H
-#include "opus/opus_defines.h"
-#include "opus/celt/kiss_fft.h"
-#include "opus/celt/arch.h"
+#include "opus_defines.h"
+#include "kiss_fft.h"
+#include "arch.h"
typedef struct {
int n;
@@ -54,7 +54,7 @@ typedef struct {
} mdct_lookup;
#if defined(HAVE_ARM_NE10)
-#include "opus/celt/arm/mdct_arm.h"
+#include "arm/mdct_arm.h"
#endif
diff --git a/drivers/opus/celt/mfrngcod.h b/thirdparty/opus/celt/mfrngcod.h
index c24d98cde..809152a59 100644
--- a/drivers/opus/celt/mfrngcod.h
+++ b/thirdparty/opus/celt/mfrngcod.h
@@ -27,7 +27,7 @@
#if !defined(_mfrngcode_H)
# define _mfrngcode_H (1)
-# include "opus/celt/entcode.h"
+# include "entcode.h"
/*Constants used by the entropy encoder/decoder.*/
diff --git a/drivers/opus/celt/mips/celt_mipsr1.h b/thirdparty/opus/celt/mips/celt_mipsr1.h
index 906848f1e..e85661a66 100644
--- a/drivers/opus/celt/mips/celt_mipsr1.h
+++ b/thirdparty/opus/celt/mips/celt_mipsr1.h
@@ -29,26 +29,29 @@
#ifndef __CELT_MIPSR1_H__
#define __CELT_MIPSR1_H__
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#define CELT_C
-#include "opus/celt/os_support.h"
-#include "opus/celt/mdct.h"
+#include "os_support.h"
+#include "mdct.h"
#include <math.h>
-#include "opus/celt/celt.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/bands.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/entcode.h"
-#include "opus/celt/quant_bands.h"
-#include "opus/celt/rate.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/float_cast.h"
+#include "celt.h"
+#include "pitch.h"
+#include "bands.h"
+#include "modes.h"
+#include "entcode.h"
+#include "quant_bands.h"
+#include "rate.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "float_cast.h"
#include <stdarg.h>
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/vq.h"
+#include "celt_lpc.h"
+#include "vq.h"
#define OVERRIDE_comb_filter
void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N,
diff --git a/drivers/opus/celt/mips/fixed_generic_mipsr1.h b/thirdparty/opus/celt/mips/fixed_generic_mipsr1.h
index 4a05efbf8..4a05efbf8 100644
--- a/drivers/opus/celt/mips/fixed_generic_mipsr1.h
+++ b/thirdparty/opus/celt/mips/fixed_generic_mipsr1.h
diff --git a/drivers/opus/celt/mips/kiss_fft_mipsr1.h b/thirdparty/opus/celt/mips/kiss_fft_mipsr1.h
index 09dc9af46..400ca4de9 100644
--- a/drivers/opus/celt/mips/kiss_fft_mipsr1.h
+++ b/thirdparty/opus/celt/mips/kiss_fft_mipsr1.h
@@ -30,7 +30,7 @@
#error "This file should only be included from _kiss_fft_guts.h"
#endif
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
#define S_MUL_ADD(a, b, c, d) (S_MUL(a,b)+S_MUL(c,d))
#define S_MUL_SUB(a, b, c, d) (S_MUL(a,b)-S_MUL(c,d))
@@ -102,7 +102,7 @@ static void kf_bfly5(
kiss_twiddle_cpx ya,yb;
kiss_fft_cpx * Fout_beg = Fout;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
ya.r = 10126;
ya.i = -31164;
yb.r = -26510;
diff --git a/drivers/opus/celt/mips/mdct_mipsr1.h b/thirdparty/opus/celt/mips/mdct_mipsr1.h
index 0bb8b5a05..2934dab77 100644
--- a/drivers/opus/celt/mips/mdct_mipsr1.h
+++ b/thirdparty/opus/celt/mips/mdct_mipsr1.h
@@ -42,16 +42,18 @@
#define __MDCT_MIPSR1_H__
#ifndef SKIP_CONFIG_H
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#endif
-#include "opus/celt/mdct.h"
-#include "opus/celt/kiss_fft.h"
-#include "opus/celt/_kiss_fft_guts.h"
+#include "mdct.h"
+#include "kiss_fft.h"
+#include "_kiss_fft_guts.h"
#include <math.h>
-#include "opus/celt/os_support.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/stack_alloc.h"
+#include "os_support.h"
+#include "mathops.h"
+#include "stack_alloc.h"
/* Forward MDCT trashes the input array */
#define OVERRIDE_clt_mdct_forward
@@ -65,7 +67,7 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar
const kiss_fft_state *st = l->kfft[shift];
const kiss_twiddle_scalar *trig;
opus_val16 scale;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Allows us to scale with MULT16_32_Q16(), which is faster than
MULT16_32_Q15() on ARM. */
int scale_shift = st->scale_shift-1;
diff --git a/drivers/opus/celt/mips/pitch_mipsr1.h b/thirdparty/opus/celt/mips/pitch_mipsr1.h
index a9500aff5..a9500aff5 100644
--- a/drivers/opus/celt/mips/pitch_mipsr1.h
+++ b/thirdparty/opus/celt/mips/pitch_mipsr1.h
diff --git a/drivers/opus/celt/mips/vq_mipsr1.h b/thirdparty/opus/celt/mips/vq_mipsr1.h
index c68159972..54cef8613 100644
--- a/drivers/opus/celt/mips/vq_mipsr1.h
+++ b/thirdparty/opus/celt/mips/vq_mipsr1.h
@@ -28,10 +28,13 @@
#ifndef __VQ_MIPSR1_H__
#define __VQ_MIPSR1_H__
-#include "opus/opus_config.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/arch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "mathops.h"
+#include "arch.h"
static unsigned extract_collapse_mask(int *iy, int N, int B);
static void normalise_residual(int * OPUS_RESTRICT iy, celt_norm * OPUS_RESTRICT X, int N, opus_val32 Ryy, opus_val16 gain);
@@ -73,7 +76,7 @@ static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_
void renormalise_vector_mips(celt_norm *X, int N, opus_val16 gain, int arch)
{
int i;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int k;
#endif
opus_val32 E = EPSILON;
@@ -104,7 +107,7 @@ void renormalise_vector_mips(celt_norm *X, int N, opus_val16 gain, int arch)
}
asm volatile("MFLO %0, $ac1" : "=r" (E));
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
k = celt_ilog2(E)>>1;
#endif
t = VSHR32(E, 2*(k-7));
diff --git a/drivers/opus/celt/modes.c b/thirdparty/opus/celt/modes.c
index d628f1468..911686e90 100644
--- a/drivers/opus/celt/modes.c
+++ b/thirdparty/opus/celt/modes.c
@@ -26,15 +26,18 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/celt.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/rate.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/quant_bands.h"
-#include "opus/celt/cpu_support.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "celt.h"
+#include "modes.h"
+#include "rate.h"
+#include "os_support.h"
+#include "stack_alloc.h"
+#include "quant_bands.h"
+#include "cpu_support.h"
static const opus_int16 eband5ms[] = {
/*0 200 400 600 800 1k 1.2 1.4 1.6 2k 2.4 2.8 3.2 4k 4.8 5.6 6.8 8k 9.6 12k 15.6 */
@@ -60,10 +63,10 @@ static const unsigned char band_allocation[] = {
};
#ifndef CUSTOM_MODES_ONLY
- #ifdef OPUS_FIXED_POINT
- #include "opus/celt/static_modes_fixed.h"
+ #ifdef FIXED_POINT
+ #include "static_modes_fixed.h"
#else
- #include "opus/celt/static_modes_float.h"
+ #include "static_modes_float.h"
#endif
#endif /* CUSTOM_MODES_ONLY */
@@ -368,7 +371,7 @@ CELTMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error)
if (window==NULL)
goto failure;
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
for (i=0;i<mode->overlap;i++)
window[i] = Q15ONE*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap));
#else
diff --git a/drivers/opus/celt/modes.h b/thirdparty/opus/celt/modes.h
index a5f1c30ac..be813ccc8 100644
--- a/drivers/opus/celt/modes.h
+++ b/thirdparty/opus/celt/modes.h
@@ -30,12 +30,12 @@
#ifndef MODES_H
#define MODES_H
-#include "opus/opus_types.h"
-#include "opus/celt/celt.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/mdct.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
+#include "opus_types.h"
+#include "celt.h"
+#include "arch.h"
+#include "mdct.h"
+#include "entenc.h"
+#include "entdec.h"
#define MAX_PERIOD 1024
diff --git a/drivers/opus/celt/opus_custom_demo.c b/thirdparty/opus/celt/opus_custom_demo.c
index 956bec4e4..ae41c0de5 100644
--- a/drivers/opus/celt/opus_custom_demo.c
+++ b/thirdparty/opus/celt/opus_custom_demo.c
@@ -25,10 +25,13 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/opus_custom.h"
-#include "opus/celt/arch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus_custom.h"
+#include "arch.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
diff --git a/drivers/opus/celt/os_support.h b/thirdparty/opus/celt/os_support.h
index 5e36b3ae5..a2171971e 100644
--- a/drivers/opus/celt/os_support.h
+++ b/thirdparty/opus/celt/os_support.h
@@ -35,8 +35,8 @@
# include "custom_support.h"
#endif
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#include "opus_types.h"
+#include "opus_defines.h"
#include <string.h>
#include <stdio.h>
diff --git a/drivers/opus/celt/pitch.c b/thirdparty/opus/celt/pitch.c
index 1bcbabe94..1d89cb034 100644
--- a/drivers/opus/celt/pitch.c
+++ b/thirdparty/opus/celt/pitch.c
@@ -30,18 +30,21 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/celt_lpc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pitch.h"
+#include "os_support.h"
+#include "modes.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "celt_lpc.h"
static void find_best_pitch(opus_val32 *xcorr, opus_val16 *y, int len,
int max_pitch, int *best_pitch
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
, int yshift, opus_val32 maxcorr
#endif
)
@@ -50,7 +53,7 @@ static void find_best_pitch(opus_val32 *xcorr, opus_val16 *y, int len,
opus_val32 Syy=1;
opus_val16 best_num[2];
opus_val32 best_den[2];
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int xshift;
xshift = celt_ilog2(maxcorr)-14;
@@ -71,7 +74,7 @@ static void find_best_pitch(opus_val32 *xcorr, opus_val16 *y, int len,
opus_val16 num;
opus_val32 xcorr16;
xcorr16 = EXTRACT16(VSHR32(xcorr[i], xshift));
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
/* Considering the range of xcorr16, this should avoid both underflows
and overflows (inf) when squaring xcorr16 */
xcorr16 *= 1e-12f;
@@ -150,7 +153,7 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x
opus_val16 lpc[4], mem[5]={0,0,0,0,0};
opus_val16 lpc2[5];
opus_val16 c1 = QCONST16(.8f,15);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int shift;
opus_val32 maxabs = celt_maxabs32(x[0], len);
if (C==2)
@@ -180,7 +183,7 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x
4, len>>1, arch);
/* Noise floor -40 dB */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
ac[0] += SHR32(ac[0],13);
#else
ac[0] *= 1.0001f;
@@ -189,7 +192,7 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x
for (i=1;i<=4;i++)
{
/*ac[i] *= exp(-.5*(2*M_PI*.002*i)*(2*M_PI*.002*i));*/
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
ac[i] -= MULT16_32_Q15(2*i*i, ac[i]);
#else
ac[i] -= ac[i]*(.008f*i)*(.008f*i);
@@ -212,7 +215,7 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x
}
/* Pure C implementation. */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_val32
#else
void
@@ -229,7 +232,7 @@ celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y,
#if 0 /* This is a simple version of the pitch correlation that should work
well on DSPs like Blackfin and TI C5x/C6x */
int i, j;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_val32 maxcorr=1;
#endif
#if !defined(OVERRIDE_PITCH_XCORR)
@@ -241,11 +244,11 @@ celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y,
for (j=0;j<len;j++)
sum = MAC16_16(sum, _x[j], _y[i+j]);
xcorr[i] = sum;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
maxcorr = MAX32(maxcorr, sum);
#endif
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
return maxcorr;
#endif
@@ -254,7 +257,7 @@ celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y,
/*The EDSP version requires that max_pitch is at least 1, and that _x is
32-bit aligned.
Since it's hard to put asserts in assembly, put them here.*/
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_val32 maxcorr=1;
#endif
celt_assert(max_pitch>0);
@@ -271,7 +274,7 @@ celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y,
xcorr[i+1]=sum[1];
xcorr[i+2]=sum[2];
xcorr[i+3]=sum[3];
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
sum[0] = MAX32(sum[0], sum[1]);
sum[2] = MAX32(sum[2], sum[3]);
sum[0] = MAX32(sum[0], sum[2]);
@@ -288,11 +291,11 @@ celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y,
sum = celt_inner_prod(_x, _y+i, len, arch);
#endif
xcorr[i] = sum;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
maxcorr = MAX32(maxcorr, sum);
#endif
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
return maxcorr;
#endif
#endif
@@ -307,7 +310,7 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR
VARDECL(opus_val16, x_lp4);
VARDECL(opus_val16, y_lp4);
VARDECL(opus_val32, xcorr);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_val32 maxcorr;
opus_val32 xmax, ymax;
int shift=0;
@@ -330,7 +333,7 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR
for (j=0;j<lag>>2;j++)
y_lp4[j] = y[2*j];
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
xmax = celt_maxabs16(x_lp4, len>>2);
ymax = celt_maxabs16(y_lp4, lag>>2);
shift = celt_ilog2(MAX32(1, MAX32(xmax, ymax)))-11;
@@ -349,19 +352,19 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR
/* Coarse search with 4x decimation */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
maxcorr =
#endif
celt_pitch_xcorr(x_lp4, y_lp4, xcorr, len>>2, max_pitch>>2, arch);
find_best_pitch(xcorr, y_lp4, len>>2, max_pitch>>2, best_pitch
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
, 0, maxcorr
#endif
);
/* Finer search with 2x decimation */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
maxcorr=1;
#endif
for (i=0;i<max_pitch>>1;i++)
@@ -370,7 +373,7 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR
xcorr[i] = 0;
if (abs(i-2*best_pitch[0])>2 && abs(i-2*best_pitch[1])>2)
continue;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
sum = 0;
for (j=0;j<len>>1;j++)
sum += SHR32(MULT16_16(x_lp[j],y[i+j]), shift);
@@ -378,12 +381,12 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR
sum = celt_inner_prod_c(x_lp, y+i, len>>1);
#endif
xcorr[i] = MAX32(-1, sum);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
maxcorr = MAX32(maxcorr, sum);
#endif
}
find_best_pitch(xcorr, y, len>>1, max_pitch>>1, best_pitch
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
, shift+1, maxcorr
#endif
);
@@ -447,7 +450,7 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
yy = yy_lookup[T0];
best_xy = xy;
best_yy = yy;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
{
opus_val32 x2y2;
int sh, t;
@@ -483,7 +486,7 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
dual_inner_prod(x, &x[-T1], &x[-T1b], N, &xy, &xy2, arch);
xy += xy2;
yy = yy_lookup[T1] + yy_lookup[T1b];
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
{
opus_val32 x2y2;
int sh, t;
diff --git a/drivers/opus/celt/pitch.h b/thirdparty/opus/celt/pitch.h
index ecae7667b..65a77a6ec 100644
--- a/drivers/opus/celt/pitch.h
+++ b/thirdparty/opus/celt/pitch.h
@@ -34,21 +34,21 @@
#ifndef PITCH_H
#define PITCH_H
-#include "opus/celt/modes.h"
-#include "opus/celt/cpu_support.h"
+#include "modes.h"
+#include "cpu_support.h"
#if (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)) \
|| ((defined(OPUS_X86_MAY_HAVE_SSE4_1) || defined(OPUS_X86_MAY_HAVE_SSE2)) && defined(FIXED_POINT))
-#include "opus/celt/x86/pitch_sse.h"
+#include "x86/pitch_sse.h"
#endif
#if defined(MIPSr1_ASM)
-#include "opus/celt/mips/pitch_mipsr1.h"
+#include "mips/pitch_mipsr1.h"
#endif
#if ((defined(OPUS_ARM_ASM) && defined(FIXED_POINT)) \
|| defined(OPUS_ARM_MAY_HAVE_NEON_INTR))
-# include "opus/celt/arm/pitch_arm.h"
+# include "arm/pitch_arm.h"
#endif
void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp,
@@ -178,7 +178,7 @@ void comb_filter_const_c(opus_val32 *y, opus_val32 *x, int T, int N,
#endif
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_val32
#else
void
@@ -206,7 +206,7 @@ void
xcorr, len, max_pitch))
# else
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_val32
#else
void
diff --git a/drivers/opus/celt/quant_bands.c b/thirdparty/opus/celt/quant_bands.c
index b38bfa8b8..95076e0af 100644
--- a/drivers/opus/celt/quant_bands.c
+++ b/thirdparty/opus/celt/quant_bands.c
@@ -25,18 +25,21 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/quant_bands.h"
-#include "opus/celt/laplace.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "quant_bands.h"
+#include "laplace.h"
#include <math.h>
-#include "opus/celt/os_support.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/rate.h"
+#include "os_support.h"
+#include "arch.h"
+#include "mathops.h"
+#include "stack_alloc.h"
+#include "rate.h"
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Mean energy in each band quantized in Q4 */
const signed char eMeans[25] = {
103,100, 92, 85, 81,
@@ -56,7 +59,7 @@ const opus_val16 eMeans[25] = {
};
#endif
/* prediction coefficients: 0.9, 0.8, 0.65, 0.5 */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
static const opus_val16 pred_coef[4] = {29440, 26112, 21248, 16384};
static const opus_val16 beta_coef[4] = {30147, 22282, 12124, 6554};
static const opus_val16 beta_intra = 4915;
@@ -187,7 +190,7 @@ static int quant_coarse_energy_impl(const CELTMode *m, int start, int end,
opus_val16 decay_bound;
x = eBands[i+c*m->nbEBands];
oldE = MAX16(-QCONST16(9.f,DB_SHIFT), oldEBands[i+c*m->nbEBands]);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
f = SHL32(EXTEND32(x),7) - PSHR32(MULT16_16(coef,oldE), 8) - prev[c];
/* Rounding to nearest integer here is really important! */
qi = (f+QCONST32(.5f,DB_SHIFT+7))>>(DB_SHIFT+7);
@@ -245,7 +248,7 @@ static int quant_coarse_energy_impl(const CELTMode *m, int start, int end,
q = (opus_val32)SHL32(EXTEND32(qi),DB_SHIFT);
tmp = PSHR32(MULT16_16(coef,oldE),8) + prev[c] + SHL32(q,7);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
tmp = MAX32(-QCONST32(28.f, DB_SHIFT+7), tmp);
#endif
oldEBands[i+c*m->nbEBands] = PSHR32(tmp, 7);
@@ -282,7 +285,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
max_decay = QCONST16(16.f,DB_SHIFT);
if (end-start>10)
{
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
max_decay = MIN32(max_decay, SHL32(EXTEND32(nbAvailableBytes),DB_SHIFT-3));
#else
max_decay = MIN32(max_decay, .125f*nbAvailableBytes);
@@ -369,7 +372,7 @@ void quant_fine_energy(const CELTMode *m, int start, int end, opus_val16 *oldEBa
do {
int q2;
opus_val16 offset;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* Has to be without rounding */
q2 = (error[i+c*m->nbEBands]+QCONST16(.5f,DB_SHIFT))>>(DB_SHIFT-fine_quant[i]);
#else
@@ -380,7 +383,7 @@ void quant_fine_energy(const CELTMode *m, int start, int end, opus_val16 *oldEBa
if (q2<0)
q2 = 0;
ec_enc_bits(enc, q2, fine_quant[i]);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
offset = SUB16(SHR32(SHL32(EXTEND32(q2),DB_SHIFT)+QCONST16(.5f,DB_SHIFT),fine_quant[i]),QCONST16(.5f,DB_SHIFT));
#else
offset = (q2+.5f)*(1<<(14-fine_quant[i]))*(1.f/16384) - .5f;
@@ -409,7 +412,7 @@ void quant_energy_finalise(const CELTMode *m, int start, int end, opus_val16 *ol
opus_val16 offset;
q2 = error[i+c*m->nbEBands]<0 ? 0 : 1;
ec_enc_bits(enc, q2, 1);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
offset = SHR16(SHL16(q2,DB_SHIFT)-QCONST16(.5f,DB_SHIFT),fine_quant[i]+1);
#else
offset = (q2-.5f)*(1<<(14-fine_quant[i]-1))*(1.f/16384);
@@ -477,7 +480,7 @@ void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *ol
oldEBands[i+c*m->nbEBands] = MAX16(-QCONST16(9.f,DB_SHIFT), oldEBands[i+c*m->nbEBands]);
tmp = PSHR32(MULT16_16(coef,oldEBands[i+c*m->nbEBands]),8) + prev[c] + SHL32(q,7);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
tmp = MAX32(-QCONST32(28.f, DB_SHIFT+7), tmp);
#endif
oldEBands[i+c*m->nbEBands] = PSHR32(tmp, 7);
@@ -499,7 +502,7 @@ void unquant_fine_energy(const CELTMode *m, int start, int end, opus_val16 *oldE
int q2;
opus_val16 offset;
q2 = ec_dec_bits(dec, fine_quant[i]);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
offset = SUB16(SHR32(SHL32(EXTEND32(q2),DB_SHIFT)+QCONST16(.5f,DB_SHIFT),fine_quant[i]),QCONST16(.5f,DB_SHIFT));
#else
offset = (q2+.5f)*(1<<(14-fine_quant[i]))*(1.f/16384) - .5f;
@@ -525,7 +528,7 @@ void unquant_energy_finalise(const CELTMode *m, int start, int end, opus_val16 *
int q2;
opus_val16 offset;
q2 = ec_dec_bits(dec, 1);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
offset = SHR16(SHL16(q2,DB_SHIFT)-QCONST16(.5f,DB_SHIFT),fine_quant[i]+1);
#else
offset = (q2-.5f)*(1<<(14-fine_quant[i]-1))*(1.f/16384);
diff --git a/drivers/opus/celt/quant_bands.h b/thirdparty/opus/celt/quant_bands.h
index 31d4b94e4..0490bca4b 100644
--- a/drivers/opus/celt/quant_bands.h
+++ b/thirdparty/opus/celt/quant_bands.h
@@ -29,13 +29,13 @@
#ifndef QUANT_BANDS
#define QUANT_BANDS
-#include "opus/celt/arch.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
-#include "opus/celt/mathops.h"
+#include "arch.h"
+#include "modes.h"
+#include "entenc.h"
+#include "entdec.h"
+#include "mathops.h"
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
extern const signed char eMeans[25];
#else
extern const opus_val16 eMeans[25];
diff --git a/drivers/opus/celt/rate.c b/thirdparty/opus/celt/rate.c
index e69fb3f03..b28d8fecc 100644
--- a/drivers/opus/celt/rate.c
+++ b/thirdparty/opus/celt/rate.c
@@ -25,16 +25,19 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <math.h>
-#include "opus/celt/modes.h"
-#include "opus/celt/cwrs.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/os_support.h"
+#include "modes.h"
+#include "cwrs.h"
+#include "arch.h"
+#include "os_support.h"
-#include "opus/celt/entcode.h"
-#include "opus/celt/rate.h"
+#include "entcode.h"
+#include "rate.h"
static const unsigned char LOG2_FRAC_TABLE[24]={
0,
diff --git a/drivers/opus/celt/rate.h b/thirdparty/opus/celt/rate.h
index cf8085fcc..515f7687c 100644
--- a/drivers/opus/celt/rate.h
+++ b/thirdparty/opus/celt/rate.h
@@ -40,8 +40,8 @@
#define QTHETA_OFFSET 4
#define QTHETA_OFFSET_TWOPHASE 16
-#include "opus/celt/cwrs.h"
-#include "opus/celt/modes.h"
+#include "cwrs.h"
+#include "modes.h"
void compute_pulse_cache(CELTMode *m, int LM);
diff --git a/drivers/opus/celt/stack_alloc.h b/thirdparty/opus/celt/stack_alloc.h
index 7cd6c56cc..2b51c8d80 100644
--- a/drivers/opus/celt/stack_alloc.h
+++ b/thirdparty/opus/celt/stack_alloc.h
@@ -32,8 +32,8 @@
#ifndef STACK_ALLOC_H
#define STACK_ALLOC_H
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#include "opus_types.h"
+#include "opus_defines.h"
#if (!defined (VAR_ARRAYS) && !defined (USE_ALLOCA) && !defined (NONTHREADSAFE_PSEUDOSTACK))
#error "Opus requires one of VAR_ARRAYS, USE_ALLOCA, or NONTHREADSAFE_PSEUDOSTACK be defined to select the temporary allocation mode."
@@ -151,7 +151,7 @@ extern char *global_stack_top;
#endif /* ENABLE_VALGRIND */
-#include "opus/celt/os_support.h"
+#include "os_support.h"
#define VARDECL(type, var) type *var
#define ALLOC(var, size, type) var = PUSH(global_stack, size, type)
#define SAVE_STACK char *_saved_stack = global_stack;
diff --git a/drivers/opus/celt/static_modes_fixed.h b/thirdparty/opus/celt/static_modes_fixed.h
index 352642f50..8717d626c 100644
--- a/drivers/opus/celt/static_modes_fixed.h
+++ b/thirdparty/opus/celt/static_modes_fixed.h
@@ -1,12 +1,12 @@
/* The contents of this file was automatically generated by dump_modes.c
with arguments: 48000 960
It contains static definitions for some pre-defined modes. */
-#include "opus/celt/modes.h"
-#include "opus/celt/rate.h"
+#include "modes.h"
+#include "rate.h"
#ifdef HAVE_ARM_NE10
#define OVERRIDE_FFT 1
-#include "opus/celt/static_modes_fixed_arm_ne10.h"
+#include "static_modes_fixed_arm_ne10.h"
#endif
#ifndef DEF_WINDOW120
diff --git a/drivers/opus/celt/static_modes_fixed_arm_ne10.h b/thirdparty/opus/celt/static_modes_fixed_arm_ne10.h
index b8ef0cee9..b8ef0cee9 100644
--- a/drivers/opus/celt/static_modes_fixed_arm_ne10.h
+++ b/thirdparty/opus/celt/static_modes_fixed_arm_ne10.h
diff --git a/drivers/opus/celt/static_modes_float.h b/thirdparty/opus/celt/static_modes_float.h
index f7d501a99..e102a3839 100644
--- a/drivers/opus/celt/static_modes_float.h
+++ b/thirdparty/opus/celt/static_modes_float.h
@@ -1,12 +1,12 @@
/* The contents of this file was automatically generated by dump_modes.c
with arguments: 48000 960
It contains static definitions for some pre-defined modes. */
-#include "opus/celt/modes.h"
-#include "opus/celt/rate.h"
+#include "modes.h"
+#include "rate.h"
#ifdef HAVE_ARM_NE10
#define OVERRIDE_FFT 1
-#include "opus/celt/static_modes_float_arm_ne10.h"
+#include "static_modes_float_arm_ne10.h"
#endif
#ifndef DEF_WINDOW120
diff --git a/drivers/opus/celt/static_modes_float_arm_ne10.h b/thirdparty/opus/celt/static_modes_float_arm_ne10.h
index 934a82a42..934a82a42 100644
--- a/drivers/opus/celt/static_modes_float_arm_ne10.h
+++ b/thirdparty/opus/celt/static_modes_float_arm_ne10.h
diff --git a/thirdparty/opus/celt/tests/test_unit_cwrs32.c b/thirdparty/opus/celt/tests/test_unit_cwrs32.c
new file mode 100644
index 000000000..36dd8af5f
--- /dev/null
+++ b/thirdparty/opus/celt/tests/test_unit_cwrs32.c
@@ -0,0 +1,161 @@
+/* Copyright (c) 2008-2011 Xiph.Org Foundation, Mozilla Corporation,
+ Gregory Maxwell
+ Written by Jean-Marc Valin, Gregory Maxwell, and Timothy B. Terriberry */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+#ifndef CUSTOM_MODES
+#define CUSTOM_MODES
+#else
+#define TEST_CUSTOM_MODES
+#endif
+
+#define CELT_C
+#include "stack_alloc.h"
+#include "entenc.c"
+#include "entdec.c"
+#include "entcode.c"
+#include "cwrs.c"
+#include "mathops.c"
+#include "rate.h"
+
+#define NMAX (240)
+#define KMAX (128)
+
+#ifdef TEST_CUSTOM_MODES
+
+#define NDIMS (44)
+static const int pn[NDIMS]={
+ 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 18, 20, 22,
+ 24, 26, 28, 30, 32, 36, 40, 44, 48,
+ 52, 56, 60, 64, 72, 80, 88, 96, 104,
+ 112, 120, 128, 144, 160, 176, 192, 208
+};
+static const int pkmax[NDIMS]={
+ 128, 128, 128, 128, 88, 52, 36, 26, 22,
+ 18, 16, 15, 13, 12, 12, 11, 10, 9,
+ 9, 8, 8, 7, 7, 7, 7, 6, 6,
+ 6, 6, 6, 5, 5, 5, 5, 5, 5,
+ 4, 4, 4, 4, 4, 4, 4, 4
+};
+
+#else /* TEST_CUSTOM_MODES */
+
+#define NDIMS (22)
+static const int pn[NDIMS]={
+ 2, 3, 4, 6, 8, 9, 11, 12, 16,
+ 18, 22, 24, 32, 36, 44, 48, 64, 72,
+ 88, 96, 144, 176
+};
+static const int pkmax[NDIMS]={
+ 128, 128, 128, 88, 36, 26, 18, 16, 12,
+ 11, 9, 9, 7, 7, 6, 6, 5, 5,
+ 5, 5, 4, 4
+};
+
+#endif
+
+int main(void){
+ int t;
+ int n;
+ ALLOC_STACK;
+ for(t=0;t<NDIMS;t++){
+ int pseudo;
+ n=pn[t];
+ for(pseudo=1;pseudo<41;pseudo++)
+ {
+ int k;
+#if defined(SMALL_FOOTPRINT)
+ opus_uint32 uu[KMAX+2U];
+#endif
+ opus_uint32 inc;
+ opus_uint32 nc;
+ opus_uint32 i;
+ k=get_pulses(pseudo);
+ if (k>pkmax[t])break;
+ printf("Testing CWRS with N=%i, K=%i...\n",n,k);
+#if defined(SMALL_FOOTPRINT)
+ nc=ncwrs_urow(n,k,uu);
+#else
+ nc=CELT_PVQ_V(n,k);
+#endif
+ inc=nc/20000;
+ if(inc<1)inc=1;
+ for(i=0;i<nc;i+=inc){
+#if defined(SMALL_FOOTPRINT)
+ opus_uint32 u[KMAX+2U];
+#endif
+ int y[NMAX];
+ int sy;
+ opus_uint32 v;
+ opus_uint32 ii;
+ int j;
+#if defined(SMALL_FOOTPRINT)
+ memcpy(u,uu,(k+2U)*sizeof(*u));
+ cwrsi(n,k,i,y,u);
+#else
+ cwrsi(n,k,i,y);
+#endif
+ sy=0;
+ for(j=0;j<n;j++)sy+=abs(y[j]);
+ if(sy!=k){
+ fprintf(stderr,"N=%d Pulse count mismatch in cwrsi (%d!=%d).\n",
+ n,sy,k);
+ return 99;
+ }
+ /*printf("%6u of %u:",i,nc);
+ for(j=0;j<n;j++)printf(" %+3i",y[j]);
+ printf(" ->");*/
+#if defined(SMALL_FOOTPRINT)
+ ii=icwrs(n,k,&v,y,u);
+#else
+ ii=icwrs(n,y);
+ v=CELT_PVQ_V(n,k);
+#endif
+ if(ii!=i){
+ fprintf(stderr,"Combination-index mismatch (%lu!=%lu).\n",
+ (long)ii,(long)i);
+ return 1;
+ }
+ if(v!=nc){
+ fprintf(stderr,"Combination count mismatch (%lu!=%lu).\n",
+ (long)v,(long)nc);
+ return 2;
+ }
+ /*printf(" %6u\n",i);*/
+ }
+ /*printf("\n");*/
+ }
+ }
+ return 0;
+}
diff --git a/thirdparty/opus/celt/tests/test_unit_dft.c b/thirdparty/opus/celt/tests/test_unit_dft.c
new file mode 100644
index 000000000..6166eb0e4
--- /dev/null
+++ b/thirdparty/opus/celt/tests/test_unit_dft.c
@@ -0,0 +1,189 @@
+/* Copyright (c) 2008 Xiph.Org Foundation
+ Written by Jean-Marc Valin */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define SKIP_CONFIG_H
+
+#ifndef CUSTOM_MODES
+#define CUSTOM_MODES
+#endif
+
+#include <stdio.h>
+
+#define CELT_C
+#define TEST_UNIT_DFT_C
+#include "stack_alloc.h"
+#include "kiss_fft.h"
+#include "kiss_fft.c"
+#include "mathops.c"
+#include "entcode.c"
+
+#if defined(OPUS_X86_MAY_HAVE_SSE2) || defined(OPUS_X86_MAY_HAVE_SSE4_1)
+# include "x86/x86cpu.c"
+#elif defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+# include "arm/armcpu.c"
+# include "celt_lpc.c"
+# include "pitch.c"
+# if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+# include "arm/celt_neon_intr.c"
+# if defined(HAVE_ARM_NE10)
+# include "mdct.c"
+# include "arm/celt_ne10_fft.c"
+# include "arm/celt_ne10_mdct.c"
+# endif
+# endif
+# include "arm/arm_celt_map.c"
+#endif
+
+#ifndef M_PI
+#define M_PI 3.141592653
+#endif
+
+int ret = 0;
+
+void check(kiss_fft_cpx * in,kiss_fft_cpx * out,int nfft,int isinverse)
+{
+ int bin,k;
+ double errpow=0,sigpow=0, snr;
+
+ for (bin=0;bin<nfft;++bin) {
+ double ansr = 0;
+ double ansi = 0;
+ double difr;
+ double difi;
+
+ for (k=0;k<nfft;++k) {
+ double phase = -2*M_PI*bin*k/nfft;
+ double re = cos(phase);
+ double im = sin(phase);
+ if (isinverse)
+ im = -im;
+
+ if (!isinverse)
+ {
+ re /= nfft;
+ im /= nfft;
+ }
+
+ ansr += in[k].r * re - in[k].i * im;
+ ansi += in[k].r * im + in[k].i * re;
+ }
+ /*printf ("%d %d ", (int)ansr, (int)ansi);*/
+ difr = ansr - out[bin].r;
+ difi = ansi - out[bin].i;
+ errpow += difr*difr + difi*difi;
+ sigpow += ansr*ansr+ansi*ansi;
+ }
+ snr = 10*log10(sigpow/errpow);
+ printf("nfft=%d inverse=%d,snr = %f\n",nfft,isinverse,snr );
+ if (snr<60) {
+ printf( "** poor snr: %f ** \n", snr);
+ ret = 1;
+ }
+}
+
+void test1d(int nfft,int isinverse,int arch)
+{
+ size_t buflen = sizeof(kiss_fft_cpx)*nfft;
+
+ kiss_fft_cpx * in = (kiss_fft_cpx*)malloc(buflen);
+ kiss_fft_cpx * out= (kiss_fft_cpx*)malloc(buflen);
+ kiss_fft_state *cfg = opus_fft_alloc(nfft,0,0,arch);
+ int k;
+
+ for (k=0;k<nfft;++k) {
+ in[k].r = (rand() % 32767) - 16384;
+ in[k].i = (rand() % 32767) - 16384;
+ }
+
+ for (k=0;k<nfft;++k) {
+ in[k].r *= 32768;
+ in[k].i *= 32768;
+ }
+
+ if (isinverse)
+ {
+ for (k=0;k<nfft;++k) {
+ in[k].r /= nfft;
+ in[k].i /= nfft;
+ }
+ }
+
+ /*for (k=0;k<nfft;++k) printf("%d %d ", in[k].r, in[k].i);printf("\n");*/
+
+ if (isinverse)
+ opus_ifft(cfg,in,out, arch);
+ else
+ opus_fft(cfg,in,out, arch);
+
+ /*for (k=0;k<nfft;++k) printf("%d %d ", out[k].r, out[k].i);printf("\n");*/
+
+ check(in,out,nfft,isinverse);
+
+ free(in);
+ free(out);
+ opus_fft_free(cfg, arch);
+}
+
+int main(int argc,char ** argv)
+{
+ ALLOC_STACK;
+ int arch = opus_select_arch();
+
+ if (argc>1) {
+ int k;
+ for (k=1;k<argc;++k) {
+ test1d(atoi(argv[k]),0,arch);
+ test1d(atoi(argv[k]),1,arch);
+ }
+ }else{
+ test1d(32,0,arch);
+ test1d(32,1,arch);
+ test1d(128,0,arch);
+ test1d(128,1,arch);
+ test1d(256,0,arch);
+ test1d(256,1,arch);
+#ifndef RADIX_TWO_ONLY
+ test1d(36,0,arch);
+ test1d(36,1,arch);
+ test1d(50,0,arch);
+ test1d(50,1,arch);
+ test1d(60,0,arch);
+ test1d(60,1,arch);
+ test1d(120,0,arch);
+ test1d(120,1,arch);
+ test1d(240,0,arch);
+ test1d(240,1,arch);
+ test1d(480,0,arch);
+ test1d(480,1,arch);
+#endif
+ }
+ return ret;
+}
diff --git a/thirdparty/opus/celt/tests/test_unit_entropy.c b/thirdparty/opus/celt/tests/test_unit_entropy.c
new file mode 100644
index 000000000..ff9265864
--- /dev/null
+++ b/thirdparty/opus/celt/tests/test_unit_entropy.c
@@ -0,0 +1,382 @@
+/* Copyright (c) 2007-2011 Xiph.Org Foundation, Mozilla Corporation,
+ Gregory Maxwell
+ Written by Jean-Marc Valin, Gregory Maxwell, and Timothy B. Terriberry */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <time.h>
+#include "entcode.h"
+#include "entenc.h"
+#include "entdec.h"
+#include <string.h>
+
+#include "entenc.c"
+#include "entdec.c"
+#include "entcode.c"
+
+#ifndef M_LOG2E
+# define M_LOG2E 1.4426950408889634074
+#endif
+#define DATA_SIZE 10000000
+#define DATA_SIZE2 10000
+
+int main(int _argc,char **_argv){
+ ec_enc enc;
+ ec_dec dec;
+ long nbits;
+ long nbits2;
+ double entropy;
+ int ft;
+ int ftb;
+ int sz;
+ int i;
+ int ret;
+ unsigned int sym;
+ unsigned int seed;
+ unsigned char *ptr;
+ const char *env_seed;
+ ret=0;
+ entropy=0;
+ if (_argc > 2) {
+ fprintf(stderr, "Usage: %s [<seed>]\n", _argv[0]);
+ return 1;
+ }
+ env_seed = getenv("SEED");
+ if (_argc > 1)
+ seed = atoi(_argv[1]);
+ else if (env_seed)
+ seed = atoi(env_seed);
+ else
+ seed = time(NULL);
+ /*Testing encoding of raw bit values.*/
+ ptr = (unsigned char *)malloc(DATA_SIZE);
+ ec_enc_init(&enc,ptr, DATA_SIZE);
+ for(ft=2;ft<1024;ft++){
+ for(i=0;i<ft;i++){
+ entropy+=log(ft)*M_LOG2E;
+ ec_enc_uint(&enc,i,ft);
+ }
+ }
+ /*Testing encoding of raw bit values.*/
+ for(ftb=1;ftb<16;ftb++){
+ for(i=0;i<(1<<ftb);i++){
+ entropy+=ftb;
+ nbits=ec_tell(&enc);
+ ec_enc_bits(&enc,i,ftb);
+ nbits2=ec_tell(&enc);
+ if(nbits2-nbits!=ftb){
+ fprintf(stderr,"Used %li bits to encode %i bits directly.\n",
+ nbits2-nbits,ftb);
+ ret=-1;
+ }
+ }
+ }
+ nbits=ec_tell_frac(&enc);
+ ec_enc_done(&enc);
+ fprintf(stderr,
+ "Encoded %0.2lf bits of entropy to %0.2lf bits (%0.3lf%% wasted).\n",
+ entropy,ldexp(nbits,-3),100*(nbits-ldexp(entropy,3))/nbits);
+ fprintf(stderr,"Packed to %li bytes.\n",(long)ec_range_bytes(&enc));
+ ec_dec_init(&dec,ptr,DATA_SIZE);
+ for(ft=2;ft<1024;ft++){
+ for(i=0;i<ft;i++){
+ sym=ec_dec_uint(&dec,ft);
+ if(sym!=(unsigned)i){
+ fprintf(stderr,"Decoded %i instead of %i with ft of %i.\n",sym,i,ft);
+ ret=-1;
+ }
+ }
+ }
+ for(ftb=1;ftb<16;ftb++){
+ for(i=0;i<(1<<ftb);i++){
+ sym=ec_dec_bits(&dec,ftb);
+ if(sym!=(unsigned)i){
+ fprintf(stderr,"Decoded %i instead of %i with ftb of %i.\n",sym,i,ftb);
+ ret=-1;
+ }
+ }
+ }
+ nbits2=ec_tell_frac(&dec);
+ if(nbits!=nbits2){
+ fprintf(stderr,
+ "Reported number of bits used was %0.2lf, should be %0.2lf.\n",
+ ldexp(nbits2,-3),ldexp(nbits,-3));
+ ret=-1;
+ }
+ /*Testing an encoder bust prefers range coder data over raw bits.
+ This isn't a general guarantee, will only work for data that is buffered in
+ the encoder state and not yet stored in the user buffer, and should never
+ get used in practice.
+ It's mostly here for code coverage completeness.*/
+ /*Start with a 16-bit buffer.*/
+ ec_enc_init(&enc,ptr,2);
+ /*Write 7 raw bits.*/
+ ec_enc_bits(&enc,0x55,7);
+ /*Write 12.3 bits of range coder data.*/
+ ec_enc_uint(&enc,1,2);
+ ec_enc_uint(&enc,1,3);
+ ec_enc_uint(&enc,1,4);
+ ec_enc_uint(&enc,1,5);
+ ec_enc_uint(&enc,2,6);
+ ec_enc_uint(&enc,6,7);
+ ec_enc_done(&enc);
+ ec_dec_init(&dec,ptr,2);
+ if(!enc.error
+ /*The raw bits should have been overwritten by the range coder data.*/
+ ||ec_dec_bits(&dec,7)!=0x05
+ /*And all the range coder data should have been encoded correctly.*/
+ ||ec_dec_uint(&dec,2)!=1
+ ||ec_dec_uint(&dec,3)!=1
+ ||ec_dec_uint(&dec,4)!=1
+ ||ec_dec_uint(&dec,5)!=1
+ ||ec_dec_uint(&dec,6)!=2
+ ||ec_dec_uint(&dec,7)!=6){
+ fprintf(stderr,"Encoder bust overwrote range coder data with raw bits.\n");
+ ret=-1;
+ }
+ srand(seed);
+ fprintf(stderr,"Testing random streams... Random seed: %u (%.4X)\n", seed, rand() % 65536);
+ for(i=0;i<409600;i++){
+ unsigned *data;
+ unsigned *tell;
+ unsigned tell_bits;
+ int j;
+ int zeros;
+ ft=rand()/((RAND_MAX>>(rand()%11U))+1U)+10;
+ sz=rand()/((RAND_MAX>>(rand()%9U))+1U);
+ data=(unsigned *)malloc(sz*sizeof(*data));
+ tell=(unsigned *)malloc((sz+1)*sizeof(*tell));
+ ec_enc_init(&enc,ptr,DATA_SIZE2);
+ zeros = rand()%13==0;
+ tell[0]=ec_tell_frac(&enc);
+ for(j=0;j<sz;j++){
+ if (zeros)
+ data[j]=0;
+ else
+ data[j]=rand()%ft;
+ ec_enc_uint(&enc,data[j],ft);
+ tell[j+1]=ec_tell_frac(&enc);
+ }
+ if (rand()%2==0)
+ while(ec_tell(&enc)%8 != 0)
+ ec_enc_uint(&enc, rand()%2, 2);
+ tell_bits = ec_tell(&enc);
+ ec_enc_done(&enc);
+ if(tell_bits!=(unsigned)ec_tell(&enc)){
+ fprintf(stderr,"ec_tell() changed after ec_enc_done(): %i instead of %i (Random seed: %u)\n",
+ ec_tell(&enc),tell_bits,seed);
+ ret=-1;
+ }
+ if ((tell_bits+7)/8 < ec_range_bytes(&enc))
+ {
+ fprintf (stderr, "ec_tell() lied, there's %i bytes instead of %d (Random seed: %u)\n",
+ ec_range_bytes(&enc), (tell_bits+7)/8,seed);
+ ret=-1;
+ }
+ ec_dec_init(&dec,ptr,DATA_SIZE2);
+ if(ec_tell_frac(&dec)!=tell[0]){
+ fprintf(stderr,
+ "Tell mismatch between encoder and decoder at symbol %i: %i instead of %i (Random seed: %u).\n",
+ 0,ec_tell_frac(&dec),tell[0],seed);
+ }
+ for(j=0;j<sz;j++){
+ sym=ec_dec_uint(&dec,ft);
+ if(sym!=data[j]){
+ fprintf(stderr,
+ "Decoded %i instead of %i with ft of %i at position %i of %i (Random seed: %u).\n",
+ sym,data[j],ft,j,sz,seed);
+ ret=-1;
+ }
+ if(ec_tell_frac(&dec)!=tell[j+1]){
+ fprintf(stderr,
+ "Tell mismatch between encoder and decoder at symbol %i: %i instead of %i (Random seed: %u).\n",
+ j+1,ec_tell_frac(&dec),tell[j+1],seed);
+ }
+ }
+ free(tell);
+ free(data);
+ }
+ /*Test compatibility between multiple different encode/decode routines.*/
+ for(i=0;i<409600;i++){
+ unsigned *logp1;
+ unsigned *data;
+ unsigned *tell;
+ unsigned *enc_method;
+ int j;
+ sz=rand()/((RAND_MAX>>(rand()%9U))+1U);
+ logp1=(unsigned *)malloc(sz*sizeof(*logp1));
+ data=(unsigned *)malloc(sz*sizeof(*data));
+ tell=(unsigned *)malloc((sz+1)*sizeof(*tell));
+ enc_method=(unsigned *)malloc(sz*sizeof(*enc_method));
+ ec_enc_init(&enc,ptr,DATA_SIZE2);
+ tell[0]=ec_tell_frac(&enc);
+ for(j=0;j<sz;j++){
+ data[j]=rand()/((RAND_MAX>>1)+1);
+ logp1[j]=(rand()%15)+1;
+ enc_method[j]=rand()/((RAND_MAX>>2)+1);
+ switch(enc_method[j]){
+ case 0:{
+ ec_encode(&enc,data[j]?(1<<logp1[j])-1:0,
+ (1<<logp1[j])-(data[j]?0:1),1<<logp1[j]);
+ }break;
+ case 1:{
+ ec_encode_bin(&enc,data[j]?(1<<logp1[j])-1:0,
+ (1<<logp1[j])-(data[j]?0:1),logp1[j]);
+ }break;
+ case 2:{
+ ec_enc_bit_logp(&enc,data[j],logp1[j]);
+ }break;
+ case 3:{
+ unsigned char icdf[2];
+ icdf[0]=1;
+ icdf[1]=0;
+ ec_enc_icdf(&enc,data[j],icdf,logp1[j]);
+ }break;
+ }
+ tell[j+1]=ec_tell_frac(&enc);
+ }
+ ec_enc_done(&enc);
+ if((ec_tell(&enc)+7U)/8U<ec_range_bytes(&enc)){
+ fprintf(stderr,"tell() lied, there's %i bytes instead of %d (Random seed: %u)\n",
+ ec_range_bytes(&enc),(ec_tell(&enc)+7)/8,seed);
+ ret=-1;
+ }
+ ec_dec_init(&dec,ptr,DATA_SIZE2);
+ if(ec_tell_frac(&dec)!=tell[0]){
+ fprintf(stderr,
+ "Tell mismatch between encoder and decoder at symbol %i: %i instead of %i (Random seed: %u).\n",
+ 0,ec_tell_frac(&dec),tell[0],seed);
+ }
+ for(j=0;j<sz;j++){
+ int fs;
+ int dec_method;
+ dec_method=rand()/((RAND_MAX>>2)+1);
+ switch(dec_method){
+ case 0:{
+ fs=ec_decode(&dec,1<<logp1[j]);
+ sym=fs>=(1<<logp1[j])-1;
+ ec_dec_update(&dec,sym?(1<<logp1[j])-1:0,
+ (1<<logp1[j])-(sym?0:1),1<<logp1[j]);
+ }break;
+ case 1:{
+ fs=ec_decode_bin(&dec,logp1[j]);
+ sym=fs>=(1<<logp1[j])-1;
+ ec_dec_update(&dec,sym?(1<<logp1[j])-1:0,
+ (1<<logp1[j])-(sym?0:1),1<<logp1[j]);
+ }break;
+ case 2:{
+ sym=ec_dec_bit_logp(&dec,logp1[j]);
+ }break;
+ case 3:{
+ unsigned char icdf[2];
+ icdf[0]=1;
+ icdf[1]=0;
+ sym=ec_dec_icdf(&dec,icdf,logp1[j]);
+ }break;
+ }
+ if(sym!=data[j]){
+ fprintf(stderr,
+ "Decoded %i instead of %i with logp1 of %i at position %i of %i (Random seed: %u).\n",
+ sym,data[j],logp1[j],j,sz,seed);
+ fprintf(stderr,"Encoding method: %i, decoding method: %i\n",
+ enc_method[j],dec_method);
+ ret=-1;
+ }
+ if(ec_tell_frac(&dec)!=tell[j+1]){
+ fprintf(stderr,
+ "Tell mismatch between encoder and decoder at symbol %i: %i instead of %i (Random seed: %u).\n",
+ j+1,ec_tell_frac(&dec),tell[j+1],seed);
+ }
+ }
+ free(enc_method);
+ free(tell);
+ free(data);
+ free(logp1);
+ }
+ ec_enc_init(&enc,ptr,DATA_SIZE2);
+ ec_enc_bit_logp(&enc,0,1);
+ ec_enc_bit_logp(&enc,0,1);
+ ec_enc_bit_logp(&enc,0,1);
+ ec_enc_bit_logp(&enc,0,1);
+ ec_enc_bit_logp(&enc,0,2);
+ ec_enc_patch_initial_bits(&enc,3,2);
+ if(enc.error){
+ fprintf(stderr,"patch_initial_bits failed");
+ ret=-1;
+ }
+ ec_enc_patch_initial_bits(&enc,0,5);
+ if(!enc.error){
+ fprintf(stderr,"patch_initial_bits didn't fail when it should have");
+ ret=-1;
+ }
+ ec_enc_done(&enc);
+ if(ec_range_bytes(&enc)!=1||ptr[0]!=192){
+ fprintf(stderr,"Got %d when expecting 192 for patch_initial_bits",ptr[0]);
+ ret=-1;
+ }
+ ec_enc_init(&enc,ptr,DATA_SIZE2);
+ ec_enc_bit_logp(&enc,0,1);
+ ec_enc_bit_logp(&enc,0,1);
+ ec_enc_bit_logp(&enc,1,6);
+ ec_enc_bit_logp(&enc,0,2);
+ ec_enc_patch_initial_bits(&enc,0,2);
+ if(enc.error){
+ fprintf(stderr,"patch_initial_bits failed");
+ ret=-1;
+ }
+ ec_enc_done(&enc);
+ if(ec_range_bytes(&enc)!=2||ptr[0]!=63){
+ fprintf(stderr,"Got %d when expecting 63 for patch_initial_bits",ptr[0]);
+ ret=-1;
+ }
+ ec_enc_init(&enc,ptr,2);
+ ec_enc_bit_logp(&enc,0,2);
+ for(i=0;i<48;i++){
+ ec_enc_bits(&enc,0,1);
+ }
+ ec_enc_done(&enc);
+ if(!enc.error){
+ fprintf(stderr,"Raw bits overfill didn't fail when it should have");
+ ret=-1;
+ }
+ ec_enc_init(&enc,ptr,2);
+ for(i=0;i<17;i++){
+ ec_enc_bits(&enc,0,1);
+ }
+ ec_enc_done(&enc);
+ if(!enc.error){
+ fprintf(stderr,"17 raw bits encoded in two bytes");
+ ret=-1;
+ }
+ free(ptr);
+ return ret;
+}
diff --git a/thirdparty/opus/celt/tests/test_unit_laplace.c b/thirdparty/opus/celt/tests/test_unit_laplace.c
new file mode 100644
index 000000000..22951e29e
--- /dev/null
+++ b/thirdparty/opus/celt/tests/test_unit_laplace.c
@@ -0,0 +1,93 @@
+/* Copyright (c) 2008-2011 Xiph.Org Foundation, Mozilla Corporation
+ Written by Jean-Marc Valin and Timothy B. Terriberry */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "laplace.h"
+#define CELT_C
+#include "stack_alloc.h"
+
+#include "entenc.c"
+#include "entdec.c"
+#include "entcode.c"
+#include "laplace.c"
+
+#define DATA_SIZE 40000
+
+int ec_laplace_get_start_freq(int decay)
+{
+ opus_uint32 ft = 32768 - LAPLACE_MINP*(2*LAPLACE_NMIN+1);
+ int fs = (ft*(16384-decay))/(16384+decay);
+ return fs+LAPLACE_MINP;
+}
+
+int main(void)
+{
+ int i;
+ int ret = 0;
+ ec_enc enc;
+ ec_dec dec;
+ unsigned char *ptr;
+ int val[10000], decay[10000];
+ ALLOC_STACK;
+ ptr = (unsigned char *)malloc(DATA_SIZE);
+ ec_enc_init(&enc,ptr,DATA_SIZE);
+
+ val[0] = 3; decay[0] = 6000;
+ val[1] = 0; decay[1] = 5800;
+ val[2] = -1; decay[2] = 5600;
+ for (i=3;i<10000;i++)
+ {
+ val[i] = rand()%15-7;
+ decay[i] = rand()%11000+5000;
+ }
+ for (i=0;i<10000;i++)
+ ec_laplace_encode(&enc, &val[i],
+ ec_laplace_get_start_freq(decay[i]), decay[i]);
+
+ ec_enc_done(&enc);
+
+ ec_dec_init(&dec,ec_get_buffer(&enc),ec_range_bytes(&enc));
+
+ for (i=0;i<10000;i++)
+ {
+ int d = ec_laplace_decode(&dec,
+ ec_laplace_get_start_freq(decay[i]), decay[i]);
+ if (d != val[i])
+ {
+ fprintf (stderr, "Got %d instead of %d\n", d, val[i]);
+ ret = 1;
+ }
+ }
+
+ free(ptr);
+ return ret;
+}
diff --git a/thirdparty/opus/celt/tests/test_unit_mathops.c b/thirdparty/opus/celt/tests/test_unit_mathops.c
new file mode 100644
index 000000000..fd3319da9
--- /dev/null
+++ b/thirdparty/opus/celt/tests/test_unit_mathops.c
@@ -0,0 +1,304 @@
+/* Copyright (c) 2008-2011 Xiph.Org Foundation, Mozilla Corporation,
+ Gregory Maxwell
+ Written by Jean-Marc Valin, Gregory Maxwell, and Timothy B. Terriberry */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef CUSTOM_MODES
+#define CUSTOM_MODES
+#endif
+
+#define CELT_C
+
+#include <stdio.h>
+#include <math.h>
+#include "mathops.c"
+#include "entenc.c"
+#include "entdec.c"
+#include "entcode.c"
+#include "bands.c"
+#include "quant_bands.c"
+#include "laplace.c"
+#include "vq.c"
+#include "cwrs.c"
+#include "pitch.c"
+#include "celt_lpc.c"
+#include "celt.c"
+
+#if defined(OPUS_X86_MAY_HAVE_SSE) || defined(OPUS_X86_MAY_HAVE_SSE2) || defined(OPUS_X86_MAY_HAVE_SSE4_1)
+# if defined(OPUS_X86_MAY_HAVE_SSE)
+# include "x86/pitch_sse.c"
+# endif
+# if defined(OPUS_X86_MAY_HAVE_SSE2)
+# include "x86/pitch_sse2.c"
+# endif
+# if defined(OPUS_X86_MAY_HAVE_SSE4_1)
+# include "x86/pitch_sse4_1.c"
+# include "x86/celt_lpc_sse.c"
+# endif
+# include "x86/x86_celt_map.c"
+#elif defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+# include "arm/armcpu.c"
+# if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+# include "arm/celt_neon_intr.c"
+# if defined(HAVE_ARM_NE10)
+# include "kiss_fft.c"
+# include "mdct.c"
+# include "arm/celt_ne10_fft.c"
+# include "arm/celt_ne10_mdct.c"
+# endif
+# endif
+# include "arm/arm_celt_map.c"
+#endif
+
+#ifdef FIXED_POINT
+#define WORD "%d"
+#else
+#define WORD "%f"
+#endif
+
+int ret = 0;
+
+void testdiv(void)
+{
+ opus_int32 i;
+ for (i=1;i<=327670;i++)
+ {
+ double prod;
+ opus_val32 val;
+ val = celt_rcp(i);
+#ifdef FIXED_POINT
+ prod = (1./32768./65526.)*val*i;
+#else
+ prod = val*i;
+#endif
+ if (fabs(prod-1) > .00025)
+ {
+ fprintf (stderr, "div failed: 1/%d="WORD" (product = %f)\n", i, val, prod);
+ ret = 1;
+ }
+ }
+}
+
+void testsqrt(void)
+{
+ opus_int32 i;
+ for (i=1;i<=1000000000;i++)
+ {
+ double ratio;
+ opus_val16 val;
+ val = celt_sqrt(i);
+ ratio = val/sqrt(i);
+ if (fabs(ratio - 1) > .0005 && fabs(val-sqrt(i)) > 2)
+ {
+ fprintf (stderr, "sqrt failed: sqrt(%d)="WORD" (ratio = %f)\n", i, val, ratio);
+ ret = 1;
+ }
+ i+= i>>10;
+ }
+}
+
+void testbitexactcos(void)
+{
+ int i;
+ opus_int32 min_d,max_d,last,chk;
+ chk=max_d=0;
+ last=min_d=32767;
+ for(i=64;i<=16320;i++)
+ {
+ opus_int32 d;
+ opus_int32 q=bitexact_cos(i);
+ chk ^= q*i;
+ d = last - q;
+ if (d>max_d)max_d=d;
+ if (d<min_d)min_d=d;
+ last = q;
+ }
+ if ((chk!=89408644)||(max_d!=5)||(min_d!=0)||(bitexact_cos(64)!=32767)||
+ (bitexact_cos(16320)!=200)||(bitexact_cos(8192)!=23171))
+ {
+ fprintf (stderr, "bitexact_cos failed\n");
+ ret = 1;
+ }
+}
+
+void testbitexactlog2tan(void)
+{
+ int i,fail;
+ opus_int32 min_d,max_d,last,chk;
+ fail=chk=max_d=0;
+ last=min_d=15059;
+ for(i=64;i<8193;i++)
+ {
+ opus_int32 d;
+ opus_int32 mid=bitexact_cos(i);
+ opus_int32 side=bitexact_cos(16384-i);
+ opus_int32 q=bitexact_log2tan(mid,side);
+ chk ^= q*i;
+ d = last - q;
+ if (q!=-1*bitexact_log2tan(side,mid))
+ fail = 1;
+ if (d>max_d)max_d=d;
+ if (d<min_d)min_d=d;
+ last = q;
+ }
+ if ((chk!=15821257)||(max_d!=61)||(min_d!=-2)||fail||
+ (bitexact_log2tan(32767,200)!=15059)||(bitexact_log2tan(30274,12540)!=2611)||
+ (bitexact_log2tan(23171,23171)!=0))
+ {
+ fprintf (stderr, "bitexact_log2tan failed\n");
+ ret = 1;
+ }
+}
+
+#ifndef FIXED_POINT
+void testlog2(void)
+{
+ float x;
+ for (x=0.001;x<1677700.0;x+=(x/8.0))
+ {
+ float error = fabs((1.442695040888963387*log(x))-celt_log2(x));
+ if (error>0.0009)
+ {
+ fprintf (stderr, "celt_log2 failed: fabs((1.442695040888963387*log(x))-celt_log2(x))>0.001 (x = %f, error = %f)\n", x,error);
+ ret = 1;
+ }
+ }
+}
+
+void testexp2(void)
+{
+ float x;
+ for (x=-11.0;x<24.0;x+=0.0007)
+ {
+ float error = fabs(x-(1.442695040888963387*log(celt_exp2(x))));
+ if (error>0.0002)
+ {
+ fprintf (stderr, "celt_exp2 failed: fabs(x-(1.442695040888963387*log(celt_exp2(x))))>0.0005 (x = %f, error = %f)\n", x,error);
+ ret = 1;
+ }
+ }
+}
+
+void testexp2log2(void)
+{
+ float x;
+ for (x=-11.0;x<24.0;x+=0.0007)
+ {
+ float error = fabs(x-(celt_log2(celt_exp2(x))));
+ if (error>0.001)
+ {
+ fprintf (stderr, "celt_log2/celt_exp2 failed: fabs(x-(celt_log2(celt_exp2(x))))>0.001 (x = %f, error = %f)\n", x,error);
+ ret = 1;
+ }
+ }
+}
+#else
+void testlog2(void)
+{
+ opus_val32 x;
+ for (x=8;x<1073741824;x+=(x>>3))
+ {
+ float error = fabs((1.442695040888963387*log(x/16384.0))-celt_log2(x)/1024.0);
+ if (error>0.003)
+ {
+ fprintf (stderr, "celt_log2 failed: x = %ld, error = %f\n", (long)x,error);
+ ret = 1;
+ }
+ }
+}
+
+void testexp2(void)
+{
+ opus_val16 x;
+ for (x=-32768;x<15360;x++)
+ {
+ float error1 = fabs(x/1024.0-(1.442695040888963387*log(celt_exp2(x)/65536.0)));
+ float error2 = fabs(exp(0.6931471805599453094*x/1024.0)-celt_exp2(x)/65536.0);
+ if (error1>0.0002&&error2>0.00004)
+ {
+ fprintf (stderr, "celt_exp2 failed: x = "WORD", error1 = %f, error2 = %f\n", x,error1,error2);
+ ret = 1;
+ }
+ }
+}
+
+void testexp2log2(void)
+{
+ opus_val32 x;
+ for (x=8;x<65536;x+=(x>>3))
+ {
+ float error = fabs(x-0.25*celt_exp2(celt_log2(x)))/16384;
+ if (error>0.004)
+ {
+ fprintf (stderr, "celt_log2/celt_exp2 failed: fabs(x-(celt_exp2(celt_log2(x))))>0.001 (x = %ld, error = %f)\n", (long)x,error);
+ ret = 1;
+ }
+ }
+}
+
+void testilog2(void)
+{
+ opus_val32 x;
+ for (x=1;x<=268435455;x+=127)
+ {
+ opus_val32 lg;
+ opus_val32 y;
+
+ lg = celt_ilog2(x);
+ if (lg<0 || lg>=31)
+ {
+ printf("celt_ilog2 failed: 0<=celt_ilog2(x)<31 (x = %d, celt_ilog2(x) = %d)\n",x,lg);
+ ret = 1;
+ }
+ y = 1<<lg;
+
+ if (x<y || (x>>1)>=y)
+ {
+ printf("celt_ilog2 failed: 2**celt_ilog2(x)<=x<2**(celt_ilog2(x)+1) (x = %d, 2**celt_ilog2(x) = %d)\n",x,y);
+ ret = 1;
+ }
+ }
+}
+#endif
+
+int main(void)
+{
+ testbitexactcos();
+ testbitexactlog2tan();
+ testdiv();
+ testsqrt();
+ testlog2();
+ testexp2();
+ testexp2log2();
+#ifdef FIXED_POINT
+ testilog2();
+#endif
+ return ret;
+}
diff --git a/thirdparty/opus/celt/tests/test_unit_mdct.c b/thirdparty/opus/celt/tests/test_unit_mdct.c
new file mode 100644
index 000000000..8dbb9caa2
--- /dev/null
+++ b/thirdparty/opus/celt/tests/test_unit_mdct.c
@@ -0,0 +1,230 @@
+/* Copyright (c) 2008-2011 Xiph.Org Foundation
+ Written by Jean-Marc Valin */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define SKIP_CONFIG_H
+
+#ifndef CUSTOM_MODES
+#define CUSTOM_MODES
+#endif
+
+#include <stdio.h>
+
+#define CELT_C
+#include "mdct.h"
+#include "stack_alloc.h"
+
+#include "kiss_fft.c"
+#include "mdct.c"
+#include "mathops.c"
+#include "entcode.c"
+
+#if defined(OPUS_X86_MAY_HAVE_SSE2) || defined(OPUS_X86_MAY_HAVE_SSE4_1)
+# include "x86/x86cpu.c"
+#elif defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+# include "arm/armcpu.c"
+# include "pitch.c"
+# include "celt_lpc.c"
+# if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+# include "arm/celt_neon_intr.c"
+# if defined(HAVE_ARM_NE10)
+# include "arm/celt_ne10_fft.c"
+# include "arm/celt_ne10_mdct.c"
+# endif
+# endif
+# include "arm/arm_celt_map.c"
+#endif
+
+#ifndef M_PI
+#define M_PI 3.141592653
+#endif
+
+int ret = 0;
+void check(kiss_fft_scalar * in,kiss_fft_scalar * out,int nfft,int isinverse)
+{
+ int bin,k;
+ double errpow=0,sigpow=0;
+ double snr;
+ for (bin=0;bin<nfft/2;++bin) {
+ double ansr = 0;
+ double difr;
+
+ for (k=0;k<nfft;++k) {
+ double phase = 2*M_PI*(k+.5+.25*nfft)*(bin+.5)/nfft;
+ double re = cos(phase);
+
+ re /= nfft/4;
+
+ ansr += in[k] * re;
+ }
+ /*printf ("%f %f\n", ansr, out[bin]);*/
+ difr = ansr - out[bin];
+ errpow += difr*difr;
+ sigpow += ansr*ansr;
+ }
+ snr = 10*log10(sigpow/errpow);
+ printf("nfft=%d inverse=%d,snr = %f\n",nfft,isinverse,snr );
+ if (snr<60) {
+ printf( "** poor snr: %f **\n", snr);
+ ret = 1;
+ }
+}
+
+void check_inv(kiss_fft_scalar * in,kiss_fft_scalar * out,int nfft,int isinverse)
+{
+ int bin,k;
+ double errpow=0,sigpow=0;
+ double snr;
+ for (bin=0;bin<nfft;++bin) {
+ double ansr = 0;
+ double difr;
+
+ for (k=0;k<nfft/2;++k) {
+ double phase = 2*M_PI*(bin+.5+.25*nfft)*(k+.5)/nfft;
+ double re = cos(phase);
+
+ /*re *= 2;*/
+
+ ansr += in[k] * re;
+ }
+ /*printf ("%f %f\n", ansr, out[bin]);*/
+ difr = ansr - out[bin];
+ errpow += difr*difr;
+ sigpow += ansr*ansr;
+ }
+ snr = 10*log10(sigpow/errpow);
+ printf("nfft=%d inverse=%d,snr = %f\n",nfft,isinverse,snr );
+ if (snr<60) {
+ printf( "** poor snr: %f **\n", snr);
+ ret = 1;
+ }
+}
+
+
+void test1d(int nfft,int isinverse,int arch)
+{
+ mdct_lookup cfg;
+ size_t buflen = sizeof(kiss_fft_scalar)*nfft;
+
+ kiss_fft_scalar * in = (kiss_fft_scalar*)malloc(buflen);
+ kiss_fft_scalar * in_copy = (kiss_fft_scalar*)malloc(buflen);
+ kiss_fft_scalar * out= (kiss_fft_scalar*)malloc(buflen);
+ opus_val16 * window= (opus_val16*)malloc(sizeof(opus_val16)*nfft/2);
+ int k;
+
+ clt_mdct_init(&cfg, nfft, 0, arch);
+ for (k=0;k<nfft;++k) {
+ in[k] = (rand() % 32768) - 16384;
+ }
+
+ for (k=0;k<nfft/2;++k) {
+ window[k] = Q15ONE;
+ }
+ for (k=0;k<nfft;++k) {
+ in[k] *= 32768;
+ }
+
+ if (isinverse)
+ {
+ for (k=0;k<nfft;++k) {
+ in[k] /= nfft;
+ }
+ }
+
+ for (k=0;k<nfft;++k)
+ in_copy[k] = in[k];
+ /*for (k=0;k<nfft;++k) printf("%d %d ", in[k].r, in[k].i);printf("\n");*/
+
+ if (isinverse)
+ {
+ for (k=0;k<nfft;++k)
+ out[k] = 0;
+ clt_mdct_backward(&cfg,in,out, window, nfft/2, 0, 1, arch);
+ /* apply TDAC because clt_mdct_backward() no longer does that */
+ for (k=0;k<nfft/4;++k)
+ out[nfft-k-1] = out[nfft/2+k];
+ check_inv(in,out,nfft,isinverse);
+ } else {
+ clt_mdct_forward(&cfg,in,out,window, nfft/2, 0, 1, arch);
+ check(in_copy,out,nfft,isinverse);
+ }
+ /*for (k=0;k<nfft;++k) printf("%d %d ", out[k].r, out[k].i);printf("\n");*/
+
+
+ free(in);
+ free(in_copy);
+ free(out);
+ free(window);
+ clt_mdct_clear(&cfg, arch);
+}
+
+int main(int argc,char ** argv)
+{
+ ALLOC_STACK;
+ int arch = opus_select_arch();
+
+ if (argc>1) {
+ int k;
+ for (k=1;k<argc;++k) {
+ test1d(atoi(argv[k]),0,arch);
+ test1d(atoi(argv[k]),1,arch);
+ }
+ }else{
+ test1d(32,0,arch);
+ test1d(32,1,arch);
+ test1d(256,0,arch);
+ test1d(256,1,arch);
+ test1d(512,0,arch);
+ test1d(512,1,arch);
+ test1d(1024,0,arch);
+ test1d(1024,1,arch);
+ test1d(2048,0,arch);
+ test1d(2048,1,arch);
+#ifndef RADIX_TWO_ONLY
+ test1d(36,0,arch);
+ test1d(36,1,arch);
+ test1d(40,0,arch);
+ test1d(40,1,arch);
+ test1d(60,0,arch);
+ test1d(60,1,arch);
+ test1d(120,0,arch);
+ test1d(120,1,arch);
+ test1d(240,0,arch);
+ test1d(240,1,arch);
+ test1d(480,0,arch);
+ test1d(480,1,arch);
+ test1d(960,0,arch);
+ test1d(960,1,arch);
+ test1d(1920,0,arch);
+ test1d(1920,1,arch);
+#endif
+ }
+ return ret;
+}
diff --git a/thirdparty/opus/celt/tests/test_unit_rotation.c b/thirdparty/opus/celt/tests/test_unit_rotation.c
new file mode 100644
index 000000000..1080c2085
--- /dev/null
+++ b/thirdparty/opus/celt/tests/test_unit_rotation.c
@@ -0,0 +1,120 @@
+/* Copyright (c) 2008-2011 Xiph.Org Foundation
+ Written by Jean-Marc Valin */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef CUSTOM_MODES
+#define CUSTOM_MODES
+#endif
+
+#define CELT_C
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "vq.c"
+#include "cwrs.c"
+#include "entcode.c"
+#include "entenc.c"
+#include "entdec.c"
+#include "mathops.c"
+#include "bands.h"
+#include "pitch.c"
+#include "celt_lpc.c"
+#include "celt.c"
+#include <math.h>
+
+#if defined(OPUS_X86_MAY_HAVE_SSE) || defined(OPUS_X86_MAY_HAVE_SSE2) || defined(OPUS_X86_MAY_HAVE_SSE4_1)
+# if defined(OPUS_X86_MAY_HAVE_SSE)
+# include "x86/pitch_sse.c"
+# endif
+# if defined(OPUS_X86_MAY_HAVE_SSE2)
+# include "x86/pitch_sse2.c"
+# endif
+# if defined(OPUS_X86_MAY_HAVE_SSE4_1)
+# include "x86/pitch_sse4_1.c"
+# include "x86/celt_lpc_sse.c"
+# endif
+# include "x86/x86_celt_map.c"
+#elif defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+# include "arm/armcpu.c"
+# if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+# include "arm/celt_neon_intr.c"
+# if defined(HAVE_ARM_NE10)
+# include "kiss_fft.c"
+# include "mdct.c"
+# include "arm/celt_ne10_fft.c"
+# include "arm/celt_ne10_mdct.c"
+# endif
+# endif
+# include "arm/arm_celt_map.c"
+#endif
+
+#define MAX_SIZE 100
+
+int ret=0;
+void test_rotation(int N, int K)
+{
+ int i;
+ double err = 0, ener = 0, snr, snr0;
+ opus_val16 x0[MAX_SIZE];
+ opus_val16 x1[MAX_SIZE];
+ for (i=0;i<N;i++)
+ x1[i] = x0[i] = rand()%32767-16384;
+ exp_rotation(x1, N, 1, 1, K, SPREAD_NORMAL);
+ for (i=0;i<N;i++)
+ {
+ err += (x0[i]-(double)x1[i])*(x0[i]-(double)x1[i]);
+ ener += x0[i]*(double)x0[i];
+ }
+ snr0 = 20*log10(ener/err);
+ err = ener = 0;
+ exp_rotation(x1, N, -1, 1, K, SPREAD_NORMAL);
+ for (i=0;i<N;i++)
+ {
+ err += (x0[i]-(double)x1[i])*(x0[i]-(double)x1[i]);
+ ener += x0[i]*(double)x0[i];
+ }
+ snr = 20*log10(ener/err);
+ printf ("SNR for size %d (%d pulses) is %f (was %f without inverse)\n", N, K, snr, snr0);
+ if (snr < 60 || snr0 > 20)
+ {
+ fprintf(stderr, "FAIL!\n");
+ ret = 1;
+ }
+}
+
+int main(void)
+{
+ ALLOC_STACK;
+ test_rotation(15, 3);
+ test_rotation(23, 5);
+ test_rotation(50, 3);
+ test_rotation(80, 1);
+ return ret;
+}
diff --git a/drivers/speex/lpc.h b/thirdparty/opus/celt/tests/test_unit_types.c
index 952ecdd93..67a0fb8ed 100644
--- a/drivers/speex/lpc.h
+++ b/thirdparty/opus/celt/tests/test_unit_types.c
@@ -1,29 +1,22 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file lpc.h
- @brief Functions for LPC (Linear Prediction Coefficients) analysis
-*/
+/* Copyright (c) 2008-2011 Xiph.Org Foundation
+ Written by Jean-Marc Valin */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
@@ -32,22 +25,26 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef LPC_H
-#define LPC_H
-
-#include "arch.h"
-
-void _spx_autocorr(
- const spx_word16_t * x, /* in: [0...n-1] samples x */
- spx_word16_t *ac, /* out: [0...lag-1] ac values */
- int lag, int n);
-
-spx_word32_t /* returns minimum mean square error */
-_spx_lpc(
- spx_coef_t * lpc, /* [0...p-1] LPC coefficients */
- const spx_word16_t * ac, /* in: [0...p] autocorrelation values */
- int p
- );
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "opus_types.h"
+#include <stdio.h>
-#endif
+int main(void)
+{
+ opus_int16 i = 1;
+ i <<= 14;
+ if (i>>14 != 1)
+ {
+ fprintf(stderr, "opus_int16 isn't 16 bits\n");
+ return 1;
+ }
+ if (sizeof(opus_int16)*2 != sizeof(opus_int32))
+ {
+ fprintf(stderr, "16*2 != 32\n");
+ return 1;
+ }
+ return 0;
+}
diff --git a/drivers/opus/celt/vq.c b/thirdparty/opus/celt/vq.c
index 3061e3006..f35839606 100644
--- a/drivers/opus/celt/vq.c
+++ b/thirdparty/opus/celt/vq.c
@@ -25,16 +25,19 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/cwrs.h"
-#include "opus/celt/vq.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/bands.h"
-#include "opus/celt/rate.h"
-#include "opus/celt/pitch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "mathops.h"
+#include "cwrs.h"
+#include "vq.h"
+#include "arch.h"
+#include "os_support.h"
+#include "bands.h"
+#include "rate.h"
+#include "pitch.h"
#ifndef OVERRIDE_vq_exp_rotation1
static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_val16 s)
@@ -115,13 +118,13 @@ static void normalise_residual(int * OPUS_RESTRICT iy, celt_norm * OPUS_RESTRICT
int N, opus_val32 Ryy, opus_val16 gain)
{
int i;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int k;
#endif
opus_val32 t;
opus_val16 g;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
k = celt_ilog2(Ryy)>>1;
#endif
t = VSHR32(Ryy, 2*(k-7));
@@ -208,7 +211,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc
} while (++j<N);
/* If X is too small, just replace it with a pulse at 0 */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (sum <= K)
#else
/* Prevents infinities and NaNs from causing too many pulses
@@ -224,7 +227,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc
}
rcp = EXTRACT16(MULT16_32_Q16(K-1, celt_rcp(sum)));
j=0; do {
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* It's really important to round *towards zero* here */
iy[j] = MULT16_16_Q15(X[j],rcp);
#else
@@ -241,7 +244,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc
/* This should never happen, but just in case it does (e.g. on silence)
we fill the first bin with pulses. */
-#ifdef OPUS_FIXED_POINT_DEBUG
+#ifdef FIXED_POINT_DEBUG
celt_assert2(pulsesLeft<=N+3, "Not enough pulses in the quick pass");
#endif
if (pulsesLeft > N+3)
@@ -259,10 +262,10 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc
int best_id;
opus_val32 best_num = -VERY_LARGE16;
opus_val16 best_den = 0;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int rshift;
#endif
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
rshift = 1+celt_ilog2(K-pulsesLeft+i+1);
#endif
best_id = 0;
@@ -346,7 +349,7 @@ unsigned alg_unquant(celt_norm *X, int N, int K, int spread, int B,
void renormalise_vector(celt_norm *X, int N, opus_val16 gain, int arch)
{
int i;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int k;
#endif
opus_val32 E;
@@ -354,7 +357,7 @@ void renormalise_vector(celt_norm *X, int N, opus_val16 gain, int arch)
opus_val32 t;
celt_norm *xptr;
E = EPSILON + celt_inner_prod(X, X, N, arch);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
k = celt_ilog2(E)>>1;
#endif
t = VSHR32(E, 2*(k-7));
@@ -394,7 +397,7 @@ int stereo_itheta(const celt_norm *X, const celt_norm *Y, int stereo, int N, int
}
mid = celt_sqrt(Emid);
side = celt_sqrt(Eside);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* 0.63662 = 2/pi */
itheta = MULT16_16_Q15(QCONST16(0.63662f,15),celt_atan2p(side, mid));
#else
diff --git a/drivers/opus/celt/vq.h b/thirdparty/opus/celt/vq.h
index 10b5e5530..5cfcbe50e 100644
--- a/drivers/opus/celt/vq.h
+++ b/thirdparty/opus/celt/vq.h
@@ -33,12 +33,12 @@
#ifndef VQ_H
#define VQ_H
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
-#include "opus/celt/modes.h"
+#include "entenc.h"
+#include "entdec.h"
+#include "modes.h"
#if defined(MIPSr1_ASM)
-#include "opus/celt/mips/vq_mipsr1.h"
+#include "mips/vq_mipsr1.h"
#endif
diff --git a/drivers/opus/celt/x86/celt_lpc_sse.c b/thirdparty/opus/celt/x86/celt_lpc_sse.c
index cfc86dc66..67e5592ac 100644
--- a/drivers/opus/celt/x86/celt_lpc_sse.c
+++ b/thirdparty/opus/celt/x86/celt_lpc_sse.c
@@ -24,16 +24,19 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/x86/x86cpu.h"
+#include "celt_lpc.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "pitch.h"
+#include "x86cpu.h"
#if defined(FIXED_POINT)
diff --git a/drivers/opus/celt/x86/celt_lpc_sse.h b/thirdparty/opus/celt/x86/celt_lpc_sse.h
index 3787afd3f..c5ec796ed 100644
--- a/drivers/opus/celt/x86/celt_lpc_sse.h
+++ b/thirdparty/opus/celt/x86/celt_lpc_sse.h
@@ -27,7 +27,10 @@
#ifndef CELT_LPC_SSE_H
#define CELT_LPC_SSE_H
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#if defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)
#define OVERRIDE_CELT_FIR
diff --git a/drivers/opus/celt/x86/pitch_sse.c b/thirdparty/opus/celt/x86/pitch_sse.c
index 9f22ffd9a..20e73126b 100644
--- a/drivers/opus/celt/x86/pitch_sse.c
+++ b/thirdparty/opus/celt/x86/pitch_sse.c
@@ -24,18 +24,21 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/silk/macros.h"
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/pitch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "macros.h"
+#include "celt_lpc.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "pitch.h"
#if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)
#include <xmmintrin.h>
-#include "opus/celt/arch.h"
+#include "arch.h"
void xcorr_kernel_sse(const opus_val16 *x, const opus_val16 *y, opus_val32 sum[4], int len)
{
diff --git a/drivers/opus/celt/x86/pitch_sse.h b/thirdparty/opus/celt/x86/pitch_sse.h
index 2b4b54f61..d4cbeb8b9 100644
--- a/drivers/opus/celt/x86/pitch_sse.h
+++ b/thirdparty/opus/celt/x86/pitch_sse.h
@@ -32,7 +32,10 @@
#ifndef PITCH_SSE_H
#define PITCH_SSE_H
-#include "opus/opus_config.h"
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
#if defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)
void xcorr_kernel_sse4_1(
diff --git a/drivers/opus/celt/x86/pitch_sse2.c b/thirdparty/opus/celt/x86/pitch_sse2.c
index b5a78b4ac..a0e7d1bea 100644
--- a/drivers/opus/celt/x86/pitch_sse2.c
+++ b/thirdparty/opus/celt/x86/pitch_sse2.c
@@ -24,16 +24,19 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
-#include "opus/silk/macros.h"
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/pitch.h"
+#include "macros.h"
+#include "celt_lpc.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "pitch.h"
#if defined(OPUS_X86_MAY_HAVE_SSE2) && defined(FIXED_POINT)
opus_val32 celt_inner_prod_sse2(const opus_val16 *x, const opus_val16 *y,
diff --git a/drivers/opus/celt/x86/pitch_sse4_1.c b/thirdparty/opus/celt/x86/pitch_sse4_1.c
index 57fb33221..a092c68b2 100644
--- a/drivers/opus/celt/x86/pitch_sse4_1.c
+++ b/thirdparty/opus/celt/x86/pitch_sse4_1.c
@@ -24,20 +24,23 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
-#include "opus/silk/macros.h"
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/pitch.h"
+#include "macros.h"
+#include "celt_lpc.h"
+#include "stack_alloc.h"
+#include "mathops.h"
+#include "pitch.h"
#if defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)
#include <smmintrin.h>
-#include "opus/celt/x86/x86cpu.h"
+#include "x86cpu.h"
opus_val32 celt_inner_prod_sse4_1(const opus_val16 *x, const opus_val16 *y,
int N)
diff --git a/drivers/opus/celt/x86/x86_celt_map.c b/thirdparty/opus/celt/x86/x86_celt_map.c
index 5146ea2b3..8e5e44927 100644
--- a/drivers/opus/celt/x86/x86_celt_map.c
+++ b/thirdparty/opus/celt/x86/x86_celt_map.c
@@ -24,12 +24,15 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/x86/x86cpu.h"
-#include "opus/celt/celt_lpc.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/x86/pitch_sse.h"
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include "x86/x86cpu.h"
+#include "celt_lpc.h"
+#include "pitch.h"
+#include "pitch_sse.h"
#if defined(OPUS_HAVE_RTCD)
diff --git a/drivers/opus/celt/x86/x86cpu.c b/thirdparty/opus/celt/x86/x86cpu.c
index 91b9b185c..555a576b8 100644
--- a/drivers/opus/celt/x86/x86cpu.c
+++ b/thirdparty/opus/celt/x86/x86cpu.c
@@ -24,13 +24,16 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/cpu_support.h"
-#include "opus/silk/macros.h"
-#include "opus/silk/main.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/x86/x86cpu.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cpu_support.h"
+#include "macros.h"
+#include "main.h"
+#include "pitch.h"
+#include "x86cpu.h"
#if (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)) || \
(defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2)) || \
diff --git a/drivers/opus/celt/x86/x86cpu.h b/thirdparty/opus/celt/x86/x86cpu.h
index 04fd48aac..04fd48aac 100644
--- a/drivers/opus/celt/x86/x86cpu.h
+++ b/thirdparty/opus/celt/x86/x86cpu.h
diff --git a/drivers/opus/opus_config.h b/thirdparty/opus/config.h
index 7b9c92c6a..7b9c92c6a 100644
--- a/drivers/opus/opus_config.h
+++ b/thirdparty/opus/config.h
diff --git a/drivers/opus/http.c b/thirdparty/opus/http.c
index 602d514f6..cfd4e626a 100644
--- a/drivers/opus/http.c
+++ b/thirdparty/opus/http.c
@@ -9,9 +9,11 @@
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
* *
********************************************************************/
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#include "opus/internal.h"
+#include "internal.h"
#include <ctype.h>
#include <errno.h>
#include <limits.h>
@@ -212,7 +214,7 @@ static const char *op_parse_file_url(const char *_src){
# include <winsock2.h>
# include <ws2tcpip.h>
# include <openssl/ssl.h>
-# include "opus/winerrno.h"
+# include "winerrno.h"
typedef SOCKET op_sock;
diff --git a/drivers/opus/info.c b/thirdparty/opus/info.c
index b94393351..55e2906d5 100644
--- a/drivers/opus/info.c
+++ b/thirdparty/opus/info.c
@@ -9,9 +9,11 @@
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
* *
********************************************************************/
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#include "opus/internal.h"
+#include "internal.h"
#include <limits.h>
#include <string.h>
diff --git a/drivers/opus/internal.c b/thirdparty/opus/internal.c
index bd7d2ee4b..96c80def8 100644
--- a/drivers/opus/internal.c
+++ b/thirdparty/opus/internal.c
@@ -9,9 +9,11 @@
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
* *
********************************************************************/
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#include "opus/internal.h"
+#include "internal.h"
#if defined(OP_ENABLE_ASSERTIONS)
void op_fatal_impl(const char *_str,const char *_file,int _line){
diff --git a/drivers/opus/internal.h b/thirdparty/opus/internal.h
index f7a5bd8c7..ee48ea34c 100644
--- a/drivers/opus/internal.h
+++ b/thirdparty/opus/internal.h
@@ -29,7 +29,7 @@
# endif
# include <stdlib.h>
-# include "opus/opusfile.h"
+# include <opusfile.h>
typedef struct OggOpusLink OggOpusLink;
diff --git a/drivers/opus/mlp.c b/thirdparty/opus/mlp.c
index 125106e88..ff9e50df4 100644
--- a/drivers/opus/mlp.c
+++ b/thirdparty/opus/mlp.c
@@ -24,15 +24,18 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus_types.h"
+#include "opus_defines.h"
#include <math.h>
-#include "opus/mlp.h"
-#include "opus/celt/arch.h"
-#include "opus/tansig_table.h"
+#include "mlp.h"
+#include "arch.h"
+#include "tansig_table.h"
#define MAX_NEURONS 100
#if 0
@@ -72,7 +75,7 @@ static OPUS_INLINE float tansig_approx(float x)
return 1;
if (!(x>-8))
return -1;
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
/* Another check in case of -ffast-math */
if (celt_isnan(x))
return 0;
diff --git a/drivers/opus/mlp.h b/thirdparty/opus/mlp.h
index 2b4962625..618e246e2 100644
--- a/drivers/opus/mlp.h
+++ b/thirdparty/opus/mlp.h
@@ -28,7 +28,7 @@
#ifndef _MLP_H_
#define _MLP_H_
-#include "opus/celt/arch.h"
+#include "arch.h"
typedef struct {
int layers;
diff --git a/drivers/opus/mlp_data.c b/thirdparty/opus/mlp_data.c
index c542a509c..c2fda4e2e 100644
--- a/drivers/opus/mlp_data.c
+++ b/thirdparty/opus/mlp_data.c
@@ -1,8 +1,11 @@
/* The contents of this file was automatically generated by mlp_train.c
It contains multi-layer perceptron (MLP) weights. */
-#include "opus/opus_config.h"
-#include "opus/mlp.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "mlp.h"
/* RMS error was 0.138320, seed was 1361535663 */
diff --git a/drivers/opus/opus.c b/thirdparty/opus/opus.c
index 762a9d746..e9ce93b30 100644
--- a/drivers/opus/opus.c
+++ b/thirdparty/opus/opus.c
@@ -24,10 +24,13 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/opus.h"
-#include "opus/opus_private.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus.h"
+#include "opus_private.h"
#ifndef DISABLE_FLOAT_API
OPUS_EXPORT void opus_pcm_soft_clip(float *_x, int N, int C, float *declip_mem)
diff --git a/drivers/opus/opus.h b/thirdparty/opus/opus.h
index 4cb171378..b0bdf6f2d 100644
--- a/drivers/opus/opus.h
+++ b/thirdparty/opus/opus.h
@@ -33,8 +33,8 @@
#ifndef OPUS_H
#define OPUS_H
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#include "opus_types.h"
+#include "opus_defines.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/opus/opus_compare.c b/thirdparty/opus/opus_compare.c
index 06c67d752..06c67d752 100644
--- a/drivers/opus/opus_compare.c
+++ b/thirdparty/opus/opus_compare.c
diff --git a/drivers/opus/opus_custom.h b/thirdparty/opus/opus_custom.h
index 32fcb81ac..41f36bf2f 100644
--- a/drivers/opus/opus_custom.h
+++ b/thirdparty/opus/opus_custom.h
@@ -35,7 +35,7 @@
#ifndef OPUS_CUSTOM_H
#define OPUS_CUSTOM_H
-#include "opus/opus_defines.h"
+#include "opus_defines.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/opus/opus_decoder.c b/thirdparty/opus/opus_decoder.c
index b954b98f0..080bec507 100644
--- a/drivers/opus/opus_decoder.c
+++ b/thirdparty/opus/opus_decoder.c
@@ -24,7 +24,10 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#ifndef OPUS_BUILD
# error "OPUS_BUILD _MUST_ be defined to build Opus. This probably means you need other defines as well, as in a config.h. See the included build files for details."
@@ -35,19 +38,19 @@
#endif
#include <stdarg.h>
-#include "opus/celt/celt.h"
-#include "opus/opus.h"
-#include "opus/celt/entdec.h"
-#include "opus/celt/modes.h"
-#include "opus/silk/API.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/float_cast.h"
-#include "opus/opus_private.h"
-#include "opus/celt/os_support.h"
-#include "opus/silk/structs.h"
-#include "opus/silk/define.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/cpu_support.h"
+#include "celt.h"
+#include "opus.h"
+#include "entdec.h"
+#include "modes.h"
+#include "API.h"
+#include "stack_alloc.h"
+#include "float_cast.h"
+#include "opus_private.h"
+#include "os_support.h"
+#include "structs.h"
+#include "define.h"
+#include "mathops.h"
+#include "cpu_support.h"
struct OpusDecoder {
int celt_dec_offset;
@@ -68,7 +71,7 @@ struct OpusDecoder {
int frame_size;
int prev_redundancy;
int last_packet_duration;
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
opus_val16 softclip_mem[2];
#endif
@@ -291,7 +294,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
/* In fixed-point, we can tell CELT to do the accumulation on top of the
SILK PCM buffer. This saves some stack space. */
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
celt_accum = (mode != MODE_CELT_ONLY) && (frame_size >= F10);
#else
celt_accum = 0;
@@ -335,7 +338,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
{
int lost_flag, decoded_samples;
opus_int16 *pcm_ptr;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (celt_accum)
pcm_ptr = pcm;
else
@@ -504,7 +507,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
if (mode != MODE_CELT_ONLY && !celt_accum)
{
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
for (i=0;i<frame_size*st->channels;i++)
pcm[i] = SAT16(ADD32(pcm[i], pcm_silk[i]));
#else
@@ -696,7 +699,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
st->last_packet_duration = nb_samples;
if (OPUS_CHECK_ARRAY(pcm, nb_samples*st->channels))
OPUS_PRINT_INT(nb_samples);
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
if (soft_clip)
opus_pcm_soft_clip(pcm, nb_samples, st->channels, st->softclip_mem);
else
@@ -705,7 +708,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
return nb_samples;
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int opus_decode(OpusDecoder *st, const unsigned char *data,
opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec)
diff --git a/drivers/opus/opus_defines.h b/thirdparty/opus/opus_defines.h
index b972ce0eb..647ed5d6f 100644
--- a/drivers/opus/opus_defines.h
+++ b/thirdparty/opus/opus_defines.h
@@ -33,7 +33,7 @@
#ifndef OPUS_DEFINES_H
#define OPUS_DEFINES_H
-#include "opus/opus_types.h"
+#include "opus_types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/opus/opus_encoder.c b/thirdparty/opus/opus_encoder.c
index 5c6af5a19..a7e19127d 100644
--- a/drivers/opus/opus_encoder.c
+++ b/thirdparty/opus/opus_encoder.c
@@ -24,28 +24,31 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdarg.h>
-#include "opus/celt/celt.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/modes.h"
-#include "opus/silk/API.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/float_cast.h"
-#include "opus/opus.h"
-#include "opus/celt/arch.h"
-#include "opus/celt/pitch.h"
-#include "opus/opus_private.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/cpu_support.h"
-#include "opus/analysis.h"
-#include "opus/celt/mathops.h"
-#include "opus/silk/tuning_parameters.h"
-#ifdef OPUS_FIXED_POINT
-#include "opus/silk/fixed/structs_FIX.h"
+#include "celt.h"
+#include "entenc.h"
+#include "modes.h"
+#include "API.h"
+#include "stack_alloc.h"
+#include "float_cast.h"
+#include "opus.h"
+#include "arch.h"
+#include "pitch.h"
+#include "opus_private.h"
+#include "os_support.h"
+#include "cpu_support.h"
+#include "analysis.h"
+#include "mathops.h"
+#include "tuning_parameters.h"
+#ifdef FIXED_POINT
+#include "fixed/structs_FIX.h"
#else
-#include "opus/silk/float/structs_FLP.h"
+#include "float/structs_FLP.h"
#endif
#define MAX_ENCODER_BUFFER 480
@@ -280,7 +283,7 @@ static unsigned char gen_toc(int mode, int framerate, int bandwidth, int channel
return toc;
}
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
static void silk_biquad_float(
const opus_val16 *in, /* I: Input signal */
const opus_int32 *B_Q28, /* I: MA coefficients [3] */
@@ -342,7 +345,7 @@ static void hp_cutoff(const opus_val16 *in, opus_int32 cutoff_Hz, opus_val16 *ou
A_Q28[ 0 ] = silk_SMULWW( r_Q22, silk_SMULWW( Fc_Q19, Fc_Q19 ) - SILK_FIX_CONST( 2.0, 22 ) );
A_Q28[ 1 ] = silk_SMULWW( r_Q22, r_Q22 );
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
silk_biquad_alt( in, B_Q28, A_Q28, hp_mem, out, len, channels );
if( channels == 2 ) {
silk_biquad_alt( in+1, B_Q28, A_Q28, hp_mem+2, out+1, len, channels );
@@ -355,7 +358,7 @@ static void hp_cutoff(const opus_val16 *in, opus_int32 cutoff_Hz, opus_val16 *ou
#endif
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
static void dc_reject(const opus_val16 *in, opus_int32 cutoff_Hz, opus_val16 *out, opus_val32 *hp_mem, int len, int channels, opus_int32 Fs)
{
int c, i;
@@ -727,7 +730,7 @@ static int optimize_framesize(const void *x, int len, int C, opus_int32 Fs,
#endif
#ifndef DISABLE_FLOAT_API
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
#define PCM2VAL(x) FLOAT2INT16(x)
#else
#define PCM2VAL(x) SCALEIN(x)
@@ -753,7 +756,7 @@ void downmix_float(const void *_x, opus_val32 *sub, int subframe, int offset, in
sub[j] += PCM2VAL(x[(j+offset)*C+c]);
}
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
scale = (1<<SIG_SHIFT);
#else
scale = 1.f;
@@ -788,7 +791,7 @@ void downmix_int(const void *_x, opus_val32 *sub, int subframe, int offset, int
sub[j] += x[(j+offset)*C+c];
}
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
scale = (1<<SIG_SHIFT);
#else
scale = 1.f/32768;
@@ -998,7 +1001,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
celt_encoder_ctl(celt_enc, CELT_GET_MODE(&celt_mode));
#ifndef DISABLE_FLOAT_API
analysis_info.valid = 0;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
if (st->silk_mode.complexity >= 10 && st->Fs==48000)
#else
if (st->silk_mode.complexity >= 7 && st->Fs==48000)
@@ -1459,7 +1462,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
} else {
dc_reject(pcm, 3, &pcm_buf[total_buffer*st->channels], st->hp_mem, frame_size, st->channels, st->Fs);
}
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
if (float_api)
{
opus_val32 sum;
@@ -1480,7 +1483,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
if (st->mode != MODE_CELT_ONLY)
{
opus_int32 total_bitRate, celt_rate;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
const opus_int16 *pcm_silk;
#else
VARDECL(opus_int16, pcm_silk);
@@ -1628,7 +1631,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
gain_fade(st->delay_buffer+prefill_offset, st->delay_buffer+prefill_offset,
0, Q15ONE, celt_mode->overlap, st->Fs/400, st->channels, celt_mode->window, st->Fs);
OPUS_CLEAR(st->delay_buffer, prefill_offset);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
pcm_silk = st->delay_buffer;
#else
for (i=0;i<st->encoder_buffer*st->channels;i++)
@@ -1637,7 +1640,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
silk_Encode( silk_enc, &st->silk_mode, pcm_silk, st->encoder_buffer, NULL, &zero, 1 );
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
pcm_silk = pcm_buf+total_buffer*st->channels;
#else
for (i=0;i<frame_size*st->channels;i++)
@@ -1781,7 +1784,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
opus_val16 g1, g2;
g1 = st->hybrid_stereo_width_Q14;
g2 = (opus_val16)(st->silk_mode.stereoWidth_Q14);
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
g1 = g1==16384 ? Q15ONE : SHL16(g1,1);
g2 = g2==16384 ? Q15ONE : SHL16(g2,1);
#else
@@ -1961,7 +1964,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
return ret;
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
#ifndef DISABLE_FLOAT_API
opus_int32 opus_encode_float(OpusEncoder *st, const float *pcm, int analysis_frame_size,
diff --git a/drivers/opus/opus_multistream.c b/thirdparty/opus/opus_multistream.c
index aa9480377..09c3639b7 100644
--- a/drivers/opus/opus_multistream.c
+++ b/thirdparty/opus/opus_multistream.c
@@ -24,15 +24,18 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/opus_multistream.h"
-#include "opus/opus.h"
-#include "opus/opus_private.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus_multistream.h"
+#include "opus.h"
+#include "opus_private.h"
+#include "stack_alloc.h"
#include <stdarg.h>
-#include "opus/celt/float_cast.h"
-#include "opus/celt/os_support.h"
+#include "float_cast.h"
+#include "os_support.h"
int validate_layout(const ChannelLayout *layout)
diff --git a/drivers/opus/opus_multistream.h b/thirdparty/opus/opus_multistream.h
index 5519c46a9..47e03900b 100644
--- a/drivers/opus/opus_multistream.h
+++ b/thirdparty/opus/opus_multistream.h
@@ -33,7 +33,7 @@
#ifndef OPUS_MULTISTREAM_H
#define OPUS_MULTISTREAM_H
-#include "opus/opus.h"
+#include "opus.h"
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/opus/opus_multistream_decoder.c b/thirdparty/opus/opus_multistream_decoder.c
index 25100edba..b95eaa6ea 100644
--- a/drivers/opus/opus_multistream_decoder.c
+++ b/thirdparty/opus/opus_multistream_decoder.c
@@ -24,15 +24,18 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/opus_multistream.h"
-#include "opus/opus.h"
-#include "opus/opus_private.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus_multistream.h"
+#include "opus.h"
+#include "opus_private.h"
+#include "stack_alloc.h"
#include <stdarg.h>
-#include "opus/celt/float_cast.h"
-#include "opus/celt/os_support.h"
+#include "float_cast.h"
+#include "os_support.h"
struct OpusMSDecoder {
ChannelLayout layout;
@@ -358,7 +361,7 @@ static void opus_copy_channel_out_short(
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int opus_multistream_decode(
OpusMSDecoder *st,
const unsigned char *data,
diff --git a/drivers/opus/opus_multistream_encoder.c b/thirdparty/opus/opus_multistream_encoder.c
index 426c72e99..9e8577357 100644
--- a/drivers/opus/opus_multistream_encoder.c
+++ b/thirdparty/opus/opus_multistream_encoder.c
@@ -24,21 +24,24 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/opus_multistream.h"
-#include "opus/opus.h"
-#include "opus/opus_private.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus_multistream.h"
+#include "opus.h"
+#include "opus_private.h"
+#include "stack_alloc.h"
#include <stdarg.h>
-#include "opus/celt/float_cast.h"
-#include "opus/celt/os_support.h"
-#include "opus/celt/mathops.h"
-#include "opus/celt/mdct.h"
-#include "opus/celt/modes.h"
-#include "opus/celt/bands.h"
-#include "opus/celt/quant_bands.h"
-#include "opus/celt/pitch.h"
+#include "float_cast.h"
+#include "os_support.h"
+#include "mathops.h"
+#include "mdct.h"
+#include "modes.h"
+#include "bands.h"
+#include "quant_bands.h"
+#include "pitch.h"
typedef struct {
int nb_streams;
@@ -202,7 +205,7 @@ static opus_val16 logSum(opus_val16 a, opus_val16 b)
}
if (!(diff < QCONST16(8.f, DB_SHIFT))) /* inverted to catch NaNs */
return max;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
low = SHR32(diff, DB_SHIFT-1);
frac = SHL16(diff - SHL16(low, DB_SHIFT-1), 16-DB_SHIFT);
#else
@@ -258,7 +261,7 @@ void surround_analysis(const CELTMode *celt_mode, const void *pcm, opus_val16 *b
OPUS_COPY(in, mem+c*overlap, overlap);
(*copy_channel_in)(x, 1, pcm, channels, c, len);
celt_preemphasis(x, in+overlap, frame_size, 1, upsample, celt_mode->preemph, preemph_mem+c, 0);
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
{
opus_val32 sum;
sum = celt_inner_prod(in, in, frame_size+overlap, 0);
@@ -668,7 +671,7 @@ static opus_int32 surround_rate_allocation(
+ nb_lfe*lfe_ratio;
channel_rate = 256*(st->bitrate_bps-lfe_offset*nb_lfe-stream_offset*(nb_coupled+nb_uncoupled))/total;
}
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
if (st->variable_duration==OPUS_FRAMESIZE_VARIABLE && frame_size != Fs/50)
{
opus_int32 bonus;
@@ -955,7 +958,7 @@ static void opus_copy_channel_in_short(
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
int opus_multistream_encode(
OpusMSEncoder *st,
const opus_val16 *pcm,
diff --git a/drivers/opus/opus_private.h b/thirdparty/opus/opus_private.h
index 129977ed1..3b62eed09 100644
--- a/drivers/opus/opus_private.h
+++ b/thirdparty/opus/opus_private.h
@@ -29,9 +29,9 @@
#ifndef OPUS_PRIVATE_H
#define OPUS_PRIVATE_H
-#include "opus/celt/arch.h"
-#include "opus/opus.h"
-#include "opus/celt/celt.h"
+#include "arch.h"
+#include "opus.h"
+#include "celt.h"
#include <stddef.h> /* offsetof */
diff --git a/drivers/opus/opus_types.h b/thirdparty/opus/opus_types.h
index b28e03aea..b28e03aea 100644
--- a/drivers/opus/opus_types.h
+++ b/thirdparty/opus/opus_types.h
diff --git a/drivers/opus/opusfile.c b/thirdparty/opus/opusfile.c
index a9d6cc4d6..9c9b684ca 100644
--- a/drivers/opus/opusfile.c
+++ b/thirdparty/opus/opusfile.c
@@ -14,9 +14,11 @@
last mod: $Id: vorbisfile.c 17573 2010-10-27 14:53:59Z xiphmont $
********************************************************************/
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#include "opus/internal.h"
+#include "internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -24,7 +26,7 @@
#include <string.h>
#include <math.h>
-#include "opus/opusfile.h"
+#include "opusfile.h"
/*This implementation is largely based off of libvorbisfile.
All of the Ogg bits work roughly the same, though I have made some
diff --git a/drivers/opus/opusfile.h b/thirdparty/opus/opusfile.h
index da31a2976..3604115c3 100644
--- a/drivers/opus/opusfile.h
+++ b/thirdparty/opus/opusfile.h
@@ -107,7 +107,7 @@ extern "C" {
# include <stdarg.h>
# include <stdio.h>
# include <ogg/ogg.h>
-# include "opus/opus_multistream.h"
+# include <opus_multistream.h>
/**@cond PRIVATE*/
diff --git a/drivers/opus/repacketizer.c b/thirdparty/opus/repacketizer.c
index 3822f9c86..f27e9ab95 100644
--- a/drivers/opus/repacketizer.c
+++ b/thirdparty/opus/repacketizer.c
@@ -24,11 +24,14 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/opus.h"
-#include "opus/opus_private.h"
-#include "opus/celt/os_support.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus.h"
+#include "opus_private.h"
+#include "os_support.h"
int opus_repacketizer_get_size(void)
diff --git a/drivers/opus/repacketizer_demo.c b/thirdparty/opus/repacketizer_demo.c
index 57acf6a53..dc05c1b35 100644
--- a/drivers/opus/repacketizer_demo.c
+++ b/thirdparty/opus/repacketizer_demo.c
@@ -24,9 +24,12 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/opus.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/drivers/opus/silk/A2NLSF.c b/thirdparty/opus/silk/A2NLSF.c
index 38dbefc3b..b6e9e5ffc 100644
--- a/drivers/opus/silk/A2NLSF.c
+++ b/thirdparty/opus/silk/A2NLSF.c
@@ -30,10 +30,13 @@ POSSIBILITY OF SUCH DAMAGE.
/* A piecewise linear approximation maps LSF <-> cos(LSF) */
/* Therefore the result is not accurate NLSFs, but the two */
/* functions are accurate inverses of each other */
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "tables.h"
/* Number of binary divisions, when not in low complexity mode */
#define BIN_DIV_STEPS_A2NLSF_FIX 3 /* must be no higher than 16 - log2( LSF_COS_TAB_SZ_FIX ) */
diff --git a/drivers/opus/silk/API.h b/thirdparty/opus/silk/API.h
index ce868c0c9..0131acbb0 100644
--- a/drivers/opus/silk/API.h
+++ b/thirdparty/opus/silk/API.h
@@ -28,11 +28,11 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_API_H
#define SILK_API_H
-#include "opus/silk/control.h"
-#include "opus/silk/typedef.h"
-#include "opus/silk/errors.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
+#include "control.h"
+#include "typedef.h"
+#include "errors.h"
+#include "entenc.h"
+#include "entdec.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/CNG.c b/thirdparty/opus/silk/CNG.c
index 595a28886..61787c230 100644
--- a/drivers/opus/silk/CNG.c
+++ b/thirdparty/opus/silk/CNG.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
/* Generates excitation for CNG LPC synthesis */
static OPUS_INLINE void silk_CNG_exc(
diff --git a/drivers/opus/silk/HP_variable_cutoff.c b/thirdparty/opus/silk/HP_variable_cutoff.c
index 6b93fdb5a..bbe10f04c 100644
--- a/drivers/opus/silk/HP_variable_cutoff.c
+++ b/thirdparty/opus/silk/HP_variable_cutoff.c
@@ -24,13 +24,16 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#ifdef OPUS_FIXED_POINT
-#include "opus/silk/fixed/main_FIX.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef FIXED_POINT
+#include "main_FIX.h"
#else
-#include "opus/silk/float/main_FLP.h"
+#include "main_FLP.h"
#endif
-#include "opus/silk/tuning_parameters.h"
+#include "tuning_parameters.h"
/* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
void silk_HP_variable_cutoff(
diff --git a/drivers/opus/silk/Inlines.h b/thirdparty/opus/silk/Inlines.h
index ec986cdfd..ec986cdfd 100644
--- a/drivers/opus/silk/Inlines.h
+++ b/thirdparty/opus/silk/Inlines.h
diff --git a/drivers/opus/silk/LPC_analysis_filter.c b/thirdparty/opus/silk/LPC_analysis_filter.c
index f3c34b548..20906673f 100644
--- a/drivers/opus/silk/LPC_analysis_filter.c
+++ b/thirdparty/opus/silk/LPC_analysis_filter.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/celt/celt_lpc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "celt_lpc.h"
/*******************************************/
/* LPC analysis filter */
@@ -46,7 +49,7 @@ void silk_LPC_analysis_filter(
)
{
opus_int j;
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_int16 mem[SILK_MAX_ORDER_LPC];
opus_int16 num[SILK_MAX_ORDER_LPC];
#else
@@ -59,7 +62,7 @@ void silk_LPC_analysis_filter(
silk_assert( (d & 1) == 0 );
silk_assert( d <= len );
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
silk_assert( d <= SILK_MAX_ORDER_LPC );
for ( j = 0; j < d; j++ ) {
num[ j ] = -B[ j ];
diff --git a/drivers/opus/silk/LPC_inv_pred_gain.c b/thirdparty/opus/silk/LPC_inv_pred_gain.c
index 8ace51500..4af89aa5f 100644
--- a/drivers/opus/silk/LPC_inv_pred_gain.c
+++ b/thirdparty/opus/silk/LPC_inv_pred_gain.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
#define QA 24
#define A_LIMIT SILK_FIX_CONST( 0.99975, QA )
@@ -127,7 +130,7 @@ opus_int32 silk_LPC_inverse_pred_gain( /* O Returns inverse predi
return LPC_inverse_pred_gain_QA( Atmp_QA, order );
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* For input in Q24 domain */
opus_int32 silk_LPC_inverse_pred_gain_Q24( /* O Returns inverse prediction gain in energy domain, Q30 */
diff --git a/drivers/opus/silk/LP_variable_cutoff.c b/thirdparty/opus/silk/LP_variable_cutoff.c
index b39497c4d..f639e1f89 100644
--- a/drivers/opus/silk/LP_variable_cutoff.c
+++ b/thirdparty/opus/silk/LP_variable_cutoff.c
@@ -24,7 +24,10 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/*
Elliptic/Cauer filters designed with 0.1 dB passband ripple,
@@ -32,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
[0.95 : 0.15 : 0.35] normalized cut off frequencies.
*/
-#include "opus/silk/main.h"
+#include "main.h"
/* Helper function, interpolates the filter taps */
static OPUS_INLINE void silk_LP_interpolate_filter_taps(
diff --git a/drivers/opus/silk/MacroCount.h b/thirdparty/opus/silk/MacroCount.h
index 834817d05..834817d05 100644
--- a/drivers/opus/silk/MacroCount.h
+++ b/thirdparty/opus/silk/MacroCount.h
diff --git a/drivers/opus/silk/MacroDebug.h b/thirdparty/opus/silk/MacroDebug.h
index 35aedc5c5..35aedc5c5 100644
--- a/drivers/opus/silk/MacroDebug.h
+++ b/thirdparty/opus/silk/MacroDebug.h
diff --git a/drivers/opus/silk/NLSF2A.c b/thirdparty/opus/silk/NLSF2A.c
index 09db1c1c3..b1c559ea6 100644
--- a/drivers/opus/silk/NLSF2A.c
+++ b/thirdparty/opus/silk/NLSF2A.c
@@ -24,7 +24,10 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/* conversion between prediction filter coefficients and LSFs */
/* order should be even */
@@ -32,8 +35,8 @@ POSSIBILITY OF SUCH DAMAGE.
/* therefore the result is not accurate LSFs, but the two */
/* functions are accurate inverses of each other */
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/tables.h"
+#include "SigProc_FIX.h"
+#include "tables.h"
#define QA 16
diff --git a/drivers/opus/silk/NLSF_VQ.c b/thirdparty/opus/silk/NLSF_VQ.c
index 99a37d4e0..69b6e22e1 100644
--- a/drivers/opus/silk/NLSF_VQ.c
+++ b/thirdparty/opus/silk/NLSF_VQ.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Compute quantization errors for an LPC_order element input vector for a VQ codebook */
void silk_NLSF_VQ(
diff --git a/drivers/opus/silk/NLSF_VQ_weights_laroia.c b/thirdparty/opus/silk/NLSF_VQ_weights_laroia.c
index 5743a4dee..04894c59a 100644
--- a/drivers/opus/silk/NLSF_VQ_weights_laroia.c
+++ b/thirdparty/opus/silk/NLSF_VQ_weights_laroia.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/define.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "define.h"
+#include "SigProc_FIX.h"
/*
R. Laroia, N. Phamdo and N. Farvardin, "Robust and Efficient Quantization of Speech LSP
diff --git a/drivers/opus/silk/NLSF_decode.c b/thirdparty/opus/silk/NLSF_decode.c
index 6b922f3ee..9f715060b 100644
--- a/drivers/opus/silk/NLSF_decode.c
+++ b/thirdparty/opus/silk/NLSF_decode.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Predictive dequantizer for NLSF residuals */
static OPUS_INLINE void silk_NLSF_residual_dequant( /* O Returns RD value in Q30 */
diff --git a/drivers/opus/silk/NLSF_del_dec_quant.c b/thirdparty/opus/silk/NLSF_del_dec_quant.c
index 3f81b2028..c3b9efccf 100644
--- a/drivers/opus/silk/NLSF_del_dec_quant.c
+++ b/thirdparty/opus/silk/NLSF_del_dec_quant.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Delayed-decision quantizer for NLSF residuals */
opus_int32 silk_NLSF_del_dec_quant( /* O Returns RD value in Q25 */
diff --git a/drivers/opus/silk/NLSF_encode.c b/thirdparty/opus/silk/NLSF_encode.c
index 9efb3e515..03a036fda 100644
--- a/drivers/opus/silk/NLSF_encode.c
+++ b/thirdparty/opus/silk/NLSF_encode.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
/***********************/
/* NLSF vector encoder */
diff --git a/drivers/opus/silk/NLSF_stabilize.c b/thirdparty/opus/silk/NLSF_stabilize.c
index 1a45e1692..1fa1ea379 100644
--- a/drivers/opus/silk/NLSF_stabilize.c
+++ b/thirdparty/opus/silk/NLSF_stabilize.c
@@ -24,7 +24,10 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/* NLSF stabilizer: */
/* */
@@ -35,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* - Output are sorted NLSF coefficients */
/* */
-#include "opus/silk/SigProc_FIX.h"
+#include "SigProc_FIX.h"
/* Constant Definitions */
#define MAX_LOOPS 20
diff --git a/drivers/opus/silk/NLSF_unpack.c b/thirdparty/opus/silk/NLSF_unpack.c
index c958f4a6e..17bd23f75 100644
--- a/drivers/opus/silk/NLSF_unpack.c
+++ b/thirdparty/opus/silk/NLSF_unpack.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Unpack predictor values and indices for entropy coding tables */
void silk_NLSF_unpack(
diff --git a/drivers/opus/silk/NSQ.c b/thirdparty/opus/silk/NSQ.c
index e41e533bd..a06588407 100644
--- a/drivers/opus/silk/NSQ.c
+++ b/thirdparty/opus/silk/NSQ.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
static OPUS_INLINE void silk_nsq_scale_states(
const silk_encoder_state *psEncC, /* I Encoder State */
diff --git a/thirdparty/opus/silk/NSQ.h b/thirdparty/opus/silk/NSQ.h
new file mode 100644
index 000000000..971832f66
--- /dev/null
+++ b/thirdparty/opus/silk/NSQ.h
@@ -0,0 +1,101 @@
+/***********************************************************************
+Copyright (c) 2014 Vidyo.
+Copyright (c) 2006-2011, Skype Limited. All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+- Neither the name of Internet Society, IETF or IETF Trust, nor the
+names of specific contributors, may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+***********************************************************************/
+#ifndef SILK_NSQ_H
+#define SILK_NSQ_H
+
+#include "SigProc_FIX.h"
+
+#undef silk_short_prediction_create_arch_coef
+
+static OPUS_INLINE opus_int32 silk_noise_shape_quantizer_short_prediction_c(const opus_int32 *buf32, const opus_int16 *coef16, opus_int order)
+{
+ opus_int32 out;
+ silk_assert( order == 10 || order == 16 );
+
+ /* Avoids introducing a bias because silk_SMLAWB() always rounds to -inf */
+ out = silk_RSHIFT( order, 1 );
+ out = silk_SMLAWB( out, buf32[ 0 ], coef16[ 0 ] );
+ out = silk_SMLAWB( out, buf32[ -1 ], coef16[ 1 ] );
+ out = silk_SMLAWB( out, buf32[ -2 ], coef16[ 2 ] );
+ out = silk_SMLAWB( out, buf32[ -3 ], coef16[ 3 ] );
+ out = silk_SMLAWB( out, buf32[ -4 ], coef16[ 4 ] );
+ out = silk_SMLAWB( out, buf32[ -5 ], coef16[ 5 ] );
+ out = silk_SMLAWB( out, buf32[ -6 ], coef16[ 6 ] );
+ out = silk_SMLAWB( out, buf32[ -7 ], coef16[ 7 ] );
+ out = silk_SMLAWB( out, buf32[ -8 ], coef16[ 8 ] );
+ out = silk_SMLAWB( out, buf32[ -9 ], coef16[ 9 ] );
+
+ if( order == 16 )
+ {
+ out = silk_SMLAWB( out, buf32[ -10 ], coef16[ 10 ] );
+ out = silk_SMLAWB( out, buf32[ -11 ], coef16[ 11 ] );
+ out = silk_SMLAWB( out, buf32[ -12 ], coef16[ 12 ] );
+ out = silk_SMLAWB( out, buf32[ -13 ], coef16[ 13 ] );
+ out = silk_SMLAWB( out, buf32[ -14 ], coef16[ 14 ] );
+ out = silk_SMLAWB( out, buf32[ -15 ], coef16[ 15 ] );
+ }
+ return out;
+}
+
+#define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) ((void)arch,silk_noise_shape_quantizer_short_prediction_c(in, coef, order))
+
+static OPUS_INLINE opus_int32 silk_NSQ_noise_shape_feedback_loop_c(const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef, opus_int order)
+{
+ opus_int32 out;
+ opus_int32 tmp1, tmp2;
+ opus_int j;
+
+ tmp2 = data0[0];
+ tmp1 = data1[0];
+ data1[0] = tmp2;
+
+ out = silk_RSHIFT(order, 1);
+ out = silk_SMLAWB(out, tmp2, coef[0]);
+
+ for (j = 2; j < order; j += 2) {
+ tmp2 = data1[j - 1];
+ data1[j - 1] = tmp1;
+ out = silk_SMLAWB(out, tmp1, coef[j - 1]);
+ tmp1 = data1[j + 0];
+ data1[j + 0] = tmp2;
+ out = silk_SMLAWB(out, tmp2, coef[j]);
+ }
+ data1[order - 1] = tmp1;
+ out = silk_SMLAWB(out, tmp1, coef[order - 1]);
+ /* Q11 -> Q12 */
+ out = silk_LSHIFT32( out, 1 );
+ return out;
+}
+
+#define silk_NSQ_noise_shape_feedback_loop(data0, data1, coef, order, arch) ((void)arch,silk_NSQ_noise_shape_feedback_loop_c(data0, data1, coef, order))
+
+#if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+#include "arm/NSQ_neon.h"
+#endif
+
+#endif /* SILK_NSQ_H */
diff --git a/drivers/opus/silk/NSQ_del_dec.c b/thirdparty/opus/silk/NSQ_del_dec.c
index 28b385e41..aff560c22 100644
--- a/drivers/opus/silk/NSQ_del_dec.c
+++ b/thirdparty/opus/silk/NSQ_del_dec.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
typedef struct {
opus_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ];
@@ -55,7 +58,7 @@ typedef struct {
typedef NSQ_sample_struct NSQ_sample_pair[ 2 ];
#if defined(MIPSr1_ASM)
-#include "opus/silk/mips/NSQ_del_dec_mipsr1.h"
+#include "mips/NSQ_del_dec_mipsr1.h"
#endif
static OPUS_INLINE void silk_nsq_del_dec_scale_states(
const silk_encoder_state *psEncC, /* I Encoder State */
diff --git a/drivers/opus/silk/PLC.c b/thirdparty/opus/silk/PLC.c
index 4007112c5..34a94bc31 100644
--- a/drivers/opus/silk/PLC.c
+++ b/thirdparty/opus/silk/PLC.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/PLC.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
+#include "PLC.h"
#define NB_ATT 2
static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /* 0.99, 0.95 */
diff --git a/drivers/opus/silk/PLC.h b/thirdparty/opus/silk/PLC.h
index 209c2de48..6438f5163 100644
--- a/drivers/opus/silk/PLC.h
+++ b/thirdparty/opus/silk/PLC.h
@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_PLC_H
#define SILK_PLC_H
-#include "opus/silk/main.h"
+#include "main.h"
#define BWE_COEF 0.99
#define V_PITCH_GAIN_START_MIN_Q14 11469 /* 0.7 in Q14 */
diff --git a/drivers/opus/silk/SigProc_FIX.h b/thirdparty/opus/silk/SigProc_FIX.h
index 743cf7800..b63299441 100644
--- a/drivers/opus/silk/SigProc_FIX.h
+++ b/thirdparty/opus/silk/SigProc_FIX.h
@@ -38,13 +38,13 @@ extern "C"
#define SILK_MAX_ORDER_LPC 16 /* max order of the LPC analysis in schur() and k2a() */
#include <string.h> /* for memset(), memcpy(), memmove() */
-#include "opus/silk/typedef.h"
-#include "opus/silk/resampler_structs.h"
-#include "opus/silk/macros.h"
-#include "opus/celt/cpu_support.h"
+#include "typedef.h"
+#include "resampler_structs.h"
+#include "macros.h"
+#include "cpu_support.h"
#if defined(OPUS_X86_MAY_HAVE_SSE4_1)
-#include "opus/silk/x86/SigProc_FIX_sse.h"
+#include "x86/SigProc_FIX_sse.h"
#endif
/********************************************************************/
@@ -591,20 +591,20 @@ static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
((void)(arch),silk_inner_prod16_aligned_64_c(inVec1, inVec2, len))
#endif
-#include "opus/silk/Inlines.h"
-#include "opus/silk/MacroCount.h"
-#include "opus/silk/MacroDebug.h"
+#include "Inlines.h"
+#include "MacroCount.h"
+#include "MacroDebug.h"
#ifdef OPUS_ARM_INLINE_ASM
-#include "opus/silk/arm/SigProc_FIX_armv4.h"
+#include "arm/SigProc_FIX_armv4.h"
#endif
#ifdef OPUS_ARM_INLINE_EDSP
-#include "opus/silk/arm/SigProc_FIX_armv5e.h"
+#include "arm/SigProc_FIX_armv5e.h"
#endif
#if defined(MIPSr1_ASM)
-#include "opus/silk/mips/sigproc_fix_mipsr1.h"
+#include "mips/sigproc_fix_mipsr1.h"
#endif
diff --git a/drivers/opus/silk/VAD.c b/thirdparty/opus/silk/VAD.c
index bb664cff8..0a782af2f 100644
--- a/drivers/opus/silk/VAD.c
+++ b/thirdparty/opus/silk/VAD.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
/* Silk VAD noise level estimation */
# if !defined(OPUS_X86_MAY_HAVE_SSE4_1)
diff --git a/drivers/opus/silk/VQ_WMat_EC.c b/thirdparty/opus/silk/VQ_WMat_EC.c
index fec9ee8dd..7983f1db8 100644
--- a/drivers/opus/silk/VQ_WMat_EC.c
+++ b/thirdparty/opus/silk/VQ_WMat_EC.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Entropy constrained matrix-weighted VQ, hard-coded to 5-element vectors, for a single input data vector */
void silk_VQ_WMat_EC_c(
diff --git a/drivers/opus/silk/ana_filt_bank_1.c b/thirdparty/opus/silk/ana_filt_bank_1.c
index b49bdd90b..24cfb03fd 100644
--- a/drivers/opus/silk/ana_filt_bank_1.c
+++ b/thirdparty/opus/silk/ana_filt_bank_1.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Coefficients for 2-band filter bank based on first-order allpass filters */
static opus_int16 A_fb1_20 = 5394 << 1;
diff --git a/thirdparty/opus/silk/arm/NSQ_neon.c b/thirdparty/opus/silk/arm/NSQ_neon.c
new file mode 100644
index 000000000..964252997
--- /dev/null
+++ b/thirdparty/opus/silk/arm/NSQ_neon.c
@@ -0,0 +1,112 @@
+/***********************************************************************
+Copyright (C) 2014 Vidyo
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+- Neither the name of Internet Society, IETF or IETF Trust, nor the
+names of specific contributors, may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+***********************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <arm_neon.h>
+#include "main.h"
+#include "stack_alloc.h"
+#include "NSQ.h"
+#include "celt/cpu_support.h"
+#include "celt/arm/armcpu.h"
+
+opus_int32 silk_noise_shape_quantizer_short_prediction_neon(const opus_int32 *buf32, const opus_int32 *coef32, opus_int order)
+{
+ int32x4_t coef0 = vld1q_s32(coef32);
+ int32x4_t coef1 = vld1q_s32(coef32 + 4);
+ int32x4_t coef2 = vld1q_s32(coef32 + 8);
+ int32x4_t coef3 = vld1q_s32(coef32 + 12);
+
+ int32x4_t a0 = vld1q_s32(buf32 - 15);
+ int32x4_t a1 = vld1q_s32(buf32 - 11);
+ int32x4_t a2 = vld1q_s32(buf32 - 7);
+ int32x4_t a3 = vld1q_s32(buf32 - 3);
+
+ int32x4_t b0 = vqdmulhq_s32(coef0, a0);
+ int32x4_t b1 = vqdmulhq_s32(coef1, a1);
+ int32x4_t b2 = vqdmulhq_s32(coef2, a2);
+ int32x4_t b3 = vqdmulhq_s32(coef3, a3);
+
+ int32x4_t c0 = vaddq_s32(b0, b1);
+ int32x4_t c1 = vaddq_s32(b2, b3);
+
+ int32x4_t d = vaddq_s32(c0, c1);
+
+ int64x2_t e = vpaddlq_s32(d);
+
+ int64x1_t f = vadd_s64(vget_low_s64(e), vget_high_s64(e));
+
+ opus_int32 out = vget_lane_s32(vreinterpret_s32_s64(f), 0);
+
+ out += silk_RSHIFT( order, 1 );
+
+ return out;
+}
+
+
+opus_int32 silk_NSQ_noise_shape_feedback_loop_neon(const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef, opus_int order)
+{
+ opus_int32 out;
+ if (order == 8)
+ {
+ int32x4_t a00 = vdupq_n_s32(data0[0]);
+ int32x4_t a01 = vld1q_s32(data1); /* data1[0] ... [3] */
+
+ int32x4_t a0 = vextq_s32 (a00, a01, 3); /* data0[0] data1[0] ...[2] */
+ int32x4_t a1 = vld1q_s32(data1 + 3); /* data1[3] ... [6] */
+
+ /*TODO: Convert these once in advance instead of once per sample, like
+ silk_noise_shape_quantizer_short_prediction_neon() does.*/
+ int16x8_t coef16 = vld1q_s16(coef);
+ int32x4_t coef0 = vmovl_s16(vget_low_s16(coef16));
+ int32x4_t coef1 = vmovl_s16(vget_high_s16(coef16));
+
+ /*This is not bit-exact with the C version, since we do not drop the
+ lower 16 bits of each multiply, but wait until the end to truncate
+ precision. This is an encoder-specific calculation (and unlike
+ silk_noise_shape_quantizer_short_prediction_neon(), is not meant to
+ simulate what the decoder will do). We still could use vqdmulhq_s32()
+ like silk_noise_shape_quantizer_short_prediction_neon() and save
+ half the multiplies, but the speed difference is not large, since we
+ then need two extra adds.*/
+ int64x2_t b0 = vmull_s32(vget_low_s32(a0), vget_low_s32(coef0));
+ int64x2_t b1 = vmlal_s32(b0, vget_high_s32(a0), vget_high_s32(coef0));
+ int64x2_t b2 = vmlal_s32(b1, vget_low_s32(a1), vget_low_s32(coef1));
+ int64x2_t b3 = vmlal_s32(b2, vget_high_s32(a1), vget_high_s32(coef1));
+
+ int64x1_t c = vadd_s64(vget_low_s64(b3), vget_high_s64(b3));
+ int64x1_t cS = vrshr_n_s64(c, 15);
+ int32x2_t d = vreinterpret_s32_s64(cS);
+
+ out = vget_lane_s32(d, 0);
+ vst1q_s32(data1, a0);
+ vst1q_s32(data1 + 4, a1);
+ return out;
+ }
+ return silk_NSQ_noise_shape_feedback_loop_c(data0, data1, coef, order);
+}
diff --git a/thirdparty/opus/silk/arm/NSQ_neon.h b/thirdparty/opus/silk/arm/NSQ_neon.h
new file mode 100644
index 000000000..77c946af8
--- /dev/null
+++ b/thirdparty/opus/silk/arm/NSQ_neon.h
@@ -0,0 +1,113 @@
+/***********************************************************************
+Copyright (C) 2014 Vidyo
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+- Neither the name of Internet Society, IETF or IETF Trust, nor the
+names of specific contributors, may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+***********************************************************************/
+#ifndef SILK_NSQ_NEON_H
+#define SILK_NSQ_NEON_H
+
+#include "cpu_support.h"
+
+#undef silk_short_prediction_create_arch_coef
+/* For vectorized calc, reverse a_Q12 coefs, convert to 32-bit, and shift for vqdmulhq_s32. */
+static OPUS_INLINE void silk_short_prediction_create_arch_coef_neon(opus_int32 *out, const opus_int16 *in, opus_int order)
+{
+ out[15] = in[0] << 15;
+ out[14] = in[1] << 15;
+ out[13] = in[2] << 15;
+ out[12] = in[3] << 15;
+ out[11] = in[4] << 15;
+ out[10] = in[5] << 15;
+ out[9] = in[6] << 15;
+ out[8] = in[7] << 15;
+ out[7] = in[8] << 15;
+ out[6] = in[9] << 15;
+
+ if (order == 16)
+ {
+ out[5] = in[10] << 15;
+ out[4] = in[11] << 15;
+ out[3] = in[12] << 15;
+ out[2] = in[13] << 15;
+ out[1] = in[14] << 15;
+ out[0] = in[15] << 15;
+ }
+ else
+ {
+ out[5] = 0;
+ out[4] = 0;
+ out[3] = 0;
+ out[2] = 0;
+ out[1] = 0;
+ out[0] = 0;
+ }
+}
+
+#if defined(OPUS_ARM_PRESUME_NEON_INTR)
+
+#define silk_short_prediction_create_arch_coef(out, in, order) \
+ (silk_short_prediction_create_arch_coef_neon(out, in, order))
+
+#elif defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+
+#define silk_short_prediction_create_arch_coef(out, in, order) \
+ do { if (arch == OPUS_ARCH_ARM_NEON) { silk_short_prediction_create_arch_coef_neon(out, in, order); } } while (0)
+
+#endif
+
+opus_int32 silk_noise_shape_quantizer_short_prediction_neon(const opus_int32 *buf32, const opus_int32 *coef32, opus_int order);
+
+opus_int32 silk_NSQ_noise_shape_feedback_loop_neon(const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef, opus_int order);
+
+#if defined(OPUS_ARM_PRESUME_NEON_INTR)
+#undef silk_noise_shape_quantizer_short_prediction
+#define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) \
+ ((void)arch,silk_noise_shape_quantizer_short_prediction_neon(in, coefRev, order))
+
+#undef silk_NSQ_noise_shape_feedback_loop
+#define silk_NSQ_noise_shape_feedback_loop(data0, data1, coef, order, arch) ((void)arch,silk_NSQ_noise_shape_feedback_loop_neon(data0, data1, coef, order))
+
+#elif defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+
+/* silk_noise_shape_quantizer_short_prediction implementations take different parameters based on arch
+ (coef vs. coefRev) so can't use the usual IMPL table implementation */
+#undef silk_noise_shape_quantizer_short_prediction
+#define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) \
+ (arch == OPUS_ARCH_ARM_NEON ? \
+ silk_noise_shape_quantizer_short_prediction_neon(in, coefRev, order) : \
+ silk_noise_shape_quantizer_short_prediction_c(in, coef, order))
+
+extern opus_int32
+ (*const SILK_NSQ_NOISE_SHAPE_FEEDBACK_LOOP_IMPL[OPUS_ARCHMASK+1])(
+ const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef,
+ opus_int order);
+
+#undef silk_NSQ_noise_shape_feedback_loop
+#define silk_NSQ_noise_shape_feedback_loop(data0, data1, coef, order, arch) \
+ (SILK_NSQ_NOISE_SHAPE_FEEDBACK_LOOP_IMPL[(arch)&OPUS_ARCHMASK](data0, data1, \
+ coef, order))
+
+#endif
+
+#endif /* SILK_NSQ_NEON_H */
diff --git a/drivers/opus/silk/arm/SigProc_FIX_armv4.h b/thirdparty/opus/silk/arm/SigProc_FIX_armv4.h
index ff62b1e5d..ff62b1e5d 100644
--- a/drivers/opus/silk/arm/SigProc_FIX_armv4.h
+++ b/thirdparty/opus/silk/arm/SigProc_FIX_armv4.h
diff --git a/drivers/opus/silk/arm/SigProc_FIX_armv5e.h b/thirdparty/opus/silk/arm/SigProc_FIX_armv5e.h
index 617a09cab..617a09cab 100644
--- a/drivers/opus/silk/arm/SigProc_FIX_armv5e.h
+++ b/thirdparty/opus/silk/arm/SigProc_FIX_armv5e.h
diff --git a/thirdparty/opus/silk/arm/arm_silk_map.c b/thirdparty/opus/silk/arm/arm_silk_map.c
new file mode 100644
index 000000000..9bd86a7b2
--- /dev/null
+++ b/thirdparty/opus/silk/arm/arm_silk_map.c
@@ -0,0 +1,55 @@
+/***********************************************************************
+Copyright (C) 2014 Vidyo
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+- Neither the name of Internet Society, IETF or IETF Trust, nor the
+names of specific contributors, may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+***********************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "NSQ.h"
+
+#if defined(OPUS_HAVE_RTCD)
+
+# if (defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && \
+ !defined(OPUS_ARM_PRESUME_NEON_INTR))
+
+/*There is no table for silk_noise_shape_quantizer_short_prediction because the
+ NEON version takes different parameters than the C version.
+ Instead RTCD is done via if statements at the call sites.
+ See NSQ_neon.h for details.*/
+
+opus_int32
+ (*const SILK_NSQ_NOISE_SHAPE_FEEDBACK_LOOP_IMPL[OPUS_ARCHMASK+1])(
+ const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef,
+ opus_int order) = {
+ silk_NSQ_noise_shape_feedback_loop_c, /* ARMv4 */
+ silk_NSQ_noise_shape_feedback_loop_c, /* EDSP */
+ silk_NSQ_noise_shape_feedback_loop_c, /* Media */
+ silk_NSQ_noise_shape_feedback_loop_neon, /* NEON */
+};
+
+# endif
+
+#endif /* OPUS_HAVE_RTCD */
diff --git a/thirdparty/opus/silk/arm/macros_arm64.h b/thirdparty/opus/silk/arm/macros_arm64.h
new file mode 100644
index 000000000..ed030413c
--- /dev/null
+++ b/thirdparty/opus/silk/arm/macros_arm64.h
@@ -0,0 +1,39 @@
+/***********************************************************************
+Copyright (C) 2015 Vidyo
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+- Neither the name of Internet Society, IETF or IETF Trust, nor the
+names of specific contributors, may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+***********************************************************************/
+
+#ifndef SILK_MACROS_ARM64_H
+#define SILK_MACROS_ARM64_H
+
+#include <arm_neon.h>
+
+#undef silk_ADD_SAT32
+#define silk_ADD_SAT32(a, b) (vqadds_s32((a), (b)))
+
+#undef silk_SUB_SAT32
+#define silk_SUB_SAT32(a, b) (vqsubs_s32((a), (b)))
+
+#endif /* SILK_MACROS_ARM64_H */
diff --git a/drivers/opus/silk/arm/macros_armv4.h b/thirdparty/opus/silk/arm/macros_armv4.h
index 3f30e9728..3f30e9728 100644
--- a/drivers/opus/silk/arm/macros_armv4.h
+++ b/thirdparty/opus/silk/arm/macros_armv4.h
diff --git a/drivers/opus/silk/arm/macros_armv5e.h b/thirdparty/opus/silk/arm/macros_armv5e.h
index aad4117e4..aad4117e4 100644
--- a/drivers/opus/silk/arm/macros_armv5e.h
+++ b/thirdparty/opus/silk/arm/macros_armv5e.h
diff --git a/drivers/opus/silk/biquad_alt.c b/thirdparty/opus/silk/biquad_alt.c
index f797d1e70..d55f5ee92 100644
--- a/drivers/opus/silk/biquad_alt.c
+++ b/thirdparty/opus/silk/biquad_alt.c
@@ -31,9 +31,12 @@ POSSIBILITY OF SUCH DAMAGE.
* Second order ARMA filter *
* Can handle slowly varying filter coefficients *
* */
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Second order ARMA filter, alternative implementation */
void silk_biquad_alt(
diff --git a/drivers/opus/silk/bwexpander.c b/thirdparty/opus/silk/bwexpander.c
index e7cc44852..2eb445669 100644
--- a/drivers/opus/silk/bwexpander.c
+++ b/thirdparty/opus/silk/bwexpander.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Chirp (bandwidth expand) LP AR filter */
void silk_bwexpander(
diff --git a/drivers/opus/silk/bwexpander_32.c b/thirdparty/opus/silk/bwexpander_32.c
index dedd213b3..d0010f73d 100644
--- a/drivers/opus/silk/bwexpander_32.c
+++ b/thirdparty/opus/silk/bwexpander_32.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Chirp (bandwidth expand) LP AR filter */
void silk_bwexpander_32(
diff --git a/drivers/opus/silk/check_control_input.c b/thirdparty/opus/silk/check_control_input.c
index 61a7cc1f3..b5de9ce48 100644
--- a/drivers/opus/silk/check_control_input.c
+++ b/thirdparty/opus/silk/check_control_input.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/silk/control.h"
-#include "opus/silk/errors.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "control.h"
+#include "errors.h"
/* Check encoder control struct */
opus_int check_control_input(
diff --git a/drivers/opus/silk/code_signs.c b/thirdparty/opus/silk/code_signs.c
index 79c189351..dfd1dca9a 100644
--- a/drivers/opus/silk/code_signs.c
+++ b/thirdparty/opus/silk/code_signs.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/*#define silk_enc_map(a) ((a) > 0 ? 1 : 0)*/
/*#define silk_dec_map(a) ((a) > 0 ? 1 : -1)*/
diff --git a/drivers/opus/silk/control.h b/thirdparty/opus/silk/control.h
index 4b20c4a8b..747e5426a 100644
--- a/drivers/opus/silk/control.h
+++ b/thirdparty/opus/silk/control.h
@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_CONTROL_H
#define SILK_CONTROL_H
-#include "opus/silk/typedef.h"
+#include "typedef.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/control_SNR.c b/thirdparty/opus/silk/control_SNR.c
index 5aebfcf38..cee87eb0d 100644
--- a/drivers/opus/silk/control_SNR.c
+++ b/thirdparty/opus/silk/control_SNR.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "tuning_parameters.h"
/* Control SNR of redidual quantizer */
opus_int silk_control_SNR(
diff --git a/drivers/opus/silk/control_audio_bandwidth.c b/thirdparty/opus/silk/control_audio_bandwidth.c
index 04640f53f..4f9bc5cbd 100644
--- a/drivers/opus/silk/control_audio_bandwidth.c
+++ b/thirdparty/opus/silk/control_audio_bandwidth.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "tuning_parameters.h"
/* Control internal sampling rate */
opus_int silk_control_audio_bandwidth(
diff --git a/drivers/opus/silk/control_codec.c b/thirdparty/opus/silk/control_codec.c
index 03caab36a..044eea3f2 100644
--- a/drivers/opus/silk/control_codec.c
+++ b/thirdparty/opus/silk/control_codec.c
@@ -24,17 +24,20 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#ifdef OPUS_FIXED_POINT
-#include "opus/silk/fixed/main_FIX.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef FIXED_POINT
+#include "main_FIX.h"
#define silk_encoder_state_Fxx silk_encoder_state_FIX
#else
-#include "opus/silk/float/main_FLP.h"
+#include "main_FLP.h"
#define silk_encoder_state_Fxx silk_encoder_state_FLP
#endif
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/tuning_parameters.h"
-#include "opus/silk/pitch_est_defines.h"
+#include "stack_alloc.h"
+#include "tuning_parameters.h"
+#include "pitch_est_defines.h"
static opus_int silk_setup_resamplers(
silk_encoder_state_Fxx *psEnc, /* I/O */
@@ -145,7 +148,7 @@ static opus_int silk_setup_resamplers(
} else {
VARDECL( opus_int16, x_buf_API_fs_Hz );
VARDECL( silk_resampler_state_struct, temp_resampler_state );
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
opus_int16 *x_bufFIX = psEnc->x_buf;
#else
VARDECL( opus_int16, x_bufFIX );
@@ -158,7 +161,7 @@ static opus_int silk_setup_resamplers(
buf_length_ms = silk_LSHIFT( psEnc->sCmn.nb_subfr * 5, 1 ) + LA_SHAPE_MS;
old_buf_samples = buf_length_ms * psEnc->sCmn.fs_kHz;
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
new_buf_samples = buf_length_ms * fs_kHz;
ALLOC( x_bufFIX, silk_max( old_buf_samples, new_buf_samples ),
opus_int16 );
@@ -182,7 +185,7 @@ static opus_int silk_setup_resamplers(
/* Correct resampler state by resampling buffered data from API_fs_Hz to fs_kHz */
ret += silk_resampler( &psEnc->sCmn.resampler_state, x_bufFIX, x_buf_API_fs_Hz, api_buf_samples );
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
silk_short2float_array( psEnc->x_buf, x_bufFIX, new_buf_samples);
#endif
}
diff --git a/drivers/opus/silk/debug.c b/thirdparty/opus/silk/debug.c
index ffb3f811a..9253faf71 100644
--- a/drivers/opus/silk/debug.c
+++ b/thirdparty/opus/silk/debug.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/debug.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "debug.h"
+#include "SigProc_FIX.h"
#if SILK_TIC_TOC
diff --git a/drivers/opus/silk/debug.h b/thirdparty/opus/silk/debug.h
index d2eccfa1e..efb6d3e99 100644
--- a/drivers/opus/silk/debug.h
+++ b/thirdparty/opus/silk/debug.h
@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_DEBUG_H
#define SILK_DEBUG_H
-#include "opus/silk/typedef.h"
+#include "typedef.h"
#include <stdio.h> /* file writing */
#include <string.h> /* strcpy, strcmp */
diff --git a/drivers/opus/silk/dec_API.c b/thirdparty/opus/silk/dec_API.c
index 2fd681c0d..b7d8ed48d 100644
--- a/drivers/opus/silk/dec_API.c
+++ b/thirdparty/opus/silk/dec_API.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/API.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/celt/os_support.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "API.h"
+#include "main.h"
+#include "stack_alloc.h"
+#include "os_support.h"
/************************/
/* Decoder Super Struct */
diff --git a/drivers/opus/silk/decode_core.c b/thirdparty/opus/silk/decode_core.c
index 8ca1adffd..b88991e34 100644
--- a/drivers/opus/silk/decode_core.c
+++ b/thirdparty/opus/silk/decode_core.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
/**********************************************************/
/* Core decoder. Performs inverse NSQ operation LTP + LPC */
diff --git a/drivers/opus/silk/decode_frame.c b/thirdparty/opus/silk/decode_frame.c
index 18e2bc9b1..a605d95ac 100644
--- a/drivers/opus/silk/decode_frame.c
+++ b/thirdparty/opus/silk/decode_frame.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/PLC.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
+#include "PLC.h"
/****************/
/* Decode frame */
diff --git a/drivers/opus/silk/decode_indices.c b/thirdparty/opus/silk/decode_indices.c
index fa8066e5f..7afe5c26c 100644
--- a/drivers/opus/silk/decode_indices.c
+++ b/thirdparty/opus/silk/decode_indices.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Decode side-information parameters from payload */
void silk_decode_indices(
diff --git a/drivers/opus/silk/decode_parameters.c b/thirdparty/opus/silk/decode_parameters.c
index d17cb8a3d..e345b1dce 100644
--- a/drivers/opus/silk/decode_parameters.c
+++ b/thirdparty/opus/silk/decode_parameters.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Decode parameters from payload */
void silk_decode_parameters(
diff --git a/drivers/opus/silk/decode_pitch.c b/thirdparty/opus/silk/decode_pitch.c
index 1d98ee7f3..fedbc6a52 100644
--- a/drivers/opus/silk/decode_pitch.c
+++ b/thirdparty/opus/silk/decode_pitch.c
@@ -24,13 +24,16 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/***********************************************************
* Pitch analyser function
********************************************************** */
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/pitch_est_defines.h"
+#include "SigProc_FIX.h"
+#include "pitch_est_defines.h"
void silk_decode_pitch(
opus_int16 lagIndex, /* I */
diff --git a/drivers/opus/silk/decode_pulses.c b/thirdparty/opus/silk/decode_pulses.c
index c687d3bfa..d6bbec922 100644
--- a/drivers/opus/silk/decode_pulses.c
+++ b/thirdparty/opus/silk/decode_pulses.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/*********************************************/
/* Decode quantization indices of excitation */
diff --git a/drivers/opus/silk/decoder_set_fs.c b/thirdparty/opus/silk/decoder_set_fs.c
index 0079a506e..eef0fd25e 100644
--- a/drivers/opus/silk/decoder_set_fs.c
+++ b/thirdparty/opus/silk/decoder_set_fs.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Set decoder sampling rate */
opus_int silk_decoder_set_fs(
diff --git a/drivers/opus/silk/define.h b/thirdparty/opus/silk/define.h
index c6165e3cf..19c9b00e2 100644
--- a/drivers/opus/silk/define.h
+++ b/thirdparty/opus/silk/define.h
@@ -28,8 +28,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_DEFINE_H
#define SILK_DEFINE_H
-#include "opus/silk/errors.h"
-#include "opus/silk/typedef.h"
+#include "errors.h"
+#include "typedef.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/enc_API.c b/thirdparty/opus/silk/enc_API.c
index beb46214d..f8060286d 100644
--- a/drivers/opus/silk/enc_API.c
+++ b/thirdparty/opus/silk/enc_API.c
@@ -24,18 +24,21 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/define.h"
-#include "opus/silk/API.h"
-#include "opus/silk/control.h"
-#include "opus/silk/typedef.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/structs.h"
-#include "opus/silk/tuning_parameters.h"
-#ifdef OPUS_FIXED_POINT
-#include "opus/silk/fixed/main_FIX.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "define.h"
+#include "API.h"
+#include "control.h"
+#include "typedef.h"
+#include "stack_alloc.h"
+#include "structs.h"
+#include "tuning_parameters.h"
+#ifdef FIXED_POINT
+#include "main_FIX.h"
#else
-#include "opus/silk/float/main_FLP.h"
+#include "main_FLP.h"
#endif
/***************************************/
diff --git a/drivers/opus/silk/encode_indices.c b/thirdparty/opus/silk/encode_indices.c
index 72fc6a80e..666c8c0b1 100644
--- a/drivers/opus/silk/encode_indices.c
+++ b/thirdparty/opus/silk/encode_indices.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Encode side-information parameters to payload */
void silk_encode_indices(
diff --git a/drivers/opus/silk/encode_pulses.c b/thirdparty/opus/silk/encode_pulses.c
index 238eec1e4..ab00264f9 100644
--- a/drivers/opus/silk/encode_pulses.c
+++ b/thirdparty/opus/silk/encode_pulses.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
/*********************************************/
/* Encode quantization indices of excitation */
diff --git a/drivers/opus/silk/errors.h b/thirdparty/opus/silk/errors.h
index 45070800f..45070800f 100644
--- a/drivers/opus/silk/errors.h
+++ b/thirdparty/opus/silk/errors.h
diff --git a/drivers/opus/silk/fixed/LTP_analysis_filter_FIX.c b/thirdparty/opus/silk/fixed/LTP_analysis_filter_FIX.c
index 041e85f0b..5574e7069 100644
--- a/drivers/opus/silk/fixed/LTP_analysis_filter_FIX.c
+++ b/thirdparty/opus/silk/fixed/LTP_analysis_filter_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
void silk_LTP_analysis_filter_FIX(
opus_int16 *LTP_res, /* O LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */
diff --git a/drivers/opus/silk/fixed/LTP_scale_ctrl_FIX.c b/thirdparty/opus/silk/fixed/LTP_scale_ctrl_FIX.c
index dac1fbc08..3dcedef89 100644
--- a/drivers/opus/silk/fixed/LTP_scale_ctrl_FIX.c
+++ b/thirdparty/opus/silk/fixed/LTP_scale_ctrl_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
/* Calculation of LTP state scaling */
void silk_LTP_scale_ctrl_FIX(
diff --git a/drivers/opus/silk/fixed/apply_sine_window_FIX.c b/thirdparty/opus/silk/fixed/apply_sine_window_FIX.c
index 9d63e7bce..4502b7130 100644
--- a/drivers/opus/silk/fixed/apply_sine_window_FIX.c
+++ b/thirdparty/opus/silk/fixed/apply_sine_window_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Apply sine window to signal vector. */
/* Window types: */
diff --git a/drivers/opus/silk/fixed/autocorr_FIX.c b/thirdparty/opus/silk/fixed/autocorr_FIX.c
index db39a0335..de95c9869 100644
--- a/drivers/opus/silk/fixed/autocorr_FIX.c
+++ b/thirdparty/opus/silk/fixed/autocorr_FIX.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/celt/celt_lpc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "celt_lpc.h"
/* Compute autocorrelation */
void silk_autocorr(
diff --git a/drivers/opus/silk/fixed/burg_modified_FIX.c b/thirdparty/opus/silk/fixed/burg_modified_FIX.c
index 48d64eccc..4878553b6 100644
--- a/drivers/opus/silk/fixed/burg_modified_FIX.c
+++ b/thirdparty/opus/silk/fixed/burg_modified_FIX.c
@@ -24,12 +24,15 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/define.h"
-#include "opus/silk/tuning_parameters.h"
-#include "opus/celt/pitch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "define.h"
+#include "tuning_parameters.h"
+#include "pitch.h"
#define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384 */
diff --git a/drivers/opus/silk/fixed/corrMatrix_FIX.c b/thirdparty/opus/silk/fixed/corrMatrix_FIX.c
index ac5331fe5..c1d437c78 100644
--- a/drivers/opus/silk/fixed/corrMatrix_FIX.c
+++ b/thirdparty/opus/silk/fixed/corrMatrix_FIX.c
@@ -24,13 +24,16 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/**********************************************************************
* Correlation Matrix Computations for LS estimate.
**********************************************************************/
-#include "opus/silk/fixed/main_FIX.h"
+#include "main_FIX.h"
/* Calculates correlation vector X'*t */
void silk_corrVector_FIX(
diff --git a/drivers/opus/silk/fixed/encode_frame_FIX.c b/thirdparty/opus/silk/fixed/encode_frame_FIX.c
index e4ead0afe..5ef44b03f 100644
--- a/drivers/opus/silk/fixed/encode_frame_FIX.c
+++ b/thirdparty/opus/silk/fixed/encode_frame_FIX.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
+#include "tuning_parameters.h"
/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */
static OPUS_INLINE void silk_LBRR_encode_FIX(
diff --git a/drivers/opus/silk/fixed/find_LPC_FIX.c b/thirdparty/opus/silk/fixed/find_LPC_FIX.c
index 5b56c4170..e11cdc86e 100644
--- a/drivers/opus/silk/fixed/find_LPC_FIX.c
+++ b/thirdparty/opus/silk/fixed/find_LPC_FIX.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
+#include "tuning_parameters.h"
/* Finds LPC vector from correlations, and converts to NLSF */
void silk_find_LPC_FIX(
diff --git a/drivers/opus/silk/fixed/find_LTP_FIX.c b/thirdparty/opus/silk/fixed/find_LTP_FIX.c
index a5a253516..1314a2813 100644
--- a/drivers/opus/silk/fixed/find_LTP_FIX.c
+++ b/thirdparty/opus/silk/fixed/find_LTP_FIX.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "tuning_parameters.h"
/* Head room for correlations */
#define LTP_CORRS_HEAD_ROOM 2
diff --git a/drivers/opus/silk/fixed/find_pitch_lags_FIX.c b/thirdparty/opus/silk/fixed/find_pitch_lags_FIX.c
index bfd2c1b2d..b8440a824 100644
--- a/drivers/opus/silk/fixed/find_pitch_lags_FIX.c
+++ b/thirdparty/opus/silk/fixed/find_pitch_lags_FIX.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
+#include "tuning_parameters.h"
/* Find pitch lags */
void silk_find_pitch_lags_FIX(
diff --git a/drivers/opus/silk/fixed/find_pred_coefs_FIX.c b/thirdparty/opus/silk/fixed/find_pred_coefs_FIX.c
index d0280963b..d308e9cf5 100644
--- a/drivers/opus/silk/fixed/find_pred_coefs_FIX.c
+++ b/thirdparty/opus/silk/fixed/find_pred_coefs_FIX.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
void silk_find_pred_coefs_FIX(
silk_encoder_state_FIX *psEnc, /* I/O encoder state */
diff --git a/drivers/opus/silk/fixed/k2a_FIX.c b/thirdparty/opus/silk/fixed/k2a_FIX.c
index 64771f370..5fee599bc 100644
--- a/drivers/opus/silk/fixed/k2a_FIX.c
+++ b/thirdparty/opus/silk/fixed/k2a_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Step up function, converts reflection coefficients to prediction coefficients */
void silk_k2a(
diff --git a/drivers/opus/silk/fixed/k2a_Q16_FIX.c b/thirdparty/opus/silk/fixed/k2a_Q16_FIX.c
index 49d90a862..3b0398754 100644
--- a/drivers/opus/silk/fixed/k2a_Q16_FIX.c
+++ b/thirdparty/opus/silk/fixed/k2a_Q16_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Step up function, converts reflection coefficients to prediction coefficients */
void silk_k2a_Q16(
diff --git a/drivers/opus/silk/fixed/main_FIX.h b/thirdparty/opus/silk/fixed/main_FIX.h
index f824c4765..375b5eb32 100644
--- a/drivers/opus/silk/fixed/main_FIX.h
+++ b/thirdparty/opus/silk/fixed/main_FIX.h
@@ -28,13 +28,13 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_MAIN_FIX_H
#define SILK_MAIN_FIX_H
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/fixed/structs_FIX.h"
-#include "opus/silk/control.h"
-#include "opus/silk/main.h"
-#include "opus/silk/PLC.h"
-#include "opus/silk/debug.h"
-#include "opus/celt/entenc.h"
+#include "SigProc_FIX.h"
+#include "structs_FIX.h"
+#include "control.h"
+#include "main.h"
+#include "PLC.h"
+#include "debug.h"
+#include "entenc.h"
#ifndef FORCE_CPP_BUILD
#ifdef __cplusplus
diff --git a/drivers/opus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h b/thirdparty/opus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h
index c30481e43..c30481e43 100644
--- a/drivers/opus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h
+++ b/thirdparty/opus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h
diff --git a/drivers/opus/silk/fixed/mips/prefilter_FIX_mipsr1.h b/thirdparty/opus/silk/fixed/mips/prefilter_FIX_mipsr1.h
index c7f04279a..21b256885 100644
--- a/drivers/opus/silk/fixed/mips/prefilter_FIX_mipsr1.h
+++ b/thirdparty/opus/silk/fixed/mips/prefilter_FIX_mipsr1.h
@@ -26,11 +26,14 @@ POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
#ifndef __PREFILTER_FIX_MIPSR1_H__
#define __PREFILTER_FIX_MIPSR1_H__
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
+#include "tuning_parameters.h"
#define OVERRIDE_silk_warped_LPC_analysis_filter_FIX
void silk_warped_LPC_analysis_filter_FIX(
diff --git a/drivers/opus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h b/thirdparty/opus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h
index eba7711db..e803ef0fc 100644
--- a/drivers/opus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h
+++ b/thirdparty/opus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h
@@ -27,9 +27,12 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef __WARPED_AUTOCORRELATION_FIX_MIPSR1_H__
#define __WARPED_AUTOCORRELATION_FIX_MIPSR1_H__
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
#undef QC
#define QC 10
diff --git a/drivers/opus/silk/fixed/noise_shape_analysis_FIX.c b/thirdparty/opus/silk/fixed/noise_shape_analysis_FIX.c
index 6f1dc3ddd..22a89f75a 100644
--- a/drivers/opus/silk/fixed/noise_shape_analysis_FIX.c
+++ b/thirdparty/opus/silk/fixed/noise_shape_analysis_FIX.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
+#include "tuning_parameters.h"
/* Compute gain to make warped filter coefficients have a zero mean log frequency response on a */
/* non-warped frequency scale. (So that it can be implemented with a minimum-phase monic filter.) */
@@ -136,7 +139,7 @@ static OPUS_INLINE void limit_warped_coefs(
}
#if defined(MIPSr1_ASM)
-#include "opus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h"
+#include "mips/noise_shape_analysis_FIX_mipsr1.h"
#endif
/**************************************************************/
diff --git a/drivers/opus/silk/fixed/pitch_analysis_core_FIX.c b/thirdparty/opus/silk/fixed/pitch_analysis_core_FIX.c
index cf421c961..01bb9fc0a 100644
--- a/drivers/opus/silk/fixed/pitch_analysis_core_FIX.c
+++ b/thirdparty/opus/silk/fixed/pitch_analysis_core_FIX.c
@@ -24,16 +24,19 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/***********************************************************
* Pitch analyser function
********************************************************** */
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/pitch_est_defines.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/debug.h"
-#include "opus/celt/pitch.h"
+#include "SigProc_FIX.h"
+#include "pitch_est_defines.h"
+#include "stack_alloc.h"
+#include "debug.h"
+#include "pitch.h"
#define SCRATCH_SIZE 22
#define SF_LENGTH_4KHZ ( PE_SUBFR_LENGTH_MS * 4 )
diff --git a/drivers/opus/silk/fixed/prefilter_FIX.c b/thirdparty/opus/silk/fixed/prefilter_FIX.c
index 344be2bad..6a8e35152 100644
--- a/drivers/opus/silk/fixed/prefilter_FIX.c
+++ b/thirdparty/opus/silk/fixed/prefilter_FIX.c
@@ -24,14 +24,17 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
+#include "tuning_parameters.h"
#if defined(MIPSr1_ASM)
-#include "opus/silk/fixed/mips/prefilter_FIX_mipsr1.h"
+#include "mips/prefilter_FIX_mipsr1.h"
#endif
diff --git a/drivers/opus/silk/fixed/process_gains_FIX.c b/thirdparty/opus/silk/fixed/process_gains_FIX.c
index c0d591210..05aba3178 100644
--- a/drivers/opus/silk/fixed/process_gains_FIX.c
+++ b/thirdparty/opus/silk/fixed/process_gains_FIX.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "tuning_parameters.h"
/* Processing of gains */
void silk_process_gains_FIX(
diff --git a/drivers/opus/silk/fixed/regularize_correlations_FIX.c b/thirdparty/opus/silk/fixed/regularize_correlations_FIX.c
index c38a5589b..a2836b05f 100644
--- a/drivers/opus/silk/fixed/regularize_correlations_FIX.c
+++ b/thirdparty/opus/silk/fixed/regularize_correlations_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
/* Add noise to matrix diagonal */
void silk_regularize_correlations_FIX(
diff --git a/drivers/opus/silk/fixed/residual_energy16_FIX.c b/thirdparty/opus/silk/fixed/residual_energy16_FIX.c
index 39bc96fd9..ebffb2a66 100644
--- a/drivers/opus/silk/fixed/residual_energy16_FIX.c
+++ b/thirdparty/opus/silk/fixed/residual_energy16_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
/* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */
opus_int32 silk_residual_energy16_covar_FIX(
diff --git a/drivers/opus/silk/fixed/residual_energy_FIX.c b/thirdparty/opus/silk/fixed/residual_energy_FIX.c
index 0e51f4baa..41f74778e 100644
--- a/drivers/opus/silk/fixed/residual_energy_FIX.c
+++ b/thirdparty/opus/silk/fixed/residual_energy_FIX.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
/* Calculates residual energies of input subframes where all subframes have LPC_order */
/* of preceding samples */
diff --git a/drivers/opus/silk/fixed/schur64_FIX.c b/thirdparty/opus/silk/fixed/schur64_FIX.c
index 69ef76e02..764a10ef3 100644
--- a/drivers/opus/silk/fixed/schur64_FIX.c
+++ b/thirdparty/opus/silk/fixed/schur64_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Slower than schur(), but more accurate. */
/* Uses SMULL(), available on armv4 */
diff --git a/drivers/opus/silk/fixed/schur_FIX.c b/thirdparty/opus/silk/fixed/schur_FIX.c
index 9effa59da..c4c0ef23b 100644
--- a/drivers/opus/silk/fixed/schur_FIX.c
+++ b/thirdparty/opus/silk/fixed/schur_FIX.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Faster than schur64(), but much less accurate. */
/* uses SMLAWB(), requiring armv5E and higher. */
diff --git a/drivers/opus/silk/fixed/solve_LS_FIX.c b/thirdparty/opus/silk/fixed/solve_LS_FIX.c
index 4ff97497b..51d7d49d0 100644
--- a/drivers/opus/silk/fixed/solve_LS_FIX.c
+++ b/thirdparty/opus/silk/fixed/solve_LS_FIX.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
-#include "opus/celt/stack_alloc.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
+#include "stack_alloc.h"
+#include "tuning_parameters.h"
/*****************************/
/* Internal function headers */
diff --git a/drivers/opus/silk/fixed/structs_FIX.h b/thirdparty/opus/silk/fixed/structs_FIX.h
index 36ddff0a9..3294b2512 100644
--- a/drivers/opus/silk/fixed/structs_FIX.h
+++ b/thirdparty/opus/silk/fixed/structs_FIX.h
@@ -28,9 +28,9 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_STRUCTS_FIX_H
#define SILK_STRUCTS_FIX_H
-#include "opus/silk/typedef.h"
-#include "opus/silk/main.h"
-#include "opus/silk/structs.h"
+#include "typedef.h"
+#include "main.h"
+#include "structs.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/fixed/vector_ops_FIX.c b/thirdparty/opus/silk/fixed/vector_ops_FIX.c
index 1e8fdec0c..d94980014 100644
--- a/drivers/opus/silk/fixed/vector_ops_FIX.c
+++ b/thirdparty/opus/silk/fixed/vector_ops_FIX.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/celt/pitch.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "pitch.h"
/* Copy and multiply a vector by a constant */
void silk_scale_copy_vector16(
@@ -72,7 +75,7 @@ opus_int32 silk_inner_prod_aligned(
int arch /* I Run-time architecture */
)
{
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
return celt_inner_prod(inVec1, inVec2, len, arch);
#else
opus_int i;
diff --git a/drivers/opus/silk/fixed/warped_autocorrelation_FIX.c b/thirdparty/opus/silk/fixed/warped_autocorrelation_FIX.c
index 3b8d52d5c..6ca6c1184 100644
--- a/drivers/opus/silk/fixed/warped_autocorrelation_FIX.c
+++ b/thirdparty/opus/silk/fixed/warped_autocorrelation_FIX.c
@@ -24,15 +24,18 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/fixed/main_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FIX.h"
#define QC 10
#define QS 14
#if defined(MIPSr1_ASM)
-#include "opus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h"
+#include "mips/warped_autocorrelation_FIX_mipsr1.h"
#endif
diff --git a/drivers/opus/silk/fixed/x86/burg_modified_FIX_sse.c b/thirdparty/opus/silk/fixed/x86/burg_modified_FIX_sse.c
index f7d46487d..3756095fb 100644
--- a/drivers/opus/silk/fixed/x86/burg_modified_FIX_sse.c
+++ b/thirdparty/opus/silk/fixed/x86/burg_modified_FIX_sse.c
@@ -24,17 +24,20 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/define.h"
-#include "opus/silk/tuning_parameters.h"
-#include "opus/celt/pitch.h"
-#include "opus/celt/x86/x86cpu.h"
+#include "SigProc_FIX.h"
+#include "define.h"
+#include "tuning_parameters.h"
+#include "pitch.h"
+#include "celt/x86/x86cpu.h"
#define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384 */
diff --git a/drivers/opus/silk/fixed/x86/prefilter_FIX_sse.c b/thirdparty/opus/silk/fixed/x86/prefilter_FIX_sse.c
index febb10564..488a603f5 100644
--- a/drivers/opus/silk/fixed/x86/prefilter_FIX_sse.c
+++ b/thirdparty/opus/silk/fixed/x86/prefilter_FIX_sse.c
@@ -24,13 +24,16 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
-#include "opus/silk/main.h"
-#include "opus/celt/x86/x86cpu.h"
+#include "main.h"
+#include "celt/x86/x86cpu.h"
void silk_warped_LPC_analysis_filter_FIX_sse4_1(
opus_int32 state[], /* I/O State [order + 1] */
diff --git a/drivers/opus/silk/fixed/x86/vector_ops_FIX_sse.c b/thirdparty/opus/silk/fixed/x86/vector_ops_FIX_sse.c
index 920d58ceb..c1e90564d 100644
--- a/drivers/opus/silk/fixed/x86/vector_ops_FIX_sse.c
+++ b/thirdparty/opus/silk/fixed/x86/vector_ops_FIX_sse.c
@@ -24,15 +24,18 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
-#include "opus/silk/main.h"
+#include "main.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/celt/pitch.h"
+#include "SigProc_FIX.h"
+#include "pitch.h"
opus_int64 silk_inner_prod16_aligned_64_sse4_1(
const opus_int16 *inVec1, /* I input vector 1 */
diff --git a/drivers/opus/silk/float/LPC_analysis_filter_FLP.c b/thirdparty/opus/silk/float/LPC_analysis_filter_FLP.c
index 344e52ade..cae89a0a1 100644
--- a/drivers/opus/silk/float/LPC_analysis_filter_FLP.c
+++ b/thirdparty/opus/silk/float/LPC_analysis_filter_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
-#include "opus/silk/float/main_FLP.h"
+#include "main_FLP.h"
/************************************************/
/* LPC analysis filter */
diff --git a/drivers/opus/silk/float/LPC_inv_pred_gain_FLP.c b/thirdparty/opus/silk/float/LPC_inv_pred_gain_FLP.c
index f99a42762..25178bacd 100644
--- a/drivers/opus/silk/float/LPC_inv_pred_gain_FLP.c
+++ b/thirdparty/opus/silk/float/LPC_inv_pred_gain_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "SigProc_FLP.h"
#define RC_THRESHOLD 0.9999f
diff --git a/drivers/opus/silk/float/LTP_analysis_filter_FLP.c b/thirdparty/opus/silk/float/LTP_analysis_filter_FLP.c
index 853040d16..849b7c1c5 100644
--- a/drivers/opus/silk/float/LTP_analysis_filter_FLP.c
+++ b/thirdparty/opus/silk/float/LTP_analysis_filter_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
void silk_LTP_analysis_filter_FLP(
silk_float *LTP_res, /* O LTP res MAX_NB_SUBFR*(pre_lgth+subfr_lngth) */
diff --git a/drivers/opus/silk/float/LTP_scale_ctrl_FLP.c b/thirdparty/opus/silk/float/LTP_scale_ctrl_FLP.c
index 4219c14c5..8dbe29d0f 100644
--- a/drivers/opus/silk/float/LTP_scale_ctrl_FLP.c
+++ b/thirdparty/opus/silk/float/LTP_scale_ctrl_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
void silk_LTP_scale_ctrl_FLP(
silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
diff --git a/drivers/opus/silk/float/SigProc_FLP.h b/thirdparty/opus/silk/float/SigProc_FLP.h
index 9b14f24f2..f0cb3733b 100644
--- a/drivers/opus/silk/float/SigProc_FLP.h
+++ b/thirdparty/opus/silk/float/SigProc_FLP.h
@@ -28,8 +28,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_SIGPROC_FLP_H
#define SILK_SIGPROC_FLP_H
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/celt/float_cast.h"
+#include "SigProc_FIX.h"
+#include "float_cast.h"
#include <math.h>
#ifdef __cplusplus
diff --git a/drivers/opus/silk/float/apply_sine_window_FLP.c b/thirdparty/opus/silk/float/apply_sine_window_FLP.c
index 0d9c894cd..6aae57c0a 100644
--- a/drivers/opus/silk/float/apply_sine_window_FLP.c
+++ b/thirdparty/opus/silk/float/apply_sine_window_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
/* Apply sine window to signal vector */
/* Window types: */
diff --git a/drivers/opus/silk/float/autocorrelation_FLP.c b/thirdparty/opus/silk/float/autocorrelation_FLP.c
index 0b78b0230..8b8a9e659 100644
--- a/drivers/opus/silk/float/autocorrelation_FLP.c
+++ b/thirdparty/opus/silk/float/autocorrelation_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/typedef.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "typedef.h"
+#include "SigProc_FLP.h"
/* compute autocorrelation */
void silk_autocorrelation_FLP(
diff --git a/drivers/opus/silk/float/burg_modified_FLP.c b/thirdparty/opus/silk/float/burg_modified_FLP.c
index 567990b85..ea5dc25a9 100644
--- a/drivers/opus/silk/float/burg_modified_FLP.c
+++ b/thirdparty/opus/silk/float/burg_modified_FLP.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
-#include "opus/silk/tuning_parameters.h"
-#include "opus/silk/define.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
+#include "tuning_parameters.h"
+#include "define.h"
#define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384*/
diff --git a/drivers/opus/silk/float/bwexpander_FLP.c b/thirdparty/opus/silk/float/bwexpander_FLP.c
index c47bfa943..d55a4d79a 100644
--- a/drivers/opus/silk/float/bwexpander_FLP.c
+++ b/thirdparty/opus/silk/float/bwexpander_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
/* Chirp (bw expand) LP AR filter */
void silk_bwexpander_FLP(
diff --git a/drivers/opus/silk/float/corrMatrix_FLP.c b/thirdparty/opus/silk/float/corrMatrix_FLP.c
index e34b42b54..eae6a1cfc 100644
--- a/drivers/opus/silk/float/corrMatrix_FLP.c
+++ b/thirdparty/opus/silk/float/corrMatrix_FLP.c
@@ -24,13 +24,16 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/**********************************************************************
* Correlation matrix computations for LS estimate.
**********************************************************************/
-#include "opus/silk/float/main_FLP.h"
+#include "main_FLP.h"
/* Calculates correlation vector X'*t */
void silk_corrVector_FLP(
diff --git a/drivers/opus/silk/float/encode_frame_FLP.c b/thirdparty/opus/silk/float/encode_frame_FLP.c
index 4e46a52ee..2092a4d9e 100644
--- a/drivers/opus/silk/float/encode_frame_FLP.c
+++ b/thirdparty/opus/silk/float/encode_frame_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
+#include "tuning_parameters.h"
/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */
static OPUS_INLINE void silk_LBRR_encode_FLP(
diff --git a/drivers/opus/silk/float/energy_FLP.c b/thirdparty/opus/silk/float/energy_FLP.c
index 443f52bb1..24b8179f9 100644
--- a/drivers/opus/silk/float/energy_FLP.c
+++ b/thirdparty/opus/silk/float/energy_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
/* sum of squares of a silk_float array, with result as double */
double silk_energy_FLP(
diff --git a/drivers/opus/silk/float/find_LPC_FLP.c b/thirdparty/opus/silk/float/find_LPC_FLP.c
index 162a490d1..fcfe1c368 100644
--- a/drivers/opus/silk/float/find_LPC_FLP.c
+++ b/thirdparty/opus/silk/float/find_LPC_FLP.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/define.h"
-#include "opus/silk/float/main_FLP.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "define.h"
+#include "main_FLP.h"
+#include "tuning_parameters.h"
/* LPC analysis */
void silk_find_LPC_FLP(
diff --git a/drivers/opus/silk/float/find_LTP_FLP.c b/thirdparty/opus/silk/float/find_LTP_FLP.c
index 9c03eeb6a..722999601 100644
--- a/drivers/opus/silk/float/find_LTP_FLP.c
+++ b/thirdparty/opus/silk/float/find_LTP_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
+#include "tuning_parameters.h"
void silk_find_LTP_FLP(
silk_float b[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */
diff --git a/drivers/opus/silk/float/find_pitch_lags_FLP.c b/thirdparty/opus/silk/float/find_pitch_lags_FLP.c
index bb7ef8ec2..f3b22d25c 100644
--- a/drivers/opus/silk/float/find_pitch_lags_FLP.c
+++ b/thirdparty/opus/silk/float/find_pitch_lags_FLP.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
-#include "opus/silk/float/main_FLP.h"
-#include "opus/silk/tuning_parameters.h"
+#include "main_FLP.h"
+#include "tuning_parameters.h"
void silk_find_pitch_lags_FLP(
silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
diff --git a/drivers/opus/silk/float/find_pred_coefs_FLP.c b/thirdparty/opus/silk/float/find_pred_coefs_FLP.c
index c0496ff1b..1af4fe5f1 100644
--- a/drivers/opus/silk/float/find_pred_coefs_FLP.c
+++ b/thirdparty/opus/silk/float/find_pred_coefs_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
/* Find LPC and LTP coefficients */
void silk_find_pred_coefs_FLP(
diff --git a/drivers/opus/silk/float/inner_product_FLP.c b/thirdparty/opus/silk/float/inner_product_FLP.c
index 0586c4d7f..029c01291 100644
--- a/drivers/opus/silk/float/inner_product_FLP.c
+++ b/thirdparty/opus/silk/float/inner_product_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
/* inner product of two silk_float arrays, with result as double */
double silk_inner_product_FLP(
diff --git a/drivers/opus/silk/float/k2a_FLP.c b/thirdparty/opus/silk/float/k2a_FLP.c
index 26ba94e61..12af4e766 100644
--- a/drivers/opus/silk/float/k2a_FLP.c
+++ b/thirdparty/opus/silk/float/k2a_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
/* step up function, converts reflection coefficients to prediction coefficients */
void silk_k2a_FLP(
diff --git a/drivers/opus/silk/float/levinsondurbin_FLP.c b/thirdparty/opus/silk/float/levinsondurbin_FLP.c
index 7e3c9d653..f0ba60698 100644
--- a/drivers/opus/silk/float/levinsondurbin_FLP.c
+++ b/thirdparty/opus/silk/float/levinsondurbin_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
/* Solve the normal equations using the Levinson-Durbin recursion */
silk_float silk_levinsondurbin_FLP( /* O prediction error energy */
diff --git a/drivers/opus/silk/float/main_FLP.h b/thirdparty/opus/silk/float/main_FLP.h
index 8f3517754..e5a75972e 100644
--- a/drivers/opus/silk/float/main_FLP.h
+++ b/thirdparty/opus/silk/float/main_FLP.h
@@ -28,13 +28,13 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_MAIN_FLP_H
#define SILK_MAIN_FLP_H
-#include "opus/silk/float/SigProc_FLP.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/float/structs_FLP.h"
-#include "opus/silk/main.h"
-#include "opus/silk/define.h"
-#include "opus/silk/debug.h"
-#include "opus/celt/entenc.h"
+#include "SigProc_FLP.h"
+#include "SigProc_FIX.h"
+#include "structs_FLP.h"
+#include "main.h"
+#include "define.h"
+#include "debug.h"
+#include "entenc.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/float/noise_shape_analysis_FLP.c b/thirdparty/opus/silk/float/noise_shape_analysis_FLP.c
index cbb8ba447..65f6ea587 100644
--- a/drivers/opus/silk/float/noise_shape_analysis_FLP.c
+++ b/thirdparty/opus/silk/float/noise_shape_analysis_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
+#include "tuning_parameters.h"
/* Compute gain to make warped filter coefficients have a zero mean log frequency response on a */
/* non-warped frequency scale. (So that it can be implemented with a minimum-phase monic filter.) */
diff --git a/drivers/opus/silk/float/pitch_analysis_core_FLP.c b/thirdparty/opus/silk/float/pitch_analysis_core_FLP.c
index 6a48ae498..d0e637a29 100644
--- a/drivers/opus/silk/float/pitch_analysis_core_FLP.c
+++ b/thirdparty/opus/silk/float/pitch_analysis_core_FLP.c
@@ -24,15 +24,18 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/*****************************************************************************
* Pitch analyser function
******************************************************************************/
-#include "opus/silk/float/SigProc_FLP.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/pitch_est_defines.h"
-#include "opus/celt/pitch.h"
+#include "SigProc_FLP.h"
+#include "SigProc_FIX.h"
+#include "pitch_est_defines.h"
+#include "pitch.h"
#define SCRATCH_SIZE 22
diff --git a/drivers/opus/silk/float/prefilter_FLP.c b/thirdparty/opus/silk/float/prefilter_FLP.c
index 0857888b9..8bc32fb41 100644
--- a/drivers/opus/silk/float/prefilter_FLP.c
+++ b/thirdparty/opus/silk/float/prefilter_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
+#include "tuning_parameters.h"
/*
* Prefilter for finding Quantizer input signal
diff --git a/drivers/opus/silk/float/process_gains_FLP.c b/thirdparty/opus/silk/float/process_gains_FLP.c
index 3a1e46f09..c0da0dae4 100644
--- a/drivers/opus/silk/float/process_gains_FLP.c
+++ b/thirdparty/opus/silk/float/process_gains_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
+#include "tuning_parameters.h"
/* Processing of gains */
void silk_process_gains_FLP(
diff --git a/drivers/opus/silk/float/regularize_correlations_FLP.c b/thirdparty/opus/silk/float/regularize_correlations_FLP.c
index 20e9074a0..df4612604 100644
--- a/drivers/opus/silk/float/regularize_correlations_FLP.c
+++ b/thirdparty/opus/silk/float/regularize_correlations_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
/* Add noise to matrix diagonal */
void silk_regularize_correlations_FLP(
diff --git a/drivers/opus/silk/float/residual_energy_FLP.c b/thirdparty/opus/silk/float/residual_energy_FLP.c
index cc462a9e5..b2e03a86a 100644
--- a/drivers/opus/silk/float/residual_energy_FLP.c
+++ b/thirdparty/opus/silk/float/residual_energy_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
#define MAX_ITERATIONS_RESIDUAL_NRG 10
#define REGULARIZATION_FACTOR 1e-8f
diff --git a/drivers/opus/silk/float/scale_copy_vector_FLP.c b/thirdparty/opus/silk/float/scale_copy_vector_FLP.c
index 2656963e8..20db32b3b 100644
--- a/drivers/opus/silk/float/scale_copy_vector_FLP.c
+++ b/thirdparty/opus/silk/float/scale_copy_vector_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
/* copy and multiply a vector by a constant */
void silk_scale_copy_vector_FLP(
diff --git a/drivers/opus/silk/float/scale_vector_FLP.c b/thirdparty/opus/silk/float/scale_vector_FLP.c
index ea2aa0e33..108fdcbed 100644
--- a/drivers/opus/silk/float/scale_vector_FLP.c
+++ b/thirdparty/opus/silk/float/scale_vector_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
/* multiply a vector by a constant */
void silk_scale_vector_FLP(
diff --git a/drivers/opus/silk/float/schur_FLP.c b/thirdparty/opus/silk/float/schur_FLP.c
index f2071db21..ee436f835 100644
--- a/drivers/opus/silk/float/schur_FLP.c
+++ b/thirdparty/opus/silk/float/schur_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FLP.h"
silk_float silk_schur_FLP( /* O returns residual energy */
silk_float refl_coef[], /* O reflection coefficients (length order) */
diff --git a/drivers/opus/silk/float/solve_LS_FLP.c b/thirdparty/opus/silk/float/solve_LS_FLP.c
index 9d625c695..7c90d665a 100644
--- a/drivers/opus/silk/float/solve_LS_FLP.c
+++ b/thirdparty/opus/silk/float/solve_LS_FLP.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
+#include "tuning_parameters.h"
/**********************************************************************
* LDL Factorisation. Finds the upper triangular matrix L and the diagonal
diff --git a/drivers/opus/silk/float/sort_FLP.c b/thirdparty/opus/silk/float/sort_FLP.c
index ed212c63c..f08d7592c 100644
--- a/drivers/opus/silk/float/sort_FLP.c
+++ b/thirdparty/opus/silk/float/sort_FLP.c
@@ -24,14 +24,17 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/* Insertion sort (fast for already almost sorted arrays): */
/* Best case: O(n) for an already sorted array */
/* Worst case: O(n^2) for an inversely sorted array */
-#include "opus/silk/typedef.h"
-#include "opus/silk/float/SigProc_FLP.h"
+#include "typedef.h"
+#include "SigProc_FLP.h"
void silk_insertion_sort_decreasing_FLP(
silk_float *a, /* I/O Unsorted / Sorted vector */
diff --git a/drivers/opus/silk/float/structs_FLP.h b/thirdparty/opus/silk/float/structs_FLP.h
index 9eb5eb05e..14d647ced 100644
--- a/drivers/opus/silk/float/structs_FLP.h
+++ b/thirdparty/opus/silk/float/structs_FLP.h
@@ -28,9 +28,9 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_STRUCTS_FLP_H
#define SILK_STRUCTS_FLP_H
-#include "opus/silk/typedef.h"
-#include "opus/silk/main.h"
-#include "opus/silk/structs.h"
+#include "typedef.h"
+#include "main.h"
+#include "structs.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/float/warped_autocorrelation_FLP.c b/thirdparty/opus/silk/float/warped_autocorrelation_FLP.c
index b814661b9..542414f48 100644
--- a/drivers/opus/silk/float/warped_autocorrelation_FLP.c
+++ b/thirdparty/opus/silk/float/warped_autocorrelation_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
/* Autocorrelations for a warped frequency axis */
void silk_warped_autocorrelation_FLP(
diff --git a/drivers/opus/silk/float/wrappers_FLP.c b/thirdparty/opus/silk/float/wrappers_FLP.c
index c80c618a9..6666b8efa 100644
--- a/drivers/opus/silk/float/wrappers_FLP.c
+++ b/thirdparty/opus/silk/float/wrappers_FLP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/float/main_FLP.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main_FLP.h"
/* Wrappers. Calls flp / fix code */
diff --git a/drivers/opus/silk/gain_quant.c b/thirdparty/opus/silk/gain_quant.c
index 7b7a65d67..64ccd0611 100644
--- a/drivers/opus/silk/gain_quant.c
+++ b/thirdparty/opus/silk/gain_quant.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
#define OFFSET ( ( MIN_QGAIN_DB * 128 ) / 6 + 16 * 128 )
#define SCALE_Q16 ( ( 65536 * ( N_LEVELS_QGAIN - 1 ) ) / ( ( ( MAX_QGAIN_DB - MIN_QGAIN_DB ) * 128 ) / 6 ) )
diff --git a/drivers/opus/silk/init_decoder.c b/thirdparty/opus/silk/init_decoder.c
index c8f694c9d..f887c6788 100644
--- a/drivers/opus/silk/init_decoder.c
+++ b/thirdparty/opus/silk/init_decoder.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/************************/
/* Init Decoder State */
diff --git a/drivers/opus/silk/init_encoder.c b/thirdparty/opus/silk/init_encoder.c
index 1c63edb4b..65995c33f 100644
--- a/drivers/opus/silk/init_encoder.c
+++ b/thirdparty/opus/silk/init_encoder.c
@@ -24,14 +24,17 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#ifdef OPUS_FIXED_POINT
-#include "opus/silk/fixed/main_FIX.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef FIXED_POINT
+#include "main_FIX.h"
#else
-#include "opus/silk/float/main_FLP.h"
+#include "main_FLP.h"
#endif
-#include "opus/silk/tuning_parameters.h"
-#include "opus/celt/cpu_support.h"
+#include "tuning_parameters.h"
+#include "cpu_support.h"
/*********************************/
/* Initialize Silk Encoder state */
diff --git a/drivers/opus/silk/inner_prod_aligned.c b/thirdparty/opus/silk/inner_prod_aligned.c
index 7bd7297c7..257ae9e04 100644
--- a/drivers/opus/silk/inner_prod_aligned.c
+++ b/thirdparty/opus/silk/inner_prod_aligned.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
opus_int32 silk_inner_prod_aligned_scale(
const opus_int16 *const inVec1, /* I input vector 1 */
diff --git a/drivers/opus/silk/interpolate.c b/thirdparty/opus/silk/interpolate.c
index 25091b4fa..1bd8ca4d5 100644
--- a/drivers/opus/silk/interpolate.c
+++ b/thirdparty/opus/silk/interpolate.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Interpolate two vectors */
void silk_interpolate(
diff --git a/drivers/opus/silk/lin2log.c b/thirdparty/opus/silk/lin2log.c
index 694eb1e87..d4fe51532 100644
--- a/drivers/opus/silk/lin2log.c
+++ b/thirdparty/opus/silk/lin2log.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Approximation of 128 * log2() (very close inverse of silk_log2lin()) */
/* Convert input to a log scale */
opus_int32 silk_lin2log(
diff --git a/drivers/opus/silk/log2lin.c b/thirdparty/opus/silk/log2lin.c
index 8d14150a4..b7c48e474 100644
--- a/drivers/opus/silk/log2lin.c
+++ b/thirdparty/opus/silk/log2lin.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Approximation of 2^() (very close inverse of silk_lin2log()) */
/* Convert input to a linear scale */
diff --git a/drivers/opus/silk/macros.h b/thirdparty/opus/silk/macros.h
index 29efd11ac..bc3030346 100644
--- a/drivers/opus/silk/macros.h
+++ b/thirdparty/opus/silk/macros.h
@@ -27,10 +27,13 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_MACROS_H
#define SILK_MACROS_H
-#include "opus/opus_config.h"
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "opus_types.h"
+#include "opus_defines.h"
#if OPUS_GNUC_PREREQ(3, 0)
#define opus_likely(x) (__builtin_expect(!!(x), 1))
@@ -108,10 +111,10 @@ POSSIBILITY OF SUCH DAMAGE.
((((a)^0x80000000) & (b) & 0x80000000) ? silk_int32_MAX : (a)-(b)) )
#if defined(MIPSr1_ASM)
-#include "opus/silk/mips/macros_mipsr1.h"
+#include "mips/macros_mipsr1.h"
#endif
-#include "opus/celt/ecintrin.h"
+#include "ecintrin.h"
#ifndef OVERRIDE_silk_CLZ16
static OPUS_INLINE opus_int32 silk_CLZ16(opus_int16 in16)
{
@@ -139,11 +142,11 @@ static OPUS_INLINE opus_int32 silk_CLZ32(opus_int32 in32)
#endif
#ifdef OPUS_ARM_INLINE_ASM
-#include "opus/silk/arm/macros_armv4.h"
+#include "arm/macros_armv4.h"
#endif
#ifdef OPUS_ARM_INLINE_EDSP
-#include "opus/silk/arm/macros_armv5e.h"
+#include "arm/macros_armv5e.h"
#endif
#endif /* SILK_MACROS_H */
diff --git a/drivers/opus/silk/main.h b/thirdparty/opus/silk/main.h
index a6ec2d7e4..2f90d68f7 100644
--- a/drivers/opus/silk/main.h
+++ b/thirdparty/opus/silk/main.h
@@ -28,18 +28,18 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_MAIN_H
#define SILK_MAIN_H
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/define.h"
-#include "opus/silk/structs.h"
-#include "opus/silk/tables.h"
-#include "opus/silk/PLC.h"
-#include "opus/silk/control.h"
-#include "opus/silk/debug.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
+#include "SigProc_FIX.h"
+#include "define.h"
+#include "structs.h"
+#include "tables.h"
+#include "PLC.h"
+#include "control.h"
+#include "debug.h"
+#include "entenc.h"
+#include "entdec.h"
#if defined(OPUS_X86_MAY_HAVE_SSE4_1)
-#include "opus/silk/x86/main_sse.h"
+#include "x86/main_sse.h"
#endif
/* Convert Left/Right stereo signal to adaptive Mid/Side representation */
diff --git a/drivers/opus/silk/mips/NSQ_del_dec_mipsr1.h b/thirdparty/opus/silk/mips/NSQ_del_dec_mipsr1.h
index 5cecca28b..f6afd923e 100644
--- a/drivers/opus/silk/mips/NSQ_del_dec_mipsr1.h
+++ b/thirdparty/opus/silk/mips/NSQ_del_dec_mipsr1.h
@@ -27,10 +27,13 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef __NSQ_DEL_DEC_MIPSR1_H__
#define __NSQ_DEL_DEC_MIPSR1_H__
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
#define OVERRIDE_silk_noise_shape_quantizer_del_dec
static inline void silk_noise_shape_quantizer_del_dec(
diff --git a/drivers/opus/silk/mips/macros_mipsr1.h b/thirdparty/opus/silk/mips/macros_mipsr1.h
index 12ed981a6..12ed981a6 100644
--- a/drivers/opus/silk/mips/macros_mipsr1.h
+++ b/thirdparty/opus/silk/mips/macros_mipsr1.h
diff --git a/drivers/opus/silk/mips/sigproc_fix_mipsr1.h b/thirdparty/opus/silk/mips/sigproc_fix_mipsr1.h
index 3b0a69536..3b0a69536 100644
--- a/drivers/opus/silk/mips/sigproc_fix_mipsr1.h
+++ b/thirdparty/opus/silk/mips/sigproc_fix_mipsr1.h
diff --git a/drivers/opus/silk/pitch_est_defines.h b/thirdparty/opus/silk/pitch_est_defines.h
index e2d9e517c..e1e4b5d76 100644
--- a/drivers/opus/silk/pitch_est_defines.h
+++ b/thirdparty/opus/silk/pitch_est_defines.h
@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_PE_DEFINES_H
#define SILK_PE_DEFINES_H
-#include "opus/silk/SigProc_FIX.h"
+#include "SigProc_FIX.h"
/********************************************************/
/* Definitions for pitch estimator */
diff --git a/drivers/opus/silk/pitch_est_tables.c b/thirdparty/opus/silk/pitch_est_tables.c
index eb17bf0b2..81a8bacac 100644
--- a/drivers/opus/silk/pitch_est_tables.c
+++ b/thirdparty/opus/silk/pitch_est_tables.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/typedef.h"
-#include "opus/silk/pitch_est_defines.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "typedef.h"
+#include "pitch_est_defines.h"
const opus_int8 silk_CB_lags_stage2_10_ms[ PE_MAX_NB_SUBFR >> 1][ PE_NB_CBKS_STAGE2_10MS ] =
{
diff --git a/drivers/opus/silk/process_NLSFs.c b/thirdparty/opus/silk/process_NLSFs.c
index 9d8f96d7b..c27cf0304 100644
--- a/drivers/opus/silk/process_NLSFs.c
+++ b/thirdparty/opus/silk/process_NLSFs.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Limit, stabilize, convert and quantize NLSFs */
void silk_process_NLSFs(
diff --git a/drivers/opus/silk/quant_LTP_gains.c b/thirdparty/opus/silk/quant_LTP_gains.c
index ffc3cb24a..513a8c446 100644
--- a/drivers/opus/silk/quant_LTP_gains.c
+++ b/thirdparty/opus/silk/quant_LTP_gains.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/silk/tuning_parameters.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "tuning_parameters.h"
void silk_quant_LTP_gains(
opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */
diff --git a/drivers/opus/silk/resampler.c b/thirdparty/opus/silk/resampler.c
index 12b2f9206..374fbb372 100644
--- a/drivers/opus/silk/resampler.c
+++ b/thirdparty/opus/silk/resampler.c
@@ -24,7 +24,10 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/*
* Matrix of resampling methods used:
@@ -44,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
* AF -> AR2 filter followed by FIR interpolation
*/
-#include "opus/silk/resampler_private.h"
+#include "resampler_private.h"
/* Tables with delay compensation values to equalize total delay for different modes */
static const opus_int8 delay_matrix_enc[ 5 ][ 3 ] = {
diff --git a/drivers/opus/silk/resampler_down2.c b/thirdparty/opus/silk/resampler_down2.c
index 20a42c98a..cec363464 100644
--- a/drivers/opus/silk/resampler_down2.c
+++ b/thirdparty/opus/silk/resampler_down2.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/resampler_rom.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "resampler_rom.h"
/* Downsample by a factor 2 */
void silk_resampler_down2(
diff --git a/drivers/opus/silk/resampler_down2_3.c b/thirdparty/opus/silk/resampler_down2_3.c
index e01dd2bc7..4342614dc 100644
--- a/drivers/opus/silk/resampler_down2_3.c
+++ b/thirdparty/opus/silk/resampler_down2_3.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/resampler_private.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "resampler_private.h"
+#include "stack_alloc.h"
#define ORDER_FIR 4
diff --git a/drivers/opus/silk/resampler_private.h b/thirdparty/opus/silk/resampler_private.h
index 5c0ee110f..422a7d9d9 100644
--- a/drivers/opus/silk/resampler_private.h
+++ b/thirdparty/opus/silk/resampler_private.h
@@ -32,9 +32,9 @@ POSSIBILITY OF SUCH DAMAGE.
extern "C" {
#endif
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/resampler_structs.h"
-#include "opus/silk/resampler_rom.h"
+#include "SigProc_FIX.h"
+#include "resampler_structs.h"
+#include "resampler_rom.h"
/* Number of input samples to process in the inner loop */
#define RESAMPLER_MAX_BATCH_SIZE_MS 10
diff --git a/drivers/opus/silk/resampler_private_AR2.c b/thirdparty/opus/silk/resampler_private_AR2.c
index cc753ea70..5fff23714 100644
--- a/drivers/opus/silk/resampler_private_AR2.c
+++ b/thirdparty/opus/silk/resampler_private_AR2.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/resampler_private.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "resampler_private.h"
/* Second order AR filter with single delay elements */
void silk_resampler_private_AR2(
diff --git a/drivers/opus/silk/resampler_private_IIR_FIR.c b/thirdparty/opus/silk/resampler_private_IIR_FIR.c
index 9a8733fbb..6b2b3a2e1 100644
--- a/drivers/opus/silk/resampler_private_IIR_FIR.c
+++ b/thirdparty/opus/silk/resampler_private_IIR_FIR.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/resampler_private.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "resampler_private.h"
+#include "stack_alloc.h"
static OPUS_INLINE opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL(
opus_int16 *out,
diff --git a/drivers/opus/silk/resampler_private_down_FIR.c b/thirdparty/opus/silk/resampler_private_down_FIR.c
index fb9acc60a..783e42b35 100644
--- a/drivers/opus/silk/resampler_private_down_FIR.c
+++ b/thirdparty/opus/silk/resampler_private_down_FIR.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/resampler_private.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "resampler_private.h"
+#include "stack_alloc.h"
static OPUS_INLINE opus_int16 *silk_resampler_private_down_FIR_INTERPOL(
opus_int16 *out,
diff --git a/drivers/opus/silk/resampler_private_up2_HQ.c b/thirdparty/opus/silk/resampler_private_up2_HQ.c
index 0b23c16da..c7ec8de36 100644
--- a/drivers/opus/silk/resampler_private_up2_HQ.c
+++ b/thirdparty/opus/silk/resampler_private_up2_HQ.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/resampler_private.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
+#include "resampler_private.h"
/* Upsample by a factor 2, high quality */
/* Uses 2nd order allpass filters for the 2x upsampling, followed by a */
diff --git a/drivers/opus/silk/resampler_rom.c b/thirdparty/opus/silk/resampler_rom.c
index 7079efe1d..5e6b04476 100644
--- a/drivers/opus/silk/resampler_rom.c
+++ b/thirdparty/opus/silk/resampler_rom.c
@@ -24,12 +24,15 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/* Filter coefficients for IIR/FIR polyphase resampling *
* Total size: 179 Words (358 Bytes) */
-#include "opus/silk/resampler_private.h"
+#include "resampler_private.h"
/* Matlab code for the notch filter coefficients: */
/* B = [1, 0.147, 1]; A = [1, 0.107, 0.89]; G = 0.93; freqz(G * B, A, 2^14, 16e3); axis([0, 8000, -10, 1]) */
diff --git a/drivers/opus/silk/resampler_rom.h b/thirdparty/opus/silk/resampler_rom.h
index 2fa586ebf..490b3388d 100644
--- a/drivers/opus/silk/resampler_rom.h
+++ b/thirdparty/opus/silk/resampler_rom.h
@@ -33,8 +33,8 @@ extern "C"
{
#endif
-#include "opus/silk/typedef.h"
-#include "opus/silk/resampler_structs.h"
+#include "typedef.h"
+#include "resampler_structs.h"
#define RESAMPLER_DOWN_ORDER_FIR0 18
#define RESAMPLER_DOWN_ORDER_FIR1 24
diff --git a/drivers/opus/silk/resampler_structs.h b/thirdparty/opus/silk/resampler_structs.h
index 9e9457d11..9e9457d11 100644
--- a/drivers/opus/silk/resampler_structs.h
+++ b/thirdparty/opus/silk/resampler_structs.h
diff --git a/drivers/opus/silk/shell_coder.c b/thirdparty/opus/silk/shell_coder.c
index 67a544692..4af341474 100644
--- a/drivers/opus/silk/shell_coder.c
+++ b/thirdparty/opus/silk/shell_coder.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* shell coder; pulse-subframe length is hardcoded */
diff --git a/drivers/opus/silk/sigm_Q15.c b/thirdparty/opus/silk/sigm_Q15.c
index 3171d15f4..3c507d255 100644
--- a/drivers/opus/silk/sigm_Q15.c
+++ b/thirdparty/opus/silk/sigm_Q15.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/* Approximate sigmoid function */
-#include "opus/silk/SigProc_FIX.h"
+#include "SigProc_FIX.h"
/* fprintf(1, '%d, ', round(1024 * ([1 ./ (1 + exp(-(1:5))), 1] - 1 ./ (1 + exp(-(0:5)))))); */
static const opus_int32 sigm_LUT_slope_Q10[ 6 ] = {
diff --git a/drivers/opus/silk/sort.c b/thirdparty/opus/silk/sort.c
index dd2988e5b..8670dbdd0 100644
--- a/drivers/opus/silk/sort.c
+++ b/thirdparty/opus/silk/sort.c
@@ -24,7 +24,10 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/* Insertion sort (fast for already almost sorted arrays): */
/* Best case: O(n) for an already sorted array */
@@ -32,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* */
/* Shell short: http://en.wikipedia.org/wiki/Shell_sort */
-#include "opus/silk/SigProc_FIX.h"
+#include "SigProc_FIX.h"
void silk_insertion_sort_increasing(
opus_int32 *a, /* I/O Unsorted / Sorted vector */
@@ -80,7 +83,7 @@ void silk_insertion_sort_increasing(
}
}
-#ifdef OPUS_FIXED_POINT
+#ifdef FIXED_POINT
/* This function is only used by the fixed-point build */
void silk_insertion_sort_decreasing_int16(
opus_int16 *a, /* I/O Unsorted / Sorted vector */
diff --git a/drivers/opus/silk/stereo_LR_to_MS.c b/thirdparty/opus/silk/stereo_LR_to_MS.c
index cf8affa90..42906e6f6 100644
--- a/drivers/opus/silk/stereo_LR_to_MS.c
+++ b/thirdparty/opus/silk/stereo_LR_to_MS.c
@@ -24,10 +24,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "stack_alloc.h"
/* Convert Left/Right stereo signal to adaptive Mid/Side representation */
void silk_stereo_LR_to_MS(
diff --git a/drivers/opus/silk/stereo_MS_to_LR.c b/thirdparty/opus/silk/stereo_MS_to_LR.c
index 4f553eb69..62521a4f3 100644
--- a/drivers/opus/silk/stereo_MS_to_LR.c
+++ b/thirdparty/opus/silk/stereo_MS_to_LR.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Convert adaptive Mid/Side representation to Left/Right stereo signal */
void silk_stereo_MS_to_LR(
diff --git a/drivers/opus/silk/stereo_decode_pred.c b/thirdparty/opus/silk/stereo_decode_pred.c
index 9e8abf39d..56ba3925e 100644
--- a/drivers/opus/silk/stereo_decode_pred.c
+++ b/thirdparty/opus/silk/stereo_decode_pred.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Decode mid/side predictors */
void silk_stereo_decode_pred(
diff --git a/drivers/opus/silk/stereo_encode_pred.c b/thirdparty/opus/silk/stereo_encode_pred.c
index a864d404f..e6dd19506 100644
--- a/drivers/opus/silk/stereo_encode_pred.c
+++ b/thirdparty/opus/silk/stereo_encode_pred.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Entropy code the mid/side quantization indices */
void silk_stereo_encode_pred(
diff --git a/drivers/opus/silk/stereo_find_predictor.c b/thirdparty/opus/silk/stereo_find_predictor.c
index c7fa3ac55..e30e90bdd 100644
--- a/drivers/opus/silk/stereo_find_predictor.c
+++ b/thirdparty/opus/silk/stereo_find_predictor.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Find least-squares prediction gain for one signal based on another and quantize it */
opus_int32 silk_stereo_find_predictor( /* O Returns predictor in Q13 */
diff --git a/drivers/opus/silk/stereo_quant_pred.c b/thirdparty/opus/silk/stereo_quant_pred.c
index ff2971e7c..d4ced6c3e 100644
--- a/drivers/opus/silk/stereo_quant_pred.c
+++ b/thirdparty/opus/silk/stereo_quant_pred.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/main.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
/* Quantize mid/side predictors */
void silk_stereo_quant_pred(
diff --git a/drivers/opus/silk/structs.h b/thirdparty/opus/silk/structs.h
index a2876b62a..827829dc6 100644
--- a/drivers/opus/silk/structs.h
+++ b/thirdparty/opus/silk/structs.h
@@ -28,11 +28,11 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_STRUCTS_H
#define SILK_STRUCTS_H
-#include "opus/silk/typedef.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/silk/define.h"
-#include "opus/celt/entenc.h"
-#include "opus/celt/entdec.h"
+#include "typedef.h"
+#include "SigProc_FIX.h"
+#include "define.h"
+#include "entenc.h"
+#include "entdec.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/sum_sqr_shift.c b/thirdparty/opus/silk/sum_sqr_shift.c
index 1d1da449f..129df191d 100644
--- a/drivers/opus/silk/sum_sqr_shift.c
+++ b/thirdparty/opus/silk/sum_sqr_shift.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/SigProc_FIX.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "SigProc_FIX.h"
/* Compute number of bits to right shift the sum of squares of a vector */
/* of int16s to make it fit in an int32 */
diff --git a/drivers/opus/silk/table_LSF_cos.c b/thirdparty/opus/silk/table_LSF_cos.c
index d350df9ad..ec9dc6392 100644
--- a/drivers/opus/silk/table_LSF_cos.c
+++ b/thirdparty/opus/silk/table_LSF_cos.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tables.h"
/* Cosine approximation table for LSF conversion */
/* Q12 values (even) */
diff --git a/drivers/opus/silk/tables.h b/thirdparty/opus/silk/tables.h
index 2ad69eec8..7fea6fda3 100644
--- a/drivers/opus/silk/tables.h
+++ b/thirdparty/opus/silk/tables.h
@@ -28,8 +28,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_TABLES_H
#define SILK_TABLES_H
-#include "opus/silk/define.h"
-#include "opus/silk/structs.h"
+#include "define.h"
+#include "structs.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/tables_LTP.c b/thirdparty/opus/silk/tables_LTP.c
index 9f500b25f..0e6a0254d 100644
--- a/drivers/opus/silk/tables_LTP.c
+++ b/thirdparty/opus/silk/tables_LTP.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tables.h"
const opus_uint8 silk_LTP_per_index_iCDF[3] = {
179, 99, 0
diff --git a/drivers/opus/silk/tables_NLSF_CB_NB_MB.c b/thirdparty/opus/silk/tables_NLSF_CB_NB_MB.c
index d1cf99356..8c59d207a 100644
--- a/drivers/opus/silk/tables_NLSF_CB_NB_MB.c
+++ b/thirdparty/opus/silk/tables_NLSF_CB_NB_MB.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tables.h"
static const opus_uint8 silk_NLSF_CB1_NB_MB_Q8[ 320 ] = {
12, 35, 60, 83, 108, 132, 157, 180,
diff --git a/drivers/opus/silk/tables_NLSF_CB_WB.c b/thirdparty/opus/silk/tables_NLSF_CB_WB.c
index 5ee6e880c..50af87eb2 100644
--- a/drivers/opus/silk/tables_NLSF_CB_WB.c
+++ b/thirdparty/opus/silk/tables_NLSF_CB_WB.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tables.h"
static const opus_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = {
7, 23, 38, 54, 69, 85, 100, 116,
diff --git a/drivers/opus/silk/tables_gain.c b/thirdparty/opus/silk/tables_gain.c
index e1e4319d7..37e41d890 100644
--- a/drivers/opus/silk/tables_gain.c
+++ b/thirdparty/opus/silk/tables_gain.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tables.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/tables_other.c b/thirdparty/opus/silk/tables_other.c
index 3713ff822..398686bf2 100644
--- a/drivers/opus/silk/tables_other.c
+++ b/thirdparty/opus/silk/tables_other.c
@@ -24,11 +24,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/structs.h"
-#include "opus/silk/define.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "structs.h"
+#include "define.h"
+#include "tables.h"
#ifdef __cplusplus
extern "C"
diff --git a/drivers/opus/silk/tables_pitch_lag.c b/thirdparty/opus/silk/tables_pitch_lag.c
index f435b7e01..e80cc59a2 100644
--- a/drivers/opus/silk/tables_pitch_lag.c
+++ b/thirdparty/opus/silk/tables_pitch_lag.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tables.h"
const opus_uint8 silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ] = {
253, 250, 244, 233, 212, 182, 150, 131,
diff --git a/drivers/opus/silk/tables_pulses_per_block.c b/thirdparty/opus/silk/tables_pulses_per_block.c
index 21f430791..c7c01c889 100644
--- a/drivers/opus/silk/tables_pulses_per_block.c
+++ b/thirdparty/opus/silk/tables_pulses_per_block.c
@@ -24,9 +24,12 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
-#include "opus/opus_config.h"
-#include "opus/silk/tables.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tables.h"
const opus_uint8 silk_max_pulses_table[ 4 ] = {
8, 10, 12, 16
diff --git a/drivers/opus/silk/tuning_parameters.h b/thirdparty/opus/silk/tuning_parameters.h
index 5b8f40423..5b8f40423 100644
--- a/drivers/opus/silk/tuning_parameters.h
+++ b/thirdparty/opus/silk/tuning_parameters.h
diff --git a/drivers/opus/silk/typedef.h b/thirdparty/opus/silk/typedef.h
index 3e193b4a4..97b7e709b 100644
--- a/drivers/opus/silk/typedef.h
+++ b/thirdparty/opus/silk/typedef.h
@@ -28,10 +28,10 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_TYPEDEF_H
#define SILK_TYPEDEF_H
-#include "opus/opus_types.h"
-#include "opus/opus_defines.h"
+#include "opus_types.h"
+#include "opus_defines.h"
-#ifndef OPUS_FIXED_POINT
+#ifndef FIXED_POINT
# include <float.h>
# define silk_float float
# define silk_float_MAX FLT_MAX
diff --git a/drivers/opus/silk/x86/NSQ_del_dec_sse.c b/thirdparty/opus/silk/x86/NSQ_del_dec_sse.c
index e9afbba01..21d4a8bc1 100644
--- a/drivers/opus/silk/x86/NSQ_del_dec_sse.c
+++ b/thirdparty/opus/silk/x86/NSQ_del_dec_sse.c
@@ -24,15 +24,18 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
-#include "opus/silk/main.h"
-#include "opus/celt/x86/x86cpu.h"
+#include "main.h"
+#include "celt/x86/x86cpu.h"
-#include "opus/celt/stack_alloc.h"
+#include "stack_alloc.h"
typedef struct {
opus_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ];
diff --git a/drivers/opus/silk/x86/NSQ_sse.c b/thirdparty/opus/silk/x86/NSQ_sse.c
index ac0fa1ab0..72f34fd6f 100644
--- a/drivers/opus/silk/x86/NSQ_sse.c
+++ b/thirdparty/opus/silk/x86/NSQ_sse.c
@@ -24,14 +24,17 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
-#include "opus/silk/main.h"
-#include "opus/celt/x86/x86cpu.h"
-#include "opus/celt/stack_alloc.h"
+#include "main.h"
+#include "celt/x86/x86cpu.h"
+#include "stack_alloc.h"
static OPUS_INLINE void silk_nsq_scale_states_sse4_1(
const silk_encoder_state *psEncC, /* I Encoder State */
diff --git a/drivers/opus/silk/x86/SigProc_FIX_sse.h b/thirdparty/opus/silk/x86/SigProc_FIX_sse.h
index 67ab30fd7..61efa8da4 100644
--- a/drivers/opus/silk/x86/SigProc_FIX_sse.h
+++ b/thirdparty/opus/silk/x86/SigProc_FIX_sse.h
@@ -27,7 +27,10 @@
#ifndef SIGPROC_FIX_SSE_H
#define SIGPROC_FIX_SSE_H
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#if defined(OPUS_X86_MAY_HAVE_SSE4_1)
void silk_burg_modified_sse4_1(
diff --git a/drivers/opus/silk/x86/VAD_sse.c b/thirdparty/opus/silk/x86/VAD_sse.c
index 5db2c86aa..4e90f4410 100644
--- a/drivers/opus/silk/x86/VAD_sse.c
+++ b/thirdparty/opus/silk/x86/VAD_sse.c
@@ -24,14 +24,17 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
-#include "opus/silk/main.h"
-#include "opus/celt/stack_alloc.h"
+#include "main.h"
+#include "stack_alloc.h"
/* Weighting factors for tilt measure */
static const opus_int32 tiltWeights[ VAD_N_BANDS ] = { 30000, 6000, -12000, -12000 };
diff --git a/drivers/opus/silk/x86/VQ_WMat_EC_sse.c b/thirdparty/opus/silk/x86/VQ_WMat_EC_sse.c
index 3afa42a6e..74d6c6d0e 100644
--- a/drivers/opus/silk/x86/VQ_WMat_EC_sse.c
+++ b/thirdparty/opus/silk/x86/VQ_WMat_EC_sse.c
@@ -24,13 +24,16 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
-#include "opus/silk/main.h"
-#include "opus/celt/x86/x86cpu.h"
+#include "main.h"
+#include "celt/x86/x86cpu.h"
/* Entropy constrained matrix-weighted VQ, hard-coded to 5-element vectors, for a single input data vector */
void silk_VQ_WMat_EC_sse4_1(
diff --git a/drivers/opus/silk/x86/main_sse.h b/thirdparty/opus/silk/x86/main_sse.h
index 6fef1b358..afd5ec26e 100644
--- a/drivers/opus/silk/x86/main_sse.h
+++ b/thirdparty/opus/silk/x86/main_sse.h
@@ -27,7 +27,10 @@
#ifndef MAIN_SSE_H
#define MAIN_SSE_H
-#include "opus/opus_config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
# if defined(OPUS_X86_MAY_HAVE_SSE4_1)
diff --git a/drivers/opus/silk/x86/x86_silk_map.c b/thirdparty/opus/silk/x86/x86_silk_map.c
index c3502114d..818841f2c 100644
--- a/drivers/opus/silk/x86/x86_silk_map.c
+++ b/thirdparty/opus/silk/x86/x86_silk_map.c
@@ -24,19 +24,22 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opus/opus_config.h"
-#include "opus/celt/x86/x86cpu.h"
-#include "opus/silk/structs.h"
-#include "opus/silk/SigProc_FIX.h"
-#include "opus/celt/pitch.h"
-#include "opus/silk/main.h"
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include "celt/x86/x86cpu.h"
+#include "structs.h"
+#include "SigProc_FIX.h"
+#include "pitch.h"
+#include "main.h"
#if !defined(OPUS_X86_PRESUME_SSE4_1)
#if defined(FIXED_POINT)
-#include "opus/silk/fixed/main_FIX.h"
+#include "fixed/main_FIX.h"
opus_int64 (*const SILK_INNER_PROD16_ALIGNED_64_IMPL[ OPUS_ARCHMASK + 1 ] )(
const opus_int16 *inVec1,
diff --git a/drivers/opus/stream.c b/thirdparty/opus/stream.c
index 2ac12642d..0238a6b31 100644
--- a/drivers/opus/stream.c
+++ b/thirdparty/opus/stream.c
@@ -14,9 +14,11 @@
last mod: $Id: vorbisfile.c 17573 2010-10-27 14:53:59Z xiphmont $
********************************************************************/
-#include "opus/opus_config.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#include "opus/internal.h"
+#include "internal.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/drivers/opus/tansig_table.h b/thirdparty/opus/tansig_table.h
index c76f844a7..c76f844a7 100644
--- a/drivers/opus/tansig_table.h
+++ b/thirdparty/opus/tansig_table.h
diff --git a/drivers/opus/wincerts.c b/thirdparty/opus/wincerts.c
index 1a5b63406..b0e35aa35 100644
--- a/drivers/opus/wincerts.c
+++ b/thirdparty/opus/wincerts.c
@@ -15,9 +15,12 @@
action, so I'm giving up and re-implementing it locally.
[1] <http://rt.openssl.org/Ticket/Display.html?id=2158>*/
-#include "opus/opus_config.h"
-#include "opus/internal.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "internal.h"
#if defined(OP_ENABLE_HTTP)&&defined(_WIN32)
/*You must include windows.h before wincrypt.h and x509.h.*/
# define WIN32_LEAN_AND_MEAN
diff --git a/drivers/opus/winerrno.h b/thirdparty/opus/winerrno.h
index 32a90b4ee..32a90b4ee 100644
--- a/drivers/opus/winerrno.h
+++ b/thirdparty/opus/winerrno.h
diff --git a/drivers/pvr/AlphaBitmap.h b/thirdparty/pvrtccompressor/AlphaBitmap.h
index 57c6b026e..57c6b026e 100644
--- a/drivers/pvr/AlphaBitmap.h
+++ b/thirdparty/pvrtccompressor/AlphaBitmap.h
diff --git a/drivers/pvr/BitScale.cpp b/thirdparty/pvrtccompressor/BitScale.cpp
index 97b3f0aa2..97b3f0aa2 100644
--- a/drivers/pvr/BitScale.cpp
+++ b/thirdparty/pvrtccompressor/BitScale.cpp
diff --git a/drivers/pvr/BitScale.h b/thirdparty/pvrtccompressor/BitScale.h
index 36613aeee..36613aeee 100644
--- a/drivers/pvr/BitScale.h
+++ b/thirdparty/pvrtccompressor/BitScale.h
diff --git a/drivers/pvr/BitUtility.h b/thirdparty/pvrtccompressor/BitUtility.h
index 588ff3e89..588ff3e89 100644
--- a/drivers/pvr/BitUtility.h
+++ b/thirdparty/pvrtccompressor/BitUtility.h
diff --git a/drivers/pvr/Bitmap.h b/thirdparty/pvrtccompressor/Bitmap.h
index 508ed8cb7..508ed8cb7 100644
--- a/drivers/pvr/Bitmap.h
+++ b/thirdparty/pvrtccompressor/Bitmap.h
diff --git a/drivers/pvr/ColorRgba.h b/thirdparty/pvrtccompressor/ColorRgba.h
index 070142056..070142056 100644
--- a/drivers/pvr/ColorRgba.h
+++ b/thirdparty/pvrtccompressor/ColorRgba.h
diff --git a/drivers/pvr/Interval.h b/thirdparty/pvrtccompressor/Interval.h
index a7252e837..a7252e837 100644
--- a/drivers/pvr/Interval.h
+++ b/thirdparty/pvrtccompressor/Interval.h
diff --git a/thirdparty/pvrtccompressor/LICENSE.TXT b/thirdparty/pvrtccompressor/LICENSE.TXT
new file mode 100644
index 000000000..974fc09e2
--- /dev/null
+++ b/thirdparty/pvrtccompressor/LICENSE.TXT
@@ -0,0 +1,25 @@
+Copyright © 2014, Jeffrey Lim. All Rights Reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/drivers/pvr/MortonTable.cpp b/thirdparty/pvrtccompressor/MortonTable.cpp
index 29a5af67f..29a5af67f 100644
--- a/drivers/pvr/MortonTable.cpp
+++ b/thirdparty/pvrtccompressor/MortonTable.cpp
diff --git a/drivers/pvr/MortonTable.h b/thirdparty/pvrtccompressor/MortonTable.h
index 7a27e5954..7a27e5954 100644
--- a/drivers/pvr/MortonTable.h
+++ b/thirdparty/pvrtccompressor/MortonTable.h
diff --git a/drivers/pvr/Point2.h b/thirdparty/pvrtccompressor/Point2.h
index 89fa4b632..89fa4b632 100644
--- a/drivers/pvr/Point2.h
+++ b/thirdparty/pvrtccompressor/Point2.h
diff --git a/drivers/pvr/PvrTcDecoder.cpp b/thirdparty/pvrtccompressor/PvrTcDecoder.cpp
index d8a36b342..d8a36b342 100644
--- a/drivers/pvr/PvrTcDecoder.cpp
+++ b/thirdparty/pvrtccompressor/PvrTcDecoder.cpp
diff --git a/drivers/pvr/PvrTcDecoder.h b/thirdparty/pvrtccompressor/PvrTcDecoder.h
index 1b6fcf964..1b6fcf964 100644
--- a/drivers/pvr/PvrTcDecoder.h
+++ b/thirdparty/pvrtccompressor/PvrTcDecoder.h
diff --git a/drivers/pvr/PvrTcEncoder.cpp b/thirdparty/pvrtccompressor/PvrTcEncoder.cpp
index 587b1320f..587b1320f 100644
--- a/drivers/pvr/PvrTcEncoder.cpp
+++ b/thirdparty/pvrtccompressor/PvrTcEncoder.cpp
diff --git a/drivers/pvr/PvrTcEncoder.h b/thirdparty/pvrtccompressor/PvrTcEncoder.h
index b9344367d..b9344367d 100644
--- a/drivers/pvr/PvrTcEncoder.h
+++ b/thirdparty/pvrtccompressor/PvrTcEncoder.h
diff --git a/drivers/pvr/PvrTcPacket.cpp b/thirdparty/pvrtccompressor/PvrTcPacket.cpp
index 2e40d371e..2e40d371e 100644
--- a/drivers/pvr/PvrTcPacket.cpp
+++ b/thirdparty/pvrtccompressor/PvrTcPacket.cpp
diff --git a/drivers/pvr/PvrTcPacket.h b/thirdparty/pvrtccompressor/PvrTcPacket.h
index ac3b6a4dd..ac3b6a4dd 100644
--- a/drivers/pvr/PvrTcPacket.h
+++ b/thirdparty/pvrtccompressor/PvrTcPacket.h
diff --git a/drivers/pvr/RgbBitmap.h b/thirdparty/pvrtccompressor/RgbBitmap.h
index cf1d78667..cf1d78667 100644
--- a/drivers/pvr/RgbBitmap.h
+++ b/thirdparty/pvrtccompressor/RgbBitmap.h
diff --git a/drivers/pvr/RgbaBitmap.h b/thirdparty/pvrtccompressor/RgbaBitmap.h
index 66b5542c1..66b5542c1 100644
--- a/drivers/pvr/RgbaBitmap.h
+++ b/thirdparty/pvrtccompressor/RgbaBitmap.h
diff --git a/drivers/etc1/rg_etc1.cpp b/thirdparty/rg-etc1/rg_etc1.cpp
index 8e28b53f9..8e28b53f9 100644
--- a/drivers/etc1/rg_etc1.cpp
+++ b/thirdparty/rg-etc1/rg_etc1.cpp
diff --git a/drivers/etc1/rg_etc1.h b/thirdparty/rg-etc1/rg_etc1.h
index 9ce89a6cc..9ce89a6cc 100644
--- a/drivers/etc1/rg_etc1.h
+++ b/thirdparty/rg-etc1/rg_etc1.h
diff --git a/drivers/rtaudio/RtAudio.cpp b/thirdparty/rtaudio/RtAudio.cpp
index 04159776f..04159776f 100644
--- a/drivers/rtaudio/RtAudio.cpp
+++ b/thirdparty/rtaudio/RtAudio.cpp
diff --git a/drivers/rtaudio/RtAudio.h b/thirdparty/rtaudio/RtAudio.h
index 4392e95f3..4392e95f3 100644
--- a/drivers/rtaudio/RtAudio.h
+++ b/thirdparty/rtaudio/RtAudio.h
diff --git a/thirdparty/squish/alpha.cpp b/thirdparty/squish/alpha.cpp
new file mode 100644
index 000000000..7039c1a3b
--- /dev/null
+++ b/thirdparty/squish/alpha.cpp
@@ -0,0 +1,350 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#include "alpha.h"
+
+#include <climits>
+#include <algorithm>
+
+namespace squish {
+
+static int FloatToInt( float a, int limit )
+{
+ // use ANSI round-to-zero behaviour to get round-to-nearest
+ int i = ( int )( a + 0.5f );
+
+ // clamp to the limit
+ if( i < 0 )
+ i = 0;
+ else if( i > limit )
+ i = limit;
+
+ // done
+ return i;
+}
+
+void CompressAlphaDxt3( u8 const* rgba, int mask, void* block )
+{
+ u8* bytes = reinterpret_cast< u8* >( block );
+
+ // quantise and pack the alpha values pairwise
+ for( int i = 0; i < 8; ++i )
+ {
+ // quantise down to 4 bits
+ float alpha1 = ( float )rgba[8*i + 3] * ( 15.0f/255.0f );
+ float alpha2 = ( float )rgba[8*i + 7] * ( 15.0f/255.0f );
+ int quant1 = FloatToInt( alpha1, 15 );
+ int quant2 = FloatToInt( alpha2, 15 );
+
+ // set alpha to zero where masked
+ int bit1 = 1 << ( 2*i );
+ int bit2 = 1 << ( 2*i + 1 );
+ if( ( mask & bit1 ) == 0 )
+ quant1 = 0;
+ if( ( mask & bit2 ) == 0 )
+ quant2 = 0;
+
+ // pack into the byte
+ bytes[i] = ( u8 )( quant1 | ( quant2 << 4 ) );
+ }
+}
+
+void DecompressAlphaDxt3( u8* rgba, void const* block )
+{
+ u8 const* bytes = reinterpret_cast< u8 const* >( block );
+
+ // unpack the alpha values pairwise
+ for( int i = 0; i < 8; ++i )
+ {
+ // quantise down to 4 bits
+ u8 quant = bytes[i];
+
+ // unpack the values
+ u8 lo = quant & 0x0f;
+ u8 hi = quant & 0xf0;
+
+ // convert back up to bytes
+ rgba[8*i + 3] = lo | ( lo << 4 );
+ rgba[8*i + 7] = hi | ( hi >> 4 );
+ }
+}
+
+static void FixRange( int& min, int& max, int steps )
+{
+ if( max - min < steps )
+ max = std::min( min + steps, 255 );
+ if( max - min < steps )
+ min = std::max( 0, max - steps );
+}
+
+static int FitCodes( u8 const* rgba, int mask, u8 const* codes, u8* indices )
+{
+ // fit each alpha value to the codebook
+ int err = 0;
+ for( int i = 0; i < 16; ++i )
+ {
+ // check this pixel is valid
+ int bit = 1 << i;
+ if( ( mask & bit ) == 0 )
+ {
+ // use the first code
+ indices[i] = 0;
+ continue;
+ }
+
+ // find the least error and corresponding index
+ int value = rgba[4*i + 3];
+ int least = INT_MAX;
+ int index = 0;
+ for( int j = 0; j < 8; ++j )
+ {
+ // get the squared error from this code
+ int dist = ( int )value - ( int )codes[j];
+ dist *= dist;
+
+ // compare with the best so far
+ if( dist < least )
+ {
+ least = dist;
+ index = j;
+ }
+ }
+
+ // save this index and accumulate the error
+ indices[i] = ( u8 )index;
+ err += least;
+ }
+
+ // return the total error
+ return err;
+}
+
+static void WriteAlphaBlock( int alpha0, int alpha1, u8 const* indices, void* block )
+{
+ u8* bytes = reinterpret_cast< u8* >( block );
+
+ // write the first two bytes
+ bytes[0] = ( u8 )alpha0;
+ bytes[1] = ( u8 )alpha1;
+
+ // pack the indices with 3 bits each
+ u8* dest = bytes + 2;
+ u8 const* src = indices;
+ for( int i = 0; i < 2; ++i )
+ {
+ // pack 8 3-bit values
+ int value = 0;
+ for( int j = 0; j < 8; ++j )
+ {
+ int index = *src++;
+ value |= ( index << 3*j );
+ }
+
+ // store in 3 bytes
+ for( int j = 0; j < 3; ++j )
+ {
+ int byte = ( value >> 8*j ) & 0xff;
+ *dest++ = ( u8 )byte;
+ }
+ }
+}
+
+static void WriteAlphaBlock5( int alpha0, int alpha1, u8 const* indices, void* block )
+{
+ // check the relative values of the endpoints
+ if( alpha0 > alpha1 )
+ {
+ // swap the indices
+ u8 swapped[16];
+ for( int i = 0; i < 16; ++i )
+ {
+ u8 index = indices[i];
+ if( index == 0 )
+ swapped[i] = 1;
+ else if( index == 1 )
+ swapped[i] = 0;
+ else if( index <= 5 )
+ swapped[i] = 7 - index;
+ else
+ swapped[i] = index;
+ }
+
+ // write the block
+ WriteAlphaBlock( alpha1, alpha0, swapped, block );
+ }
+ else
+ {
+ // write the block
+ WriteAlphaBlock( alpha0, alpha1, indices, block );
+ }
+}
+
+static void WriteAlphaBlock7( int alpha0, int alpha1, u8 const* indices, void* block )
+{
+ // check the relative values of the endpoints
+ if( alpha0 < alpha1 )
+ {
+ // swap the indices
+ u8 swapped[16];
+ for( int i = 0; i < 16; ++i )
+ {
+ u8 index = indices[i];
+ if( index == 0 )
+ swapped[i] = 1;
+ else if( index == 1 )
+ swapped[i] = 0;
+ else
+ swapped[i] = 9 - index;
+ }
+
+ // write the block
+ WriteAlphaBlock( alpha1, alpha0, swapped, block );
+ }
+ else
+ {
+ // write the block
+ WriteAlphaBlock( alpha0, alpha1, indices, block );
+ }
+}
+
+void CompressAlphaDxt5( u8 const* rgba, int mask, void* block )
+{
+ // get the range for 5-alpha and 7-alpha interpolation
+ int min5 = 255;
+ int max5 = 0;
+ int min7 = 255;
+ int max7 = 0;
+ for( int i = 0; i < 16; ++i )
+ {
+ // check this pixel is valid
+ int bit = 1 << i;
+ if( ( mask & bit ) == 0 )
+ continue;
+
+ // incorporate into the min/max
+ int value = rgba[4*i + 3];
+ if( value < min7 )
+ min7 = value;
+ if( value > max7 )
+ max7 = value;
+ if( value != 0 && value < min5 )
+ min5 = value;
+ if( value != 255 && value > max5 )
+ max5 = value;
+ }
+
+ // handle the case that no valid range was found
+ if( min5 > max5 )
+ min5 = max5;
+ if( min7 > max7 )
+ min7 = max7;
+
+ // fix the range to be the minimum in each case
+ FixRange( min5, max5, 5 );
+ FixRange( min7, max7, 7 );
+
+ // set up the 5-alpha code book
+ u8 codes5[8];
+ codes5[0] = ( u8 )min5;
+ codes5[1] = ( u8 )max5;
+ for( int i = 1; i < 5; ++i )
+ codes5[1 + i] = ( u8 )( ( ( 5 - i )*min5 + i*max5 )/5 );
+ codes5[6] = 0;
+ codes5[7] = 255;
+
+ // set up the 7-alpha code book
+ u8 codes7[8];
+ codes7[0] = ( u8 )min7;
+ codes7[1] = ( u8 )max7;
+ for( int i = 1; i < 7; ++i )
+ codes7[1 + i] = ( u8 )( ( ( 7 - i )*min7 + i*max7 )/7 );
+
+ // fit the data to both code books
+ u8 indices5[16];
+ u8 indices7[16];
+ int err5 = FitCodes( rgba, mask, codes5, indices5 );
+ int err7 = FitCodes( rgba, mask, codes7, indices7 );
+
+ // save the block with least error
+ if( err5 <= err7 )
+ WriteAlphaBlock5( min5, max5, indices5, block );
+ else
+ WriteAlphaBlock7( min7, max7, indices7, block );
+}
+
+void DecompressAlphaDxt5( u8* rgba, void const* block )
+{
+ // get the two alpha values
+ u8 const* bytes = reinterpret_cast< u8 const* >( block );
+ int alpha0 = bytes[0];
+ int alpha1 = bytes[1];
+
+ // compare the values to build the codebook
+ u8 codes[8];
+ codes[0] = ( u8 )alpha0;
+ codes[1] = ( u8 )alpha1;
+ if( alpha0 <= alpha1 )
+ {
+ // use 5-alpha codebook
+ for( int i = 1; i < 5; ++i )
+ codes[1 + i] = ( u8 )( ( ( 5 - i )*alpha0 + i*alpha1 )/5 );
+ codes[6] = 0;
+ codes[7] = 255;
+ }
+ else
+ {
+ // use 7-alpha codebook
+ for( int i = 1; i < 7; ++i )
+ codes[1 + i] = ( u8 )( ( ( 7 - i )*alpha0 + i*alpha1 )/7 );
+ }
+
+ // decode the indices
+ u8 indices[16];
+ u8 const* src = bytes + 2;
+ u8* dest = indices;
+ for( int i = 0; i < 2; ++i )
+ {
+ // grab 3 bytes
+ int value = 0;
+ for( int j = 0; j < 3; ++j )
+ {
+ int byte = *src++;
+ value |= ( byte << 8*j );
+ }
+
+ // unpack 8 3-bit values from it
+ for( int j = 0; j < 8; ++j )
+ {
+ int index = ( value >> 3*j ) & 0x7;
+ *dest++ = ( u8 )index;
+ }
+ }
+
+ // write out the indexed codebook values
+ for( int i = 0; i < 16; ++i )
+ rgba[4*i + 3] = codes[indices[i]];
+}
+
+} // namespace squish
diff --git a/thirdparty/squish/alpha.h b/thirdparty/squish/alpha.h
new file mode 100644
index 000000000..a1fffd404
--- /dev/null
+++ b/thirdparty/squish/alpha.h
@@ -0,0 +1,41 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_ALPHA_H
+#define SQUISH_ALPHA_H
+
+#include "squish.h"
+
+namespace squish {
+
+void CompressAlphaDxt3( u8 const* rgba, int mask, void* block );
+void CompressAlphaDxt5( u8 const* rgba, int mask, void* block );
+
+void DecompressAlphaDxt3( u8* rgba, void const* block );
+void DecompressAlphaDxt5( u8* rgba, void const* block );
+
+} // namespace squish
+
+#endif // ndef SQUISH_ALPHA_H
diff --git a/thirdparty/squish/clusterfit.cpp b/thirdparty/squish/clusterfit.cpp
new file mode 100644
index 000000000..1610ecb5d
--- /dev/null
+++ b/thirdparty/squish/clusterfit.cpp
@@ -0,0 +1,392 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+ Copyright (c) 2007 Ignacio Castano icastano@nvidia.com
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#include "clusterfit.h"
+#include "colourset.h"
+#include "colourblock.h"
+#include <cfloat>
+
+namespace squish {
+
+ClusterFit::ClusterFit( ColourSet const* colours, int flags, float* metric )
+ : ColourFit( colours, flags )
+{
+ // set the iteration count
+ m_iterationCount = ( m_flags & kColourIterativeClusterFit ) ? kMaxIterations : 1;
+
+ // initialise the metric (old perceptual = 0.2126f, 0.7152f, 0.0722f)
+ if( metric )
+ m_metric = Vec4( metric[0], metric[1], metric[2], 1.0f );
+ else
+ m_metric = VEC4_CONST( 1.0f );
+
+ // initialise the best error
+ m_besterror = VEC4_CONST( FLT_MAX );
+
+ // cache some values
+ int const count = m_colours->GetCount();
+ Vec3 const* values = m_colours->GetPoints();
+
+ // get the covariance matrix
+ Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights() );
+
+ // compute the principle component
+ m_principle = ComputePrincipleComponent( covariance );
+}
+
+bool ClusterFit::ConstructOrdering( Vec3 const& axis, int iteration )
+{
+ // cache some values
+ int const count = m_colours->GetCount();
+ Vec3 const* values = m_colours->GetPoints();
+
+ // build the list of dot products
+ float dps[16];
+ u8* order = ( u8* )m_order + 16*iteration;
+ for( int i = 0; i < count; ++i )
+ {
+ dps[i] = Dot( values[i], axis );
+ order[i] = ( u8 )i;
+ }
+
+ // stable sort using them
+ for( int i = 0; i < count; ++i )
+ {
+ for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j )
+ {
+ std::swap( dps[j], dps[j - 1] );
+ std::swap( order[j], order[j - 1] );
+ }
+ }
+
+ // check this ordering is unique
+ for( int it = 0; it < iteration; ++it )
+ {
+ u8 const* prev = ( u8* )m_order + 16*it;
+ bool same = true;
+ for( int i = 0; i < count; ++i )
+ {
+ if( order[i] != prev[i] )
+ {
+ same = false;
+ break;
+ }
+ }
+ if( same )
+ return false;
+ }
+
+ // copy the ordering and weight all the points
+ Vec3 const* unweighted = m_colours->GetPoints();
+ float const* weights = m_colours->GetWeights();
+ m_xsum_wsum = VEC4_CONST( 0.0f );
+ for( int i = 0; i < count; ++i )
+ {
+ int j = order[i];
+ Vec4 p( unweighted[j].X(), unweighted[j].Y(), unweighted[j].Z(), 1.0f );
+ Vec4 w( weights[j] );
+ Vec4 x = p*w;
+ m_points_weights[i] = x;
+ m_xsum_wsum += x;
+ }
+ return true;
+}
+
+void ClusterFit::Compress3( void* block )
+{
+ // declare variables
+ int const count = m_colours->GetCount();
+ Vec4 const two = VEC4_CONST( 2.0 );
+ Vec4 const one = VEC4_CONST( 1.0f );
+ Vec4 const half_half2( 0.5f, 0.5f, 0.5f, 0.25f );
+ Vec4 const zero = VEC4_CONST( 0.0f );
+ Vec4 const half = VEC4_CONST( 0.5f );
+ Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
+ Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
+
+ // prepare an ordering using the principle axis
+ ConstructOrdering( m_principle, 0 );
+
+ // check all possible clusters and iterate on the total order
+ Vec4 beststart = VEC4_CONST( 0.0f );
+ Vec4 bestend = VEC4_CONST( 0.0f );
+ Vec4 besterror = m_besterror;
+ u8 bestindices[16];
+ int bestiteration = 0;
+ int besti = 0, bestj = 0;
+
+ // loop over iterations (we avoid the case that all points in first or last cluster)
+ for( int iterationIndex = 0;; )
+ {
+ // first cluster [0,i) is at the start
+ Vec4 part0 = VEC4_CONST( 0.0f );
+ for( int i = 0; i < count; ++i )
+ {
+ // second cluster [i,j) is half along
+ Vec4 part1 = ( i == 0 ) ? m_points_weights[0] : VEC4_CONST( 0.0f );
+ int jmin = ( i == 0 ) ? 1 : i;
+ for( int j = jmin;; )
+ {
+ // last cluster [j,count) is at the end
+ Vec4 part2 = m_xsum_wsum - part1 - part0;
+
+ // compute least squares terms directly
+ Vec4 alphax_sum = MultiplyAdd( part1, half_half2, part0 );
+ Vec4 alpha2_sum = alphax_sum.SplatW();
+
+ Vec4 betax_sum = MultiplyAdd( part1, half_half2, part2 );
+ Vec4 beta2_sum = betax_sum.SplatW();
+
+ Vec4 alphabeta_sum = ( part1*half_half2 ).SplatW();
+
+ // compute the least-squares optimal points
+ Vec4 factor = Reciprocal( NegativeMultiplySubtract( alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum ) );
+ Vec4 a = NegativeMultiplySubtract( betax_sum, alphabeta_sum, alphax_sum*beta2_sum )*factor;
+ Vec4 b = NegativeMultiplySubtract( alphax_sum, alphabeta_sum, betax_sum*alpha2_sum )*factor;
+
+ // clamp to the grid
+ a = Min( one, Max( zero, a ) );
+ b = Min( one, Max( zero, b ) );
+ a = Truncate( MultiplyAdd( grid, a, half ) )*gridrcp;
+ b = Truncate( MultiplyAdd( grid, b, half ) )*gridrcp;
+
+ // compute the error (we skip the constant xxsum)
+ Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
+ Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
+ Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
+ Vec4 e4 = MultiplyAdd( two, e3, e1 );
+
+ // apply the metric to the error term
+ Vec4 e5 = e4*m_metric;
+ Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
+
+ // keep the solution if it wins
+ if( CompareAnyLessThan( error, besterror ) )
+ {
+ beststart = a;
+ bestend = b;
+ besti = i;
+ bestj = j;
+ besterror = error;
+ bestiteration = iterationIndex;
+ }
+
+ // advance
+ if( j == count )
+ break;
+ part1 += m_points_weights[j];
+ ++j;
+ }
+
+ // advance
+ part0 += m_points_weights[i];
+ }
+
+ // stop if we didn't improve in this iteration
+ if( bestiteration != iterationIndex )
+ break;
+
+ // advance if possible
+ ++iterationIndex;
+ if( iterationIndex == m_iterationCount )
+ break;
+
+ // stop if a new iteration is an ordering that has already been tried
+ Vec3 axis = ( bestend - beststart ).GetVec3();
+ if( !ConstructOrdering( axis, iterationIndex ) )
+ break;
+ }
+
+ // save the block if necessary
+ if( CompareAnyLessThan( besterror, m_besterror ) )
+ {
+ // remap the indices
+ u8 const* order = ( u8* )m_order + 16*bestiteration;
+
+ u8 unordered[16];
+ for( int m = 0; m < besti; ++m )
+ unordered[order[m]] = 0;
+ for( int m = besti; m < bestj; ++m )
+ unordered[order[m]] = 2;
+ for( int m = bestj; m < count; ++m )
+ unordered[order[m]] = 1;
+
+ m_colours->RemapIndices( unordered, bestindices );
+
+ // save the block
+ WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
+
+ // save the error
+ m_besterror = besterror;
+ }
+}
+
+void ClusterFit::Compress4( void* block )
+{
+ // declare variables
+ int const count = m_colours->GetCount();
+ Vec4 const two = VEC4_CONST( 2.0f );
+ Vec4 const one = VEC4_CONST( 1.0f );
+ Vec4 const onethird_onethird2( 1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 1.0f/9.0f );
+ Vec4 const twothirds_twothirds2( 2.0f/3.0f, 2.0f/3.0f, 2.0f/3.0f, 4.0f/9.0f );
+ Vec4 const twonineths = VEC4_CONST( 2.0f/9.0f );
+ Vec4 const zero = VEC4_CONST( 0.0f );
+ Vec4 const half = VEC4_CONST( 0.5f );
+ Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
+ Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
+
+ // prepare an ordering using the principle axis
+ ConstructOrdering( m_principle, 0 );
+
+ // check all possible clusters and iterate on the total order
+ Vec4 beststart = VEC4_CONST( 0.0f );
+ Vec4 bestend = VEC4_CONST( 0.0f );
+ Vec4 besterror = m_besterror;
+ u8 bestindices[16];
+ int bestiteration = 0;
+ int besti = 0, bestj = 0, bestk = 0;
+
+ // loop over iterations (we avoid the case that all points in first or last cluster)
+ for( int iterationIndex = 0;; )
+ {
+ // first cluster [0,i) is at the start
+ Vec4 part0 = VEC4_CONST( 0.0f );
+ for( int i = 0; i < count; ++i )
+ {
+ // second cluster [i,j) is one third along
+ Vec4 part1 = VEC4_CONST( 0.0f );
+ for( int j = i;; )
+ {
+ // third cluster [j,k) is two thirds along
+ Vec4 part2 = ( j == 0 ) ? m_points_weights[0] : VEC4_CONST( 0.0f );
+ int kmin = ( j == 0 ) ? 1 : j;
+ for( int k = kmin;; )
+ {
+ // last cluster [k,count) is at the end
+ Vec4 part3 = m_xsum_wsum - part2 - part1 - part0;
+
+ // compute least squares terms directly
+ Vec4 const alphax_sum = MultiplyAdd( part2, onethird_onethird2, MultiplyAdd( part1, twothirds_twothirds2, part0 ) );
+ Vec4 const alpha2_sum = alphax_sum.SplatW();
+
+ Vec4 const betax_sum = MultiplyAdd( part1, onethird_onethird2, MultiplyAdd( part2, twothirds_twothirds2, part3 ) );
+ Vec4 const beta2_sum = betax_sum.SplatW();
+
+ Vec4 const alphabeta_sum = twonineths*( part1 + part2 ).SplatW();
+
+ // compute the least-squares optimal points
+ Vec4 factor = Reciprocal( NegativeMultiplySubtract( alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum ) );
+ Vec4 a = NegativeMultiplySubtract( betax_sum, alphabeta_sum, alphax_sum*beta2_sum )*factor;
+ Vec4 b = NegativeMultiplySubtract( alphax_sum, alphabeta_sum, betax_sum*alpha2_sum )*factor;
+
+ // clamp to the grid
+ a = Min( one, Max( zero, a ) );
+ b = Min( one, Max( zero, b ) );
+ a = Truncate( MultiplyAdd( grid, a, half ) )*gridrcp;
+ b = Truncate( MultiplyAdd( grid, b, half ) )*gridrcp;
+
+ // compute the error (we skip the constant xxsum)
+ Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
+ Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
+ Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
+ Vec4 e4 = MultiplyAdd( two, e3, e1 );
+
+ // apply the metric to the error term
+ Vec4 e5 = e4*m_metric;
+ Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
+
+ // keep the solution if it wins
+ if( CompareAnyLessThan( error, besterror ) )
+ {
+ beststart = a;
+ bestend = b;
+ besterror = error;
+ besti = i;
+ bestj = j;
+ bestk = k;
+ bestiteration = iterationIndex;
+ }
+
+ // advance
+ if( k == count )
+ break;
+ part2 += m_points_weights[k];
+ ++k;
+ }
+
+ // advance
+ if( j == count )
+ break;
+ part1 += m_points_weights[j];
+ ++j;
+ }
+
+ // advance
+ part0 += m_points_weights[i];
+ }
+
+ // stop if we didn't improve in this iteration
+ if( bestiteration != iterationIndex )
+ break;
+
+ // advance if possible
+ ++iterationIndex;
+ if( iterationIndex == m_iterationCount )
+ break;
+
+ // stop if a new iteration is an ordering that has already been tried
+ Vec3 axis = ( bestend - beststart ).GetVec3();
+ if( !ConstructOrdering( axis, iterationIndex ) )
+ break;
+ }
+
+ // save the block if necessary
+ if( CompareAnyLessThan( besterror, m_besterror ) )
+ {
+ // remap the indices
+ u8 const* order = ( u8* )m_order + 16*bestiteration;
+
+ u8 unordered[16];
+ for( int m = 0; m < besti; ++m )
+ unordered[order[m]] = 0;
+ for( int m = besti; m < bestj; ++m )
+ unordered[order[m]] = 2;
+ for( int m = bestj; m < bestk; ++m )
+ unordered[order[m]] = 3;
+ for( int m = bestk; m < count; ++m )
+ unordered[order[m]] = 1;
+
+ m_colours->RemapIndices( unordered, bestindices );
+
+ // save the block
+ WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
+
+ // save the error
+ m_besterror = besterror;
+ }
+}
+
+} // namespace squish
diff --git a/thirdparty/squish/clusterfit.h b/thirdparty/squish/clusterfit.h
new file mode 100644
index 000000000..999396b26
--- /dev/null
+++ b/thirdparty/squish/clusterfit.h
@@ -0,0 +1,61 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+ Copyright (c) 2007 Ignacio Castano icastano@nvidia.com
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_CLUSTERFIT_H
+#define SQUISH_CLUSTERFIT_H
+
+#include "squish.h"
+#include "maths.h"
+#include "simd.h"
+#include "colourfit.h"
+
+namespace squish {
+
+class ClusterFit : public ColourFit
+{
+public:
+ ClusterFit( ColourSet const* colours, int flags, float* metric );
+
+private:
+ bool ConstructOrdering( Vec3 const& axis, int iteration );
+
+ virtual void Compress3( void* block );
+ virtual void Compress4( void* block );
+
+ enum { kMaxIterations = 8 };
+
+ int m_iterationCount;
+ Vec3 m_principle;
+ u8 m_order[16*kMaxIterations];
+ Vec4 m_points_weights[16];
+ Vec4 m_xsum_wsum;
+ Vec4 m_metric;
+ Vec4 m_besterror;
+};
+
+} // namespace squish
+
+#endif // ndef SQUISH_CLUSTERFIT_H
diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
new file mode 100644
index 000000000..af8b98036
--- /dev/null
+++ b/thirdparty/squish/colourblock.cpp
@@ -0,0 +1,214 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#include "colourblock.h"
+
+namespace squish {
+
+static int FloatToInt( float a, int limit )
+{
+ // use ANSI round-to-zero behaviour to get round-to-nearest
+ int i = ( int )( a + 0.5f );
+
+ // clamp to the limit
+ if( i < 0 )
+ i = 0;
+ else if( i > limit )
+ i = limit;
+
+ // done
+ return i;
+}
+
+static int FloatTo565( Vec3::Arg colour )
+{
+ // get the components in the correct range
+ int r = FloatToInt( 31.0f*colour.X(), 31 );
+ int g = FloatToInt( 63.0f*colour.Y(), 63 );
+ int b = FloatToInt( 31.0f*colour.Z(), 31 );
+
+ // pack into a single value
+ return ( r << 11 ) | ( g << 5 ) | b;
+}
+
+static void WriteColourBlock( int a, int b, u8* indices, void* block )
+{
+ // get the block as bytes
+ u8* bytes = ( u8* )block;
+
+ // write the endpoints
+ bytes[0] = ( u8 )( a & 0xff );
+ bytes[1] = ( u8 )( a >> 8 );
+ bytes[2] = ( u8 )( b & 0xff );
+ bytes[3] = ( u8 )( b >> 8 );
+
+ // write the indices
+ for( int i = 0; i < 4; ++i )
+ {
+ u8 const* ind = indices + 4*i;
+ bytes[4 + i] = ind[0] | ( ind[1] << 2 ) | ( ind[2] << 4 ) | ( ind[3] << 6 );
+ }
+}
+
+void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block )
+{
+ // get the packed values
+ int a = FloatTo565( start );
+ int b = FloatTo565( end );
+
+ // remap the indices
+ u8 remapped[16];
+ if( a <= b )
+ {
+ // use the indices directly
+ for( int i = 0; i < 16; ++i )
+ remapped[i] = indices[i];
+ }
+ else
+ {
+ // swap a and b
+ std::swap( a, b );
+ for( int i = 0; i < 16; ++i )
+ {
+ if( indices[i] == 0 )
+ remapped[i] = 1;
+ else if( indices[i] == 1 )
+ remapped[i] = 0;
+ else
+ remapped[i] = indices[i];
+ }
+ }
+
+ // write the block
+ WriteColourBlock( a, b, remapped, block );
+}
+
+void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block )
+{
+ // get the packed values
+ int a = FloatTo565( start );
+ int b = FloatTo565( end );
+
+ // remap the indices
+ u8 remapped[16];
+ if( a < b )
+ {
+ // swap a and b
+ std::swap( a, b );
+ for( int i = 0; i < 16; ++i )
+ remapped[i] = ( indices[i] ^ 0x1 ) & 0x3;
+ }
+ else if( a == b )
+ {
+ // use index 0
+ for( int i = 0; i < 16; ++i )
+ remapped[i] = 0;
+ }
+ else
+ {
+ // use the indices directly
+ for( int i = 0; i < 16; ++i )
+ remapped[i] = indices[i];
+ }
+
+ // write the block
+ WriteColourBlock( a, b, remapped, block );
+}
+
+static int Unpack565( u8 const* packed, u8* colour )
+{
+ // build the packed value
+ int value = ( int )packed[0] | ( ( int )packed[1] << 8 );
+
+ // get the components in the stored range
+ u8 red = ( u8 )( ( value >> 11 ) & 0x1f );
+ u8 green = ( u8 )( ( value >> 5 ) & 0x3f );
+ u8 blue = ( u8 )( value & 0x1f );
+
+ // scale up to 8 bits
+ colour[0] = ( red << 3 ) | ( red >> 2 );
+ colour[1] = ( green << 2 ) | ( green >> 4 );
+ colour[2] = ( blue << 3 ) | ( blue >> 2 );
+ colour[3] = 255;
+
+ // return the value
+ return value;
+}
+
+void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
+{
+ // get the block bytes
+ u8 const* bytes = reinterpret_cast< u8 const* >( block );
+
+ // unpack the endpoints
+ u8 codes[16];
+ int a = Unpack565( bytes, codes );
+ int b = Unpack565( bytes + 2, codes + 4 );
+
+ // generate the midpoints
+ for( int i = 0; i < 3; ++i )
+ {
+ int c = codes[i];
+ int d = codes[4 + i];
+
+ if( isDxt1 && a <= b )
+ {
+ codes[8 + i] = ( u8 )( ( c + d )/2 );
+ codes[12 + i] = 0;
+ }
+ else
+ {
+ codes[8 + i] = ( u8 )( ( 2*c + d )/3 );
+ codes[12 + i] = ( u8 )( ( c + 2*d )/3 );
+ }
+ }
+
+ // fill in alpha for the intermediate values
+ codes[8 + 3] = 255;
+ codes[12 + 3] = ( isDxt1 && a <= b ) ? 0 : 255;
+
+ // unpack the indices
+ u8 indices[16];
+ for( int i = 0; i < 4; ++i )
+ {
+ u8* ind = indices + 4*i;
+ u8 packed = bytes[4 + i];
+
+ ind[0] = packed & 0x3;
+ ind[1] = ( packed >> 2 ) & 0x3;
+ ind[2] = ( packed >> 4 ) & 0x3;
+ ind[3] = ( packed >> 6 ) & 0x3;
+ }
+
+ // store out the colours
+ for( int i = 0; i < 16; ++i )
+ {
+ u8 offset = 4*indices[i];
+ for( int j = 0; j < 4; ++j )
+ rgba[4*i + j] = codes[offset + j];
+ }
+}
+
+} // namespace squish
diff --git a/thirdparty/squish/colourblock.h b/thirdparty/squish/colourblock.h
new file mode 100644
index 000000000..fee2cd7c5
--- /dev/null
+++ b/thirdparty/squish/colourblock.h
@@ -0,0 +1,41 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_COLOURBLOCK_H
+#define SQUISH_COLOURBLOCK_H
+
+#include "squish.h"
+#include "maths.h"
+
+namespace squish {
+
+void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
+void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
+
+void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
+
+} // namespace squish
+
+#endif // ndef SQUISH_COLOURBLOCK_H
diff --git a/thirdparty/squish/colourfit.cpp b/thirdparty/squish/colourfit.cpp
new file mode 100644
index 000000000..e45b65655
--- /dev/null
+++ b/thirdparty/squish/colourfit.cpp
@@ -0,0 +1,54 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#include "colourfit.h"
+#include "colourset.h"
+
+namespace squish {
+
+ColourFit::ColourFit( ColourSet const* colours, int flags )
+ : m_colours( colours ),
+ m_flags( flags )
+{
+}
+
+ColourFit::~ColourFit()
+{
+}
+
+void ColourFit::Compress( void* block )
+{
+ bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 );
+ if( isDxt1 )
+ {
+ Compress3( block );
+ if( !m_colours->IsTransparent() )
+ Compress4( block );
+ }
+ else
+ Compress4( block );
+}
+
+} // namespace squish
diff --git a/thirdparty/squish/colourfit.h b/thirdparty/squish/colourfit.h
new file mode 100644
index 000000000..e73dceb2e
--- /dev/null
+++ b/thirdparty/squish/colourfit.h
@@ -0,0 +1,56 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_COLOURFIT_H
+#define SQUISH_COLOURFIT_H
+
+#include "squish.h"
+#include "maths.h"
+
+#include <climits>
+
+namespace squish {
+
+class ColourSet;
+
+class ColourFit
+{
+public:
+ ColourFit( ColourSet const* colours, int flags );
+ virtual ~ColourFit();
+
+ void Compress( void* block );
+
+protected:
+ virtual void Compress3( void* block ) = 0;
+ virtual void Compress4( void* block ) = 0;
+
+ ColourSet const* m_colours;
+ int m_flags;
+};
+
+} // namespace squish
+
+#endif // ndef SQUISH_COLOURFIT_H
diff --git a/thirdparty/squish/colourset.cpp b/thirdparty/squish/colourset.cpp
new file mode 100644
index 000000000..e90055647
--- /dev/null
+++ b/thirdparty/squish/colourset.cpp
@@ -0,0 +1,121 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#include "colourset.h"
+
+namespace squish {
+
+ColourSet::ColourSet( u8 const* rgba, int mask, int flags )
+ : m_count( 0 ),
+ m_transparent( false )
+{
+ // check the compression mode for dxt1
+ bool isDxt1 = ( ( flags & kDxt1 ) != 0 );
+ bool weightByAlpha = ( ( flags & kWeightColourByAlpha ) != 0 );
+
+ // create the minimal set
+ for( int i = 0; i < 16; ++i )
+ {
+ // check this pixel is enabled
+ int bit = 1 << i;
+ if( ( mask & bit ) == 0 )
+ {
+ m_remap[i] = -1;
+ continue;
+ }
+
+ // check for transparent pixels when using dxt1
+ if( isDxt1 && rgba[4*i + 3] < 128 )
+ {
+ m_remap[i] = -1;
+ m_transparent = true;
+ continue;
+ }
+
+ // loop over previous points for a match
+ for( int j = 0;; ++j )
+ {
+ // allocate a new point
+ if( j == i )
+ {
+ // normalise coordinates to [0,1]
+ float x = ( float )rgba[4*i] / 255.0f;
+ float y = ( float )rgba[4*i + 1] / 255.0f;
+ float z = ( float )rgba[4*i + 2] / 255.0f;
+
+ // ensure there is always non-zero weight even for zero alpha
+ float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
+
+ // add the point
+ m_points[m_count] = Vec3( x, y, z );
+ m_weights[m_count] = ( weightByAlpha ? w : 1.0f );
+ m_remap[i] = m_count;
+
+ // advance
+ ++m_count;
+ break;
+ }
+
+ // check for a match
+ int oldbit = 1 << j;
+ bool match = ( ( mask & oldbit ) != 0 )
+ && ( rgba[4*i] == rgba[4*j] )
+ && ( rgba[4*i + 1] == rgba[4*j + 1] )
+ && ( rgba[4*i + 2] == rgba[4*j + 2] )
+ && ( rgba[4*j + 3] >= 128 || !isDxt1 );
+ if( match )
+ {
+ // get the index of the match
+ int index = m_remap[j];
+
+ // ensure there is always non-zero weight even for zero alpha
+ float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
+
+ // map to this point and increase the weight
+ m_weights[index] += ( weightByAlpha ? w : 1.0f );
+ m_remap[i] = index;
+ break;
+ }
+ }
+ }
+
+ // square root the weights
+ for( int i = 0; i < m_count; ++i )
+ m_weights[i] = std::sqrt( m_weights[i] );
+}
+
+void ColourSet::RemapIndices( u8 const* source, u8* target ) const
+{
+ for( int i = 0; i < 16; ++i )
+ {
+ int j = m_remap[i];
+ if( j == -1 )
+ target[i] = 3;
+ else
+ target[i] = source[j];
+ }
+}
+
+} // namespace squish
diff --git a/thirdparty/squish/colourset.h b/thirdparty/squish/colourset.h
new file mode 100644
index 000000000..e13bb6fc3
--- /dev/null
+++ b/thirdparty/squish/colourset.h
@@ -0,0 +1,58 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_COLOURSET_H
+#define SQUISH_COLOURSET_H
+
+#include "squish.h"
+#include "maths.h"
+
+namespace squish {
+
+/*! @brief Represents a set of block colours
+*/
+class ColourSet
+{
+public:
+ ColourSet( u8 const* rgba, int mask, int flags );
+
+ int GetCount() const { return m_count; }
+ Vec3 const* GetPoints() const { return m_points; }
+ float const* GetWeights() const { return m_weights; }
+ bool IsTransparent() const { return m_transparent; }
+
+ void RemapIndices( u8 const* source, u8* target ) const;
+
+private:
+ int m_count;
+ Vec3 m_points[16];
+ float m_weights[16];
+ int m_remap[16];
+ bool m_transparent;
+};
+
+} // namespace sqish
+
+#endif // ndef SQUISH_COLOURSET_H
diff --git a/thirdparty/squish/config.h b/thirdparty/squish/config.h
new file mode 100644
index 000000000..92edefe96
--- /dev/null
+++ b/thirdparty/squish/config.h
@@ -0,0 +1,49 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_CONFIG_H
+#define SQUISH_CONFIG_H
+
+// Set to 1 when building squish to use Altivec instructions.
+#ifndef SQUISH_USE_ALTIVEC
+#define SQUISH_USE_ALTIVEC 0
+#endif
+
+// Set to 1 or 2 when building squish to use SSE or SSE2 instructions.
+#ifndef SQUISH_USE_SSE
+#define SQUISH_USE_SSE 0
+#endif
+
+// Internally set SQUISH_USE_SIMD when either Altivec or SSE is available.
+#if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE
+#error "Cannot enable both Altivec and SSE!"
+#endif
+#if SQUISH_USE_ALTIVEC || SQUISH_USE_SSE
+#define SQUISH_USE_SIMD 1
+#else
+#define SQUISH_USE_SIMD 0
+#endif
+
+#endif // ndef SQUISH_CONFIG_H
diff --git a/thirdparty/squish/maths.cpp b/thirdparty/squish/maths.cpp
new file mode 100644
index 000000000..4fa0bcfb3
--- /dev/null
+++ b/thirdparty/squish/maths.cpp
@@ -0,0 +1,259 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+/*! @file
+
+ The symmetric eigensystem solver algorithm is from
+ http://www.geometrictools.com/Documentation/EigenSymmetric3x3.pdf
+*/
+
+#include "maths.h"
+#include "simd.h"
+#include <cfloat>
+
+namespace squish {
+
+Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights )
+{
+ // compute the centroid
+ float total = 0.0f;
+ Vec3 centroid( 0.0f );
+ for( int i = 0; i < n; ++i )
+ {
+ total += weights[i];
+ centroid += weights[i]*points[i];
+ }
+ if( total > FLT_EPSILON )
+ centroid /= total;
+
+ // accumulate the covariance matrix
+ Sym3x3 covariance( 0.0f );
+ for( int i = 0; i < n; ++i )
+ {
+ Vec3 a = points[i] - centroid;
+ Vec3 b = weights[i]*a;
+
+ covariance[0] += a.X()*b.X();
+ covariance[1] += a.X()*b.Y();
+ covariance[2] += a.X()*b.Z();
+ covariance[3] += a.Y()*b.Y();
+ covariance[4] += a.Y()*b.Z();
+ covariance[5] += a.Z()*b.Z();
+ }
+
+ // return it
+ return covariance;
+}
+
+#if 0
+
+static Vec3 GetMultiplicity1Evector( Sym3x3 const& matrix, float evalue )
+{
+ // compute M
+ Sym3x3 m;
+ m[0] = matrix[0] - evalue;
+ m[1] = matrix[1];
+ m[2] = matrix[2];
+ m[3] = matrix[3] - evalue;
+ m[4] = matrix[4];
+ m[5] = matrix[5] - evalue;
+
+ // compute U
+ Sym3x3 u;
+ u[0] = m[3]*m[5] - m[4]*m[4];
+ u[1] = m[2]*m[4] - m[1]*m[5];
+ u[2] = m[1]*m[4] - m[2]*m[3];
+ u[3] = m[0]*m[5] - m[2]*m[2];
+ u[4] = m[1]*m[2] - m[4]*m[0];
+ u[5] = m[0]*m[3] - m[1]*m[1];
+
+ // find the largest component
+ float mc = std::fabs( u[0] );
+ int mi = 0;
+ for( int i = 1; i < 6; ++i )
+ {
+ float c = std::fabs( u[i] );
+ if( c > mc )
+ {
+ mc = c;
+ mi = i;
+ }
+ }
+
+ // pick the column with this component
+ switch( mi )
+ {
+ case 0:
+ return Vec3( u[0], u[1], u[2] );
+
+ case 1:
+ case 3:
+ return Vec3( u[1], u[3], u[4] );
+
+ default:
+ return Vec3( u[2], u[4], u[5] );
+ }
+}
+
+static Vec3 GetMultiplicity2Evector( Sym3x3 const& matrix, float evalue )
+{
+ // compute M
+ Sym3x3 m;
+ m[0] = matrix[0] - evalue;
+ m[1] = matrix[1];
+ m[2] = matrix[2];
+ m[3] = matrix[3] - evalue;
+ m[4] = matrix[4];
+ m[5] = matrix[5] - evalue;
+
+ // find the largest component
+ float mc = std::fabs( m[0] );
+ int mi = 0;
+ for( int i = 1; i < 6; ++i )
+ {
+ float c = std::fabs( m[i] );
+ if( c > mc )
+ {
+ mc = c;
+ mi = i;
+ }
+ }
+
+ // pick the first eigenvector based on this index
+ switch( mi )
+ {
+ case 0:
+ case 1:
+ return Vec3( -m[1], m[0], 0.0f );
+
+ case 2:
+ return Vec3( m[2], 0.0f, -m[0] );
+
+ case 3:
+ case 4:
+ return Vec3( 0.0f, -m[4], m[3] );
+
+ default:
+ return Vec3( 0.0f, -m[5], m[4] );
+ }
+}
+
+Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
+{
+ // compute the cubic coefficients
+ float c0 = matrix[0]*matrix[3]*matrix[5]
+ + 2.0f*matrix[1]*matrix[2]*matrix[4]
+ - matrix[0]*matrix[4]*matrix[4]
+ - matrix[3]*matrix[2]*matrix[2]
+ - matrix[5]*matrix[1]*matrix[1];
+ float c1 = matrix[0]*matrix[3] + matrix[0]*matrix[5] + matrix[3]*matrix[5]
+ - matrix[1]*matrix[1] - matrix[2]*matrix[2] - matrix[4]*matrix[4];
+ float c2 = matrix[0] + matrix[3] + matrix[5];
+
+ // compute the quadratic coefficients
+ float a = c1 - ( 1.0f/3.0f )*c2*c2;
+ float b = ( -2.0f/27.0f )*c2*c2*c2 + ( 1.0f/3.0f )*c1*c2 - c0;
+
+ // compute the root count check
+ float Q = 0.25f*b*b + ( 1.0f/27.0f )*a*a*a;
+
+ // test the multiplicity
+ if( FLT_EPSILON < Q )
+ {
+ // only one root, which implies we have a multiple of the identity
+ return Vec3( 1.0f );
+ }
+ else if( Q < -FLT_EPSILON )
+ {
+ // three distinct roots
+ float theta = std::atan2( std::sqrt( -Q ), -0.5f*b );
+ float rho = std::sqrt( 0.25f*b*b - Q );
+
+ float rt = std::pow( rho, 1.0f/3.0f );
+ float ct = std::cos( theta/3.0f );
+ float st = std::sin( theta/3.0f );
+
+ float l1 = ( 1.0f/3.0f )*c2 + 2.0f*rt*ct;
+ float l2 = ( 1.0f/3.0f )*c2 - rt*( ct + ( float )sqrt( 3.0f )*st );
+ float l3 = ( 1.0f/3.0f )*c2 - rt*( ct - ( float )sqrt( 3.0f )*st );
+
+ // pick the larger
+ if( std::fabs( l2 ) > std::fabs( l1 ) )
+ l1 = l2;
+ if( std::fabs( l3 ) > std::fabs( l1 ) )
+ l1 = l3;
+
+ // get the eigenvector
+ return GetMultiplicity1Evector( matrix, l1 );
+ }
+ else // if( -FLT_EPSILON <= Q && Q <= FLT_EPSILON )
+ {
+ // two roots
+ float rt;
+ if( b < 0.0f )
+ rt = -std::pow( -0.5f*b, 1.0f/3.0f );
+ else
+ rt = std::pow( 0.5f*b, 1.0f/3.0f );
+
+ float l1 = ( 1.0f/3.0f )*c2 + rt; // repeated
+ float l2 = ( 1.0f/3.0f )*c2 - 2.0f*rt;
+
+ // get the eigenvector
+ if( std::fabs( l1 ) > std::fabs( l2 ) )
+ return GetMultiplicity2Evector( matrix, l1 );
+ else
+ return GetMultiplicity1Evector( matrix, l2 );
+ }
+}
+
+#else
+
+#define POWER_ITERATION_COUNT 8
+
+Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
+{
+ Vec4 const row0( matrix[0], matrix[1], matrix[2], 0.0f );
+ Vec4 const row1( matrix[1], matrix[3], matrix[4], 0.0f );
+ Vec4 const row2( matrix[2], matrix[4], matrix[5], 0.0f );
+ Vec4 v = VEC4_CONST( 1.0f );
+ for( int i = 0; i < POWER_ITERATION_COUNT; ++i )
+ {
+ // matrix multiply
+ Vec4 w = row0*v.SplatX();
+ w = MultiplyAdd(row1, v.SplatY(), w);
+ w = MultiplyAdd(row2, v.SplatZ(), w);
+
+ // get max component from xyz in all channels
+ Vec4 a = Max(w.SplatX(), Max(w.SplatY(), w.SplatZ()));
+
+ // divide through and advance
+ v = w*Reciprocal(a);
+ }
+ return v.GetVec3();
+}
+
+#endif
+
+} // namespace squish
diff --git a/thirdparty/squish/maths.h b/thirdparty/squish/maths.h
new file mode 100644
index 000000000..59c32196b
--- /dev/null
+++ b/thirdparty/squish/maths.h
@@ -0,0 +1,233 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_MATHS_H
+#define SQUISH_MATHS_H
+
+#include <cmath>
+#include <algorithm>
+#include "config.h"
+
+namespace squish {
+
+class Vec3
+{
+public:
+ typedef Vec3 const& Arg;
+
+ Vec3()
+ {
+ }
+
+ explicit Vec3( float s )
+ {
+ m_x = s;
+ m_y = s;
+ m_z = s;
+ }
+
+ Vec3( float x, float y, float z )
+ {
+ m_x = x;
+ m_y = y;
+ m_z = z;
+ }
+
+ float X() const { return m_x; }
+ float Y() const { return m_y; }
+ float Z() const { return m_z; }
+
+ Vec3 operator-() const
+ {
+ return Vec3( -m_x, -m_y, -m_z );
+ }
+
+ Vec3& operator+=( Arg v )
+ {
+ m_x += v.m_x;
+ m_y += v.m_y;
+ m_z += v.m_z;
+ return *this;
+ }
+
+ Vec3& operator-=( Arg v )
+ {
+ m_x -= v.m_x;
+ m_y -= v.m_y;
+ m_z -= v.m_z;
+ return *this;
+ }
+
+ Vec3& operator*=( Arg v )
+ {
+ m_x *= v.m_x;
+ m_y *= v.m_y;
+ m_z *= v.m_z;
+ return *this;
+ }
+
+ Vec3& operator*=( float s )
+ {
+ m_x *= s;
+ m_y *= s;
+ m_z *= s;
+ return *this;
+ }
+
+ Vec3& operator/=( Arg v )
+ {
+ m_x /= v.m_x;
+ m_y /= v.m_y;
+ m_z /= v.m_z;
+ return *this;
+ }
+
+ Vec3& operator/=( float s )
+ {
+ float t = 1.0f/s;
+ m_x *= t;
+ m_y *= t;
+ m_z *= t;
+ return *this;
+ }
+
+ friend Vec3 operator+( Arg left, Arg right )
+ {
+ Vec3 copy( left );
+ return copy += right;
+ }
+
+ friend Vec3 operator-( Arg left, Arg right )
+ {
+ Vec3 copy( left );
+ return copy -= right;
+ }
+
+ friend Vec3 operator*( Arg left, Arg right )
+ {
+ Vec3 copy( left );
+ return copy *= right;
+ }
+
+ friend Vec3 operator*( Arg left, float right )
+ {
+ Vec3 copy( left );
+ return copy *= right;
+ }
+
+ friend Vec3 operator*( float left, Arg right )
+ {
+ Vec3 copy( right );
+ return copy *= left;
+ }
+
+ friend Vec3 operator/( Arg left, Arg right )
+ {
+ Vec3 copy( left );
+ return copy /= right;
+ }
+
+ friend Vec3 operator/( Arg left, float right )
+ {
+ Vec3 copy( left );
+ return copy /= right;
+ }
+
+ friend float Dot( Arg left, Arg right )
+ {
+ return left.m_x*right.m_x + left.m_y*right.m_y + left.m_z*right.m_z;
+ }
+
+ friend Vec3 Min( Arg left, Arg right )
+ {
+ return Vec3(
+ std::min( left.m_x, right.m_x ),
+ std::min( left.m_y, right.m_y ),
+ std::min( left.m_z, right.m_z )
+ );
+ }
+
+ friend Vec3 Max( Arg left, Arg right )
+ {
+ return Vec3(
+ std::max( left.m_x, right.m_x ),
+ std::max( left.m_y, right.m_y ),
+ std::max( left.m_z, right.m_z )
+ );
+ }
+
+ friend Vec3 Truncate( Arg v )
+ {
+ return Vec3(
+ v.m_x > 0.0f ? std::floor( v.m_x ) : std::ceil( v.m_x ),
+ v.m_y > 0.0f ? std::floor( v.m_y ) : std::ceil( v.m_y ),
+ v.m_z > 0.0f ? std::floor( v.m_z ) : std::ceil( v.m_z )
+ );
+ }
+
+private:
+ float m_x;
+ float m_y;
+ float m_z;
+};
+
+inline float LengthSquared( Vec3::Arg v )
+{
+ return Dot( v, v );
+}
+
+class Sym3x3
+{
+public:
+ Sym3x3()
+ {
+ }
+
+ Sym3x3( float s )
+ {
+ for( int i = 0; i < 6; ++i )
+ m_x[i] = s;
+ }
+
+ float operator[]( int index ) const
+ {
+ return m_x[index];
+ }
+
+ float& operator[]( int index )
+ {
+ return m_x[index];
+ }
+
+private:
+ float m_x[6];
+};
+
+Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights );
+Vec3 ComputePrincipleComponent( Sym3x3 const& matrix );
+
+} // namespace squish
+
+#endif // ndef SQUISH_MATHS_H
diff --git a/thirdparty/squish/rangefit.cpp b/thirdparty/squish/rangefit.cpp
new file mode 100644
index 000000000..adc07ed7d
--- /dev/null
+++ b/thirdparty/squish/rangefit.cpp
@@ -0,0 +1,201 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#include "rangefit.h"
+#include "colourset.h"
+#include "colourblock.h"
+#include <cfloat>
+
+namespace squish {
+
+RangeFit::RangeFit( ColourSet const* colours, int flags, float* metric )
+ : ColourFit( colours, flags )
+{
+ // initialise the metric (old perceptual = 0.2126f, 0.7152f, 0.0722f)
+ if( metric )
+ m_metric = Vec3( metric[0], metric[1], metric[2] );
+ else
+ m_metric = Vec3( 1.0f );
+
+ // initialise the best error
+ m_besterror = FLT_MAX;
+
+ // cache some values
+ int const count = m_colours->GetCount();
+ Vec3 const* values = m_colours->GetPoints();
+ float const* weights = m_colours->GetWeights();
+
+ // get the covariance matrix
+ Sym3x3 covariance = ComputeWeightedCovariance( count, values, weights );
+
+ // compute the principle component
+ Vec3 principle = ComputePrincipleComponent( covariance );
+
+ // get the min and max range as the codebook endpoints
+ Vec3 start( 0.0f );
+ Vec3 end( 0.0f );
+ if( count > 0 )
+ {
+ float min, max;
+
+ // compute the range
+ start = end = values[0];
+ min = max = Dot( values[0], principle );
+ for( int i = 1; i < count; ++i )
+ {
+ float val = Dot( values[i], principle );
+ if( val < min )
+ {
+ start = values[i];
+ min = val;
+ }
+ else if( val > max )
+ {
+ end = values[i];
+ max = val;
+ }
+ }
+ }
+
+ // clamp the output to [0, 1]
+ Vec3 const one( 1.0f );
+ Vec3 const zero( 0.0f );
+ start = Min( one, Max( zero, start ) );
+ end = Min( one, Max( zero, end ) );
+
+ // clamp to the grid and save
+ Vec3 const grid( 31.0f, 63.0f, 31.0f );
+ Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
+ Vec3 const half( 0.5f );
+ m_start = Truncate( grid*start + half )*gridrcp;
+ m_end = Truncate( grid*end + half )*gridrcp;
+}
+
+void RangeFit::Compress3( void* block )
+{
+ // cache some values
+ int const count = m_colours->GetCount();
+ Vec3 const* values = m_colours->GetPoints();
+
+ // create a codebook
+ Vec3 codes[3];
+ codes[0] = m_start;
+ codes[1] = m_end;
+ codes[2] = 0.5f*m_start + 0.5f*m_end;
+
+ // match each point to the closest code
+ u8 closest[16];
+ float error = 0.0f;
+ for( int i = 0; i < count; ++i )
+ {
+ // find the closest code
+ float dist = FLT_MAX;
+ int idx = 0;
+ for( int j = 0; j < 3; ++j )
+ {
+ float d = LengthSquared( m_metric*( values[i] - codes[j] ) );
+ if( d < dist )
+ {
+ dist = d;
+ idx = j;
+ }
+ }
+
+ // save the index
+ closest[i] = ( u8 )idx;
+
+ // accumulate the error
+ error += dist;
+ }
+
+ // save this scheme if it wins
+ if( error < m_besterror )
+ {
+ // remap the indices
+ u8 indices[16];
+ m_colours->RemapIndices( closest, indices );
+
+ // save the block
+ WriteColourBlock3( m_start, m_end, indices, block );
+
+ // save the error
+ m_besterror = error;
+ }
+}
+
+void RangeFit::Compress4( void* block )
+{
+ // cache some values
+ int const count = m_colours->GetCount();
+ Vec3 const* values = m_colours->GetPoints();
+
+ // create a codebook
+ Vec3 codes[4];
+ codes[0] = m_start;
+ codes[1] = m_end;
+ codes[2] = ( 2.0f/3.0f )*m_start + ( 1.0f/3.0f )*m_end;
+ codes[3] = ( 1.0f/3.0f )*m_start + ( 2.0f/3.0f )*m_end;
+
+ // match each point to the closest code
+ u8 closest[16];
+ float error = 0.0f;
+ for( int i = 0; i < count; ++i )
+ {
+ // find the closest code
+ float dist = FLT_MAX;
+ int idx = 0;
+ for( int j = 0; j < 4; ++j )
+ {
+ float d = LengthSquared( m_metric*( values[i] - codes[j] ) );
+ if( d < dist )
+ {
+ dist = d;
+ idx = j;
+ }
+ }
+
+ // save the index
+ closest[i] = ( u8 )idx;
+
+ // accumulate the error
+ error += dist;
+ }
+
+ // save this scheme if it wins
+ if( error < m_besterror )
+ {
+ // remap the indices
+ u8 indices[16];
+ m_colours->RemapIndices( closest, indices );
+
+ // save the block
+ WriteColourBlock4( m_start, m_end, indices, block );
+
+ // save the error
+ m_besterror = error;
+ }
+}
+
+} // namespace squish
diff --git a/thirdparty/squish/rangefit.h b/thirdparty/squish/rangefit.h
new file mode 100644
index 000000000..bdb21a900
--- /dev/null
+++ b/thirdparty/squish/rangefit.h
@@ -0,0 +1,54 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_RANGEFIT_H
+#define SQUISH_RANGEFIT_H
+
+#include "squish.h"
+#include "colourfit.h"
+#include "maths.h"
+
+namespace squish {
+
+class ColourSet;
+
+class RangeFit : public ColourFit
+{
+public:
+ RangeFit( ColourSet const* colours, int flags, float* metric );
+
+private:
+ virtual void Compress3( void* block );
+ virtual void Compress4( void* block );
+
+ Vec3 m_metric;
+ Vec3 m_start;
+ Vec3 m_end;
+ float m_besterror;
+};
+
+} // squish
+
+#endif // ndef SQUISH_RANGEFIT_H
diff --git a/thirdparty/squish/simd.h b/thirdparty/squish/simd.h
new file mode 100644
index 000000000..1e02fa160
--- /dev/null
+++ b/thirdparty/squish/simd.h
@@ -0,0 +1,40 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_SIMD_H
+#define SQUISH_SIMD_H
+
+#include "maths.h"
+
+#if SQUISH_USE_ALTIVEC
+#include "simd_ve.h"
+#elif SQUISH_USE_SSE
+#include "simd_sse.h"
+#else
+#include "simd_float.h"
+#endif
+
+
+#endif // ndef SQUISH_SIMD_H
diff --git a/thirdparty/squish/simd_float.h b/thirdparty/squish/simd_float.h
new file mode 100644
index 000000000..030ea7095
--- /dev/null
+++ b/thirdparty/squish/simd_float.h
@@ -0,0 +1,183 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_SIMD_FLOAT_H
+#define SQUISH_SIMD_FLOAT_H
+
+#include <algorithm>
+
+namespace squish {
+
+#define VEC4_CONST( X ) Vec4( X )
+
+class Vec4
+{
+public:
+ typedef Vec4 const& Arg;
+
+ Vec4() {}
+
+ explicit Vec4( float s )
+ : m_x( s ),
+ m_y( s ),
+ m_z( s ),
+ m_w( s )
+ {
+ }
+
+ Vec4( float x, float y, float z, float w )
+ : m_x( x ),
+ m_y( y ),
+ m_z( z ),
+ m_w( w )
+ {
+ }
+
+ Vec3 GetVec3() const
+ {
+ return Vec3( m_x, m_y, m_z );
+ }
+
+ Vec4 SplatX() const { return Vec4( m_x ); }
+ Vec4 SplatY() const { return Vec4( m_y ); }
+ Vec4 SplatZ() const { return Vec4( m_z ); }
+ Vec4 SplatW() const { return Vec4( m_w ); }
+
+ Vec4& operator+=( Arg v )
+ {
+ m_x += v.m_x;
+ m_y += v.m_y;
+ m_z += v.m_z;
+ m_w += v.m_w;
+ return *this;
+ }
+
+ Vec4& operator-=( Arg v )
+ {
+ m_x -= v.m_x;
+ m_y -= v.m_y;
+ m_z -= v.m_z;
+ m_w -= v.m_w;
+ return *this;
+ }
+
+ Vec4& operator*=( Arg v )
+ {
+ m_x *= v.m_x;
+ m_y *= v.m_y;
+ m_z *= v.m_z;
+ m_w *= v.m_w;
+ return *this;
+ }
+
+ friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
+ {
+ Vec4 copy( left );
+ return copy += right;
+ }
+
+ friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
+ {
+ Vec4 copy( left );
+ return copy -= right;
+ }
+
+ friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
+ {
+ Vec4 copy( left );
+ return copy *= right;
+ }
+
+ //! Returns a*b + c
+ friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
+ {
+ return a*b + c;
+ }
+
+ //! Returns -( a*b - c )
+ friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
+ {
+ return c - a*b;
+ }
+
+ friend Vec4 Reciprocal( Vec4::Arg v )
+ {
+ return Vec4(
+ 1.0f/v.m_x,
+ 1.0f/v.m_y,
+ 1.0f/v.m_z,
+ 1.0f/v.m_w
+ );
+ }
+
+ friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4(
+ std::min( left.m_x, right.m_x ),
+ std::min( left.m_y, right.m_y ),
+ std::min( left.m_z, right.m_z ),
+ std::min( left.m_w, right.m_w )
+ );
+ }
+
+ friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4(
+ std::max( left.m_x, right.m_x ),
+ std::max( left.m_y, right.m_y ),
+ std::max( left.m_z, right.m_z ),
+ std::max( left.m_w, right.m_w )
+ );
+ }
+
+ friend Vec4 Truncate( Vec4::Arg v )
+ {
+ return Vec4(
+ v.m_x > 0.0f ? std::floor( v.m_x ) : std::ceil( v.m_x ),
+ v.m_y > 0.0f ? std::floor( v.m_y ) : std::ceil( v.m_y ),
+ v.m_z > 0.0f ? std::floor( v.m_z ) : std::ceil( v.m_z ),
+ v.m_w > 0.0f ? std::floor( v.m_w ) : std::ceil( v.m_w )
+ );
+ }
+
+ friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
+ {
+ return left.m_x < right.m_x
+ || left.m_y < right.m_y
+ || left.m_z < right.m_z
+ || left.m_w < right.m_w;
+ }
+
+private:
+ float m_x;
+ float m_y;
+ float m_z;
+ float m_w;
+};
+
+} // namespace squish
+
+#endif // ndef SQUISH_SIMD_FLOAT_H
+
diff --git a/thirdparty/squish/simd_sse.h b/thirdparty/squish/simd_sse.h
new file mode 100644
index 000000000..2e8be4ca7
--- /dev/null
+++ b/thirdparty/squish/simd_sse.h
@@ -0,0 +1,180 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_SIMD_SSE_H
+#define SQUISH_SIMD_SSE_H
+
+#include <xmmintrin.h>
+#if ( SQUISH_USE_SSE > 1 )
+#include <emmintrin.h>
+#endif
+
+#define SQUISH_SSE_SPLAT( a ) \
+ ( ( a ) | ( ( a ) << 2 ) | ( ( a ) << 4 ) | ( ( a ) << 6 ) )
+
+#define SQUISH_SSE_SHUF( x, y, z, w ) \
+ ( ( x ) | ( ( y ) << 2 ) | ( ( z ) << 4 ) | ( ( w ) << 6 ) )
+
+namespace squish {
+
+#define VEC4_CONST( X ) Vec4( X )
+
+class Vec4
+{
+public:
+ typedef Vec4 const& Arg;
+
+ Vec4() {}
+
+ explicit Vec4( __m128 v ) : m_v( v ) {}
+
+ Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {}
+
+ Vec4& operator=( Vec4 const& arg )
+ {
+ m_v = arg.m_v;
+ return *this;
+ }
+
+ explicit Vec4( float s ) : m_v( _mm_set1_ps( s ) ) {}
+
+ Vec4( float x, float y, float z, float w ) : m_v( _mm_setr_ps( x, y, z, w ) ) {}
+
+ Vec3 GetVec3() const
+ {
+#ifdef __GNUC__
+ __attribute__ ((__aligned__ (16))) float c[4];
+#else
+ __declspec(align(16)) float c[4];
+#endif
+ _mm_store_ps( c, m_v );
+ return Vec3( c[0], c[1], c[2] );
+ }
+
+ Vec4 SplatX() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 0 ) ) ); }
+ Vec4 SplatY() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 1 ) ) ); }
+ Vec4 SplatZ() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 2 ) ) ); }
+ Vec4 SplatW() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 3 ) ) ); }
+
+ Vec4& operator+=( Arg v )
+ {
+ m_v = _mm_add_ps( m_v, v.m_v );
+ return *this;
+ }
+
+ Vec4& operator-=( Arg v )
+ {
+ m_v = _mm_sub_ps( m_v, v.m_v );
+ return *this;
+ }
+
+ Vec4& operator*=( Arg v )
+ {
+ m_v = _mm_mul_ps( m_v, v.m_v );
+ return *this;
+ }
+
+ friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( _mm_add_ps( left.m_v, right.m_v ) );
+ }
+
+ friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( _mm_sub_ps( left.m_v, right.m_v ) );
+ }
+
+ friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( _mm_mul_ps( left.m_v, right.m_v ) );
+ }
+
+ //! Returns a*b + c
+ friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
+ {
+ return Vec4( _mm_add_ps( _mm_mul_ps( a.m_v, b.m_v ), c.m_v ) );
+ }
+
+ //! Returns -( a*b - c )
+ friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
+ {
+ return Vec4( _mm_sub_ps( c.m_v, _mm_mul_ps( a.m_v, b.m_v ) ) );
+ }
+
+ friend Vec4 Reciprocal( Vec4::Arg v )
+ {
+ // get the reciprocal estimate
+ __m128 estimate = _mm_rcp_ps( v.m_v );
+
+ // one round of Newton-Rhaphson refinement
+ __m128 diff = _mm_sub_ps( _mm_set1_ps( 1.0f ), _mm_mul_ps( estimate, v.m_v ) );
+ return Vec4( _mm_add_ps( _mm_mul_ps( diff, estimate ), estimate ) );
+ }
+
+ friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( _mm_min_ps( left.m_v, right.m_v ) );
+ }
+
+ friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( _mm_max_ps( left.m_v, right.m_v ) );
+ }
+
+ friend Vec4 Truncate( Vec4::Arg v )
+ {
+#if ( SQUISH_USE_SSE == 1 )
+ // convert to ints
+ __m128 input = v.m_v;
+ __m64 lo = _mm_cvttps_pi32( input );
+ __m64 hi = _mm_cvttps_pi32( _mm_movehl_ps( input, input ) );
+
+ // convert to floats
+ __m128 part = _mm_movelh_ps( input, _mm_cvtpi32_ps( input, hi ) );
+ __m128 truncated = _mm_cvtpi32_ps( part, lo );
+
+ // clear out the MMX multimedia state to allow FP calls later
+ _mm_empty();
+ return Vec4( truncated );
+#else
+ // use SSE2 instructions
+ return Vec4( _mm_cvtepi32_ps( _mm_cvttps_epi32( v.m_v ) ) );
+#endif
+ }
+
+ friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
+ {
+ __m128 bits = _mm_cmplt_ps( left.m_v, right.m_v );
+ int value = _mm_movemask_ps( bits );
+ return value != 0;
+ }
+
+private:
+ __m128 m_v;
+};
+
+} // namespace squish
+
+#endif // ndef SQUISH_SIMD_SSE_H
diff --git a/thirdparty/squish/simd_ve.h b/thirdparty/squish/simd_ve.h
new file mode 100644
index 000000000..08a153750
--- /dev/null
+++ b/thirdparty/squish/simd_ve.h
@@ -0,0 +1,166 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_SIMD_VE_H
+#define SQUISH_SIMD_VE_H
+
+#include <altivec.h>
+#undef bool
+
+namespace squish {
+
+#define VEC4_CONST( X ) Vec4( ( vector float ){ X } )
+
+class Vec4
+{
+public:
+ typedef Vec4 Arg;
+
+ Vec4() {}
+
+ explicit Vec4( vector float v ) : m_v( v ) {}
+
+ Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {}
+
+ Vec4& operator=( Vec4 const& arg )
+ {
+ m_v = arg.m_v;
+ return *this;
+ }
+
+ explicit Vec4( float s )
+ {
+ union { vector float v; float c[4]; } u;
+ u.c[0] = s;
+ u.c[1] = s;
+ u.c[2] = s;
+ u.c[3] = s;
+ m_v = u.v;
+ }
+
+ Vec4( float x, float y, float z, float w )
+ {
+ union { vector float v; float c[4]; } u;
+ u.c[0] = x;
+ u.c[1] = y;
+ u.c[2] = z;
+ u.c[3] = w;
+ m_v = u.v;
+ }
+
+ Vec3 GetVec3() const
+ {
+ union { vector float v; float c[4]; } u;
+ u.v = m_v;
+ return Vec3( u.c[0], u.c[1], u.c[2] );
+ }
+
+ Vec4 SplatX() const { return Vec4( vec_splat( m_v, 0 ) ); }
+ Vec4 SplatY() const { return Vec4( vec_splat( m_v, 1 ) ); }
+ Vec4 SplatZ() const { return Vec4( vec_splat( m_v, 2 ) ); }
+ Vec4 SplatW() const { return Vec4( vec_splat( m_v, 3 ) ); }
+
+ Vec4& operator+=( Arg v )
+ {
+ m_v = vec_add( m_v, v.m_v );
+ return *this;
+ }
+
+ Vec4& operator-=( Arg v )
+ {
+ m_v = vec_sub( m_v, v.m_v );
+ return *this;
+ }
+
+ Vec4& operator*=( Arg v )
+ {
+ m_v = vec_madd( m_v, v.m_v, ( vector float ){ -0.0f } );
+ return *this;
+ }
+
+ friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( vec_add( left.m_v, right.m_v ) );
+ }
+
+ friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( vec_sub( left.m_v, right.m_v ) );
+ }
+
+ friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( vec_madd( left.m_v, right.m_v, ( vector float ){ -0.0f } ) );
+ }
+
+ //! Returns a*b + c
+ friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
+ {
+ return Vec4( vec_madd( a.m_v, b.m_v, c.m_v ) );
+ }
+
+ //! Returns -( a*b - c )
+ friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
+ {
+ return Vec4( vec_nmsub( a.m_v, b.m_v, c.m_v ) );
+ }
+
+ friend Vec4 Reciprocal( Vec4::Arg v )
+ {
+ // get the reciprocal estimate
+ vector float estimate = vec_re( v.m_v );
+
+ // one round of Newton-Rhaphson refinement
+ vector float diff = vec_nmsub( estimate, v.m_v, ( vector float ){ 1.0f } );
+ return Vec4( vec_madd( diff, estimate, estimate ) );
+ }
+
+ friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( vec_min( left.m_v, right.m_v ) );
+ }
+
+ friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
+ {
+ return Vec4( vec_max( left.m_v, right.m_v ) );
+ }
+
+ friend Vec4 Truncate( Vec4::Arg v )
+ {
+ return Vec4( vec_trunc( v.m_v ) );
+ }
+
+ friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
+ {
+ return vec_any_lt( left.m_v, right.m_v ) != 0;
+ }
+
+private:
+ vector float m_v;
+};
+
+} // namespace squish
+
+#endif // ndef SQUISH_SIMD_VE_H
diff --git a/thirdparty/squish/singlecolourfit.cpp b/thirdparty/squish/singlecolourfit.cpp
new file mode 100644
index 000000000..cef0ebc41
--- /dev/null
+++ b/thirdparty/squish/singlecolourfit.cpp
@@ -0,0 +1,172 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#include "singlecolourfit.h"
+#include "colourset.h"
+#include "colourblock.h"
+
+namespace squish {
+
+struct SourceBlock
+{
+ u8 start;
+ u8 end;
+ u8 error;
+};
+
+struct SingleColourLookup
+{
+ SourceBlock sources[2];
+};
+
+#include "singlecolourlookup.inl"
+
+static int FloatToInt( float a, int limit )
+{
+ // use ANSI round-to-zero behaviour to get round-to-nearest
+ int i = ( int )( a + 0.5f );
+
+ // clamp to the limit
+ if( i < 0 )
+ i = 0;
+ else if( i > limit )
+ i = limit;
+
+ // done
+ return i;
+}
+
+SingleColourFit::SingleColourFit( ColourSet const* colours, int flags )
+ : ColourFit( colours, flags )
+{
+ // grab the single colour
+ Vec3 const* values = m_colours->GetPoints();
+ m_colour[0] = ( u8 )FloatToInt( 255.0f*values->X(), 255 );
+ m_colour[1] = ( u8 )FloatToInt( 255.0f*values->Y(), 255 );
+ m_colour[2] = ( u8 )FloatToInt( 255.0f*values->Z(), 255 );
+
+ // initialise the best error
+ m_besterror = INT_MAX;
+}
+
+void SingleColourFit::Compress3( void* block )
+{
+ // build the table of lookups
+ SingleColourLookup const* const lookups[] =
+ {
+ lookup_5_3,
+ lookup_6_3,
+ lookup_5_3
+ };
+
+ // find the best end-points and index
+ ComputeEndPoints( lookups );
+
+ // build the block if we win
+ if( m_error < m_besterror )
+ {
+ // remap the indices
+ u8 indices[16];
+ m_colours->RemapIndices( &m_index, indices );
+
+ // save the block
+ WriteColourBlock3( m_start, m_end, indices, block );
+
+ // save the error
+ m_besterror = m_error;
+ }
+}
+
+void SingleColourFit::Compress4( void* block )
+{
+ // build the table of lookups
+ SingleColourLookup const* const lookups[] =
+ {
+ lookup_5_4,
+ lookup_6_4,
+ lookup_5_4
+ };
+
+ // find the best end-points and index
+ ComputeEndPoints( lookups );
+
+ // build the block if we win
+ if( m_error < m_besterror )
+ {
+ // remap the indices
+ u8 indices[16];
+ m_colours->RemapIndices( &m_index, indices );
+
+ // save the block
+ WriteColourBlock4( m_start, m_end, indices, block );
+
+ // save the error
+ m_besterror = m_error;
+ }
+}
+
+void SingleColourFit::ComputeEndPoints( SingleColourLookup const* const* lookups )
+{
+ // check each index combination (endpoint or intermediate)
+ m_error = INT_MAX;
+ for( int index = 0; index < 2; ++index )
+ {
+ // check the error for this codebook index
+ SourceBlock const* sources[3];
+ int error = 0;
+ for( int channel = 0; channel < 3; ++channel )
+ {
+ // grab the lookup table and index for this channel
+ SingleColourLookup const* lookup = lookups[channel];
+ int target = m_colour[channel];
+
+ // store a pointer to the source for this channel
+ sources[channel] = lookup[target].sources + index;
+
+ // accumulate the error
+ int diff = sources[channel]->error;
+ error += diff*diff;
+ }
+
+ // keep it if the error is lower
+ if( error < m_error )
+ {
+ m_start = Vec3(
+ ( float )sources[0]->start/31.0f,
+ ( float )sources[1]->start/63.0f,
+ ( float )sources[2]->start/31.0f
+ );
+ m_end = Vec3(
+ ( float )sources[0]->end/31.0f,
+ ( float )sources[1]->end/63.0f,
+ ( float )sources[2]->end/31.0f
+ );
+ m_index = ( u8 )( 2*index );
+ m_error = error;
+ }
+ }
+}
+
+} // namespace squish
diff --git a/thirdparty/squish/singlecolourfit.h b/thirdparty/squish/singlecolourfit.h
new file mode 100644
index 000000000..974ce7725
--- /dev/null
+++ b/thirdparty/squish/singlecolourfit.h
@@ -0,0 +1,58 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_SINGLECOLOURFIT_H
+#define SQUISH_SINGLECOLOURFIT_H
+
+#include "squish.h"
+#include "colourfit.h"
+
+namespace squish {
+
+class ColourSet;
+struct SingleColourLookup;
+
+class SingleColourFit : public ColourFit
+{
+public:
+ SingleColourFit( ColourSet const* colours, int flags );
+
+private:
+ virtual void Compress3( void* block );
+ virtual void Compress4( void* block );
+
+ void ComputeEndPoints( SingleColourLookup const* const* lookups );
+
+ u8 m_colour[3];
+ Vec3 m_start;
+ Vec3 m_end;
+ u8 m_index;
+ int m_error;
+ int m_besterror;
+};
+
+} // namespace squish
+
+#endif // ndef SQUISH_SINGLECOLOURFIT_H
diff --git a/thirdparty/squish/singlecolourlookup.inl b/thirdparty/squish/singlecolourlookup.inl
new file mode 100644
index 000000000..5b44a1e5e
--- /dev/null
+++ b/thirdparty/squish/singlecolourlookup.inl
@@ -0,0 +1,1064 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+static SingleColourLookup const lookup_5_3[] =
+{
+ { { { 0, 0, 0 }, { 0, 0, 0 } } },
+ { { { 0, 0, 1 }, { 0, 0, 1 } } },
+ { { { 0, 0, 2 }, { 0, 0, 2 } } },
+ { { { 0, 0, 3 }, { 0, 1, 1 } } },
+ { { { 0, 0, 4 }, { 0, 1, 0 } } },
+ { { { 1, 0, 3 }, { 0, 1, 1 } } },
+ { { { 1, 0, 2 }, { 0, 1, 2 } } },
+ { { { 1, 0, 1 }, { 0, 2, 1 } } },
+ { { { 1, 0, 0 }, { 0, 2, 0 } } },
+ { { { 1, 0, 1 }, { 0, 2, 1 } } },
+ { { { 1, 0, 2 }, { 0, 2, 2 } } },
+ { { { 1, 0, 3 }, { 0, 3, 1 } } },
+ { { { 1, 0, 4 }, { 0, 3, 0 } } },
+ { { { 2, 0, 3 }, { 0, 3, 1 } } },
+ { { { 2, 0, 2 }, { 0, 3, 2 } } },
+ { { { 2, 0, 1 }, { 0, 4, 1 } } },
+ { { { 2, 0, 0 }, { 0, 4, 0 } } },
+ { { { 2, 0, 1 }, { 0, 4, 1 } } },
+ { { { 2, 0, 2 }, { 0, 4, 2 } } },
+ { { { 2, 0, 3 }, { 0, 5, 1 } } },
+ { { { 2, 0, 4 }, { 0, 5, 0 } } },
+ { { { 3, 0, 3 }, { 0, 5, 1 } } },
+ { { { 3, 0, 2 }, { 0, 5, 2 } } },
+ { { { 3, 0, 1 }, { 0, 6, 1 } } },
+ { { { 3, 0, 0 }, { 0, 6, 0 } } },
+ { { { 3, 0, 1 }, { 0, 6, 1 } } },
+ { { { 3, 0, 2 }, { 0, 6, 2 } } },
+ { { { 3, 0, 3 }, { 0, 7, 1 } } },
+ { { { 3, 0, 4 }, { 0, 7, 0 } } },
+ { { { 4, 0, 4 }, { 0, 7, 1 } } },
+ { { { 4, 0, 3 }, { 0, 7, 2 } } },
+ { { { 4, 0, 2 }, { 1, 7, 1 } } },
+ { { { 4, 0, 1 }, { 1, 7, 0 } } },
+ { { { 4, 0, 0 }, { 0, 8, 0 } } },
+ { { { 4, 0, 1 }, { 0, 8, 1 } } },
+ { { { 4, 0, 2 }, { 2, 7, 1 } } },
+ { { { 4, 0, 3 }, { 2, 7, 0 } } },
+ { { { 4, 0, 4 }, { 0, 9, 0 } } },
+ { { { 5, 0, 3 }, { 0, 9, 1 } } },
+ { { { 5, 0, 2 }, { 3, 7, 1 } } },
+ { { { 5, 0, 1 }, { 3, 7, 0 } } },
+ { { { 5, 0, 0 }, { 0, 10, 0 } } },
+ { { { 5, 0, 1 }, { 0, 10, 1 } } },
+ { { { 5, 0, 2 }, { 0, 10, 2 } } },
+ { { { 5, 0, 3 }, { 0, 11, 1 } } },
+ { { { 5, 0, 4 }, { 0, 11, 0 } } },
+ { { { 6, 0, 3 }, { 0, 11, 1 } } },
+ { { { 6, 0, 2 }, { 0, 11, 2 } } },
+ { { { 6, 0, 1 }, { 0, 12, 1 } } },
+ { { { 6, 0, 0 }, { 0, 12, 0 } } },
+ { { { 6, 0, 1 }, { 0, 12, 1 } } },
+ { { { 6, 0, 2 }, { 0, 12, 2 } } },
+ { { { 6, 0, 3 }, { 0, 13, 1 } } },
+ { { { 6, 0, 4 }, { 0, 13, 0 } } },
+ { { { 7, 0, 3 }, { 0, 13, 1 } } },
+ { { { 7, 0, 2 }, { 0, 13, 2 } } },
+ { { { 7, 0, 1 }, { 0, 14, 1 } } },
+ { { { 7, 0, 0 }, { 0, 14, 0 } } },
+ { { { 7, 0, 1 }, { 0, 14, 1 } } },
+ { { { 7, 0, 2 }, { 0, 14, 2 } } },
+ { { { 7, 0, 3 }, { 0, 15, 1 } } },
+ { { { 7, 0, 4 }, { 0, 15, 0 } } },
+ { { { 8, 0, 4 }, { 0, 15, 1 } } },
+ { { { 8, 0, 3 }, { 0, 15, 2 } } },
+ { { { 8, 0, 2 }, { 1, 15, 1 } } },
+ { { { 8, 0, 1 }, { 1, 15, 0 } } },
+ { { { 8, 0, 0 }, { 0, 16, 0 } } },
+ { { { 8, 0, 1 }, { 0, 16, 1 } } },
+ { { { 8, 0, 2 }, { 2, 15, 1 } } },
+ { { { 8, 0, 3 }, { 2, 15, 0 } } },
+ { { { 8, 0, 4 }, { 0, 17, 0 } } },
+ { { { 9, 0, 3 }, { 0, 17, 1 } } },
+ { { { 9, 0, 2 }, { 3, 15, 1 } } },
+ { { { 9, 0, 1 }, { 3, 15, 0 } } },
+ { { { 9, 0, 0 }, { 0, 18, 0 } } },
+ { { { 9, 0, 1 }, { 0, 18, 1 } } },
+ { { { 9, 0, 2 }, { 0, 18, 2 } } },
+ { { { 9, 0, 3 }, { 0, 19, 1 } } },
+ { { { 9, 0, 4 }, { 0, 19, 0 } } },
+ { { { 10, 0, 3 }, { 0, 19, 1 } } },
+ { { { 10, 0, 2 }, { 0, 19, 2 } } },
+ { { { 10, 0, 1 }, { 0, 20, 1 } } },
+ { { { 10, 0, 0 }, { 0, 20, 0 } } },
+ { { { 10, 0, 1 }, { 0, 20, 1 } } },
+ { { { 10, 0, 2 }, { 0, 20, 2 } } },
+ { { { 10, 0, 3 }, { 0, 21, 1 } } },
+ { { { 10, 0, 4 }, { 0, 21, 0 } } },
+ { { { 11, 0, 3 }, { 0, 21, 1 } } },
+ { { { 11, 0, 2 }, { 0, 21, 2 } } },
+ { { { 11, 0, 1 }, { 0, 22, 1 } } },
+ { { { 11, 0, 0 }, { 0, 22, 0 } } },
+ { { { 11, 0, 1 }, { 0, 22, 1 } } },
+ { { { 11, 0, 2 }, { 0, 22, 2 } } },
+ { { { 11, 0, 3 }, { 0, 23, 1 } } },
+ { { { 11, 0, 4 }, { 0, 23, 0 } } },
+ { { { 12, 0, 4 }, { 0, 23, 1 } } },
+ { { { 12, 0, 3 }, { 0, 23, 2 } } },
+ { { { 12, 0, 2 }, { 1, 23, 1 } } },
+ { { { 12, 0, 1 }, { 1, 23, 0 } } },
+ { { { 12, 0, 0 }, { 0, 24, 0 } } },
+ { { { 12, 0, 1 }, { 0, 24, 1 } } },
+ { { { 12, 0, 2 }, { 2, 23, 1 } } },
+ { { { 12, 0, 3 }, { 2, 23, 0 } } },
+ { { { 12, 0, 4 }, { 0, 25, 0 } } },
+ { { { 13, 0, 3 }, { 0, 25, 1 } } },
+ { { { 13, 0, 2 }, { 3, 23, 1 } } },
+ { { { 13, 0, 1 }, { 3, 23, 0 } } },
+ { { { 13, 0, 0 }, { 0, 26, 0 } } },
+ { { { 13, 0, 1 }, { 0, 26, 1 } } },
+ { { { 13, 0, 2 }, { 0, 26, 2 } } },
+ { { { 13, 0, 3 }, { 0, 27, 1 } } },
+ { { { 13, 0, 4 }, { 0, 27, 0 } } },
+ { { { 14, 0, 3 }, { 0, 27, 1 } } },
+ { { { 14, 0, 2 }, { 0, 27, 2 } } },
+ { { { 14, 0, 1 }, { 0, 28, 1 } } },
+ { { { 14, 0, 0 }, { 0, 28, 0 } } },
+ { { { 14, 0, 1 }, { 0, 28, 1 } } },
+ { { { 14, 0, 2 }, { 0, 28, 2 } } },
+ { { { 14, 0, 3 }, { 0, 29, 1 } } },
+ { { { 14, 0, 4 }, { 0, 29, 0 } } },
+ { { { 15, 0, 3 }, { 0, 29, 1 } } },
+ { { { 15, 0, 2 }, { 0, 29, 2 } } },
+ { { { 15, 0, 1 }, { 0, 30, 1 } } },
+ { { { 15, 0, 0 }, { 0, 30, 0 } } },
+ { { { 15, 0, 1 }, { 0, 30, 1 } } },
+ { { { 15, 0, 2 }, { 0, 30, 2 } } },
+ { { { 15, 0, 3 }, { 0, 31, 1 } } },
+ { { { 15, 0, 4 }, { 0, 31, 0 } } },
+ { { { 16, 0, 4 }, { 0, 31, 1 } } },
+ { { { 16, 0, 3 }, { 0, 31, 2 } } },
+ { { { 16, 0, 2 }, { 1, 31, 1 } } },
+ { { { 16, 0, 1 }, { 1, 31, 0 } } },
+ { { { 16, 0, 0 }, { 4, 28, 0 } } },
+ { { { 16, 0, 1 }, { 4, 28, 1 } } },
+ { { { 16, 0, 2 }, { 2, 31, 1 } } },
+ { { { 16, 0, 3 }, { 2, 31, 0 } } },
+ { { { 16, 0, 4 }, { 4, 29, 0 } } },
+ { { { 17, 0, 3 }, { 4, 29, 1 } } },
+ { { { 17, 0, 2 }, { 3, 31, 1 } } },
+ { { { 17, 0, 1 }, { 3, 31, 0 } } },
+ { { { 17, 0, 0 }, { 4, 30, 0 } } },
+ { { { 17, 0, 1 }, { 4, 30, 1 } } },
+ { { { 17, 0, 2 }, { 4, 30, 2 } } },
+ { { { 17, 0, 3 }, { 4, 31, 1 } } },
+ { { { 17, 0, 4 }, { 4, 31, 0 } } },
+ { { { 18, 0, 3 }, { 4, 31, 1 } } },
+ { { { 18, 0, 2 }, { 4, 31, 2 } } },
+ { { { 18, 0, 1 }, { 5, 31, 1 } } },
+ { { { 18, 0, 0 }, { 5, 31, 0 } } },
+ { { { 18, 0, 1 }, { 5, 31, 1 } } },
+ { { { 18, 0, 2 }, { 5, 31, 2 } } },
+ { { { 18, 0, 3 }, { 6, 31, 1 } } },
+ { { { 18, 0, 4 }, { 6, 31, 0 } } },
+ { { { 19, 0, 3 }, { 6, 31, 1 } } },
+ { { { 19, 0, 2 }, { 6, 31, 2 } } },
+ { { { 19, 0, 1 }, { 7, 31, 1 } } },
+ { { { 19, 0, 0 }, { 7, 31, 0 } } },
+ { { { 19, 0, 1 }, { 7, 31, 1 } } },
+ { { { 19, 0, 2 }, { 7, 31, 2 } } },
+ { { { 19, 0, 3 }, { 8, 31, 1 } } },
+ { { { 19, 0, 4 }, { 8, 31, 0 } } },
+ { { { 20, 0, 4 }, { 8, 31, 1 } } },
+ { { { 20, 0, 3 }, { 8, 31, 2 } } },
+ { { { 20, 0, 2 }, { 9, 31, 1 } } },
+ { { { 20, 0, 1 }, { 9, 31, 0 } } },
+ { { { 20, 0, 0 }, { 12, 28, 0 } } },
+ { { { 20, 0, 1 }, { 12, 28, 1 } } },
+ { { { 20, 0, 2 }, { 10, 31, 1 } } },
+ { { { 20, 0, 3 }, { 10, 31, 0 } } },
+ { { { 20, 0, 4 }, { 12, 29, 0 } } },
+ { { { 21, 0, 3 }, { 12, 29, 1 } } },
+ { { { 21, 0, 2 }, { 11, 31, 1 } } },
+ { { { 21, 0, 1 }, { 11, 31, 0 } } },
+ { { { 21, 0, 0 }, { 12, 30, 0 } } },
+ { { { 21, 0, 1 }, { 12, 30, 1 } } },
+ { { { 21, 0, 2 }, { 12, 30, 2 } } },
+ { { { 21, 0, 3 }, { 12, 31, 1 } } },
+ { { { 21, 0, 4 }, { 12, 31, 0 } } },
+ { { { 22, 0, 3 }, { 12, 31, 1 } } },
+ { { { 22, 0, 2 }, { 12, 31, 2 } } },
+ { { { 22, 0, 1 }, { 13, 31, 1 } } },
+ { { { 22, 0, 0 }, { 13, 31, 0 } } },
+ { { { 22, 0, 1 }, { 13, 31, 1 } } },
+ { { { 22, 0, 2 }, { 13, 31, 2 } } },
+ { { { 22, 0, 3 }, { 14, 31, 1 } } },
+ { { { 22, 0, 4 }, { 14, 31, 0 } } },
+ { { { 23, 0, 3 }, { 14, 31, 1 } } },
+ { { { 23, 0, 2 }, { 14, 31, 2 } } },
+ { { { 23, 0, 1 }, { 15, 31, 1 } } },
+ { { { 23, 0, 0 }, { 15, 31, 0 } } },
+ { { { 23, 0, 1 }, { 15, 31, 1 } } },
+ { { { 23, 0, 2 }, { 15, 31, 2 } } },
+ { { { 23, 0, 3 }, { 16, 31, 1 } } },
+ { { { 23, 0, 4 }, { 16, 31, 0 } } },
+ { { { 24, 0, 4 }, { 16, 31, 1 } } },
+ { { { 24, 0, 3 }, { 16, 31, 2 } } },
+ { { { 24, 0, 2 }, { 17, 31, 1 } } },
+ { { { 24, 0, 1 }, { 17, 31, 0 } } },
+ { { { 24, 0, 0 }, { 20, 28, 0 } } },
+ { { { 24, 0, 1 }, { 20, 28, 1 } } },
+ { { { 24, 0, 2 }, { 18, 31, 1 } } },
+ { { { 24, 0, 3 }, { 18, 31, 0 } } },
+ { { { 24, 0, 4 }, { 20, 29, 0 } } },
+ { { { 25, 0, 3 }, { 20, 29, 1 } } },
+ { { { 25, 0, 2 }, { 19, 31, 1 } } },
+ { { { 25, 0, 1 }, { 19, 31, 0 } } },
+ { { { 25, 0, 0 }, { 20, 30, 0 } } },
+ { { { 25, 0, 1 }, { 20, 30, 1 } } },
+ { { { 25, 0, 2 }, { 20, 30, 2 } } },
+ { { { 25, 0, 3 }, { 20, 31, 1 } } },
+ { { { 25, 0, 4 }, { 20, 31, 0 } } },
+ { { { 26, 0, 3 }, { 20, 31, 1 } } },
+ { { { 26, 0, 2 }, { 20, 31, 2 } } },
+ { { { 26, 0, 1 }, { 21, 31, 1 } } },
+ { { { 26, 0, 0 }, { 21, 31, 0 } } },
+ { { { 26, 0, 1 }, { 21, 31, 1 } } },
+ { { { 26, 0, 2 }, { 21, 31, 2 } } },
+ { { { 26, 0, 3 }, { 22, 31, 1 } } },
+ { { { 26, 0, 4 }, { 22, 31, 0 } } },
+ { { { 27, 0, 3 }, { 22, 31, 1 } } },
+ { { { 27, 0, 2 }, { 22, 31, 2 } } },
+ { { { 27, 0, 1 }, { 23, 31, 1 } } },
+ { { { 27, 0, 0 }, { 23, 31, 0 } } },
+ { { { 27, 0, 1 }, { 23, 31, 1 } } },
+ { { { 27, 0, 2 }, { 23, 31, 2 } } },
+ { { { 27, 0, 3 }, { 24, 31, 1 } } },
+ { { { 27, 0, 4 }, { 24, 31, 0 } } },
+ { { { 28, 0, 4 }, { 24, 31, 1 } } },
+ { { { 28, 0, 3 }, { 24, 31, 2 } } },
+ { { { 28, 0, 2 }, { 25, 31, 1 } } },
+ { { { 28, 0, 1 }, { 25, 31, 0 } } },
+ { { { 28, 0, 0 }, { 28, 28, 0 } } },
+ { { { 28, 0, 1 }, { 28, 28, 1 } } },
+ { { { 28, 0, 2 }, { 26, 31, 1 } } },
+ { { { 28, 0, 3 }, { 26, 31, 0 } } },
+ { { { 28, 0, 4 }, { 28, 29, 0 } } },
+ { { { 29, 0, 3 }, { 28, 29, 1 } } },
+ { { { 29, 0, 2 }, { 27, 31, 1 } } },
+ { { { 29, 0, 1 }, { 27, 31, 0 } } },
+ { { { 29, 0, 0 }, { 28, 30, 0 } } },
+ { { { 29, 0, 1 }, { 28, 30, 1 } } },
+ { { { 29, 0, 2 }, { 28, 30, 2 } } },
+ { { { 29, 0, 3 }, { 28, 31, 1 } } },
+ { { { 29, 0, 4 }, { 28, 31, 0 } } },
+ { { { 30, 0, 3 }, { 28, 31, 1 } } },
+ { { { 30, 0, 2 }, { 28, 31, 2 } } },
+ { { { 30, 0, 1 }, { 29, 31, 1 } } },
+ { { { 30, 0, 0 }, { 29, 31, 0 } } },
+ { { { 30, 0, 1 }, { 29, 31, 1 } } },
+ { { { 30, 0, 2 }, { 29, 31, 2 } } },
+ { { { 30, 0, 3 }, { 30, 31, 1 } } },
+ { { { 30, 0, 4 }, { 30, 31, 0 } } },
+ { { { 31, 0, 3 }, { 30, 31, 1 } } },
+ { { { 31, 0, 2 }, { 30, 31, 2 } } },
+ { { { 31, 0, 1 }, { 31, 31, 1 } } },
+ { { { 31, 0, 0 }, { 31, 31, 0 } } }
+};
+
+static SingleColourLookup const lookup_6_3[] =
+{
+ { { { 0, 0, 0 }, { 0, 0, 0 } } },
+ { { { 0, 0, 1 }, { 0, 1, 1 } } },
+ { { { 0, 0, 2 }, { 0, 1, 0 } } },
+ { { { 1, 0, 1 }, { 0, 2, 1 } } },
+ { { { 1, 0, 0 }, { 0, 2, 0 } } },
+ { { { 1, 0, 1 }, { 0, 3, 1 } } },
+ { { { 1, 0, 2 }, { 0, 3, 0 } } },
+ { { { 2, 0, 1 }, { 0, 4, 1 } } },
+ { { { 2, 0, 0 }, { 0, 4, 0 } } },
+ { { { 2, 0, 1 }, { 0, 5, 1 } } },
+ { { { 2, 0, 2 }, { 0, 5, 0 } } },
+ { { { 3, 0, 1 }, { 0, 6, 1 } } },
+ { { { 3, 0, 0 }, { 0, 6, 0 } } },
+ { { { 3, 0, 1 }, { 0, 7, 1 } } },
+ { { { 3, 0, 2 }, { 0, 7, 0 } } },
+ { { { 4, 0, 1 }, { 0, 8, 1 } } },
+ { { { 4, 0, 0 }, { 0, 8, 0 } } },
+ { { { 4, 0, 1 }, { 0, 9, 1 } } },
+ { { { 4, 0, 2 }, { 0, 9, 0 } } },
+ { { { 5, 0, 1 }, { 0, 10, 1 } } },
+ { { { 5, 0, 0 }, { 0, 10, 0 } } },
+ { { { 5, 0, 1 }, { 0, 11, 1 } } },
+ { { { 5, 0, 2 }, { 0, 11, 0 } } },
+ { { { 6, 0, 1 }, { 0, 12, 1 } } },
+ { { { 6, 0, 0 }, { 0, 12, 0 } } },
+ { { { 6, 0, 1 }, { 0, 13, 1 } } },
+ { { { 6, 0, 2 }, { 0, 13, 0 } } },
+ { { { 7, 0, 1 }, { 0, 14, 1 } } },
+ { { { 7, 0, 0 }, { 0, 14, 0 } } },
+ { { { 7, 0, 1 }, { 0, 15, 1 } } },
+ { { { 7, 0, 2 }, { 0, 15, 0 } } },
+ { { { 8, 0, 1 }, { 0, 16, 1 } } },
+ { { { 8, 0, 0 }, { 0, 16, 0 } } },
+ { { { 8, 0, 1 }, { 0, 17, 1 } } },
+ { { { 8, 0, 2 }, { 0, 17, 0 } } },
+ { { { 9, 0, 1 }, { 0, 18, 1 } } },
+ { { { 9, 0, 0 }, { 0, 18, 0 } } },
+ { { { 9, 0, 1 }, { 0, 19, 1 } } },
+ { { { 9, 0, 2 }, { 0, 19, 0 } } },
+ { { { 10, 0, 1 }, { 0, 20, 1 } } },
+ { { { 10, 0, 0 }, { 0, 20, 0 } } },
+ { { { 10, 0, 1 }, { 0, 21, 1 } } },
+ { { { 10, 0, 2 }, { 0, 21, 0 } } },
+ { { { 11, 0, 1 }, { 0, 22, 1 } } },
+ { { { 11, 0, 0 }, { 0, 22, 0 } } },
+ { { { 11, 0, 1 }, { 0, 23, 1 } } },
+ { { { 11, 0, 2 }, { 0, 23, 0 } } },
+ { { { 12, 0, 1 }, { 0, 24, 1 } } },
+ { { { 12, 0, 0 }, { 0, 24, 0 } } },
+ { { { 12, 0, 1 }, { 0, 25, 1 } } },
+ { { { 12, 0, 2 }, { 0, 25, 0 } } },
+ { { { 13, 0, 1 }, { 0, 26, 1 } } },
+ { { { 13, 0, 0 }, { 0, 26, 0 } } },
+ { { { 13, 0, 1 }, { 0, 27, 1 } } },
+ { { { 13, 0, 2 }, { 0, 27, 0 } } },
+ { { { 14, 0, 1 }, { 0, 28, 1 } } },
+ { { { 14, 0, 0 }, { 0, 28, 0 } } },
+ { { { 14, 0, 1 }, { 0, 29, 1 } } },
+ { { { 14, 0, 2 }, { 0, 29, 0 } } },
+ { { { 15, 0, 1 }, { 0, 30, 1 } } },
+ { { { 15, 0, 0 }, { 0, 30, 0 } } },
+ { { { 15, 0, 1 }, { 0, 31, 1 } } },
+ { { { 15, 0, 2 }, { 0, 31, 0 } } },
+ { { { 16, 0, 2 }, { 1, 31, 1 } } },
+ { { { 16, 0, 1 }, { 1, 31, 0 } } },
+ { { { 16, 0, 0 }, { 0, 32, 0 } } },
+ { { { 16, 0, 1 }, { 2, 31, 0 } } },
+ { { { 16, 0, 2 }, { 0, 33, 0 } } },
+ { { { 17, 0, 1 }, { 3, 31, 0 } } },
+ { { { 17, 0, 0 }, { 0, 34, 0 } } },
+ { { { 17, 0, 1 }, { 4, 31, 0 } } },
+ { { { 17, 0, 2 }, { 0, 35, 0 } } },
+ { { { 18, 0, 1 }, { 5, 31, 0 } } },
+ { { { 18, 0, 0 }, { 0, 36, 0 } } },
+ { { { 18, 0, 1 }, { 6, 31, 0 } } },
+ { { { 18, 0, 2 }, { 0, 37, 0 } } },
+ { { { 19, 0, 1 }, { 7, 31, 0 } } },
+ { { { 19, 0, 0 }, { 0, 38, 0 } } },
+ { { { 19, 0, 1 }, { 8, 31, 0 } } },
+ { { { 19, 0, 2 }, { 0, 39, 0 } } },
+ { { { 20, 0, 1 }, { 9, 31, 0 } } },
+ { { { 20, 0, 0 }, { 0, 40, 0 } } },
+ { { { 20, 0, 1 }, { 10, 31, 0 } } },
+ { { { 20, 0, 2 }, { 0, 41, 0 } } },
+ { { { 21, 0, 1 }, { 11, 31, 0 } } },
+ { { { 21, 0, 0 }, { 0, 42, 0 } } },
+ { { { 21, 0, 1 }, { 12, 31, 0 } } },
+ { { { 21, 0, 2 }, { 0, 43, 0 } } },
+ { { { 22, 0, 1 }, { 13, 31, 0 } } },
+ { { { 22, 0, 0 }, { 0, 44, 0 } } },
+ { { { 22, 0, 1 }, { 14, 31, 0 } } },
+ { { { 22, 0, 2 }, { 0, 45, 0 } } },
+ { { { 23, 0, 1 }, { 15, 31, 0 } } },
+ { { { 23, 0, 0 }, { 0, 46, 0 } } },
+ { { { 23, 0, 1 }, { 0, 47, 1 } } },
+ { { { 23, 0, 2 }, { 0, 47, 0 } } },
+ { { { 24, 0, 1 }, { 0, 48, 1 } } },
+ { { { 24, 0, 0 }, { 0, 48, 0 } } },
+ { { { 24, 0, 1 }, { 0, 49, 1 } } },
+ { { { 24, 0, 2 }, { 0, 49, 0 } } },
+ { { { 25, 0, 1 }, { 0, 50, 1 } } },
+ { { { 25, 0, 0 }, { 0, 50, 0 } } },
+ { { { 25, 0, 1 }, { 0, 51, 1 } } },
+ { { { 25, 0, 2 }, { 0, 51, 0 } } },
+ { { { 26, 0, 1 }, { 0, 52, 1 } } },
+ { { { 26, 0, 0 }, { 0, 52, 0 } } },
+ { { { 26, 0, 1 }, { 0, 53, 1 } } },
+ { { { 26, 0, 2 }, { 0, 53, 0 } } },
+ { { { 27, 0, 1 }, { 0, 54, 1 } } },
+ { { { 27, 0, 0 }, { 0, 54, 0 } } },
+ { { { 27, 0, 1 }, { 0, 55, 1 } } },
+ { { { 27, 0, 2 }, { 0, 55, 0 } } },
+ { { { 28, 0, 1 }, { 0, 56, 1 } } },
+ { { { 28, 0, 0 }, { 0, 56, 0 } } },
+ { { { 28, 0, 1 }, { 0, 57, 1 } } },
+ { { { 28, 0, 2 }, { 0, 57, 0 } } },
+ { { { 29, 0, 1 }, { 0, 58, 1 } } },
+ { { { 29, 0, 0 }, { 0, 58, 0 } } },
+ { { { 29, 0, 1 }, { 0, 59, 1 } } },
+ { { { 29, 0, 2 }, { 0, 59, 0 } } },
+ { { { 30, 0, 1 }, { 0, 60, 1 } } },
+ { { { 30, 0, 0 }, { 0, 60, 0 } } },
+ { { { 30, 0, 1 }, { 0, 61, 1 } } },
+ { { { 30, 0, 2 }, { 0, 61, 0 } } },
+ { { { 31, 0, 1 }, { 0, 62, 1 } } },
+ { { { 31, 0, 0 }, { 0, 62, 0 } } },
+ { { { 31, 0, 1 }, { 0, 63, 1 } } },
+ { { { 31, 0, 2 }, { 0, 63, 0 } } },
+ { { { 32, 0, 2 }, { 1, 63, 1 } } },
+ { { { 32, 0, 1 }, { 1, 63, 0 } } },
+ { { { 32, 0, 0 }, { 16, 48, 0 } } },
+ { { { 32, 0, 1 }, { 2, 63, 0 } } },
+ { { { 32, 0, 2 }, { 16, 49, 0 } } },
+ { { { 33, 0, 1 }, { 3, 63, 0 } } },
+ { { { 33, 0, 0 }, { 16, 50, 0 } } },
+ { { { 33, 0, 1 }, { 4, 63, 0 } } },
+ { { { 33, 0, 2 }, { 16, 51, 0 } } },
+ { { { 34, 0, 1 }, { 5, 63, 0 } } },
+ { { { 34, 0, 0 }, { 16, 52, 0 } } },
+ { { { 34, 0, 1 }, { 6, 63, 0 } } },
+ { { { 34, 0, 2 }, { 16, 53, 0 } } },
+ { { { 35, 0, 1 }, { 7, 63, 0 } } },
+ { { { 35, 0, 0 }, { 16, 54, 0 } } },
+ { { { 35, 0, 1 }, { 8, 63, 0 } } },
+ { { { 35, 0, 2 }, { 16, 55, 0 } } },
+ { { { 36, 0, 1 }, { 9, 63, 0 } } },
+ { { { 36, 0, 0 }, { 16, 56, 0 } } },
+ { { { 36, 0, 1 }, { 10, 63, 0 } } },
+ { { { 36, 0, 2 }, { 16, 57, 0 } } },
+ { { { 37, 0, 1 }, { 11, 63, 0 } } },
+ { { { 37, 0, 0 }, { 16, 58, 0 } } },
+ { { { 37, 0, 1 }, { 12, 63, 0 } } },
+ { { { 37, 0, 2 }, { 16, 59, 0 } } },
+ { { { 38, 0, 1 }, { 13, 63, 0 } } },
+ { { { 38, 0, 0 }, { 16, 60, 0 } } },
+ { { { 38, 0, 1 }, { 14, 63, 0 } } },
+ { { { 38, 0, 2 }, { 16, 61, 0 } } },
+ { { { 39, 0, 1 }, { 15, 63, 0 } } },
+ { { { 39, 0, 0 }, { 16, 62, 0 } } },
+ { { { 39, 0, 1 }, { 16, 63, 1 } } },
+ { { { 39, 0, 2 }, { 16, 63, 0 } } },
+ { { { 40, 0, 1 }, { 17, 63, 1 } } },
+ { { { 40, 0, 0 }, { 17, 63, 0 } } },
+ { { { 40, 0, 1 }, { 18, 63, 1 } } },
+ { { { 40, 0, 2 }, { 18, 63, 0 } } },
+ { { { 41, 0, 1 }, { 19, 63, 1 } } },
+ { { { 41, 0, 0 }, { 19, 63, 0 } } },
+ { { { 41, 0, 1 }, { 20, 63, 1 } } },
+ { { { 41, 0, 2 }, { 20, 63, 0 } } },
+ { { { 42, 0, 1 }, { 21, 63, 1 } } },
+ { { { 42, 0, 0 }, { 21, 63, 0 } } },
+ { { { 42, 0, 1 }, { 22, 63, 1 } } },
+ { { { 42, 0, 2 }, { 22, 63, 0 } } },
+ { { { 43, 0, 1 }, { 23, 63, 1 } } },
+ { { { 43, 0, 0 }, { 23, 63, 0 } } },
+ { { { 43, 0, 1 }, { 24, 63, 1 } } },
+ { { { 43, 0, 2 }, { 24, 63, 0 } } },
+ { { { 44, 0, 1 }, { 25, 63, 1 } } },
+ { { { 44, 0, 0 }, { 25, 63, 0 } } },
+ { { { 44, 0, 1 }, { 26, 63, 1 } } },
+ { { { 44, 0, 2 }, { 26, 63, 0 } } },
+ { { { 45, 0, 1 }, { 27, 63, 1 } } },
+ { { { 45, 0, 0 }, { 27, 63, 0 } } },
+ { { { 45, 0, 1 }, { 28, 63, 1 } } },
+ { { { 45, 0, 2 }, { 28, 63, 0 } } },
+ { { { 46, 0, 1 }, { 29, 63, 1 } } },
+ { { { 46, 0, 0 }, { 29, 63, 0 } } },
+ { { { 46, 0, 1 }, { 30, 63, 1 } } },
+ { { { 46, 0, 2 }, { 30, 63, 0 } } },
+ { { { 47, 0, 1 }, { 31, 63, 1 } } },
+ { { { 47, 0, 0 }, { 31, 63, 0 } } },
+ { { { 47, 0, 1 }, { 32, 63, 1 } } },
+ { { { 47, 0, 2 }, { 32, 63, 0 } } },
+ { { { 48, 0, 2 }, { 33, 63, 1 } } },
+ { { { 48, 0, 1 }, { 33, 63, 0 } } },
+ { { { 48, 0, 0 }, { 48, 48, 0 } } },
+ { { { 48, 0, 1 }, { 34, 63, 0 } } },
+ { { { 48, 0, 2 }, { 48, 49, 0 } } },
+ { { { 49, 0, 1 }, { 35, 63, 0 } } },
+ { { { 49, 0, 0 }, { 48, 50, 0 } } },
+ { { { 49, 0, 1 }, { 36, 63, 0 } } },
+ { { { 49, 0, 2 }, { 48, 51, 0 } } },
+ { { { 50, 0, 1 }, { 37, 63, 0 } } },
+ { { { 50, 0, 0 }, { 48, 52, 0 } } },
+ { { { 50, 0, 1 }, { 38, 63, 0 } } },
+ { { { 50, 0, 2 }, { 48, 53, 0 } } },
+ { { { 51, 0, 1 }, { 39, 63, 0 } } },
+ { { { 51, 0, 0 }, { 48, 54, 0 } } },
+ { { { 51, 0, 1 }, { 40, 63, 0 } } },
+ { { { 51, 0, 2 }, { 48, 55, 0 } } },
+ { { { 52, 0, 1 }, { 41, 63, 0 } } },
+ { { { 52, 0, 0 }, { 48, 56, 0 } } },
+ { { { 52, 0, 1 }, { 42, 63, 0 } } },
+ { { { 52, 0, 2 }, { 48, 57, 0 } } },
+ { { { 53, 0, 1 }, { 43, 63, 0 } } },
+ { { { 53, 0, 0 }, { 48, 58, 0 } } },
+ { { { 53, 0, 1 }, { 44, 63, 0 } } },
+ { { { 53, 0, 2 }, { 48, 59, 0 } } },
+ { { { 54, 0, 1 }, { 45, 63, 0 } } },
+ { { { 54, 0, 0 }, { 48, 60, 0 } } },
+ { { { 54, 0, 1 }, { 46, 63, 0 } } },
+ { { { 54, 0, 2 }, { 48, 61, 0 } } },
+ { { { 55, 0, 1 }, { 47, 63, 0 } } },
+ { { { 55, 0, 0 }, { 48, 62, 0 } } },
+ { { { 55, 0, 1 }, { 48, 63, 1 } } },
+ { { { 55, 0, 2 }, { 48, 63, 0 } } },
+ { { { 56, 0, 1 }, { 49, 63, 1 } } },
+ { { { 56, 0, 0 }, { 49, 63, 0 } } },
+ { { { 56, 0, 1 }, { 50, 63, 1 } } },
+ { { { 56, 0, 2 }, { 50, 63, 0 } } },
+ { { { 57, 0, 1 }, { 51, 63, 1 } } },
+ { { { 57, 0, 0 }, { 51, 63, 0 } } },
+ { { { 57, 0, 1 }, { 52, 63, 1 } } },
+ { { { 57, 0, 2 }, { 52, 63, 0 } } },
+ { { { 58, 0, 1 }, { 53, 63, 1 } } },
+ { { { 58, 0, 0 }, { 53, 63, 0 } } },
+ { { { 58, 0, 1 }, { 54, 63, 1 } } },
+ { { { 58, 0, 2 }, { 54, 63, 0 } } },
+ { { { 59, 0, 1 }, { 55, 63, 1 } } },
+ { { { 59, 0, 0 }, { 55, 63, 0 } } },
+ { { { 59, 0, 1 }, { 56, 63, 1 } } },
+ { { { 59, 0, 2 }, { 56, 63, 0 } } },
+ { { { 60, 0, 1 }, { 57, 63, 1 } } },
+ { { { 60, 0, 0 }, { 57, 63, 0 } } },
+ { { { 60, 0, 1 }, { 58, 63, 1 } } },
+ { { { 60, 0, 2 }, { 58, 63, 0 } } },
+ { { { 61, 0, 1 }, { 59, 63, 1 } } },
+ { { { 61, 0, 0 }, { 59, 63, 0 } } },
+ { { { 61, 0, 1 }, { 60, 63, 1 } } },
+ { { { 61, 0, 2 }, { 60, 63, 0 } } },
+ { { { 62, 0, 1 }, { 61, 63, 1 } } },
+ { { { 62, 0, 0 }, { 61, 63, 0 } } },
+ { { { 62, 0, 1 }, { 62, 63, 1 } } },
+ { { { 62, 0, 2 }, { 62, 63, 0 } } },
+ { { { 63, 0, 1 }, { 63, 63, 1 } } },
+ { { { 63, 0, 0 }, { 63, 63, 0 } } }
+};
+
+static SingleColourLookup const lookup_5_4[] =
+{
+ { { { 0, 0, 0 }, { 0, 0, 0 } } },
+ { { { 0, 0, 1 }, { 0, 1, 1 } } },
+ { { { 0, 0, 2 }, { 0, 1, 0 } } },
+ { { { 0, 0, 3 }, { 0, 1, 1 } } },
+ { { { 0, 0, 4 }, { 0, 2, 1 } } },
+ { { { 1, 0, 3 }, { 0, 2, 0 } } },
+ { { { 1, 0, 2 }, { 0, 2, 1 } } },
+ { { { 1, 0, 1 }, { 0, 3, 1 } } },
+ { { { 1, 0, 0 }, { 0, 3, 0 } } },
+ { { { 1, 0, 1 }, { 1, 2, 1 } } },
+ { { { 1, 0, 2 }, { 1, 2, 0 } } },
+ { { { 1, 0, 3 }, { 0, 4, 0 } } },
+ { { { 1, 0, 4 }, { 0, 5, 1 } } },
+ { { { 2, 0, 3 }, { 0, 5, 0 } } },
+ { { { 2, 0, 2 }, { 0, 5, 1 } } },
+ { { { 2, 0, 1 }, { 0, 6, 1 } } },
+ { { { 2, 0, 0 }, { 0, 6, 0 } } },
+ { { { 2, 0, 1 }, { 2, 3, 1 } } },
+ { { { 2, 0, 2 }, { 2, 3, 0 } } },
+ { { { 2, 0, 3 }, { 0, 7, 0 } } },
+ { { { 2, 0, 4 }, { 1, 6, 1 } } },
+ { { { 3, 0, 3 }, { 1, 6, 0 } } },
+ { { { 3, 0, 2 }, { 0, 8, 0 } } },
+ { { { 3, 0, 1 }, { 0, 9, 1 } } },
+ { { { 3, 0, 0 }, { 0, 9, 0 } } },
+ { { { 3, 0, 1 }, { 0, 9, 1 } } },
+ { { { 3, 0, 2 }, { 0, 10, 1 } } },
+ { { { 3, 0, 3 }, { 0, 10, 0 } } },
+ { { { 3, 0, 4 }, { 2, 7, 1 } } },
+ { { { 4, 0, 4 }, { 2, 7, 0 } } },
+ { { { 4, 0, 3 }, { 0, 11, 0 } } },
+ { { { 4, 0, 2 }, { 1, 10, 1 } } },
+ { { { 4, 0, 1 }, { 1, 10, 0 } } },
+ { { { 4, 0, 0 }, { 0, 12, 0 } } },
+ { { { 4, 0, 1 }, { 0, 13, 1 } } },
+ { { { 4, 0, 2 }, { 0, 13, 0 } } },
+ { { { 4, 0, 3 }, { 0, 13, 1 } } },
+ { { { 4, 0, 4 }, { 0, 14, 1 } } },
+ { { { 5, 0, 3 }, { 0, 14, 0 } } },
+ { { { 5, 0, 2 }, { 2, 11, 1 } } },
+ { { { 5, 0, 1 }, { 2, 11, 0 } } },
+ { { { 5, 0, 0 }, { 0, 15, 0 } } },
+ { { { 5, 0, 1 }, { 1, 14, 1 } } },
+ { { { 5, 0, 2 }, { 1, 14, 0 } } },
+ { { { 5, 0, 3 }, { 0, 16, 0 } } },
+ { { { 5, 0, 4 }, { 0, 17, 1 } } },
+ { { { 6, 0, 3 }, { 0, 17, 0 } } },
+ { { { 6, 0, 2 }, { 0, 17, 1 } } },
+ { { { 6, 0, 1 }, { 0, 18, 1 } } },
+ { { { 6, 0, 0 }, { 0, 18, 0 } } },
+ { { { 6, 0, 1 }, { 2, 15, 1 } } },
+ { { { 6, 0, 2 }, { 2, 15, 0 } } },
+ { { { 6, 0, 3 }, { 0, 19, 0 } } },
+ { { { 6, 0, 4 }, { 1, 18, 1 } } },
+ { { { 7, 0, 3 }, { 1, 18, 0 } } },
+ { { { 7, 0, 2 }, { 0, 20, 0 } } },
+ { { { 7, 0, 1 }, { 0, 21, 1 } } },
+ { { { 7, 0, 0 }, { 0, 21, 0 } } },
+ { { { 7, 0, 1 }, { 0, 21, 1 } } },
+ { { { 7, 0, 2 }, { 0, 22, 1 } } },
+ { { { 7, 0, 3 }, { 0, 22, 0 } } },
+ { { { 7, 0, 4 }, { 2, 19, 1 } } },
+ { { { 8, 0, 4 }, { 2, 19, 0 } } },
+ { { { 8, 0, 3 }, { 0, 23, 0 } } },
+ { { { 8, 0, 2 }, { 1, 22, 1 } } },
+ { { { 8, 0, 1 }, { 1, 22, 0 } } },
+ { { { 8, 0, 0 }, { 0, 24, 0 } } },
+ { { { 8, 0, 1 }, { 0, 25, 1 } } },
+ { { { 8, 0, 2 }, { 0, 25, 0 } } },
+ { { { 8, 0, 3 }, { 0, 25, 1 } } },
+ { { { 8, 0, 4 }, { 0, 26, 1 } } },
+ { { { 9, 0, 3 }, { 0, 26, 0 } } },
+ { { { 9, 0, 2 }, { 2, 23, 1 } } },
+ { { { 9, 0, 1 }, { 2, 23, 0 } } },
+ { { { 9, 0, 0 }, { 0, 27, 0 } } },
+ { { { 9, 0, 1 }, { 1, 26, 1 } } },
+ { { { 9, 0, 2 }, { 1, 26, 0 } } },
+ { { { 9, 0, 3 }, { 0, 28, 0 } } },
+ { { { 9, 0, 4 }, { 0, 29, 1 } } },
+ { { { 10, 0, 3 }, { 0, 29, 0 } } },
+ { { { 10, 0, 2 }, { 0, 29, 1 } } },
+ { { { 10, 0, 1 }, { 0, 30, 1 } } },
+ { { { 10, 0, 0 }, { 0, 30, 0 } } },
+ { { { 10, 0, 1 }, { 2, 27, 1 } } },
+ { { { 10, 0, 2 }, { 2, 27, 0 } } },
+ { { { 10, 0, 3 }, { 0, 31, 0 } } },
+ { { { 10, 0, 4 }, { 1, 30, 1 } } },
+ { { { 11, 0, 3 }, { 1, 30, 0 } } },
+ { { { 11, 0, 2 }, { 4, 24, 0 } } },
+ { { { 11, 0, 1 }, { 1, 31, 1 } } },
+ { { { 11, 0, 0 }, { 1, 31, 0 } } },
+ { { { 11, 0, 1 }, { 1, 31, 1 } } },
+ { { { 11, 0, 2 }, { 2, 30, 1 } } },
+ { { { 11, 0, 3 }, { 2, 30, 0 } } },
+ { { { 11, 0, 4 }, { 2, 31, 1 } } },
+ { { { 12, 0, 4 }, { 2, 31, 0 } } },
+ { { { 12, 0, 3 }, { 4, 27, 0 } } },
+ { { { 12, 0, 2 }, { 3, 30, 1 } } },
+ { { { 12, 0, 1 }, { 3, 30, 0 } } },
+ { { { 12, 0, 0 }, { 4, 28, 0 } } },
+ { { { 12, 0, 1 }, { 3, 31, 1 } } },
+ { { { 12, 0, 2 }, { 3, 31, 0 } } },
+ { { { 12, 0, 3 }, { 3, 31, 1 } } },
+ { { { 12, 0, 4 }, { 4, 30, 1 } } },
+ { { { 13, 0, 3 }, { 4, 30, 0 } } },
+ { { { 13, 0, 2 }, { 6, 27, 1 } } },
+ { { { 13, 0, 1 }, { 6, 27, 0 } } },
+ { { { 13, 0, 0 }, { 4, 31, 0 } } },
+ { { { 13, 0, 1 }, { 5, 30, 1 } } },
+ { { { 13, 0, 2 }, { 5, 30, 0 } } },
+ { { { 13, 0, 3 }, { 8, 24, 0 } } },
+ { { { 13, 0, 4 }, { 5, 31, 1 } } },
+ { { { 14, 0, 3 }, { 5, 31, 0 } } },
+ { { { 14, 0, 2 }, { 5, 31, 1 } } },
+ { { { 14, 0, 1 }, { 6, 30, 1 } } },
+ { { { 14, 0, 0 }, { 6, 30, 0 } } },
+ { { { 14, 0, 1 }, { 6, 31, 1 } } },
+ { { { 14, 0, 2 }, { 6, 31, 0 } } },
+ { { { 14, 0, 3 }, { 8, 27, 0 } } },
+ { { { 14, 0, 4 }, { 7, 30, 1 } } },
+ { { { 15, 0, 3 }, { 7, 30, 0 } } },
+ { { { 15, 0, 2 }, { 8, 28, 0 } } },
+ { { { 15, 0, 1 }, { 7, 31, 1 } } },
+ { { { 15, 0, 0 }, { 7, 31, 0 } } },
+ { { { 15, 0, 1 }, { 7, 31, 1 } } },
+ { { { 15, 0, 2 }, { 8, 30, 1 } } },
+ { { { 15, 0, 3 }, { 8, 30, 0 } } },
+ { { { 15, 0, 4 }, { 10, 27, 1 } } },
+ { { { 16, 0, 4 }, { 10, 27, 0 } } },
+ { { { 16, 0, 3 }, { 8, 31, 0 } } },
+ { { { 16, 0, 2 }, { 9, 30, 1 } } },
+ { { { 16, 0, 1 }, { 9, 30, 0 } } },
+ { { { 16, 0, 0 }, { 12, 24, 0 } } },
+ { { { 16, 0, 1 }, { 9, 31, 1 } } },
+ { { { 16, 0, 2 }, { 9, 31, 0 } } },
+ { { { 16, 0, 3 }, { 9, 31, 1 } } },
+ { { { 16, 0, 4 }, { 10, 30, 1 } } },
+ { { { 17, 0, 3 }, { 10, 30, 0 } } },
+ { { { 17, 0, 2 }, { 10, 31, 1 } } },
+ { { { 17, 0, 1 }, { 10, 31, 0 } } },
+ { { { 17, 0, 0 }, { 12, 27, 0 } } },
+ { { { 17, 0, 1 }, { 11, 30, 1 } } },
+ { { { 17, 0, 2 }, { 11, 30, 0 } } },
+ { { { 17, 0, 3 }, { 12, 28, 0 } } },
+ { { { 17, 0, 4 }, { 11, 31, 1 } } },
+ { { { 18, 0, 3 }, { 11, 31, 0 } } },
+ { { { 18, 0, 2 }, { 11, 31, 1 } } },
+ { { { 18, 0, 1 }, { 12, 30, 1 } } },
+ { { { 18, 0, 0 }, { 12, 30, 0 } } },
+ { { { 18, 0, 1 }, { 14, 27, 1 } } },
+ { { { 18, 0, 2 }, { 14, 27, 0 } } },
+ { { { 18, 0, 3 }, { 12, 31, 0 } } },
+ { { { 18, 0, 4 }, { 13, 30, 1 } } },
+ { { { 19, 0, 3 }, { 13, 30, 0 } } },
+ { { { 19, 0, 2 }, { 16, 24, 0 } } },
+ { { { 19, 0, 1 }, { 13, 31, 1 } } },
+ { { { 19, 0, 0 }, { 13, 31, 0 } } },
+ { { { 19, 0, 1 }, { 13, 31, 1 } } },
+ { { { 19, 0, 2 }, { 14, 30, 1 } } },
+ { { { 19, 0, 3 }, { 14, 30, 0 } } },
+ { { { 19, 0, 4 }, { 14, 31, 1 } } },
+ { { { 20, 0, 4 }, { 14, 31, 0 } } },
+ { { { 20, 0, 3 }, { 16, 27, 0 } } },
+ { { { 20, 0, 2 }, { 15, 30, 1 } } },
+ { { { 20, 0, 1 }, { 15, 30, 0 } } },
+ { { { 20, 0, 0 }, { 16, 28, 0 } } },
+ { { { 20, 0, 1 }, { 15, 31, 1 } } },
+ { { { 20, 0, 2 }, { 15, 31, 0 } } },
+ { { { 20, 0, 3 }, { 15, 31, 1 } } },
+ { { { 20, 0, 4 }, { 16, 30, 1 } } },
+ { { { 21, 0, 3 }, { 16, 30, 0 } } },
+ { { { 21, 0, 2 }, { 18, 27, 1 } } },
+ { { { 21, 0, 1 }, { 18, 27, 0 } } },
+ { { { 21, 0, 0 }, { 16, 31, 0 } } },
+ { { { 21, 0, 1 }, { 17, 30, 1 } } },
+ { { { 21, 0, 2 }, { 17, 30, 0 } } },
+ { { { 21, 0, 3 }, { 20, 24, 0 } } },
+ { { { 21, 0, 4 }, { 17, 31, 1 } } },
+ { { { 22, 0, 3 }, { 17, 31, 0 } } },
+ { { { 22, 0, 2 }, { 17, 31, 1 } } },
+ { { { 22, 0, 1 }, { 18, 30, 1 } } },
+ { { { 22, 0, 0 }, { 18, 30, 0 } } },
+ { { { 22, 0, 1 }, { 18, 31, 1 } } },
+ { { { 22, 0, 2 }, { 18, 31, 0 } } },
+ { { { 22, 0, 3 }, { 20, 27, 0 } } },
+ { { { 22, 0, 4 }, { 19, 30, 1 } } },
+ { { { 23, 0, 3 }, { 19, 30, 0 } } },
+ { { { 23, 0, 2 }, { 20, 28, 0 } } },
+ { { { 23, 0, 1 }, { 19, 31, 1 } } },
+ { { { 23, 0, 0 }, { 19, 31, 0 } } },
+ { { { 23, 0, 1 }, { 19, 31, 1 } } },
+ { { { 23, 0, 2 }, { 20, 30, 1 } } },
+ { { { 23, 0, 3 }, { 20, 30, 0 } } },
+ { { { 23, 0, 4 }, { 22, 27, 1 } } },
+ { { { 24, 0, 4 }, { 22, 27, 0 } } },
+ { { { 24, 0, 3 }, { 20, 31, 0 } } },
+ { { { 24, 0, 2 }, { 21, 30, 1 } } },
+ { { { 24, 0, 1 }, { 21, 30, 0 } } },
+ { { { 24, 0, 0 }, { 24, 24, 0 } } },
+ { { { 24, 0, 1 }, { 21, 31, 1 } } },
+ { { { 24, 0, 2 }, { 21, 31, 0 } } },
+ { { { 24, 0, 3 }, { 21, 31, 1 } } },
+ { { { 24, 0, 4 }, { 22, 30, 1 } } },
+ { { { 25, 0, 3 }, { 22, 30, 0 } } },
+ { { { 25, 0, 2 }, { 22, 31, 1 } } },
+ { { { 25, 0, 1 }, { 22, 31, 0 } } },
+ { { { 25, 0, 0 }, { 24, 27, 0 } } },
+ { { { 25, 0, 1 }, { 23, 30, 1 } } },
+ { { { 25, 0, 2 }, { 23, 30, 0 } } },
+ { { { 25, 0, 3 }, { 24, 28, 0 } } },
+ { { { 25, 0, 4 }, { 23, 31, 1 } } },
+ { { { 26, 0, 3 }, { 23, 31, 0 } } },
+ { { { 26, 0, 2 }, { 23, 31, 1 } } },
+ { { { 26, 0, 1 }, { 24, 30, 1 } } },
+ { { { 26, 0, 0 }, { 24, 30, 0 } } },
+ { { { 26, 0, 1 }, { 26, 27, 1 } } },
+ { { { 26, 0, 2 }, { 26, 27, 0 } } },
+ { { { 26, 0, 3 }, { 24, 31, 0 } } },
+ { { { 26, 0, 4 }, { 25, 30, 1 } } },
+ { { { 27, 0, 3 }, { 25, 30, 0 } } },
+ { { { 27, 0, 2 }, { 28, 24, 0 } } },
+ { { { 27, 0, 1 }, { 25, 31, 1 } } },
+ { { { 27, 0, 0 }, { 25, 31, 0 } } },
+ { { { 27, 0, 1 }, { 25, 31, 1 } } },
+ { { { 27, 0, 2 }, { 26, 30, 1 } } },
+ { { { 27, 0, 3 }, { 26, 30, 0 } } },
+ { { { 27, 0, 4 }, { 26, 31, 1 } } },
+ { { { 28, 0, 4 }, { 26, 31, 0 } } },
+ { { { 28, 0, 3 }, { 28, 27, 0 } } },
+ { { { 28, 0, 2 }, { 27, 30, 1 } } },
+ { { { 28, 0, 1 }, { 27, 30, 0 } } },
+ { { { 28, 0, 0 }, { 28, 28, 0 } } },
+ { { { 28, 0, 1 }, { 27, 31, 1 } } },
+ { { { 28, 0, 2 }, { 27, 31, 0 } } },
+ { { { 28, 0, 3 }, { 27, 31, 1 } } },
+ { { { 28, 0, 4 }, { 28, 30, 1 } } },
+ { { { 29, 0, 3 }, { 28, 30, 0 } } },
+ { { { 29, 0, 2 }, { 30, 27, 1 } } },
+ { { { 29, 0, 1 }, { 30, 27, 0 } } },
+ { { { 29, 0, 0 }, { 28, 31, 0 } } },
+ { { { 29, 0, 1 }, { 29, 30, 1 } } },
+ { { { 29, 0, 2 }, { 29, 30, 0 } } },
+ { { { 29, 0, 3 }, { 29, 30, 1 } } },
+ { { { 29, 0, 4 }, { 29, 31, 1 } } },
+ { { { 30, 0, 3 }, { 29, 31, 0 } } },
+ { { { 30, 0, 2 }, { 29, 31, 1 } } },
+ { { { 30, 0, 1 }, { 30, 30, 1 } } },
+ { { { 30, 0, 0 }, { 30, 30, 0 } } },
+ { { { 30, 0, 1 }, { 30, 31, 1 } } },
+ { { { 30, 0, 2 }, { 30, 31, 0 } } },
+ { { { 30, 0, 3 }, { 30, 31, 1 } } },
+ { { { 30, 0, 4 }, { 31, 30, 1 } } },
+ { { { 31, 0, 3 }, { 31, 30, 0 } } },
+ { { { 31, 0, 2 }, { 31, 30, 1 } } },
+ { { { 31, 0, 1 }, { 31, 31, 1 } } },
+ { { { 31, 0, 0 }, { 31, 31, 0 } } }
+};
+
+static SingleColourLookup const lookup_6_4[] =
+{
+ { { { 0, 0, 0 }, { 0, 0, 0 } } },
+ { { { 0, 0, 1 }, { 0, 1, 0 } } },
+ { { { 0, 0, 2 }, { 0, 2, 0 } } },
+ { { { 1, 0, 1 }, { 0, 3, 1 } } },
+ { { { 1, 0, 0 }, { 0, 3, 0 } } },
+ { { { 1, 0, 1 }, { 0, 4, 0 } } },
+ { { { 1, 0, 2 }, { 0, 5, 0 } } },
+ { { { 2, 0, 1 }, { 0, 6, 1 } } },
+ { { { 2, 0, 0 }, { 0, 6, 0 } } },
+ { { { 2, 0, 1 }, { 0, 7, 0 } } },
+ { { { 2, 0, 2 }, { 0, 8, 0 } } },
+ { { { 3, 0, 1 }, { 0, 9, 1 } } },
+ { { { 3, 0, 0 }, { 0, 9, 0 } } },
+ { { { 3, 0, 1 }, { 0, 10, 0 } } },
+ { { { 3, 0, 2 }, { 0, 11, 0 } } },
+ { { { 4, 0, 1 }, { 0, 12, 1 } } },
+ { { { 4, 0, 0 }, { 0, 12, 0 } } },
+ { { { 4, 0, 1 }, { 0, 13, 0 } } },
+ { { { 4, 0, 2 }, { 0, 14, 0 } } },
+ { { { 5, 0, 1 }, { 0, 15, 1 } } },
+ { { { 5, 0, 0 }, { 0, 15, 0 } } },
+ { { { 5, 0, 1 }, { 0, 16, 0 } } },
+ { { { 5, 0, 2 }, { 1, 15, 0 } } },
+ { { { 6, 0, 1 }, { 0, 17, 0 } } },
+ { { { 6, 0, 0 }, { 0, 18, 0 } } },
+ { { { 6, 0, 1 }, { 0, 19, 0 } } },
+ { { { 6, 0, 2 }, { 3, 14, 0 } } },
+ { { { 7, 0, 1 }, { 0, 20, 0 } } },
+ { { { 7, 0, 0 }, { 0, 21, 0 } } },
+ { { { 7, 0, 1 }, { 0, 22, 0 } } },
+ { { { 7, 0, 2 }, { 4, 15, 0 } } },
+ { { { 8, 0, 1 }, { 0, 23, 0 } } },
+ { { { 8, 0, 0 }, { 0, 24, 0 } } },
+ { { { 8, 0, 1 }, { 0, 25, 0 } } },
+ { { { 8, 0, 2 }, { 6, 14, 0 } } },
+ { { { 9, 0, 1 }, { 0, 26, 0 } } },
+ { { { 9, 0, 0 }, { 0, 27, 0 } } },
+ { { { 9, 0, 1 }, { 0, 28, 0 } } },
+ { { { 9, 0, 2 }, { 7, 15, 0 } } },
+ { { { 10, 0, 1 }, { 0, 29, 0 } } },
+ { { { 10, 0, 0 }, { 0, 30, 0 } } },
+ { { { 10, 0, 1 }, { 0, 31, 0 } } },
+ { { { 10, 0, 2 }, { 9, 14, 0 } } },
+ { { { 11, 0, 1 }, { 0, 32, 0 } } },
+ { { { 11, 0, 0 }, { 0, 33, 0 } } },
+ { { { 11, 0, 1 }, { 2, 30, 0 } } },
+ { { { 11, 0, 2 }, { 0, 34, 0 } } },
+ { { { 12, 0, 1 }, { 0, 35, 0 } } },
+ { { { 12, 0, 0 }, { 0, 36, 0 } } },
+ { { { 12, 0, 1 }, { 3, 31, 0 } } },
+ { { { 12, 0, 2 }, { 0, 37, 0 } } },
+ { { { 13, 0, 1 }, { 0, 38, 0 } } },
+ { { { 13, 0, 0 }, { 0, 39, 0 } } },
+ { { { 13, 0, 1 }, { 5, 30, 0 } } },
+ { { { 13, 0, 2 }, { 0, 40, 0 } } },
+ { { { 14, 0, 1 }, { 0, 41, 0 } } },
+ { { { 14, 0, 0 }, { 0, 42, 0 } } },
+ { { { 14, 0, 1 }, { 6, 31, 0 } } },
+ { { { 14, 0, 2 }, { 0, 43, 0 } } },
+ { { { 15, 0, 1 }, { 0, 44, 0 } } },
+ { { { 15, 0, 0 }, { 0, 45, 0 } } },
+ { { { 15, 0, 1 }, { 8, 30, 0 } } },
+ { { { 15, 0, 2 }, { 0, 46, 0 } } },
+ { { { 16, 0, 2 }, { 0, 47, 0 } } },
+ { { { 16, 0, 1 }, { 1, 46, 0 } } },
+ { { { 16, 0, 0 }, { 0, 48, 0 } } },
+ { { { 16, 0, 1 }, { 0, 49, 0 } } },
+ { { { 16, 0, 2 }, { 0, 50, 0 } } },
+ { { { 17, 0, 1 }, { 2, 47, 0 } } },
+ { { { 17, 0, 0 }, { 0, 51, 0 } } },
+ { { { 17, 0, 1 }, { 0, 52, 0 } } },
+ { { { 17, 0, 2 }, { 0, 53, 0 } } },
+ { { { 18, 0, 1 }, { 4, 46, 0 } } },
+ { { { 18, 0, 0 }, { 0, 54, 0 } } },
+ { { { 18, 0, 1 }, { 0, 55, 0 } } },
+ { { { 18, 0, 2 }, { 0, 56, 0 } } },
+ { { { 19, 0, 1 }, { 5, 47, 0 } } },
+ { { { 19, 0, 0 }, { 0, 57, 0 } } },
+ { { { 19, 0, 1 }, { 0, 58, 0 } } },
+ { { { 19, 0, 2 }, { 0, 59, 0 } } },
+ { { { 20, 0, 1 }, { 7, 46, 0 } } },
+ { { { 20, 0, 0 }, { 0, 60, 0 } } },
+ { { { 20, 0, 1 }, { 0, 61, 0 } } },
+ { { { 20, 0, 2 }, { 0, 62, 0 } } },
+ { { { 21, 0, 1 }, { 8, 47, 0 } } },
+ { { { 21, 0, 0 }, { 0, 63, 0 } } },
+ { { { 21, 0, 1 }, { 1, 62, 0 } } },
+ { { { 21, 0, 2 }, { 1, 63, 0 } } },
+ { { { 22, 0, 1 }, { 10, 46, 0 } } },
+ { { { 22, 0, 0 }, { 2, 62, 0 } } },
+ { { { 22, 0, 1 }, { 2, 63, 0 } } },
+ { { { 22, 0, 2 }, { 3, 62, 0 } } },
+ { { { 23, 0, 1 }, { 11, 47, 0 } } },
+ { { { 23, 0, 0 }, { 3, 63, 0 } } },
+ { { { 23, 0, 1 }, { 4, 62, 0 } } },
+ { { { 23, 0, 2 }, { 4, 63, 0 } } },
+ { { { 24, 0, 1 }, { 13, 46, 0 } } },
+ { { { 24, 0, 0 }, { 5, 62, 0 } } },
+ { { { 24, 0, 1 }, { 5, 63, 0 } } },
+ { { { 24, 0, 2 }, { 6, 62, 0 } } },
+ { { { 25, 0, 1 }, { 14, 47, 0 } } },
+ { { { 25, 0, 0 }, { 6, 63, 0 } } },
+ { { { 25, 0, 1 }, { 7, 62, 0 } } },
+ { { { 25, 0, 2 }, { 7, 63, 0 } } },
+ { { { 26, 0, 1 }, { 16, 45, 0 } } },
+ { { { 26, 0, 0 }, { 8, 62, 0 } } },
+ { { { 26, 0, 1 }, { 8, 63, 0 } } },
+ { { { 26, 0, 2 }, { 9, 62, 0 } } },
+ { { { 27, 0, 1 }, { 16, 48, 0 } } },
+ { { { 27, 0, 0 }, { 9, 63, 0 } } },
+ { { { 27, 0, 1 }, { 10, 62, 0 } } },
+ { { { 27, 0, 2 }, { 10, 63, 0 } } },
+ { { { 28, 0, 1 }, { 16, 51, 0 } } },
+ { { { 28, 0, 0 }, { 11, 62, 0 } } },
+ { { { 28, 0, 1 }, { 11, 63, 0 } } },
+ { { { 28, 0, 2 }, { 12, 62, 0 } } },
+ { { { 29, 0, 1 }, { 16, 54, 0 } } },
+ { { { 29, 0, 0 }, { 12, 63, 0 } } },
+ { { { 29, 0, 1 }, { 13, 62, 0 } } },
+ { { { 29, 0, 2 }, { 13, 63, 0 } } },
+ { { { 30, 0, 1 }, { 16, 57, 0 } } },
+ { { { 30, 0, 0 }, { 14, 62, 0 } } },
+ { { { 30, 0, 1 }, { 14, 63, 0 } } },
+ { { { 30, 0, 2 }, { 15, 62, 0 } } },
+ { { { 31, 0, 1 }, { 16, 60, 0 } } },
+ { { { 31, 0, 0 }, { 15, 63, 0 } } },
+ { { { 31, 0, 1 }, { 24, 46, 0 } } },
+ { { { 31, 0, 2 }, { 16, 62, 0 } } },
+ { { { 32, 0, 2 }, { 16, 63, 0 } } },
+ { { { 32, 0, 1 }, { 17, 62, 0 } } },
+ { { { 32, 0, 0 }, { 25, 47, 0 } } },
+ { { { 32, 0, 1 }, { 17, 63, 0 } } },
+ { { { 32, 0, 2 }, { 18, 62, 0 } } },
+ { { { 33, 0, 1 }, { 18, 63, 0 } } },
+ { { { 33, 0, 0 }, { 27, 46, 0 } } },
+ { { { 33, 0, 1 }, { 19, 62, 0 } } },
+ { { { 33, 0, 2 }, { 19, 63, 0 } } },
+ { { { 34, 0, 1 }, { 20, 62, 0 } } },
+ { { { 34, 0, 0 }, { 28, 47, 0 } } },
+ { { { 34, 0, 1 }, { 20, 63, 0 } } },
+ { { { 34, 0, 2 }, { 21, 62, 0 } } },
+ { { { 35, 0, 1 }, { 21, 63, 0 } } },
+ { { { 35, 0, 0 }, { 30, 46, 0 } } },
+ { { { 35, 0, 1 }, { 22, 62, 0 } } },
+ { { { 35, 0, 2 }, { 22, 63, 0 } } },
+ { { { 36, 0, 1 }, { 23, 62, 0 } } },
+ { { { 36, 0, 0 }, { 31, 47, 0 } } },
+ { { { 36, 0, 1 }, { 23, 63, 0 } } },
+ { { { 36, 0, 2 }, { 24, 62, 0 } } },
+ { { { 37, 0, 1 }, { 24, 63, 0 } } },
+ { { { 37, 0, 0 }, { 32, 47, 0 } } },
+ { { { 37, 0, 1 }, { 25, 62, 0 } } },
+ { { { 37, 0, 2 }, { 25, 63, 0 } } },
+ { { { 38, 0, 1 }, { 26, 62, 0 } } },
+ { { { 38, 0, 0 }, { 32, 50, 0 } } },
+ { { { 38, 0, 1 }, { 26, 63, 0 } } },
+ { { { 38, 0, 2 }, { 27, 62, 0 } } },
+ { { { 39, 0, 1 }, { 27, 63, 0 } } },
+ { { { 39, 0, 0 }, { 32, 53, 0 } } },
+ { { { 39, 0, 1 }, { 28, 62, 0 } } },
+ { { { 39, 0, 2 }, { 28, 63, 0 } } },
+ { { { 40, 0, 1 }, { 29, 62, 0 } } },
+ { { { 40, 0, 0 }, { 32, 56, 0 } } },
+ { { { 40, 0, 1 }, { 29, 63, 0 } } },
+ { { { 40, 0, 2 }, { 30, 62, 0 } } },
+ { { { 41, 0, 1 }, { 30, 63, 0 } } },
+ { { { 41, 0, 0 }, { 32, 59, 0 } } },
+ { { { 41, 0, 1 }, { 31, 62, 0 } } },
+ { { { 41, 0, 2 }, { 31, 63, 0 } } },
+ { { { 42, 0, 1 }, { 32, 61, 0 } } },
+ { { { 42, 0, 0 }, { 32, 62, 0 } } },
+ { { { 42, 0, 1 }, { 32, 63, 0 } } },
+ { { { 42, 0, 2 }, { 41, 46, 0 } } },
+ { { { 43, 0, 1 }, { 33, 62, 0 } } },
+ { { { 43, 0, 0 }, { 33, 63, 0 } } },
+ { { { 43, 0, 1 }, { 34, 62, 0 } } },
+ { { { 43, 0, 2 }, { 42, 47, 0 } } },
+ { { { 44, 0, 1 }, { 34, 63, 0 } } },
+ { { { 44, 0, 0 }, { 35, 62, 0 } } },
+ { { { 44, 0, 1 }, { 35, 63, 0 } } },
+ { { { 44, 0, 2 }, { 44, 46, 0 } } },
+ { { { 45, 0, 1 }, { 36, 62, 0 } } },
+ { { { 45, 0, 0 }, { 36, 63, 0 } } },
+ { { { 45, 0, 1 }, { 37, 62, 0 } } },
+ { { { 45, 0, 2 }, { 45, 47, 0 } } },
+ { { { 46, 0, 1 }, { 37, 63, 0 } } },
+ { { { 46, 0, 0 }, { 38, 62, 0 } } },
+ { { { 46, 0, 1 }, { 38, 63, 0 } } },
+ { { { 46, 0, 2 }, { 47, 46, 0 } } },
+ { { { 47, 0, 1 }, { 39, 62, 0 } } },
+ { { { 47, 0, 0 }, { 39, 63, 0 } } },
+ { { { 47, 0, 1 }, { 40, 62, 0 } } },
+ { { { 47, 0, 2 }, { 48, 46, 0 } } },
+ { { { 48, 0, 2 }, { 40, 63, 0 } } },
+ { { { 48, 0, 1 }, { 41, 62, 0 } } },
+ { { { 48, 0, 0 }, { 41, 63, 0 } } },
+ { { { 48, 0, 1 }, { 48, 49, 0 } } },
+ { { { 48, 0, 2 }, { 42, 62, 0 } } },
+ { { { 49, 0, 1 }, { 42, 63, 0 } } },
+ { { { 49, 0, 0 }, { 43, 62, 0 } } },
+ { { { 49, 0, 1 }, { 48, 52, 0 } } },
+ { { { 49, 0, 2 }, { 43, 63, 0 } } },
+ { { { 50, 0, 1 }, { 44, 62, 0 } } },
+ { { { 50, 0, 0 }, { 44, 63, 0 } } },
+ { { { 50, 0, 1 }, { 48, 55, 0 } } },
+ { { { 50, 0, 2 }, { 45, 62, 0 } } },
+ { { { 51, 0, 1 }, { 45, 63, 0 } } },
+ { { { 51, 0, 0 }, { 46, 62, 0 } } },
+ { { { 51, 0, 1 }, { 48, 58, 0 } } },
+ { { { 51, 0, 2 }, { 46, 63, 0 } } },
+ { { { 52, 0, 1 }, { 47, 62, 0 } } },
+ { { { 52, 0, 0 }, { 47, 63, 0 } } },
+ { { { 52, 0, 1 }, { 48, 61, 0 } } },
+ { { { 52, 0, 2 }, { 48, 62, 0 } } },
+ { { { 53, 0, 1 }, { 56, 47, 0 } } },
+ { { { 53, 0, 0 }, { 48, 63, 0 } } },
+ { { { 53, 0, 1 }, { 49, 62, 0 } } },
+ { { { 53, 0, 2 }, { 49, 63, 0 } } },
+ { { { 54, 0, 1 }, { 58, 46, 0 } } },
+ { { { 54, 0, 0 }, { 50, 62, 0 } } },
+ { { { 54, 0, 1 }, { 50, 63, 0 } } },
+ { { { 54, 0, 2 }, { 51, 62, 0 } } },
+ { { { 55, 0, 1 }, { 59, 47, 0 } } },
+ { { { 55, 0, 0 }, { 51, 63, 0 } } },
+ { { { 55, 0, 1 }, { 52, 62, 0 } } },
+ { { { 55, 0, 2 }, { 52, 63, 0 } } },
+ { { { 56, 0, 1 }, { 61, 46, 0 } } },
+ { { { 56, 0, 0 }, { 53, 62, 0 } } },
+ { { { 56, 0, 1 }, { 53, 63, 0 } } },
+ { { { 56, 0, 2 }, { 54, 62, 0 } } },
+ { { { 57, 0, 1 }, { 62, 47, 0 } } },
+ { { { 57, 0, 0 }, { 54, 63, 0 } } },
+ { { { 57, 0, 1 }, { 55, 62, 0 } } },
+ { { { 57, 0, 2 }, { 55, 63, 0 } } },
+ { { { 58, 0, 1 }, { 56, 62, 1 } } },
+ { { { 58, 0, 0 }, { 56, 62, 0 } } },
+ { { { 58, 0, 1 }, { 56, 63, 0 } } },
+ { { { 58, 0, 2 }, { 57, 62, 0 } } },
+ { { { 59, 0, 1 }, { 57, 63, 1 } } },
+ { { { 59, 0, 0 }, { 57, 63, 0 } } },
+ { { { 59, 0, 1 }, { 58, 62, 0 } } },
+ { { { 59, 0, 2 }, { 58, 63, 0 } } },
+ { { { 60, 0, 1 }, { 59, 62, 1 } } },
+ { { { 60, 0, 0 }, { 59, 62, 0 } } },
+ { { { 60, 0, 1 }, { 59, 63, 0 } } },
+ { { { 60, 0, 2 }, { 60, 62, 0 } } },
+ { { { 61, 0, 1 }, { 60, 63, 1 } } },
+ { { { 61, 0, 0 }, { 60, 63, 0 } } },
+ { { { 61, 0, 1 }, { 61, 62, 0 } } },
+ { { { 61, 0, 2 }, { 61, 63, 0 } } },
+ { { { 62, 0, 1 }, { 62, 62, 1 } } },
+ { { { 62, 0, 0 }, { 62, 62, 0 } } },
+ { { { 62, 0, 1 }, { 62, 63, 0 } } },
+ { { { 62, 0, 2 }, { 63, 62, 0 } } },
+ { { { 63, 0, 1 }, { 63, 63, 1 } } },
+ { { { 63, 0, 0 }, { 63, 63, 0 } } }
+};
diff --git a/thirdparty/squish/squish.cpp b/thirdparty/squish/squish.cpp
new file mode 100644
index 000000000..d3cbabbaf
--- /dev/null
+++ b/thirdparty/squish/squish.cpp
@@ -0,0 +1,395 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#include <string.h>
+#include "squish.h"
+#include "colourset.h"
+#include "maths.h"
+#include "rangefit.h"
+#include "clusterfit.h"
+#include "colourblock.h"
+#include "alpha.h"
+#include "singlecolourfit.h"
+
+namespace squish {
+
+static int FixFlags( int flags )
+{
+ // grab the flag bits
+ int method = flags & ( kDxt1 | kDxt3 | kDxt5 | kBc4 | kBc5 );
+ int fit = flags & ( kColourIterativeClusterFit | kColourClusterFit | kColourRangeFit );
+ int extra = flags & kWeightColourByAlpha;
+
+ // set defaults
+ if ( method != kDxt3
+ && method != kDxt5
+ && method != kBc4
+ && method != kBc5 )
+ {
+ method = kDxt1;
+ }
+ if( fit != kColourRangeFit && fit != kColourIterativeClusterFit )
+ fit = kColourClusterFit;
+
+ // done
+ return method | fit | extra;
+}
+
+void CompressMasked( u8 const* rgba, int mask, void* block, int flags, float* metric )
+{
+ // fix any bad flags
+ flags = FixFlags( flags );
+
+ if ( ( flags & ( kBc4 | kBc5 ) ) != 0 )
+ {
+ u8 alpha[16*4];
+ for( int i = 0; i < 16; ++i )
+ {
+ alpha[i*4 + 3] = rgba[i*4 + 0]; // copy R to A
+ }
+
+ u8* rBlock = reinterpret_cast< u8* >( block );
+ CompressAlphaDxt5( alpha, mask, rBlock );
+
+ if ( ( flags & ( kBc5 ) ) != 0 )
+ {
+ for( int i = 0; i < 16; ++i )
+ {
+ alpha[i*4 + 3] = rgba[i*4 + 1]; // copy G to A
+ }
+
+ u8* gBlock = reinterpret_cast< u8* >( block ) + 8;
+ CompressAlphaDxt5( alpha, mask, gBlock );
+ }
+
+ return;
+ }
+
+ // get the block locations
+ void* colourBlock = block;
+ void* alphaBlock = block;
+ if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 )
+ colourBlock = reinterpret_cast< u8* >( block ) + 8;
+
+ // create the minimal point set
+ ColourSet colours( rgba, mask, flags );
+
+ // check the compression type and compress colour
+ if( colours.GetCount() == 1 )
+ {
+ // always do a single colour fit
+ SingleColourFit fit( &colours, flags );
+ fit.Compress( colourBlock );
+ }
+ else if( ( flags & kColourRangeFit ) != 0 || colours.GetCount() == 0 )
+ {
+ // do a range fit
+ RangeFit fit( &colours, flags, metric );
+ fit.Compress( colourBlock );
+ }
+ else
+ {
+ // default to a cluster fit (could be iterative or not)
+ ClusterFit fit( &colours, flags, metric );
+ fit.Compress( colourBlock );
+ }
+
+ // compress alpha separately if necessary
+ if( ( flags & kDxt3 ) != 0 )
+ CompressAlphaDxt3( rgba, mask, alphaBlock );
+ else if( ( flags & kDxt5 ) != 0 )
+ CompressAlphaDxt5( rgba, mask, alphaBlock );
+}
+
+void Decompress( u8* rgba, void const* block, int flags )
+{
+ // fix any bad flags
+ flags = FixFlags( flags );
+
+ // get the block locations
+ void const* colourBlock = block;
+ void const* alphaBlock = block;
+ if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 )
+ colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
+
+ // decompress colour
+ DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
+
+ // decompress alpha separately if necessary
+ if( ( flags & kDxt3 ) != 0 )
+ DecompressAlphaDxt3( rgba, alphaBlock );
+ else if( ( flags & kDxt5 ) != 0 )
+ DecompressAlphaDxt5( rgba, alphaBlock );
+}
+
+int GetStorageRequirements( int width, int height, int flags )
+{
+ // fix any bad flags
+ flags = FixFlags( flags );
+
+ // compute the storage requirements
+ int blockcount = ( ( width + 3 )/4 ) * ( ( height + 3 )/4 );
+ int blocksize = ( ( flags & ( kDxt1 | kBc4 ) ) != 0 ) ? 8 : 16;
+ return blockcount*blocksize;
+}
+
+void CopyRGBA( u8 const* source, u8* dest, int flags )
+{
+ if (flags & kSourceBGRA)
+ {
+ // convert from bgra to rgba
+ dest[0] = source[2];
+ dest[1] = source[1];
+ dest[2] = source[0];
+ dest[3] = source[3];
+ }
+ else
+ {
+ for( int i = 0; i < 4; ++i )
+ *dest++ = *source++;
+ }
+}
+
+void CompressImage( u8 const* rgba, int width, int height, int pitch, void* blocks, int flags, float* metric )
+{
+ // fix any bad flags
+ flags = FixFlags( flags );
+
+ // initialise the block output
+ u8* targetBlock = reinterpret_cast< u8* >( blocks );
+ int bytesPerBlock = ( ( flags & ( kDxt1 | kBc4 ) ) != 0 ) ? 8 : 16;
+
+ // loop over blocks
+ for( int y = 0; y < height; y += 4 )
+ {
+ for( int x = 0; x < width; x += 4 )
+ {
+ // build the 4x4 block of pixels
+ u8 sourceRgba[16*4];
+ u8* targetPixel = sourceRgba;
+ int mask = 0;
+ for( int py = 0; py < 4; ++py )
+ {
+ for( int px = 0; px < 4; ++px )
+ {
+ // get the source pixel in the image
+ int sx = x + px;
+ int sy = y + py;
+
+ // enable if we're in the image
+ if( sx < width && sy < height )
+ {
+ // copy the rgba value
+ u8 const* sourcePixel = rgba + pitch*sy + 4*sx;
+ CopyRGBA(sourcePixel, targetPixel, flags);
+ // enable this pixel
+ mask |= ( 1 << ( 4*py + px ) );
+ }
+
+ // advance to the next pixel
+ targetPixel += 4;
+ }
+ }
+
+ // compress it into the output
+ CompressMasked( sourceRgba, mask, targetBlock, flags, metric );
+
+ // advance
+ targetBlock += bytesPerBlock;
+ }
+ }
+}
+
+void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags, float* metric )
+{
+ CompressImage(rgba, width, height, width*4, blocks, flags, metric);
+}
+
+void DecompressImage( u8* rgba, int width, int height, int pitch, void const* blocks, int flags )
+{
+ // fix any bad flags
+ flags = FixFlags( flags );
+
+ // initialise the block input
+ u8 const* sourceBlock = reinterpret_cast< u8 const* >( blocks );
+ int bytesPerBlock = ( ( flags & ( kDxt1 | kBc4 ) ) != 0 ) ? 8 : 16;
+
+ // loop over blocks
+ for( int y = 0; y < height; y += 4 )
+ {
+ for( int x = 0; x < width; x += 4 )
+ {
+ // decompress the block
+ u8 targetRgba[4*16];
+ Decompress( targetRgba, sourceBlock, flags );
+
+ // write the decompressed pixels to the correct image locations
+ u8 const* sourcePixel = targetRgba;
+ for( int py = 0; py < 4; ++py )
+ {
+ for( int px = 0; px < 4; ++px )
+ {
+ // get the target location
+ int sx = x + px;
+ int sy = y + py;
+
+ // write if we're in the image
+ if( sx < width && sy < height )
+ {
+ // copy the rgba value
+ u8* targetPixel = rgba + pitch*sy + 4*sx;
+ CopyRGBA(sourcePixel, targetPixel, flags);
+ }
+
+ // advance to the next pixel
+ sourcePixel += 4;
+ }
+ }
+
+ // advance
+ sourceBlock += bytesPerBlock;
+ }
+ }
+}
+
+void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags )
+{
+ DecompressImage( rgba, width, height, width*4, blocks, flags );
+}
+
+static double ErrorSq(double x, double y)
+{
+ return (x - y) * (x - y);
+}
+
+static void ComputeBlockWMSE(u8 const *original, u8 const *compressed, unsigned int w, unsigned int h, double &cmse, double &amse)
+{
+ // Computes the MSE for the block and weights it by the variance of the original block.
+ // If the variance of the original block is less than 4 (i.e. a standard deviation of 1 per channel)
+ // then the block is close to being a single colour. Quantisation errors in single colour blocks
+ // are easier to see than similar errors in blocks that contain more colours, particularly when there
+ // are many such blocks in a large area (eg a blue sky background) as they cause banding. Given that
+ // banding is easier to see than small errors in "complex" blocks, we weight the errors by a factor
+ // of 5. This implies that images with large, single colour areas will have a higher potential WMSE
+ // than images with lots of detail.
+
+ cmse = amse = 0;
+ unsigned int sum_p[4]; // per channel sum of pixels
+ unsigned int sum_p2[4]; // per channel sum of pixels squared
+ memset(sum_p, 0, sizeof(sum_p));
+ memset(sum_p2, 0, sizeof(sum_p2));
+ for( unsigned int py = 0; py < 4; ++py )
+ {
+ for( unsigned int px = 0; px < 4; ++px )
+ {
+ if( px < w && py < h )
+ {
+ double pixelCMSE = 0;
+ for( int i = 0; i < 3; ++i )
+ {
+ pixelCMSE += ErrorSq(original[i], compressed[i]);
+ sum_p[i] += original[i];
+ sum_p2[i] += (unsigned int)original[i]*original[i];
+ }
+ if( original[3] == 0 && compressed[3] == 0 )
+ pixelCMSE = 0; // transparent in both, so colour is inconsequential
+ amse += ErrorSq(original[3], compressed[3]);
+ cmse += pixelCMSE;
+ sum_p[3] += original[3];
+ sum_p2[3] += (unsigned int)original[3]*original[3];
+ }
+ original += 4;
+ compressed += 4;
+ }
+ }
+ unsigned int variance = 0;
+ for( int i = 0; i < 4; ++i )
+ variance += w*h*sum_p2[i] - sum_p[i]*sum_p[i];
+ if( variance < 4 * w * w * h * h )
+ {
+ amse *= 5;
+ cmse *= 5;
+ }
+}
+
+void ComputeMSE( u8 const *rgba, int width, int height, int pitch, u8 const *dxt, int flags, double &colourMSE, double &alphaMSE )
+{
+ // fix any bad flags
+ flags = FixFlags( flags );
+ colourMSE = alphaMSE = 0;
+
+ // initialise the block input
+ squish::u8 const* sourceBlock = dxt;
+ int bytesPerBlock = ( ( flags & squish::kDxt1 ) != 0 ) ? 8 : 16;
+
+ // loop over blocks
+ for( int y = 0; y < height; y += 4 )
+ {
+ for( int x = 0; x < width; x += 4 )
+ {
+ // decompress the block
+ u8 targetRgba[4*16];
+ Decompress( targetRgba, sourceBlock, flags );
+ u8 const* sourcePixel = targetRgba;
+
+ // copy across to a similar pixel block
+ u8 originalRgba[4*16];
+ u8* originalPixel = originalRgba;
+
+ for( int py = 0; py < 4; ++py )
+ {
+ for( int px = 0; px < 4; ++px )
+ {
+ int sx = x + px;
+ int sy = y + py;
+ if( sx < width && sy < height )
+ {
+ u8 const* targetPixel = rgba + pitch*sy + 4*sx;
+ CopyRGBA(targetPixel, originalPixel, flags);
+ }
+ sourcePixel += 4;
+ originalPixel += 4;
+ }
+ }
+
+ // compute the weighted MSE of the block
+ double blockCMSE, blockAMSE;
+ ComputeBlockWMSE(originalRgba, targetRgba, std::min(4, width - x), std::min(4, height - y), blockCMSE, blockAMSE);
+ colourMSE += blockCMSE;
+ alphaMSE += blockAMSE;
+ // advance
+ sourceBlock += bytesPerBlock;
+ }
+ }
+ colourMSE /= (width * height * 3);
+ alphaMSE /= (width * height);
+}
+
+void ComputeMSE( u8 const *rgba, int width, int height, u8 const *dxt, int flags, double &colourMSE, double &alphaMSE )
+{
+ ComputeMSE(rgba, width, height, width*4, dxt, flags, colourMSE, alphaMSE);
+}
+
+} // namespace squish
diff --git a/thirdparty/squish/squish.h b/thirdparty/squish/squish.h
new file mode 100644
index 000000000..7c46e37ff
--- /dev/null
+++ b/thirdparty/squish/squish.h
@@ -0,0 +1,300 @@
+/* -----------------------------------------------------------------------------
+
+ Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ -------------------------------------------------------------------------- */
+
+#ifndef SQUISH_H
+#define SQUISH_H
+
+//! All squish API functions live in this namespace.
+namespace squish {
+
+// -----------------------------------------------------------------------------
+
+//! Typedef a quantity that is a single unsigned byte.
+typedef unsigned char u8;
+
+// -----------------------------------------------------------------------------
+
+enum
+{
+ //! Use DXT1 compression.
+ kDxt1 = ( 1 << 0 ),
+
+ //! Use DXT3 compression.
+ kDxt3 = ( 1 << 1 ),
+
+ //! Use DXT5 compression.
+ kDxt5 = ( 1 << 2 ),
+
+ //! Use BC4 compression.
+ kBc4 = ( 1 << 3 ),
+
+ //! Use BC5 compression.
+ kBc5 = ( 1 << 4 ),
+
+ //! Use a slow but high quality colour compressor (the default).
+ kColourClusterFit = ( 1 << 5 ),
+
+ //! Use a fast but low quality colour compressor.
+ kColourRangeFit = ( 1 << 6 ),
+
+ //! Weight the colour by alpha during cluster fit (disabled by default).
+ kWeightColourByAlpha = ( 1 << 7 ),
+
+ //! Use a very slow but very high quality colour compressor.
+ kColourIterativeClusterFit = ( 1 << 8 ),
+
+ //! Source is BGRA rather than RGBA
+ kSourceBGRA = ( 1 << 9 )
+};
+
+// -----------------------------------------------------------------------------
+
+/*! @brief Compresses a 4x4 block of pixels.
+
+ @param rgba The rgba values of the 16 source pixels.
+ @param mask The valid pixel mask.
+ @param block Storage for the compressed DXT block.
+ @param flags Compression flags.
+ @param metric An optional perceptual metric.
+
+ The source pixels should be presented as a contiguous array of 16 rgba
+ values, with each component as 1 byte each. In memory this should be:
+
+ { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
+
+ The mask parameter enables only certain pixels within the block. The lowest
+ bit enables the first pixel and so on up to the 16th bit. Bits beyond the
+ 16th bit are ignored. Pixels that are not enabled are allowed to take
+ arbitrary colours in the output block. An example of how this can be used
+ is in the CompressImage function to disable pixels outside the bounds of
+ the image when the width or height is not divisible by 4.
+
+ The flags parameter should specify kDxt1, kDxt3, kDxt5, kBc4, or kBc5 compression,
+ however, DXT1 will be used by default if none is specified. When using DXT1
+ compression, 8 bytes of storage are required for the compressed DXT block.
+ DXT3 and DXT5 compression require 16 bytes of storage per block.
+
+ The flags parameter can also specify a preferred colour compressor to use
+ when fitting the RGB components of the data. Possible colour compressors
+ are: kColourClusterFit (the default), kColourRangeFit (very fast, low
+ quality) or kColourIterativeClusterFit (slowest, best quality).
+
+ When using kColourClusterFit or kColourIterativeClusterFit, an additional
+ flag can be specified to weight the importance of each pixel by its alpha
+ value. For images that are rendered using alpha blending, this can
+ significantly increase the perceived quality.
+
+ The metric parameter can be used to weight the relative importance of each
+ colour channel, or pass NULL to use the default uniform weight of
+ { 1.0f, 1.0f, 1.0f }. This replaces the previous flag-based control that
+ allowed either uniform or "perceptual" weights with the fixed values
+ { 0.2126f, 0.7152f, 0.0722f }. If non-NULL, the metric should point to a
+ contiguous array of 3 floats.
+*/
+void CompressMasked( u8 const* rgba, int mask, void* block, int flags, float* metric = 0 );
+
+// -----------------------------------------------------------------------------
+
+/*! @brief Compresses a 4x4 block of pixels.
+
+ @param rgba The rgba values of the 16 source pixels.
+ @param block Storage for the compressed DXT block.
+ @param flags Compression flags.
+ @param metric An optional perceptual metric.
+
+ The source pixels should be presented as a contiguous array of 16 rgba
+ values, with each component as 1 byte each. In memory this should be:
+
+ { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
+
+ The flags parameter should specify kDxt1, kDxt3, kDxt5, kBc4, or kBc5 compression,
+ however, DXT1 will be used by default if none is specified. When using DXT1
+ compression, 8 bytes of storage are required for the compressed DXT block.
+ DXT3 and DXT5 compression require 16 bytes of storage per block.
+
+ The flags parameter can also specify a preferred colour compressor to use
+ when fitting the RGB components of the data. Possible colour compressors
+ are: kColourClusterFit (the default), kColourRangeFit (very fast, low
+ quality) or kColourIterativeClusterFit (slowest, best quality).
+
+ When using kColourClusterFit or kColourIterativeClusterFit, an additional
+ flag can be specified to weight the importance of each pixel by its alpha
+ value. For images that are rendered using alpha blending, this can
+ significantly increase the perceived quality.
+
+ The metric parameter can be used to weight the relative importance of each
+ colour channel, or pass NULL to use the default uniform weight of
+ { 1.0f, 1.0f, 1.0f }. This replaces the previous flag-based control that
+ allowed either uniform or "perceptual" weights with the fixed values
+ { 0.2126f, 0.7152f, 0.0722f }. If non-NULL, the metric should point to a
+ contiguous array of 3 floats.
+
+ This method is an inline that calls CompressMasked with a mask of 0xffff,
+ provided for compatibility with older versions of squish.
+*/
+inline void Compress( u8 const* rgba, void* block, int flags, float* metric = 0 )
+{
+ CompressMasked( rgba, 0xffff, block, flags, metric );
+}
+
+// -----------------------------------------------------------------------------
+
+/*! @brief Decompresses a 4x4 block of pixels.
+
+ @param rgba Storage for the 16 decompressed pixels.
+ @param block The compressed DXT block.
+ @param flags Compression flags.
+
+ The decompressed pixels will be written as a contiguous array of 16 rgba
+ values, with each component as 1 byte each. In memory this is:
+
+ { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
+
+ The flags parameter should specify kDxt1, kDxt3, kDxt5, kBc4, or kBc5 compression,
+ however, DXT1 will be used by default if none is specified. All other flags
+ are ignored.
+*/
+void Decompress( u8* rgba, void const* block, int flags );
+
+// -----------------------------------------------------------------------------
+
+/*! @brief Computes the amount of compressed storage required.
+
+ @param width The width of the image.
+ @param height The height of the image.
+ @param flags Compression flags.
+
+ The flags parameter should specify kDxt1, kDxt3, kDxt5, kBc4, or kBc5 compression,
+ however, DXT1 will be used by default if none is specified. All other flags
+ are ignored.
+
+ Most DXT images will be a multiple of 4 in each dimension, but this
+ function supports arbitrary size images by allowing the outer blocks to
+ be only partially used.
+*/
+int GetStorageRequirements( int width, int height, int flags );
+
+// -----------------------------------------------------------------------------
+
+/*! @brief Compresses an image in memory.
+
+ @param rgba The pixels of the source.
+ @param width The width of the source image.
+ @param height The height of the source image.
+ @param pitch The pitch of the source image.
+ @param blocks Storage for the compressed output.
+ @param flags Compression flags.
+ @param metric An optional perceptual metric.
+
+ The source pixels should be presented as a contiguous array of width*height
+ rgba values, with each component as 1 byte each. In memory this should be:
+
+ { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height
+
+ The flags parameter should specify kDxt1, kDxt3, kDxt5, kBc4, or kBc5 compression,
+ however, DXT1 will be used by default if none is specified. When using DXT1
+ compression, 8 bytes of storage are required for each compressed DXT block.
+ DXT3 and DXT5 compression require 16 bytes of storage per block.
+
+ The flags parameter can also specify a preferred colour compressor to use
+ when fitting the RGB components of the data. Possible colour compressors
+ are: kColourClusterFit (the default), kColourRangeFit (very fast, low
+ quality) or kColourIterativeClusterFit (slowest, best quality).
+
+ When using kColourClusterFit or kColourIterativeClusterFit, an additional
+ flag can be specified to weight the importance of each pixel by its alpha
+ value. For images that are rendered using alpha blending, this can
+ significantly increase the perceived quality.
+
+ The metric parameter can be used to weight the relative importance of each
+ colour channel, or pass NULL to use the default uniform weight of
+ { 1.0f, 1.0f, 1.0f }. This replaces the previous flag-based control that
+ allowed either uniform or "perceptual" weights with the fixed values
+ { 0.2126f, 0.7152f, 0.0722f }. If non-NULL, the metric should point to a
+ contiguous array of 3 floats.
+
+ Internally this function calls squish::CompressMasked for each block, which
+ allows for pixels outside the image to take arbitrary values. The function
+ squish::GetStorageRequirements can be called to compute the amount of memory
+ to allocate for the compressed output.
+*/
+void CompressImage( u8 const* rgba, int width, int height, int pitch, void* blocks, int flags, float* metric = 0 );
+void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags, float* metric = 0 );
+
+// -----------------------------------------------------------------------------
+
+/*! @brief Decompresses an image in memory.
+
+ @param rgba Storage for the decompressed pixels.
+ @param width The width of the source image.
+ @param height The height of the source image.
+ @param pitch The pitch of the decompressed pixels.
+ @param blocks The compressed DXT blocks.
+ @param flags Compression flags.
+
+ The decompressed pixels will be written as a contiguous array of width*height
+ 16 rgba values, with each component as 1 byte each. In memory this is:
+
+ { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height
+
+ The flags parameter should specify kDxt1, kDxt3, kDxt5, kBc4, or kBc5 compression,
+ however, DXT1 will be used by default if none is specified. All other flags
+ are ignored.
+
+ Internally this function calls squish::Decompress for each block.
+*/
+void DecompressImage( u8* rgba, int width, int height, int pitch, void const* blocks, int flags );
+void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags );
+
+// -----------------------------------------------------------------------------
+
+/*! @brief Computes MSE of an compressed image in memory.
+
+ @param rgba The original image pixels.
+ @param width The width of the source image.
+ @param height The height of the source image.
+ @param pitch The pitch of the source image.
+ @param dxt The compressed dxt blocks
+ @param flags Compression flags.
+ @param colourMSE The MSE of the colour values.
+ @param alphaMSE The MSE of the alpha values.
+
+ The colour MSE and alpha MSE are computed across all pixels. The colour MSE is
+ averaged across all rgb values (i.e. colourMSE = sum sum_k ||dxt.k - rgba.k||/3)
+
+ The flags parameter should specify kDxt1, kDxt3, kDxt5, kBc4, or kBc5 compression,
+ however, DXT1 will be used by default if none is specified. All other flags
+ are ignored.
+
+ Internally this function calls squish::Decompress for each block.
+*/
+void ComputeMSE(u8 const *rgba, int width, int height, int pitch, u8 const *dxt, int flags, double &colourMSE, double &alphaMSE);
+void ComputeMSE(u8 const *rgba, int width, int height, u8 const *dxt, int flags, double &colourMSE, double &alphaMSE);
+
+// -----------------------------------------------------------------------------
+
+} // namespace squish
+
+#endif // ndef SQUISH_H
diff --git a/drivers/builtin_zlib/zlib/adler32.c b/thirdparty/zlib/adler32.c
index a868f073d..a868f073d 100644
--- a/drivers/builtin_zlib/zlib/adler32.c
+++ b/thirdparty/zlib/adler32.c
diff --git a/drivers/builtin_zlib/zlib/compress.c b/thirdparty/zlib/compress.c
index 6e9762676..6e9762676 100644
--- a/drivers/builtin_zlib/zlib/compress.c
+++ b/thirdparty/zlib/compress.c
diff --git a/drivers/builtin_zlib/zlib/crc32.c b/thirdparty/zlib/crc32.c
index 979a7190a..979a7190a 100644
--- a/drivers/builtin_zlib/zlib/crc32.c
+++ b/thirdparty/zlib/crc32.c
diff --git a/drivers/builtin_zlib/zlib/crc32.h b/thirdparty/zlib/crc32.h
index 9e0c77810..9e0c77810 100644
--- a/drivers/builtin_zlib/zlib/crc32.h
+++ b/thirdparty/zlib/crc32.h
diff --git a/drivers/builtin_zlib/zlib/deflate.c b/thirdparty/zlib/deflate.c
index 696957705..696957705 100644
--- a/drivers/builtin_zlib/zlib/deflate.c
+++ b/thirdparty/zlib/deflate.c
diff --git a/drivers/builtin_zlib/zlib/deflate.h b/thirdparty/zlib/deflate.h
index ce0299edd..ce0299edd 100644
--- a/drivers/builtin_zlib/zlib/deflate.h
+++ b/thirdparty/zlib/deflate.h
diff --git a/drivers/builtin_zlib/zlib/infback.c b/thirdparty/zlib/infback.c
index f3833c2e4..f3833c2e4 100644
--- a/drivers/builtin_zlib/zlib/infback.c
+++ b/thirdparty/zlib/infback.c
diff --git a/drivers/builtin_zlib/zlib/inffast.c b/thirdparty/zlib/inffast.c
index bda59ceb6..bda59ceb6 100644
--- a/drivers/builtin_zlib/zlib/inffast.c
+++ b/thirdparty/zlib/inffast.c
diff --git a/drivers/builtin_zlib/zlib/inffast.h b/thirdparty/zlib/inffast.h
index e5c1aa4ca..e5c1aa4ca 100644
--- a/drivers/builtin_zlib/zlib/inffast.h
+++ b/thirdparty/zlib/inffast.h
diff --git a/drivers/builtin_zlib/zlib/inffixed.h b/thirdparty/zlib/inffixed.h
index d62832776..d62832776 100644
--- a/drivers/builtin_zlib/zlib/inffixed.h
+++ b/thirdparty/zlib/inffixed.h
diff --git a/drivers/builtin_zlib/zlib/inflate.c b/thirdparty/zlib/inflate.c
index 870f89bb4..870f89bb4 100644
--- a/drivers/builtin_zlib/zlib/inflate.c
+++ b/thirdparty/zlib/inflate.c
diff --git a/drivers/builtin_zlib/zlib/inflate.h b/thirdparty/zlib/inflate.h
index 95f4986d4..95f4986d4 100644
--- a/drivers/builtin_zlib/zlib/inflate.h
+++ b/thirdparty/zlib/inflate.h
diff --git a/drivers/builtin_zlib/zlib/inftrees.c b/thirdparty/zlib/inftrees.c
index 44d89cf24..44d89cf24 100644
--- a/drivers/builtin_zlib/zlib/inftrees.c
+++ b/thirdparty/zlib/inftrees.c
diff --git a/drivers/builtin_zlib/zlib/inftrees.h b/thirdparty/zlib/inftrees.h
index baa53a0b1..baa53a0b1 100644
--- a/drivers/builtin_zlib/zlib/inftrees.h
+++ b/thirdparty/zlib/inftrees.h
diff --git a/drivers/builtin_zlib/zlib/trees.c b/thirdparty/zlib/trees.c
index 1fd7759ef..1fd7759ef 100644
--- a/drivers/builtin_zlib/zlib/trees.c
+++ b/thirdparty/zlib/trees.c
diff --git a/drivers/builtin_zlib/zlib/trees.h b/thirdparty/zlib/trees.h
index d35639d82..d35639d82 100644
--- a/drivers/builtin_zlib/zlib/trees.h
+++ b/thirdparty/zlib/trees.h
diff --git a/drivers/builtin_zlib/zlib/uncompr.c b/thirdparty/zlib/uncompr.c
index 242e9493d..242e9493d 100644
--- a/drivers/builtin_zlib/zlib/uncompr.c
+++ b/thirdparty/zlib/uncompr.c
diff --git a/drivers/builtin_zlib/zlib/zconf.h b/thirdparty/zlib/zconf.h
index f44af82fc..f44af82fc 100644
--- a/drivers/builtin_zlib/zlib/zconf.h
+++ b/thirdparty/zlib/zconf.h
diff --git a/drivers/builtin_zlib/zlib/zlib.h b/thirdparty/zlib/zlib.h
index 3e0c7672a..3e0c7672a 100644
--- a/drivers/builtin_zlib/zlib/zlib.h
+++ b/thirdparty/zlib/zlib.h
diff --git a/drivers/builtin_zlib/zlib/zutil.c b/thirdparty/zlib/zutil.c
index 23d2ebef0..23d2ebef0 100644
--- a/drivers/builtin_zlib/zlib/zutil.c
+++ b/thirdparty/zlib/zutil.c
diff --git a/drivers/builtin_zlib/zlib/zutil.h b/thirdparty/zlib/zutil.h
index 24ab06b1c..24ab06b1c 100644
--- a/drivers/builtin_zlib/zlib/zutil.h
+++ b/thirdparty/zlib/zutil.h
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index ffcb34449..626f86d33 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -1112,6 +1112,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size"));
text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs"));
text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers"));
+ text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers_zero_padded"));
text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/show_line_length_guideline"));
text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/line_length_guideline_column"));
text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting"));
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 0ab42c5ad..bdbf20e34 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -546,6 +546,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["text_editor/tab_size"]=PropertyInfo(Variant::INT,"text_editor/tab_size",PROPERTY_HINT_RANGE,"1, 64, 1"); // size of 0 crashes.
set("text_editor/draw_tabs", true);
+ set("text_editor/line_numbers_zero_padded", false);
+
set("text_editor/show_line_numbers", true);
set("text_editor/show_breakpoint_gutter", true);
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index 342e6b98c..56f10ff7f 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -238,6 +238,34 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String>& p_files,Node*
}
+void SceneTreeDock::_replace_with_branch_scene(const String& p_file,Node* base) {
+ Ref<PackedScene> sdata = ResourceLoader::load(p_file);
+ if (!sdata.is_valid()) {
+ accept->get_ok()->set_text(TTR("Ugh"));
+ accept->set_text(vformat(TTR("Error loading scene from %s"),p_file));
+ accept->popup_centered_minsize();
+ return;
+ }
+
+ Node *instanced_scene=sdata->instance(true);
+ if (!instanced_scene) {
+ accept->get_ok()->set_text(TTR("Ugh"));
+ accept->set_text(vformat(TTR("Error instancing scene from %s"),p_file));
+ accept->popup_centered_minsize();
+ return;
+ }
+
+ Node *parent = base->get_parent();
+ int pos = base->get_index();
+ memdelete(base);
+ parent->add_child(instanced_scene);
+ parent->move_child(instanced_scene, pos);
+ instanced_scene->set_owner(edited_scene);
+ editor_selection->clear();
+ editor_selection->add_node(instanced_scene);
+ scene_tree->set_selected(instanced_scene);
+}
+
bool SceneTreeDock::_cyclical_dependency_exists(const String& p_target_scene_path, Node* p_desired_node) {
int childCount = p_desired_node->get_child_count();
@@ -1513,7 +1541,7 @@ void SceneTreeDock::_new_scene_from(String p_file) {
accept->popup_centered_minsize();
return;
}
-
+ _replace_with_branch_scene(p_file, base);
} else {
accept->get_ok()->set_text(TTR("I see.."));
accept->set_text(TTR("Error duplicating scene to save it."));
diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h
index 971013a56..8933a0388 100644
--- a/tools/editor/scene_tree_dock.h
+++ b/tools/editor/scene_tree_dock.h
@@ -153,6 +153,7 @@ class SceneTreeDock : public VBoxContainer {
void _filter_changed(const String& p_filter);
void _perform_instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos);
+ void _replace_with_branch_scene(const String& p_file,Node* base);
protected: