From 7ad6d1cf27436bdfdac8b95e46340fa1ae7ee408 Mon Sep 17 00:00:00 2001 From: "holmer@google.com" Date: Thu, 18 Aug 2011 08:27:26 +0000 Subject: [PATCH] Upgrading to libvpx 0.9.7-p1 (Cayuga) Review URL: http://webrtc-codereview.appspot.com/91015 git-svn-id: http://webrtc.googlecode.com/svn/trunk@398 4adac7df-926f-26a2-2b94-8c16560cd09d --- DEPS | 2 +- third_party/libvpx/input_files_linux.gypi | 362 +++++++ third_party/libvpx/input_files_mac.gypi | 362 +++++++ third_party/libvpx/input_files_win.gypi | 291 ++++++ third_party/libvpx/libvpx.gyp | 274 ++---- .../config/linux/ia32/asm_enc_offsets.asm | 42 + .../config/linux/ia32/obj_int_extract.c | 914 ++++++++++++++++++ .../source/config/linux/ia32/vpx_config.asm | 5 +- .../source/config/linux/ia32/vpx_config.c | 2 +- .../source/config/linux/ia32/vpx_config.h | 8 +- .../source/config/linux/ia32/vpx_version.h | 6 +- .../config/linux/x64/asm_enc_offsets.asm | 42 + .../source/config/linux/x64/obj_int_extract.c | 914 ++++++++++++++++++ .../source/config/linux/x64/vpx_config.asm | 5 +- .../source/config/linux/x64/vpx_config.c | 2 +- .../source/config/linux/x64/vpx_config.h | 8 +- .../source/config/linux/x64/vpx_version.h | 6 +- .../config/mac/ia32/asm_enc_offsets.asm | 42 + .../source/config/mac/ia32/obj_int_extract.c | 914 ++++++++++++++++++ .../source/config/mac/ia32/vpx_config.asm | 5 +- .../source/config/mac/ia32/vpx_config.c | 2 +- .../source/config/mac/ia32/vpx_config.h | 8 +- .../source/config/mac/ia32/vpx_version.h | 6 +- .../source/config/mac/x64/asm_enc_offsets.asm | 42 + .../source/config/mac/x64/obj_int_extract.c | 914 ++++++++++++++++++ .../source/config/mac/x64/vpx_config.asm | 5 +- .../libvpx/source/config/mac/x64/vpx_config.c | 2 +- .../libvpx/source/config/mac/x64/vpx_config.h | 8 +- .../source/config/mac/x64/vpx_version.h | 6 +- .../config/win/ia32/asm_com_offsets.asm | 12 + .../config/win/ia32/asm_dec_offsets.asm | 17 + .../config/win/ia32/asm_enc_offsets.asm | 43 + .../source/config/win/ia32/vpx_config.asm | 5 +- .../source/config/win/ia32/vpx_config.c | 2 +- .../source/config/win/ia32/vpx_config.h | 8 +- .../source/config/win/ia32/vpx_version.h | 6 +- .../source/config/win/x64/asm_com_offsets.asm | 12 + .../source/config/win/x64/asm_dec_offsets.asm | 17 + .../source/config/win/x64/asm_enc_offsets.asm | 43 + .../source/config/win/x64/vpx_config.asm | 5 +- .../libvpx/source/config/win/x64/vpx_config.c | 2 +- .../libvpx/source/config/win/x64/vpx_config.h | 8 +- .../source/config/win/x64/vpx_version.h | 6 +- 43 files changed, 5154 insertions(+), 231 deletions(-) create mode 100644 third_party/libvpx/input_files_linux.gypi create mode 100644 third_party/libvpx/input_files_mac.gypi create mode 100644 third_party/libvpx/input_files_win.gypi create mode 100644 third_party/libvpx/source/config/linux/ia32/asm_enc_offsets.asm create mode 100644 third_party/libvpx/source/config/linux/ia32/obj_int_extract.c create mode 100644 third_party/libvpx/source/config/linux/x64/asm_enc_offsets.asm create mode 100644 third_party/libvpx/source/config/linux/x64/obj_int_extract.c create mode 100644 third_party/libvpx/source/config/mac/ia32/asm_enc_offsets.asm create mode 100644 third_party/libvpx/source/config/mac/ia32/obj_int_extract.c create mode 100644 third_party/libvpx/source/config/mac/x64/asm_enc_offsets.asm create mode 100644 third_party/libvpx/source/config/mac/x64/obj_int_extract.c create mode 100644 third_party/libvpx/source/config/win/ia32/asm_com_offsets.asm create mode 100644 third_party/libvpx/source/config/win/ia32/asm_dec_offsets.asm create mode 100644 third_party/libvpx/source/config/win/ia32/asm_enc_offsets.asm create mode 100644 third_party/libvpx/source/config/win/x64/asm_com_offsets.asm create mode 100644 third_party/libvpx/source/config/win/x64/asm_dec_offsets.asm create mode 100644 third_party/libvpx/source/config/win/x64/asm_enc_offsets.asm diff --git a/DEPS b/DEPS index 09d440856..057db559f 100644 --- a/DEPS +++ b/DEPS @@ -25,7 +25,7 @@ deps = { Var("chromium_trunk") + "/src/third_party/protobuf@" + Var("chromium_revision"), "trunk/third_party/libvpx/source/libvpx": - "git://review.webmproject.org/libvpx.git@v0.9.6", + "git://review.webmproject.org/libvpx.git@v0.9.7-p1", "trunk/third_party/libjpeg_turbo/": Var("chromium_trunk") + "/deps/third_party/libjpeg_turbo@95800", diff --git a/third_party/libvpx/input_files_linux.gypi b/third_party/libvpx/input_files_linux.gypi new file mode 100644 index 000000000..0048416aa --- /dev/null +++ b/third_party/libvpx/input_files_linux.gypi @@ -0,0 +1,362 @@ +{ + 'conditions': [ + ['target_arch=="ia32"', { + 'sources': [ + # generated input files + 'source/config/linux/ia32/asm_enc_offsets.asm', + 'source/config/linux/ia32/vpx_config.asm', + 'source/config/linux/ia32/vpx_config.c', + 'source/config/linux/ia32/vpx_config.h', + 'source/config/linux/ia32/vpx_version.h', + 'source/config/linux/ia32/obj_int_extract.c', + + # source input files + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vpx/src/vpx_decoder.c', + 'source/libvpx/vpx/src/vpx_decoder_compat.c', + 'source/libvpx/vpx/src/vpx_encoder.c', + 'source/libvpx/vpx/src/vpx_codec.c', + 'source/libvpx/vpx/src/vpx_image.c', + 'source/libvpx/vpx_mem/vpx_mem.c', + 'source/libvpx/vpx_scale/generic/vpxscale.c', + 'source/libvpx/vpx_scale/generic/yv12config.c', + 'source/libvpx/vpx_scale/generic/yv12extend.c', + 'source/libvpx/vpx_scale/generic/scalesystemdependent.c', + 'source/libvpx/vpx_scale/generic/gen_scalers.c', + 'source/libvpx/vp8/common/alloccommon.c', + 'source/libvpx/vp8/common/asm_com_offsets.c', + 'source/libvpx/vp8/common/blockd.c', + 'source/libvpx/vp8/common/debugmodes.c', + 'source/libvpx/vp8/common/defaultcoefcounts.c', + 'source/libvpx/vp8/common/entropy.c', + 'source/libvpx/vp8/common/entropymode.c', + 'source/libvpx/vp8/common/entropymv.c', + 'source/libvpx/vp8/common/extend.c', + 'source/libvpx/vp8/common/filter.c', + 'source/libvpx/vp8/common/findnearmv.c', + 'source/libvpx/vp8/common/generic/systemdependent.c', + 'source/libvpx/vp8/common/idctllm.c', + 'source/libvpx/vp8/common/invtrans.c', + 'source/libvpx/vp8/common/loopfilter.c', + 'source/libvpx/vp8/common/loopfilter_filters.c', + 'source/libvpx/vp8/common/mbpitch.c', + 'source/libvpx/vp8/common/modecont.c', + 'source/libvpx/vp8/common/modecontext.c', + 'source/libvpx/vp8/common/quant_common.c', + 'source/libvpx/vp8/common/recon.c', + 'source/libvpx/vp8/common/reconinter.c', + 'source/libvpx/vp8/common/reconintra.c', + 'source/libvpx/vp8/common/reconintra4x4.c', + 'source/libvpx/vp8/common/setupintrarecon.c', + 'source/libvpx/vp8/common/swapyv12buffer.c', + 'source/libvpx/vp8/common/treecoder.c', + 'source/libvpx/vp8/common/x86/x86_systemdependent.c', + 'source/libvpx/vp8/common/x86/vp8_asm_stubs.c', + 'source/libvpx/vp8/common/x86/loopfilter_x86.c', + 'source/libvpx/vp8/common/postproc.c', + 'source/libvpx/vp8/common/x86/recon_wrapper_sse2.c', + 'source/libvpx/vp8/vp8_cx_iface.c', + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vp8/encoder/bitstream.c', + 'source/libvpx/vp8/encoder/boolhuff.c', + 'source/libvpx/vp8/encoder/dct.c', + 'source/libvpx/vp8/encoder/encodeframe.c', + 'source/libvpx/vp8/encoder/encodeintra.c', + 'source/libvpx/vp8/encoder/encodemb.c', + 'source/libvpx/vp8/encoder/encodemv.c', + 'source/libvpx/vp8/encoder/ethreading.c', + 'source/libvpx/vp8/encoder/firstpass.c', + 'source/libvpx/vp8/encoder/generic/csystemdependent.c', + 'source/libvpx/vp8/encoder/lookahead.c', + 'source/libvpx/vp8/encoder/mcomp.c', + 'source/libvpx/vp8/encoder/modecosts.c', + 'source/libvpx/vp8/encoder/onyx_if.c', + 'source/libvpx/vp8/encoder/pickinter.c', + 'source/libvpx/vp8/encoder/picklpf.c', + 'source/libvpx/vp8/encoder/psnr.c', + 'source/libvpx/vp8/encoder/quantize.c', + 'source/libvpx/vp8/encoder/ratectrl.c', + 'source/libvpx/vp8/encoder/rdopt.c', + 'source/libvpx/vp8/encoder/sad_c.c', + 'source/libvpx/vp8/encoder/segmentation.c', + 'source/libvpx/vp8/encoder/tokenize.c', + 'source/libvpx/vp8/encoder/treewriter.c', + 'source/libvpx/vp8/encoder/variance_c.c', + 'source/libvpx/vp8/encoder/temporal_filter.c', + 'source/libvpx/vp8/encoder/x86/x86_csystemdependent.c', + 'source/libvpx/vp8/encoder/x86/variance_mmx.c', + 'source/libvpx/vp8/encoder/x86/variance_sse2.c', + 'source/libvpx/vp8/encoder/x86/variance_ssse3.c', + 'source/libvpx/vp8/vp8_dx_iface.c', + 'source/libvpx/vp8/decoder/asm_dec_offsets.c', + 'source/libvpx/vp8/decoder/dboolhuff.c', + 'source/libvpx/vp8/decoder/decodemv.c', + 'source/libvpx/vp8/decoder/decodframe.c', + 'source/libvpx/vp8/decoder/dequantize.c', + 'source/libvpx/vp8/decoder/detokenize.c', + 'source/libvpx/vp8/decoder/error_concealment.c', + 'source/libvpx/vp8/decoder/generic/dsystemdependent.c', + 'source/libvpx/vp8/decoder/onyxd_if.c', + 'source/libvpx/vp8/decoder/threading.c', + 'source/libvpx/vp8/decoder/idct_blk.c', + 'source/libvpx/vp8/decoder/reconintra_mt.c', + 'source/libvpx/vp8/decoder/x86/x86_dsystemdependent.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_mmx.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_sse2.c', + 'source/libvpx/vpx_ports/x86_cpuid.c', + + # yasm input + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + ], # sources + },], # target_arch=="ia32" + ['target_arch=="x64"', { + 'sources': [ + # generated input files + 'source/config/linux/x64/asm_enc_offsets.asm', + 'source/config/linux/x64/vpx_config.asm', + 'source/config/linux/x64/vpx_config.c', + 'source/config/linux/x64/vpx_config.h', + 'source/config/linux/x64/vpx_version.h', + 'source/config/linux/x64/obj_int_extract.c', + + # source input files + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vpx/src/vpx_decoder.c', + 'source/libvpx/vpx/src/vpx_decoder_compat.c', + 'source/libvpx/vpx/src/vpx_encoder.c', + 'source/libvpx/vpx/src/vpx_codec.c', + 'source/libvpx/vpx/src/vpx_image.c', + 'source/libvpx/vpx_mem/vpx_mem.c', + 'source/libvpx/vpx_scale/generic/vpxscale.c', + 'source/libvpx/vpx_scale/generic/yv12config.c', + 'source/libvpx/vpx_scale/generic/yv12extend.c', + 'source/libvpx/vpx_scale/generic/scalesystemdependent.c', + 'source/libvpx/vpx_scale/generic/gen_scalers.c', + 'source/libvpx/vp8/common/alloccommon.c', + 'source/libvpx/vp8/common/asm_com_offsets.c', + 'source/libvpx/vp8/common/blockd.c', + 'source/libvpx/vp8/common/debugmodes.c', + 'source/libvpx/vp8/common/defaultcoefcounts.c', + 'source/libvpx/vp8/common/entropy.c', + 'source/libvpx/vp8/common/entropymode.c', + 'source/libvpx/vp8/common/entropymv.c', + 'source/libvpx/vp8/common/extend.c', + 'source/libvpx/vp8/common/filter.c', + 'source/libvpx/vp8/common/findnearmv.c', + 'source/libvpx/vp8/common/generic/systemdependent.c', + 'source/libvpx/vp8/common/idctllm.c', + 'source/libvpx/vp8/common/invtrans.c', + 'source/libvpx/vp8/common/loopfilter.c', + 'source/libvpx/vp8/common/loopfilter_filters.c', + 'source/libvpx/vp8/common/mbpitch.c', + 'source/libvpx/vp8/common/modecont.c', + 'source/libvpx/vp8/common/modecontext.c', + 'source/libvpx/vp8/common/quant_common.c', + 'source/libvpx/vp8/common/recon.c', + 'source/libvpx/vp8/common/reconinter.c', + 'source/libvpx/vp8/common/reconintra.c', + 'source/libvpx/vp8/common/reconintra4x4.c', + 'source/libvpx/vp8/common/setupintrarecon.c', + 'source/libvpx/vp8/common/swapyv12buffer.c', + 'source/libvpx/vp8/common/treecoder.c', + 'source/libvpx/vp8/common/x86/x86_systemdependent.c', + 'source/libvpx/vp8/common/x86/vp8_asm_stubs.c', + 'source/libvpx/vp8/common/x86/loopfilter_x86.c', + 'source/libvpx/vp8/common/postproc.c', + 'source/libvpx/vp8/common/x86/recon_wrapper_sse2.c', + 'source/libvpx/vp8/vp8_cx_iface.c', + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vp8/encoder/bitstream.c', + 'source/libvpx/vp8/encoder/boolhuff.c', + 'source/libvpx/vp8/encoder/dct.c', + 'source/libvpx/vp8/encoder/encodeframe.c', + 'source/libvpx/vp8/encoder/encodeintra.c', + 'source/libvpx/vp8/encoder/encodemb.c', + 'source/libvpx/vp8/encoder/encodemv.c', + 'source/libvpx/vp8/encoder/ethreading.c', + 'source/libvpx/vp8/encoder/firstpass.c', + 'source/libvpx/vp8/encoder/generic/csystemdependent.c', + 'source/libvpx/vp8/encoder/lookahead.c', + 'source/libvpx/vp8/encoder/mcomp.c', + 'source/libvpx/vp8/encoder/modecosts.c', + 'source/libvpx/vp8/encoder/onyx_if.c', + 'source/libvpx/vp8/encoder/pickinter.c', + 'source/libvpx/vp8/encoder/picklpf.c', + 'source/libvpx/vp8/encoder/psnr.c', + 'source/libvpx/vp8/encoder/quantize.c', + 'source/libvpx/vp8/encoder/ratectrl.c', + 'source/libvpx/vp8/encoder/rdopt.c', + 'source/libvpx/vp8/encoder/sad_c.c', + 'source/libvpx/vp8/encoder/segmentation.c', + 'source/libvpx/vp8/encoder/tokenize.c', + 'source/libvpx/vp8/encoder/treewriter.c', + 'source/libvpx/vp8/encoder/variance_c.c', + 'source/libvpx/vp8/encoder/temporal_filter.c', + 'source/libvpx/vp8/encoder/x86/x86_csystemdependent.c', + 'source/libvpx/vp8/encoder/x86/variance_mmx.c', + 'source/libvpx/vp8/encoder/x86/variance_sse2.c', + 'source/libvpx/vp8/encoder/x86/variance_ssse3.c', + 'source/libvpx/vp8/vp8_dx_iface.c', + 'source/libvpx/vp8/decoder/asm_dec_offsets.c', + 'source/libvpx/vp8/decoder/dboolhuff.c', + 'source/libvpx/vp8/decoder/decodemv.c', + 'source/libvpx/vp8/decoder/decodframe.c', + 'source/libvpx/vp8/decoder/dequantize.c', + 'source/libvpx/vp8/decoder/detokenize.c', + 'source/libvpx/vp8/decoder/error_concealment.c', + 'source/libvpx/vp8/decoder/generic/dsystemdependent.c', + 'source/libvpx/vp8/decoder/onyxd_if.c', + 'source/libvpx/vp8/decoder/threading.c', + 'source/libvpx/vp8/decoder/idct_blk.c', + 'source/libvpx/vp8/decoder/reconintra_mt.c', + 'source/libvpx/vp8/decoder/x86/x86_dsystemdependent.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_mmx.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_sse2.c', + 'source/libvpx/vpx_ports/x86_cpuid.c', + + # yasm input + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/encoder/x86/ssim_opt.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/encoder/x86/ssim_opt.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + ], # sources + },], # target_arch=="x64" + ], # conditions +} diff --git a/third_party/libvpx/input_files_mac.gypi b/third_party/libvpx/input_files_mac.gypi new file mode 100644 index 000000000..740f2560d --- /dev/null +++ b/third_party/libvpx/input_files_mac.gypi @@ -0,0 +1,362 @@ +{ + 'conditions': [ + ['target_arch=="ia32"', { + 'sources': [ + # generated input files + 'source/config/mac/ia32/asm_enc_offsets.asm', + 'source/config/mac/ia32/vpx_config.asm', + 'source/config/mac/ia32/vpx_config.c', + 'source/config/mac/ia32/vpx_config.h', + 'source/config/mac/ia32/vpx_version.h', + 'source/config/mac/ia32/obj_int_extract.c', + + # source input files + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vpx/src/vpx_decoder.c', + 'source/libvpx/vpx/src/vpx_decoder_compat.c', + 'source/libvpx/vpx/src/vpx_encoder.c', + 'source/libvpx/vpx/src/vpx_codec.c', + 'source/libvpx/vpx/src/vpx_image.c', + 'source/libvpx/vpx_mem/vpx_mem.c', + 'source/libvpx/vpx_scale/generic/vpxscale.c', + 'source/libvpx/vpx_scale/generic/yv12config.c', + 'source/libvpx/vpx_scale/generic/yv12extend.c', + 'source/libvpx/vpx_scale/generic/scalesystemdependent.c', + 'source/libvpx/vpx_scale/generic/gen_scalers.c', + 'source/libvpx/vp8/common/alloccommon.c', + 'source/libvpx/vp8/common/asm_com_offsets.c', + 'source/libvpx/vp8/common/blockd.c', + 'source/libvpx/vp8/common/debugmodes.c', + 'source/libvpx/vp8/common/defaultcoefcounts.c', + 'source/libvpx/vp8/common/entropy.c', + 'source/libvpx/vp8/common/entropymode.c', + 'source/libvpx/vp8/common/entropymv.c', + 'source/libvpx/vp8/common/extend.c', + 'source/libvpx/vp8/common/filter.c', + 'source/libvpx/vp8/common/findnearmv.c', + 'source/libvpx/vp8/common/generic/systemdependent.c', + 'source/libvpx/vp8/common/idctllm.c', + 'source/libvpx/vp8/common/invtrans.c', + 'source/libvpx/vp8/common/loopfilter.c', + 'source/libvpx/vp8/common/loopfilter_filters.c', + 'source/libvpx/vp8/common/mbpitch.c', + 'source/libvpx/vp8/common/modecont.c', + 'source/libvpx/vp8/common/modecontext.c', + 'source/libvpx/vp8/common/quant_common.c', + 'source/libvpx/vp8/common/recon.c', + 'source/libvpx/vp8/common/reconinter.c', + 'source/libvpx/vp8/common/reconintra.c', + 'source/libvpx/vp8/common/reconintra4x4.c', + 'source/libvpx/vp8/common/setupintrarecon.c', + 'source/libvpx/vp8/common/swapyv12buffer.c', + 'source/libvpx/vp8/common/treecoder.c', + 'source/libvpx/vp8/common/x86/x86_systemdependent.c', + 'source/libvpx/vp8/common/x86/vp8_asm_stubs.c', + 'source/libvpx/vp8/common/x86/loopfilter_x86.c', + 'source/libvpx/vp8/common/postproc.c', + 'source/libvpx/vp8/common/x86/recon_wrapper_sse2.c', + 'source/libvpx/vp8/vp8_cx_iface.c', + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vp8/encoder/bitstream.c', + 'source/libvpx/vp8/encoder/boolhuff.c', + 'source/libvpx/vp8/encoder/dct.c', + 'source/libvpx/vp8/encoder/encodeframe.c', + 'source/libvpx/vp8/encoder/encodeintra.c', + 'source/libvpx/vp8/encoder/encodemb.c', + 'source/libvpx/vp8/encoder/encodemv.c', + 'source/libvpx/vp8/encoder/ethreading.c', + 'source/libvpx/vp8/encoder/firstpass.c', + 'source/libvpx/vp8/encoder/generic/csystemdependent.c', + 'source/libvpx/vp8/encoder/lookahead.c', + 'source/libvpx/vp8/encoder/mcomp.c', + 'source/libvpx/vp8/encoder/modecosts.c', + 'source/libvpx/vp8/encoder/onyx_if.c', + 'source/libvpx/vp8/encoder/pickinter.c', + 'source/libvpx/vp8/encoder/picklpf.c', + 'source/libvpx/vp8/encoder/psnr.c', + 'source/libvpx/vp8/encoder/quantize.c', + 'source/libvpx/vp8/encoder/ratectrl.c', + 'source/libvpx/vp8/encoder/rdopt.c', + 'source/libvpx/vp8/encoder/sad_c.c', + 'source/libvpx/vp8/encoder/segmentation.c', + 'source/libvpx/vp8/encoder/tokenize.c', + 'source/libvpx/vp8/encoder/treewriter.c', + 'source/libvpx/vp8/encoder/variance_c.c', + 'source/libvpx/vp8/encoder/temporal_filter.c', + 'source/libvpx/vp8/encoder/x86/x86_csystemdependent.c', + 'source/libvpx/vp8/encoder/x86/variance_mmx.c', + 'source/libvpx/vp8/encoder/x86/variance_sse2.c', + 'source/libvpx/vp8/encoder/x86/variance_ssse3.c', + 'source/libvpx/vp8/vp8_dx_iface.c', + 'source/libvpx/vp8/decoder/asm_dec_offsets.c', + 'source/libvpx/vp8/decoder/dboolhuff.c', + 'source/libvpx/vp8/decoder/decodemv.c', + 'source/libvpx/vp8/decoder/decodframe.c', + 'source/libvpx/vp8/decoder/dequantize.c', + 'source/libvpx/vp8/decoder/detokenize.c', + 'source/libvpx/vp8/decoder/error_concealment.c', + 'source/libvpx/vp8/decoder/generic/dsystemdependent.c', + 'source/libvpx/vp8/decoder/onyxd_if.c', + 'source/libvpx/vp8/decoder/threading.c', + 'source/libvpx/vp8/decoder/idct_blk.c', + 'source/libvpx/vp8/decoder/reconintra_mt.c', + 'source/libvpx/vp8/decoder/x86/x86_dsystemdependent.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_mmx.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_sse2.c', + 'source/libvpx/vpx_ports/x86_cpuid.c', + + # yasm input + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + ], # sources + },], # target_arch=="ia32" + ['target_arch=="x64"', { + 'sources': [ + # generated input files + 'source/config/mac/x64/asm_enc_offsets.asm', + 'source/config/mac/x64/vpx_config.asm', + 'source/config/mac/x64/vpx_config.c', + 'source/config/mac/x64/vpx_config.h', + 'source/config/mac/x64/vpx_version.h', + 'source/config/mac/x64/obj_int_extract.c', + + # source input files + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vpx/src/vpx_decoder.c', + 'source/libvpx/vpx/src/vpx_decoder_compat.c', + 'source/libvpx/vpx/src/vpx_encoder.c', + 'source/libvpx/vpx/src/vpx_codec.c', + 'source/libvpx/vpx/src/vpx_image.c', + 'source/libvpx/vpx_mem/vpx_mem.c', + 'source/libvpx/vpx_scale/generic/vpxscale.c', + 'source/libvpx/vpx_scale/generic/yv12config.c', + 'source/libvpx/vpx_scale/generic/yv12extend.c', + 'source/libvpx/vpx_scale/generic/scalesystemdependent.c', + 'source/libvpx/vpx_scale/generic/gen_scalers.c', + 'source/libvpx/vp8/common/alloccommon.c', + 'source/libvpx/vp8/common/asm_com_offsets.c', + 'source/libvpx/vp8/common/blockd.c', + 'source/libvpx/vp8/common/debugmodes.c', + 'source/libvpx/vp8/common/defaultcoefcounts.c', + 'source/libvpx/vp8/common/entropy.c', + 'source/libvpx/vp8/common/entropymode.c', + 'source/libvpx/vp8/common/entropymv.c', + 'source/libvpx/vp8/common/extend.c', + 'source/libvpx/vp8/common/filter.c', + 'source/libvpx/vp8/common/findnearmv.c', + 'source/libvpx/vp8/common/generic/systemdependent.c', + 'source/libvpx/vp8/common/idctllm.c', + 'source/libvpx/vp8/common/invtrans.c', + 'source/libvpx/vp8/common/loopfilter.c', + 'source/libvpx/vp8/common/loopfilter_filters.c', + 'source/libvpx/vp8/common/mbpitch.c', + 'source/libvpx/vp8/common/modecont.c', + 'source/libvpx/vp8/common/modecontext.c', + 'source/libvpx/vp8/common/quant_common.c', + 'source/libvpx/vp8/common/recon.c', + 'source/libvpx/vp8/common/reconinter.c', + 'source/libvpx/vp8/common/reconintra.c', + 'source/libvpx/vp8/common/reconintra4x4.c', + 'source/libvpx/vp8/common/setupintrarecon.c', + 'source/libvpx/vp8/common/swapyv12buffer.c', + 'source/libvpx/vp8/common/treecoder.c', + 'source/libvpx/vp8/common/x86/x86_systemdependent.c', + 'source/libvpx/vp8/common/x86/vp8_asm_stubs.c', + 'source/libvpx/vp8/common/x86/loopfilter_x86.c', + 'source/libvpx/vp8/common/postproc.c', + 'source/libvpx/vp8/common/x86/recon_wrapper_sse2.c', + 'source/libvpx/vp8/vp8_cx_iface.c', + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vp8/encoder/bitstream.c', + 'source/libvpx/vp8/encoder/boolhuff.c', + 'source/libvpx/vp8/encoder/dct.c', + 'source/libvpx/vp8/encoder/encodeframe.c', + 'source/libvpx/vp8/encoder/encodeintra.c', + 'source/libvpx/vp8/encoder/encodemb.c', + 'source/libvpx/vp8/encoder/encodemv.c', + 'source/libvpx/vp8/encoder/ethreading.c', + 'source/libvpx/vp8/encoder/firstpass.c', + 'source/libvpx/vp8/encoder/generic/csystemdependent.c', + 'source/libvpx/vp8/encoder/lookahead.c', + 'source/libvpx/vp8/encoder/mcomp.c', + 'source/libvpx/vp8/encoder/modecosts.c', + 'source/libvpx/vp8/encoder/onyx_if.c', + 'source/libvpx/vp8/encoder/pickinter.c', + 'source/libvpx/vp8/encoder/picklpf.c', + 'source/libvpx/vp8/encoder/psnr.c', + 'source/libvpx/vp8/encoder/quantize.c', + 'source/libvpx/vp8/encoder/ratectrl.c', + 'source/libvpx/vp8/encoder/rdopt.c', + 'source/libvpx/vp8/encoder/sad_c.c', + 'source/libvpx/vp8/encoder/segmentation.c', + 'source/libvpx/vp8/encoder/tokenize.c', + 'source/libvpx/vp8/encoder/treewriter.c', + 'source/libvpx/vp8/encoder/variance_c.c', + 'source/libvpx/vp8/encoder/temporal_filter.c', + 'source/libvpx/vp8/encoder/x86/x86_csystemdependent.c', + 'source/libvpx/vp8/encoder/x86/variance_mmx.c', + 'source/libvpx/vp8/encoder/x86/variance_sse2.c', + 'source/libvpx/vp8/encoder/x86/variance_ssse3.c', + 'source/libvpx/vp8/vp8_dx_iface.c', + 'source/libvpx/vp8/decoder/asm_dec_offsets.c', + 'source/libvpx/vp8/decoder/dboolhuff.c', + 'source/libvpx/vp8/decoder/decodemv.c', + 'source/libvpx/vp8/decoder/decodframe.c', + 'source/libvpx/vp8/decoder/dequantize.c', + 'source/libvpx/vp8/decoder/detokenize.c', + 'source/libvpx/vp8/decoder/error_concealment.c', + 'source/libvpx/vp8/decoder/generic/dsystemdependent.c', + 'source/libvpx/vp8/decoder/onyxd_if.c', + 'source/libvpx/vp8/decoder/threading.c', + 'source/libvpx/vp8/decoder/idct_blk.c', + 'source/libvpx/vp8/decoder/reconintra_mt.c', + 'source/libvpx/vp8/decoder/x86/x86_dsystemdependent.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_mmx.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_sse2.c', + 'source/libvpx/vpx_ports/x86_cpuid.c', + + # yasm input + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/ssim_opt.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/encoder/x86/ssim_opt.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + ], # sources + },], # target_arch=="x64" + ], # conditions +} diff --git a/third_party/libvpx/input_files_win.gypi b/third_party/libvpx/input_files_win.gypi new file mode 100644 index 000000000..07208bf36 --- /dev/null +++ b/third_party/libvpx/input_files_win.gypi @@ -0,0 +1,291 @@ +{ + 'conditions': [ + ['target_arch=="ia32"', { + 'sources': [ + # generated input files + 'source/config/win/ia32/asm_com_offsets.asm', + 'source/config/win/ia32/asm_enc_offsets.asm', + 'source/config/win/ia32/asm_dec_offsets.asm', + 'source/config/win/ia32/vpx_config.asm', + 'source/config/win/ia32/vpx_config.c', + 'source/config/win/ia32/vpx_config.h', + 'source/config/win/ia32/vpx_version.h', + + # source input files + 'source/libvpx/vpx/src/vpx_decoder.c', + 'source/libvpx/vpx/src/vpx_decoder_compat.c', + 'source/libvpx/vpx/src/vpx_encoder.c', + 'source/libvpx/vpx/src/vpx_codec.c', + 'source/libvpx/vpx/src/vpx_image.c', + 'source/libvpx/vpx_mem/vpx_mem.c', + 'source/libvpx/vpx_scale/generic/vpxscale.c', + 'source/libvpx/vpx_scale/generic/yv12config.c', + 'source/libvpx/vpx_scale/generic/yv12extend.c', + 'source/libvpx/vpx_scale/generic/scalesystemdependent.c', + 'source/libvpx/vpx_scale/generic/gen_scalers.c', + 'source/libvpx/vp8/common/alloccommon.c', + 'source/libvpx/vp8/common/asm_com_offsets.c', + 'source/libvpx/vp8/common/blockd.c', + 'source/libvpx/vp8/common/debugmodes.c', + 'source/libvpx/vp8/common/defaultcoefcounts.c', + 'source/libvpx/vp8/common/entropy.c', + 'source/libvpx/vp8/common/entropymode.c', + 'source/libvpx/vp8/common/entropymv.c', + 'source/libvpx/vp8/common/extend.c', + 'source/libvpx/vp8/common/filter.c', + 'source/libvpx/vp8/common/findnearmv.c', + 'source/libvpx/vp8/common/generic/systemdependent.c', + 'source/libvpx/vp8/common/idctllm.c', + 'source/libvpx/vp8/common/invtrans.c', + 'source/libvpx/vp8/common/loopfilter.c', + 'source/libvpx/vp8/common/loopfilter_filters.c', + 'source/libvpx/vp8/common/mbpitch.c', + 'source/libvpx/vp8/common/modecont.c', + 'source/libvpx/vp8/common/modecontext.c', + 'source/libvpx/vp8/common/quant_common.c', + 'source/libvpx/vp8/common/recon.c', + 'source/libvpx/vp8/common/reconinter.c', + 'source/libvpx/vp8/common/reconintra.c', + 'source/libvpx/vp8/common/reconintra4x4.c', + 'source/libvpx/vp8/common/setupintrarecon.c', + 'source/libvpx/vp8/common/swapyv12buffer.c', + 'source/libvpx/vp8/common/treecoder.c', + 'source/libvpx/vp8/common/x86/x86_systemdependent.c', + 'source/libvpx/vp8/common/x86/vp8_asm_stubs.c', + 'source/libvpx/vp8/common/x86/loopfilter_x86.c', + 'source/libvpx/vp8/common/postproc.c', + 'source/libvpx/vp8/common/x86/recon_wrapper_sse2.c', + 'source/libvpx/vp8/vp8_cx_iface.c', + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vp8/encoder/bitstream.c', + 'source/libvpx/vp8/encoder/boolhuff.c', + 'source/libvpx/vp8/encoder/dct.c', + 'source/libvpx/vp8/encoder/encodeframe.c', + 'source/libvpx/vp8/encoder/encodeintra.c', + 'source/libvpx/vp8/encoder/encodemb.c', + 'source/libvpx/vp8/encoder/encodemv.c', + 'source/libvpx/vp8/encoder/ethreading.c', + 'source/libvpx/vp8/encoder/firstpass.c', + 'source/libvpx/vp8/encoder/generic/csystemdependent.c', + 'source/libvpx/vp8/encoder/lookahead.c', + 'source/libvpx/vp8/encoder/mcomp.c', + 'source/libvpx/vp8/encoder/modecosts.c', + 'source/libvpx/vp8/encoder/onyx_if.c', + 'source/libvpx/vp8/encoder/pickinter.c', + 'source/libvpx/vp8/encoder/picklpf.c', + 'source/libvpx/vp8/encoder/psnr.c', + 'source/libvpx/vp8/encoder/quantize.c', + 'source/libvpx/vp8/encoder/ratectrl.c', + 'source/libvpx/vp8/encoder/rdopt.c', + 'source/libvpx/vp8/encoder/sad_c.c', + 'source/libvpx/vp8/encoder/segmentation.c', + 'source/libvpx/vp8/encoder/tokenize.c', + 'source/libvpx/vp8/encoder/treewriter.c', + 'source/libvpx/vp8/encoder/variance_c.c', + 'source/libvpx/vp8/encoder/temporal_filter.c', + 'source/libvpx/vp8/encoder/x86/x86_csystemdependent.c', + 'source/libvpx/vp8/encoder/x86/variance_mmx.c', + 'source/libvpx/vp8/encoder/x86/variance_sse2.c', + 'source/libvpx/vp8/encoder/x86/variance_ssse3.c', + 'source/libvpx/vp8/vp8_dx_iface.c', + 'source/libvpx/vp8/decoder/asm_dec_offsets.c', + 'source/libvpx/vp8/decoder/dboolhuff.c', + 'source/libvpx/vp8/decoder/decodemv.c', + 'source/libvpx/vp8/decoder/decodframe.c', + 'source/libvpx/vp8/decoder/dequantize.c', + 'source/libvpx/vp8/decoder/detokenize.c', + 'source/libvpx/vp8/decoder/error_concealment.c', + 'source/libvpx/vp8/decoder/generic/dsystemdependent.c', + 'source/libvpx/vp8/decoder/onyxd_if.c', + 'source/libvpx/vp8/decoder/threading.c', + 'source/libvpx/vp8/decoder/idct_blk.c', + 'source/libvpx/vp8/decoder/reconintra_mt.c', + 'source/libvpx/vp8/decoder/x86/x86_dsystemdependent.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_mmx.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_sse2.c', + 'source/libvpx/vpx_ports/x86_cpuid.c', + + # yasm input + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + ], # sources + },], # target_arch=="ia32" + ['target_arch=="x64"', { + 'sources': [ + # generated input files + 'source/config/win/x64/asm_com_offsets.asm', + 'source/config/win/x64/asm_dec_offsets.asm', + 'source/config/win/x64/asm_enc_offsets.asm', + 'source/config/win/x64/vpx_config.asm', + 'source/config/win/x64/vpx_config.c', + 'source/config/win/x64/vpx_config.h', + 'source/config/win/x64/vpx_version.h', + + # source input files + 'source/libvpx/vpx/src/vpx_decoder.c', + 'source/libvpx/vpx/src/vpx_decoder_compat.c', + 'source/libvpx/vpx/src/vpx_encoder.c', + 'source/libvpx/vpx/src/vpx_codec.c', + 'source/libvpx/vpx/src/vpx_image.c', + 'source/libvpx/vpx_mem/vpx_mem.c', + 'source/libvpx/vpx_scale/generic/vpxscale.c', + 'source/libvpx/vpx_scale/generic/yv12config.c', + 'source/libvpx/vpx_scale/generic/yv12extend.c', + 'source/libvpx/vpx_scale/generic/scalesystemdependent.c', + 'source/libvpx/vpx_scale/generic/gen_scalers.c', + 'source/libvpx/vp8/common/alloccommon.c', + 'source/libvpx/vp8/common/asm_com_offsets.c', + 'source/libvpx/vp8/common/blockd.c', + 'source/libvpx/vp8/common/debugmodes.c', + 'source/libvpx/vp8/common/defaultcoefcounts.c', + 'source/libvpx/vp8/common/entropy.c', + 'source/libvpx/vp8/common/entropymode.c', + 'source/libvpx/vp8/common/entropymv.c', + 'source/libvpx/vp8/common/extend.c', + 'source/libvpx/vp8/common/filter.c', + 'source/libvpx/vp8/common/findnearmv.c', + 'source/libvpx/vp8/common/generic/systemdependent.c', + 'source/libvpx/vp8/common/idctllm.c', + 'source/libvpx/vp8/common/invtrans.c', + 'source/libvpx/vp8/common/loopfilter.c', + 'source/libvpx/vp8/common/loopfilter_filters.c', + 'source/libvpx/vp8/common/mbpitch.c', + 'source/libvpx/vp8/common/modecont.c', + 'source/libvpx/vp8/common/modecontext.c', + 'source/libvpx/vp8/common/quant_common.c', + 'source/libvpx/vp8/common/recon.c', + 'source/libvpx/vp8/common/reconinter.c', + 'source/libvpx/vp8/common/reconintra.c', + 'source/libvpx/vp8/common/reconintra4x4.c', + 'source/libvpx/vp8/common/setupintrarecon.c', + 'source/libvpx/vp8/common/swapyv12buffer.c', + 'source/libvpx/vp8/common/treecoder.c', + 'source/libvpx/vp8/common/x86/x86_systemdependent.c', + 'source/libvpx/vp8/common/x86/vp8_asm_stubs.c', + 'source/libvpx/vp8/common/x86/loopfilter_x86.c', + 'source/libvpx/vp8/common/postproc.c', + 'source/libvpx/vp8/common/x86/recon_wrapper_sse2.c', + 'source/libvpx/vp8/vp8_cx_iface.c', + 'source/libvpx/vp8/encoder/asm_enc_offsets.c', + 'source/libvpx/vp8/encoder/bitstream.c', + 'source/libvpx/vp8/encoder/boolhuff.c', + 'source/libvpx/vp8/encoder/dct.c', + 'source/libvpx/vp8/encoder/encodeframe.c', + 'source/libvpx/vp8/encoder/encodeintra.c', + 'source/libvpx/vp8/encoder/encodemb.c', + 'source/libvpx/vp8/encoder/encodemv.c', + 'source/libvpx/vp8/encoder/ethreading.c', + 'source/libvpx/vp8/encoder/firstpass.c', + 'source/libvpx/vp8/encoder/generic/csystemdependent.c', + 'source/libvpx/vp8/encoder/lookahead.c', + 'source/libvpx/vp8/encoder/mcomp.c', + 'source/libvpx/vp8/encoder/modecosts.c', + 'source/libvpx/vp8/encoder/onyx_if.c', + 'source/libvpx/vp8/encoder/pickinter.c', + 'source/libvpx/vp8/encoder/picklpf.c', + 'source/libvpx/vp8/encoder/psnr.c', + 'source/libvpx/vp8/encoder/quantize.c', + 'source/libvpx/vp8/encoder/ratectrl.c', + 'source/libvpx/vp8/encoder/rdopt.c', + 'source/libvpx/vp8/encoder/sad_c.c', + 'source/libvpx/vp8/encoder/segmentation.c', + 'source/libvpx/vp8/encoder/tokenize.c', + 'source/libvpx/vp8/encoder/treewriter.c', + 'source/libvpx/vp8/encoder/variance_c.c', + 'source/libvpx/vp8/encoder/temporal_filter.c', + 'source/libvpx/vp8/encoder/x86/x86_csystemdependent.c', + 'source/libvpx/vp8/encoder/x86/variance_mmx.c', + 'source/libvpx/vp8/encoder/x86/variance_sse2.c', + 'source/libvpx/vp8/encoder/x86/variance_ssse3.c', + 'source/libvpx/vp8/vp8_dx_iface.c', + 'source/libvpx/vp8/decoder/asm_dec_offsets.c', + 'source/libvpx/vp8/decoder/dboolhuff.c', + 'source/libvpx/vp8/decoder/decodemv.c', + 'source/libvpx/vp8/decoder/decodframe.c', + 'source/libvpx/vp8/decoder/dequantize.c', + 'source/libvpx/vp8/decoder/detokenize.c', + 'source/libvpx/vp8/decoder/error_concealment.c', + 'source/libvpx/vp8/decoder/generic/dsystemdependent.c', + 'source/libvpx/vp8/decoder/onyxd_if.c', + 'source/libvpx/vp8/decoder/threading.c', + 'source/libvpx/vp8/decoder/idct_blk.c', + 'source/libvpx/vp8/decoder/reconintra_mt.c', + 'source/libvpx/vp8/decoder/x86/x86_dsystemdependent.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_mmx.c', + 'source/libvpx/vp8/decoder/x86/idct_blk_sse2.c', + 'source/libvpx/vpx_ports/x86_cpuid.c', + + # yasm input + 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', + 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', + 'source/libvpx/vp8/common/x86/recon_mmx.asm', + 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', + 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', + 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', + 'source/libvpx/vp8/common/x86/recon_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', + 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', + 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', + 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', + 'source/libvpx/vp8/common/x86/postproc_mmx.asm', + 'source/libvpx/vp8/common/x86/postproc_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', + 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', + 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', + 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', + 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', + 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', + 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', + 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_sse4.asm', + 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', + 'source/libvpx/vp8/encoder/x86/encodeopt.asm', + 'source/libvpx/vp8/encoder/x86/ssim_opt.asm', + 'source/libvpx/vpx_ports/emms.asm', + 'source/libvpx/vpx_ports/x86_abi_support.asm', + 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', + ], # sources + },], # target_arch=="x64" + ], # conditions +} diff --git a/third_party/libvpx/libvpx.gyp b/third_party/libvpx/libvpx.gyp index fad9680ff..087b88f43 100644 --- a/third_party/libvpx/libvpx.gyp +++ b/third_party/libvpx/libvpx.gyp @@ -6,15 +6,6 @@ { 'target_name': 'libvpx', 'type': 'static_library', - # Don't build yasm from source on Windows - 'conditions': [ - ['OS!="win"', { - 'dependencies': [ - '../yasm/yasm.gyp:yasm#host', - ], - }, - ], - ], 'variables': { 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx', @@ -23,82 +14,102 @@ '-I', 'source/config/<(OS)/<(target_arch)', '-I', 'source/libvpx' ], - 'conditions': [ - ['OS!="win"', { - 'asm_obj_dir': - '<(shared_generated_dir)', - 'obj_file_ending': - 'o', - }, - { - 'asm_obj_dir': - 'asm', - 'obj_file_ending': - 'obj', - 'yasm_path': '../yasm/binaries/win/yasm.exe', - } - ], - ['target_arch=="ia32"', { + }, + 'conditions': [ + ['OS=="linux"', { + 'variables': { + 'asm_obj_dir': + '<(shared_generated_dir)', + 'obj_file_ending': + 'o', 'conditions': [ - ['OS=="linux"', { + ['target_arch=="ia32"', { 'yasm_flags': [ '-felf32', + '-m', 'x86', ], - }, - ], - ['OS=="mac"', { - 'yasm_flags': [ - '-fmacho32', - ], - }, - ], - ['OS=="win"', { - 'yasm_flags': [ - '-fwin32', - ], - }, - ], - ], - 'yasm_flags': [ - '-m', 'x86', - ], - }, - ], - ['target_arch=="x64"', { - 'conditions': [ - ['OS=="linux"', { + },], + ['target_arch=="x64"', { 'yasm_flags': [ '-felf64', - ], - }, - ], - ['OS=="mac"', { - 'yasm_flags': [ - '-fmacho64', + '-m', 'amd64', ], - }, - ], - ['OS=="win"', { - 'yasm_flags': [ - '-win64', - ], - }, - ], - ], - 'yasm_flags': [ - '-m', 'amd64', + },], ], }, + 'dependencies': [ + '../yasm/yasm.gyp:yasm#host', ], - ], - }, + 'includes': [ + 'input_files_linux.gypi', + ], + },], + ['OS=="mac"', { + 'variables': { + 'asm_obj_dir': + '<(shared_generated_dir)', + 'obj_file_ending': + 'o', + 'conditions': [ + ['target_arch=="ia32"', { + 'yasm_flags': [ + '-fmacho32', + '-m', 'x86', + ], + },], + ['target_arch=="x64"', { + 'yasm_flags': [ + '-fmacho64', + '-m', 'amd64', + ], + },], + ], + }, + 'dependencies': [ + '../yasm/yasm.gyp:yasm#host', + ], + 'includes': [ + 'input_files_mac.gypi', + ], + },], + ['OS=="win"', { + # Don't build yasm from source on Windows + 'variables': { + 'asm_obj_dir': + 'asm', + 'obj_file_ending': + 'obj', + 'yasm_path': '../yasm/binaries/win/yasm.exe', + 'conditions': [ + ['target_arch=="ia32"', { + 'yasm_flags': [ + '-fwin32', + '-m', 'x86', + ], + },], + ['target_arch=="x64"', { + 'yasm_flags': [ + '-fwin64', + '-m', 'amd64', + ], + },], + ], + }, + 'includes': [ + 'input_files_win.gypi', + ], + },], + ], + 'include_dirs': [ 'source/config/<(OS)/<(target_arch)', - 'source/libvpx', + 'source/libvpx/build', + 'source/libvpx/', 'source/libvpx/vp8/common', 'source/libvpx/vp8/decoder', 'source/libvpx/vp8/encoder', ], + 'rules': [ { 'rule_name': 'assemble', @@ -117,131 +128,6 @@ 'message': 'Build libvpx yasm build <(RULE_INPUT_PATH).', }, ], - - 'sources': [ - 'source/libvpx/vpx/src/vpx_decoder.c', - 'source/libvpx/vpx/src/vpx_decoder_compat.c', - 'source/libvpx/vpx/src/vpx_encoder.c', - 'source/libvpx/vpx/src/vpx_codec.c', - 'source/libvpx/vpx/src/vpx_image.c', - 'source/libvpx/vpx_mem/vpx_mem.c', - 'source/libvpx/vpx_scale/generic/vpxscale.c', - 'source/libvpx/vpx_scale/generic/yv12config.c', - 'source/libvpx/vpx_scale/generic/yv12extend.c', - 'source/libvpx/vpx_scale/generic/scalesystemdependant.c', - 'source/libvpx/vpx_scale/generic/gen_scalers.c', - 'source/libvpx/vp8/common/alloccommon.c', - 'source/libvpx/vp8/common/blockd.c', - 'source/libvpx/vp8/common/debugmodes.c', - 'source/libvpx/vp8/common/entropy.c', - 'source/libvpx/vp8/common/entropymode.c', - 'source/libvpx/vp8/common/entropymv.c', - 'source/libvpx/vp8/common/extend.c', - 'source/libvpx/vp8/common/filter.c', - 'source/libvpx/vp8/common/findnearmv.c', - 'source/libvpx/vp8/common/generic/systemdependent.c', - 'source/libvpx/vp8/common/idctllm.c', - 'source/libvpx/vp8/common/invtrans.c', - 'source/libvpx/vp8/common/loopfilter.c', - 'source/libvpx/vp8/common/loopfilter_filters.c', - 'source/libvpx/vp8/common/mbpitch.c', - 'source/libvpx/vp8/common/modecont.c', - 'source/libvpx/vp8/common/modecontext.c', - 'source/libvpx/vp8/common/postproc.c', - 'source/libvpx/vp8/common/quant_common.c', - 'source/libvpx/vp8/common/recon.c', - 'source/libvpx/vp8/common/reconinter.c', - 'source/libvpx/vp8/common/reconintra.c', - 'source/libvpx/vp8/common/reconintra4x4.c', - 'source/libvpx/vp8/common/setupintrarecon.c', - 'source/libvpx/vp8/common/swapyv12buffer.c', - 'source/libvpx/vp8/common/textblit.c', - 'source/libvpx/vp8/common/treecoder.c', - 'source/libvpx/vp8/common/x86/x86_systemdependent.c', - 'source/libvpx/vp8/common/x86/vp8_asm_stubs.c', - 'source/libvpx/vp8/common/x86/loopfilter_x86.c', - 'source/libvpx/vp8/vp8_cx_iface.c', - 'source/libvpx/vp8/encoder/bitstream.c', - 'source/libvpx/vp8/encoder/boolhuff.c', - 'source/libvpx/vp8/encoder/dct.c', - 'source/libvpx/vp8/encoder/encodeframe.c', - 'source/libvpx/vp8/encoder/encodeintra.c', - 'source/libvpx/vp8/encoder/encodemb.c', - 'source/libvpx/vp8/encoder/encodemv.c', - 'source/libvpx/vp8/encoder/ethreading.c', - 'source/libvpx/vp8/encoder/firstpass.c', - 'source/libvpx/vp8/encoder/generic/csystemdependent.c', - 'source/libvpx/vp8/encoder/mcomp.c', - 'source/libvpx/vp8/encoder/modecosts.c', - 'source/libvpx/vp8/encoder/onyx_if.c', - 'source/libvpx/vp8/encoder/pickinter.c', - 'source/libvpx/vp8/encoder/picklpf.c', - 'source/libvpx/vp8/encoder/psnr.c', - 'source/libvpx/vp8/encoder/quantize.c', - 'source/libvpx/vp8/encoder/ratectrl.c', - 'source/libvpx/vp8/encoder/rdopt.c', - 'source/libvpx/vp8/encoder/sad_c.c', - 'source/libvpx/vp8/encoder/segmentation.c', - 'source/libvpx/vp8/encoder/tokenize.c', - 'source/libvpx/vp8/encoder/treewriter.c', - 'source/libvpx/vp8/encoder/variance_c.c', - 'source/libvpx/vp8/encoder/temporal_filter.c', - 'source/libvpx/vp8/encoder/x86/x86_csystemdependent.c', - 'source/libvpx/vp8/encoder/x86/variance_mmx.c', - 'source/libvpx/vp8/encoder/x86/variance_sse2.c', - 'source/libvpx/vp8/vp8_dx_iface.c', - 'source/libvpx/vp8/decoder/dboolhuff.c', - 'source/libvpx/vp8/decoder/decodemv.c', - 'source/libvpx/vp8/decoder/decodframe.c', - 'source/libvpx/vp8/decoder/dequantize.c', - 'source/libvpx/vp8/decoder/detokenize.c', - 'source/libvpx/vp8/decoder/generic/dsystemdependent.c', - 'source/libvpx/vp8/decoder/onyxd_if.c', - 'source/libvpx/vp8/decoder/threading.c', - 'source/libvpx/vp8/decoder/idct_blk.c', - 'source/libvpx/vp8/decoder/reconintra_mt.c', - 'source/libvpx/vp8/decoder/x86/x86_dsystemdependent.c', - 'source/libvpx/vp8/decoder/x86/idct_blk_mmx.c', - 'source/libvpx/vp8/decoder/x86/idct_blk_sse2.c', - 'source/libvpx/vpx_ports/x86_cpuid.c', - # Yasm inputs. - 'source/libvpx/vp8/common/x86/idctllm_mmx.asm', - 'source/libvpx/vp8/common/x86/idctllm_sse2.asm', - 'source/libvpx/vp8/common/x86/iwalsh_mmx.asm', - 'source/libvpx/vp8/common/x86/iwalsh_sse2.asm', - 'source/libvpx/vp8/common/x86/loopfilter_mmx.asm', - 'source/libvpx/vp8/common/x86/loopfilter_sse2.asm', - 'source/libvpx/vp8/common/x86/postproc_mmx.asm', - 'source/libvpx/vp8/common/x86/postproc_sse2.asm', - 'source/libvpx/vp8/common/x86/recon_mmx.asm', - 'source/libvpx/vp8/common/x86/recon_sse2.asm', - 'source/libvpx/vp8/common/x86/subpixel_mmx.asm', - 'source/libvpx/vp8/common/x86/subpixel_sse2.asm', - 'source/libvpx/vp8/common/x86/subpixel_ssse3.asm', - 'source/libvpx/vp8/decoder/x86/dequantize_mmx.asm', - 'source/libvpx/vp8/encoder/x86/dct_mmx.asm', - 'source/libvpx/vp8/encoder/x86/dct_sse2.asm', - 'source/libvpx/vp8/encoder/x86/encodeopt.asm', - 'source/libvpx/vp8/encoder/x86/fwalsh_sse2.asm', - 'source/libvpx/vp8/encoder/x86/quantize_mmx.asm', - 'source/libvpx/vp8/encoder/x86/quantize_sse2.asm', - 'source/libvpx/vp8/encoder/x86/quantize_ssse3.asm', - 'source/libvpx/vp8/encoder/x86/sad_mmx.asm', - 'source/libvpx/vp8/encoder/x86/sad_sse2.asm', - 'source/libvpx/vp8/encoder/x86/sad_sse3.asm', - 'source/libvpx/vp8/encoder/x86/sad_sse4.asm', - 'source/libvpx/vp8/encoder/x86/sad_ssse3.asm', - 'source/libvpx/vp8/encoder/x86/subtract_mmx.asm', - 'source/libvpx/vp8/encoder/x86/subtract_sse2.asm', - 'source/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm', - 'source/libvpx/vp8/encoder/x86/variance_impl_mmx.asm', - 'source/libvpx/vp8/encoder/x86/variance_impl_sse2.asm', - 'source/libvpx/vpx_ports/emms.asm', - 'source/libvpx/vpx_ports/x86_abi_support.asm', - - # Generated by ./configure and checked in. - 'source/config/<(OS)/<(target_arch)/vpx_config.c', - ] } ] } diff --git a/third_party/libvpx/source/config/linux/ia32/asm_enc_offsets.asm b/third_party/libvpx/source/config/linux/ia32/asm_enc_offsets.asm new file mode 100644 index 000000000..a0416b5e8 --- /dev/null +++ b/third_party/libvpx/source/config/linux/ia32/asm_enc_offsets.asm @@ -0,0 +1,42 @@ +vp8_block_coeff EQU 4 +vp8_block_zbin EQU 20 +vp8_block_round EQU 28 +vp8_block_quant EQU 8 +vp8_block_quant_fast EQU 12 +vp8_block_zbin_extra EQU 32 +vp8_block_zrun_zbin_boost EQU 24 +vp8_block_quant_shift EQU 16 +vp8_blockd_qcoeff EQU 0 +vp8_blockd_dequant EQU 16 +vp8_blockd_dqcoeff EQU 4 +vp8_blockd_eob EQU 44 +vp8_block_base_src EQU 36 +vp8_block_src EQU 40 +vp8_block_src_diff EQU 0 +vp8_block_src_stride EQU 44 +vp8_blockd_predictor EQU 8 +vp8_writer_lowvalue EQU 0 +vp8_writer_range EQU 4 +vp8_writer_value EQU 8 +vp8_writer_count EQU 12 +vp8_writer_pos EQU 16 +vp8_writer_buffer EQU 20 +tokenextra_token EQU 6 +tokenextra_extra EQU 4 +tokenextra_context_tree EQU 0 +tokenextra_skip_eob_node EQU 7 +TOKENEXTRA_SZ EQU 8 +vp8_extra_bit_struct_sz EQU 16 +vp8_token_value EQU 0 +vp8_token_len EQU 4 +vp8_extra_bit_struct_tree EQU 0 +vp8_extra_bit_struct_prob EQU 4 +vp8_extra_bit_struct_len EQU 8 +vp8_extra_bit_struct_base_val EQU 12 +vp8_comp_tplist EQU 181336 +vp8_comp_common EQU 105408 +vp8_comp_bc2 EQU 128480 +tokenlist_start EQU 0 +tokenlist_stop EQU 4 +TOKENLIST_SZ EQU 8 +vp8_common_mb_rows EQU 12984 diff --git a/third_party/libvpx/source/config/linux/ia32/obj_int_extract.c b/third_party/libvpx/source/config/linux/ia32/obj_int_extract.c new file mode 100644 index 000000000..04e14a6c8 --- /dev/null +++ b/third_party/libvpx/source/config/linux/ia32/obj_int_extract.c @@ -0,0 +1,914 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE 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. + */ + + +#include +#include +#include +#include + +#include "vpx_config.h" +#include "vpx/vpx_integer.h" + +typedef enum +{ + OUTPUT_FMT_PLAIN, + OUTPUT_FMT_RVDS, + OUTPUT_FMT_GAS, +} output_fmt_t; + +int log_msg(const char *fmt, ...) +{ + int res; + va_list ap; + va_start(ap, fmt); + res = vfprintf(stderr, fmt, ap); + va_end(ap); + return res; +} + +#if defined(__GNUC__) && __GNUC__ +#if defined(__MACH__) + +#include +#include + +int parse_macho(uint8_t *base_buf, size_t sz) +{ + int i, j; + struct mach_header header; + uint8_t *buf = base_buf; + int base_data_section = 0; + int bits = 0; + + /* We can read in mach_header for 32 and 64 bit architectures + * because it's identical to mach_header_64 except for the last + * element (uint32_t reserved), which we don't use. Then, when + * we know which architecture we're looking at, increment buf + * appropriately. + */ + memcpy(&header, buf, sizeof(struct mach_header)); + + if (header.magic == MH_MAGIC) + { + if (header.cputype == CPU_TYPE_ARM + || header.cputype == CPU_TYPE_X86) + { + bits = 32; + buf += sizeof(struct mach_header); + } + else + { + log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_[ARM|X86].\n"); + goto bail; + } + } + else if (header.magic == MH_MAGIC_64) + { + if (header.cputype == CPU_TYPE_X86_64) + { + bits = 64; + buf += sizeof(struct mach_header_64); + } + else + { + log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_X86_64.\n"); + goto bail; + } + } + else + { + log_msg("Bad magic number for object file. 0x%x or 0x%x expected, 0x%x found.\n", + MH_MAGIC, MH_MAGIC_64, header.magic); + goto bail; + } + + if (header.filetype != MH_OBJECT) + { + log_msg("Bad filetype for object file. Currently only tested for MH_OBJECT.\n"); + goto bail; + } + + for (i = 0; i < header.ncmds; i++) + { + struct load_command lc; + + memcpy(&lc, buf, sizeof(struct load_command)); + + if (lc.cmd == LC_SEGMENT) + { + uint8_t *seg_buf = buf; + struct section s; + struct segment_command seg_c; + + memcpy(&seg_c, seg_buf, sizeof(struct segment_command)); + seg_buf += sizeof(struct segment_command); + + /* Although each section is given it's own offset, nlist.n_value + * references the offset of the first section. This isn't + * apparent without debug information because the offset of the + * data section is the same as the first section. However, with + * debug sections mixed in, the offset of the debug section + * increases but n_value still references the first section. + */ + if (seg_c.nsects < 1) + { + log_msg("Not enough sections\n"); + goto bail; + } + + memcpy(&s, seg_buf, sizeof(struct section)); + base_data_section = s.offset; + } + else if (lc.cmd == LC_SEGMENT_64) + { + uint8_t *seg_buf = buf; + struct section_64 s; + struct segment_command_64 seg_c; + + memcpy(&seg_c, seg_buf, sizeof(struct segment_command_64)); + seg_buf += sizeof(struct segment_command_64); + + /* Explanation in LG_SEGMENT */ + if (seg_c.nsects < 1) + { + log_msg("Not enough sections\n"); + goto bail; + } + + memcpy(&s, seg_buf, sizeof(struct section_64)); + base_data_section = s.offset; + } + else if (lc.cmd == LC_SYMTAB) + { + if (base_data_section != 0) + { + struct symtab_command sc; + uint8_t *sym_buf = base_buf; + uint8_t *str_buf = base_buf; + + memcpy(&sc, buf, sizeof(struct symtab_command)); + + if (sc.cmdsize != sizeof(struct symtab_command)) + { + log_msg("Can't find symbol table!\n"); + goto bail; + } + + sym_buf += sc.symoff; + str_buf += sc.stroff; + + for (j = 0; j < sc.nsyms; j++) + { + /* Location of string is cacluated each time from the + * start of the string buffer. On darwin the symbols + * are prefixed by "_", so we bump the pointer by 1. + * The target value is defined as an int in asm_*_offsets.c, + * which is 4 bytes on all targets we currently use. + */ + if (bits == 32) + { + struct nlist nl; + int val; + + memcpy(&nl, sym_buf, sizeof(struct nlist)); + sym_buf += sizeof(struct nlist); + + memcpy(&val, base_buf + base_data_section + nl.n_value, + sizeof(val)); + printf("%-40s EQU %5d\n", + str_buf + nl.n_un.n_strx + 1, val); + } + else /* if (bits == 64) */ + { + struct nlist_64 nl; + int val; + + memcpy(&nl, sym_buf, sizeof(struct nlist_64)); + sym_buf += sizeof(struct nlist_64); + + memcpy(&val, base_buf + base_data_section + nl.n_value, + sizeof(val)); + printf("%-40s EQU %5d\n", + str_buf + nl.n_un.n_strx + 1, val); + } + } + } + } + + buf += lc.cmdsize; + } + + return 0; +bail: + return 1; + +} + +#elif defined(__ELF__) +#include "elf.h" + +#define COPY_STRUCT(dst, buf, ofst, sz) do {\ + if(ofst + sizeof((*(dst))) > sz) goto bail;\ + memcpy(dst, buf+ofst, sizeof((*(dst))));\ + } while(0) + +#define ENDIAN_ASSIGN(val, memb) do {\ + if(!elf->le_data) {log_msg("Big Endian data not supported yet!\n");goto bail;}\ + (val) = (memb);\ + } while(0) + +#define ENDIAN_ASSIGN_IN_PLACE(memb) do {\ + ENDIAN_ASSIGN(memb, memb);\ + } while(0) + +typedef struct +{ + uint8_t *buf; /* Buffer containing ELF data */ + size_t sz; /* Buffer size */ + int le_data; /* Data is little-endian */ + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + int bits; /* 32 or 64 */ + Elf32_Ehdr hdr32; + Elf64_Ehdr hdr64; +} elf_obj_t; + +int parse_elf_header(elf_obj_t *elf) +{ + int res; + /* Verify ELF Magic numbers */ + COPY_STRUCT(&elf->e_ident, elf->buf, 0, elf->sz); + res = elf->e_ident[EI_MAG0] == ELFMAG0; + res &= elf->e_ident[EI_MAG1] == ELFMAG1; + res &= elf->e_ident[EI_MAG2] == ELFMAG2; + res &= elf->e_ident[EI_MAG3] == ELFMAG3; + res &= elf->e_ident[EI_CLASS] == ELFCLASS32 + || elf->e_ident[EI_CLASS] == ELFCLASS64; + res &= elf->e_ident[EI_DATA] == ELFDATA2LSB; + + if (!res) goto bail; + + elf->le_data = elf->e_ident[EI_DATA] == ELFDATA2LSB; + + /* Read in relevant values */ + if (elf->e_ident[EI_CLASS] == ELFCLASS32) + { + elf->bits = 32; + COPY_STRUCT(&elf->hdr32, elf->buf, 0, elf->sz); + + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_type); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_machine); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_version); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_entry); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_flags); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_ehsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shstrndx); + } + else /* if (elf->e_ident[EI_CLASS] == ELFCLASS64) */ + { + elf->bits = 64; + COPY_STRUCT(&elf->hdr64, elf->buf, 0, elf->sz); + + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_type); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_machine); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_version); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_entry); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_flags); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_ehsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shstrndx); + } + + return 0; +bail: + log_msg("Failed to parse ELF file header"); + return 1; +} + +int parse_elf_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr32, Elf64_Shdr *hdr64) +{ + if (hdr32) + { + if (idx >= elf->hdr32.e_shnum) + goto bail; + + COPY_STRUCT(hdr32, elf->buf, elf->hdr32.e_shoff + idx * elf->hdr32.e_shentsize, + elf->sz); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_name); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_type); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_flags); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addr); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_offset); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_size); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_link); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_info); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addralign); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_entsize); + } + else /* if (hdr64) */ + { + if (idx >= elf->hdr64.e_shnum) + goto bail; + + COPY_STRUCT(hdr64, elf->buf, elf->hdr64.e_shoff + idx * elf->hdr64.e_shentsize, + elf->sz); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_name); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_type); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_flags); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addr); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_offset); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_size); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_link); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_info); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addralign); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_entsize); + } + + return 0; +bail: + return 1; +} + +char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx) +{ + if (elf->bits == 32) + { + Elf32_Shdr shdr; + + if (parse_elf_section(elf, s_idx, &shdr, NULL)) + { + log_msg("Failed to parse ELF string table: section %d, index %d\n", + s_idx, idx); + return ""; + } + + return (char *)(elf->buf + shdr.sh_offset + idx); + } + else /* if (elf->bits == 64) */ + { + Elf64_Shdr shdr; + + if (parse_elf_section(elf, s_idx, NULL, &shdr)) + { + log_msg("Failed to parse ELF string table: section %d, index %d\n", + s_idx, idx); + return ""; + } + + return (char *)(elf->buf + shdr.sh_offset + idx); + } +} + +int parse_elf_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym32, Elf64_Sym *sym64) +{ + if (sym32) + { + COPY_STRUCT(sym32, elf->buf, ofst, elf->sz); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_name); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_value); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_size); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_info); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_other); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_shndx); + } + else /* if (sym64) */ + { + COPY_STRUCT(sym64, elf->buf, ofst, elf->sz); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_name); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_value); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_size); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_info); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_other); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_shndx); + } + return 0; +bail: + return 1; +} + +int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode) +{ + elf_obj_t elf; + unsigned int ofst; + int i; + Elf32_Off strtab_off32; + Elf64_Off strtab_off64; /* save String Table offset for later use */ + + memset(&elf, 0, sizeof(elf)); + elf.buf = buf; + elf.sz = sz; + + /* Parse Header */ + if (parse_elf_header(&elf)) + goto bail; + + if (elf.bits == 32) + { + Elf32_Shdr shdr; + for (i = 0; i < elf.hdr32.e_shnum; i++) + { + parse_elf_section(&elf, i, &shdr, NULL); + + if (shdr.sh_type == SHT_STRTAB) + { + char strtsb_name[128]; + + strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name)); + + if (!(strcmp(strtsb_name, ".shstrtab"))) + { + /* log_msg("found section: %s\n", strtsb_name); */ + strtab_off32 = shdr.sh_offset; + break; + } + } + } + } + else /* if (elf.bits == 64) */ + { + Elf64_Shdr shdr; + for (i = 0; i < elf.hdr64.e_shnum; i++) + { + parse_elf_section(&elf, i, NULL, &shdr); + + if (shdr.sh_type == SHT_STRTAB) + { + char strtsb_name[128]; + + strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name)); + + if (!(strcmp(strtsb_name, ".shstrtab"))) + { + /* log_msg("found section: %s\n", strtsb_name); */ + strtab_off64 = shdr.sh_offset; + break; + } + } + } + } + + /* Parse all Symbol Tables */ + if (elf.bits == 32) + { + Elf32_Shdr shdr; + for (i = 0; i < elf.hdr32.e_shnum; i++) + { + parse_elf_section(&elf, i, &shdr, NULL); + + if (shdr.sh_type == SHT_SYMTAB) + { + for (ofst = shdr.sh_offset; + ofst < shdr.sh_offset + shdr.sh_size; + ofst += shdr.sh_entsize) + { + Elf32_Sym sym; + + parse_elf_symbol(&elf, ofst, &sym, NULL); + + /* For all OBJECTS (data objects), extract the value from the + * proper data segment. + */ + /* if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name) + log_msg("found data object %s\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name)); + */ + + if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT + && sym.st_size == 4) + { + Elf32_Shdr dhdr; + int val = 0; + char section_name[128]; + + parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL); + + /* For explanition - refer to _MSC_VER version of code */ + strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name)); + /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */ + + if (strcmp(section_name, ".bss")) + { + if (sizeof(val) != sym.st_size) + { + /* The target value is declared as an int in + * asm_*_offsets.c, which is 4 bytes on all + * targets we currently use. Complain loudly if + * this is not true. + */ + log_msg("Symbol size is wrong\n"); + goto bail; + } + + memcpy(&val, + elf.buf + dhdr.sh_offset + sym.st_value, + sym.st_size); + } + + if (!elf.le_data) + { + log_msg("Big Endian data not supported yet!\n"); + goto bail; + } + + switch (mode) + { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + case OUTPUT_FMT_GAS: + printf(".equ %-40s, %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + default: + printf("%s = %d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + } + } + } + } + } + } + else /* if (elf.bits == 64) */ + { + Elf64_Shdr shdr; + for (i = 0; i < elf.hdr64.e_shnum; i++) + { + parse_elf_section(&elf, i, NULL, &shdr); + + if (shdr.sh_type == SHT_SYMTAB) + { + for (ofst = shdr.sh_offset; + ofst < shdr.sh_offset + shdr.sh_size; + ofst += shdr.sh_entsize) + { + Elf64_Sym sym; + + parse_elf_symbol(&elf, ofst, NULL, &sym); + + /* For all OBJECTS (data objects), extract the value from the + * proper data segment. + */ + /* if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name) + log_msg("found data object %s\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name)); + */ + + if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT + && sym.st_size == 4) + { + Elf64_Shdr dhdr; + int val = 0; + char section_name[128]; + + parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr); + + /* For explanition - refer to _MSC_VER version of code */ + strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name)); + /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */ + + if ((strcmp(section_name, ".bss"))) + { + if (sizeof(val) != sym.st_size) + { + /* The target value is declared as an int in + * asm_*_offsets.c, which is 4 bytes on all + * targets we currently use. Complain loudly if + * this is not true. + */ + log_msg("Symbol size is wrong\n"); + goto bail; + } + + memcpy(&val, + elf.buf + dhdr.sh_offset + sym.st_value, + sym.st_size); + } + + if (!elf.le_data) + { + log_msg("Big Endian data not supported yet!\n"); + goto bail; + } + + switch (mode) + { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + case OUTPUT_FMT_GAS: + printf(".equ %-40s, %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + default: + printf("%s = %d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + } + } + } + } + } + } + + if (mode == OUTPUT_FMT_RVDS) + printf(" END\n"); + + return 0; +bail: + log_msg("Parse error: File does not appear to be valid ELF32 or ELF64\n"); + return 1; +} + +#endif +#endif /* defined(__GNUC__) && __GNUC__ */ + + +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) +/* See "Microsoft Portable Executable and Common Object File Format Specification" + for reference. +*/ +#define get_le32(x) ((*(x)) | (*(x+1)) << 8 |(*(x+2)) << 16 | (*(x+3)) << 24 ) +#define get_le16(x) ((*(x)) | (*(x+1)) << 8) + +int parse_coff(uint8_t *buf, size_t sz) +{ + unsigned int nsections, symtab_ptr, symtab_sz, strtab_ptr; + unsigned int sectionrawdata_ptr; + unsigned int i; + uint8_t *ptr; + uint32_t symoffset; + + char **sectionlist; //this array holds all section names in their correct order. + //it is used to check if the symbol is in .bss or .data section. + + nsections = get_le16(buf + 2); + symtab_ptr = get_le32(buf + 8); + symtab_sz = get_le32(buf + 12); + strtab_ptr = symtab_ptr + symtab_sz * 18; + + if (nsections > 96) + { + log_msg("Too many sections\n"); + return 1; + } + + sectionlist = malloc(nsections * sizeof(sectionlist)); + + if (sectionlist == NULL) + { + log_msg("Allocating first level of section list failed\n"); + return 1; + } + + //log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections); + + /* + The size of optional header is always zero for an obj file. So, the section header + follows the file header immediately. + */ + + ptr = buf + 20; //section header + + for (i = 0; i < nsections; i++) + { + char sectionname[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + strncpy(sectionname, ptr, 8); + //log_msg("COFF: Parsing section %s\n",sectionname); + + sectionlist[i] = malloc(strlen(sectionname) + 1); + + if (sectionlist[i] == NULL) + { + log_msg("Allocating storage for %s failed\n", sectionname); + goto bail; + } + strcpy(sectionlist[i], sectionname); + + if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20); + + ptr += 40; + } + + //log_msg("COFF: Symbol table at offset %u\n", symtab_ptr); + //log_msg("COFF: raw data pointer ofset for section .data is %u\n", sectionrawdata_ptr); + + /* The compiler puts the data with non-zero offset in .data section, but puts the data with + zero offset in .bss section. So, if the data in in .bss section, set offset=0. + Note from Wiki: In an object module compiled from C, the bss section contains + the local variables (but not functions) that were declared with the static keyword, + except for those with non-zero initial values. (In C, static variables are initialized + to zero by default.) It also contains the non-local (both extern and static) variables + that are also initialized to zero (either explicitly or by default). + */ + //move to symbol table + /* COFF symbol table: + offset field + 0 Name(*) + 8 Value + 12 SectionNumber + 14 Type + 16 StorageClass + 17 NumberOfAuxSymbols + */ + ptr = buf + symtab_ptr; + + for (i = 0; i < symtab_sz; i++) + { + int16_t section = get_le16(ptr + 12); //section number + + if (section > 0 && ptr[16] == 2) + { + //if(section > 0 && ptr[16] == 3 && get_le32(ptr+8)) { + + if (get_le32(ptr)) + { + char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + strncpy(name, ptr, 8); + //log_msg("COFF: Parsing symbol %s\n",name); + /* The 64bit Windows compiler doesn't prefix with an _. + * Check what's there, and bump if necessary + */ + if (name[0] == '_') + printf("%-40s EQU ", name + 1); + else + printf("%-40s EQU ", name); + } + else + { + //log_msg("COFF: Parsing symbol %s\n", + // buf + strtab_ptr + get_le32(ptr+4)); + if ((buf + strtab_ptr + get_le32(ptr + 4))[0] == '_') + printf("%-40s EQU ", + buf + strtab_ptr + get_le32(ptr + 4) + 1); + else + printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4)); + } + + if (!(strcmp(sectionlist[section-1], ".bss"))) + { + symoffset = 0; + } + else + { + symoffset = get_le32(buf + sectionrawdata_ptr + get_le32(ptr + 8)); + } + + //log_msg(" Section: %d\n",section); + //log_msg(" Class: %d\n",ptr[16]); + //log_msg(" Address: %u\n",get_le32(ptr+8)); + //log_msg(" Offset: %u\n", symoffset); + + printf("%5d\n", symoffset); + } + + ptr += 18; + } + + printf(" END\n"); + + for (i = 0; i < nsections; i++) + { + free(sectionlist[i]); + } + + free(sectionlist); + + return 0; +bail: + + for (i = 0; i < nsections; i++) + { + free(sectionlist[i]); + } + + free(sectionlist); + + return 1; +} +#endif /* defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) */ + +int main(int argc, char **argv) +{ + output_fmt_t mode = OUTPUT_FMT_PLAIN; + const char *f; + uint8_t *file_buf; + int res; + FILE *fp; + long int file_size; + + if (argc < 2 || argc > 3) + { + fprintf(stderr, "Usage: %s [output format] \n\n", argv[0]); + fprintf(stderr, " \tobject file to parse\n"); + fprintf(stderr, "Output Formats:\n"); + fprintf(stderr, " gas - compatible with GNU assembler\n"); + fprintf(stderr, " rvds - compatible with armasm\n"); + goto bail; + } + + f = argv[2]; + + if (!strcmp(argv[1], "rvds")) + mode = OUTPUT_FMT_RVDS; + else if (!strcmp(argv[1], "gas")) + mode = OUTPUT_FMT_GAS; + else + f = argv[1]; + + fp = fopen(f, "rb"); + + if (!fp) + { + perror("Unable to open file"); + goto bail; + } + + if (fseek(fp, 0, SEEK_END)) + { + perror("stat"); + goto bail; + } + + file_size = ftell(fp); + file_buf = malloc(file_size); + + if (!file_buf) + { + perror("malloc"); + goto bail; + } + + rewind(fp); + + if (fread(file_buf, sizeof(char), file_size, fp) != file_size) + { + perror("read"); + goto bail; + } + + if (fclose(fp)) + { + perror("close"); + goto bail; + } + +#if defined(__GNUC__) && __GNUC__ +#if defined(__MACH__) + res = parse_macho(file_buf, file_size); +#elif defined(__ELF__) + res = parse_elf(file_buf, file_size, mode); +#endif +#endif +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) + res = parse_coff(file_buf, file_size); +#endif + + free(file_buf); + + if (!res) + return EXIT_SUCCESS; + +bail: + return EXIT_FAILURE; +} diff --git a/third_party/libvpx/source/config/linux/ia32/vpx_config.asm b/third_party/libvpx/source/config/linux/ia32/vpx_config.asm index 74276adba..85c92c22c 100644 --- a/third_party/libvpx/source/config/linux/ia32/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/ia32/vpx_config.asm @@ -22,6 +22,7 @@ HAVE_STDINT_H equ 1 HAVE_ALT_TREE_LAYOUT equ 0 HAVE_PTHREAD_H equ 1 HAVE_SYS_MMAN_H equ 1 +HAVE_UNISTD_H equ 1 CONFIG_EXTERNAL_BUILD equ 0 CONFIG_INSTALL_DOCS equ 0 CONFIG_INSTALL_BINS equ 1 @@ -47,7 +48,7 @@ CONFIG_DC_RECON equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_POSTPROC equ 1 CONFIG_MULTITHREAD equ 1 -CONFIG_PSNR equ 0 +CONFIG_INTERNAL_STATS equ 0 CONFIG_VP8_ENCODER equ 1 CONFIG_VP8_DECODER equ 1 CONFIG_VP8 equ 1 @@ -56,7 +57,9 @@ CONFIG_DECODERS equ 1 CONFIG_STATIC_MSVCRT equ 0 CONFIG_SPATIAL_RESAMPLING equ 1 CONFIG_REALTIME_ONLY equ 0 +CONFIG_ERROR_CONCEALMENT equ 1 CONFIG_SHARED equ 0 +CONFIG_STATIC equ 1 CONFIG_SMALL equ 0 CONFIG_POSTPROC_VISUALIZER equ 0 CONFIG_OS_SUPPORT equ 1 diff --git a/third_party/libvpx/source/config/linux/ia32/vpx_config.c b/third_party/libvpx/source/config/linux/ia32/vpx_config.c index b851fac90..2f5a4545a 100644 --- a/third_party/libvpx/source/config/linux/ia32/vpx_config.c +++ b/third_party/libvpx/source/config/linux/ia32/vpx_config.c @@ -1,2 +1,2 @@ -static const char* const cfg = "--target=x86-linux-gcc --enable-pic --disable-install-docs --disable-install-srcs --disable-examples --disable-psnr"; +static const char* const cfg = "--target=x86-linux-gcc --enable-pic --enable-error-concealment --disable-install-docs --disable-install-srcs --disable-examples --disable-internal-stats"; const char *vpx_codec_build_config(void) {return cfg;} diff --git a/third_party/libvpx/source/config/linux/ia32/vpx_config.h b/third_party/libvpx/source/config/linux/ia32/vpx_config.h index 1a4998965..161db7808 100644 --- a/third_party/libvpx/source/config/linux/ia32/vpx_config.h +++ b/third_party/libvpx/source/config/linux/ia32/vpx_config.h @@ -1,4 +1,6 @@ /* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_CONFIG_H +#define VPX_CONFIG_H #define RESTRICT #define ARCH_ARM 0 #define ARCH_MIPS 0 @@ -24,6 +26,7 @@ #define HAVE_ALT_TREE_LAYOUT 0 #define HAVE_PTHREAD_H 1 #define HAVE_SYS_MMAN_H 1 +#define HAVE_UNISTD_H 1 #define CONFIG_EXTERNAL_BUILD 0 #define CONFIG_INSTALL_DOCS 0 #define CONFIG_INSTALL_BINS 1 @@ -49,7 +52,7 @@ #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_POSTPROC 1 #define CONFIG_MULTITHREAD 1 -#define CONFIG_PSNR 0 +#define CONFIG_INTERNAL_STATS 0 #define CONFIG_VP8_ENCODER 1 #define CONFIG_VP8_DECODER 1 #define CONFIG_VP8 1 @@ -58,7 +61,10 @@ #define CONFIG_STATIC_MSVCRT 0 #define CONFIG_SPATIAL_RESAMPLING 1 #define CONFIG_REALTIME_ONLY 0 +#define CONFIG_ERROR_CONCEALMENT 1 #define CONFIG_SHARED 0 +#define CONFIG_STATIC 1 #define CONFIG_SMALL 0 #define CONFIG_POSTPROC_VISUALIZER 0 #define CONFIG_OS_SUPPORT 1 +#endif /* VPX_CONFIG_H */ diff --git a/third_party/libvpx/source/config/linux/ia32/vpx_version.h b/third_party/libvpx/source/config/linux/ia32/vpx_version.h index 1d8ba965d..5eedf6133 100644 --- a/third_party/libvpx/source/config/linux/ia32/vpx_version.h +++ b/third_party/libvpx/source/config/linux/ia32/vpx_version.h @@ -1,7 +1,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 9 -#define VERSION_PATCH 6 +#define VERSION_PATCH 7 #define VERSION_EXTRA "" #define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH)) -#define VERSION_STRING_NOSP "v0.9.6" -#define VERSION_STRING " v0.9.6" +#define VERSION_STRING_NOSP "v0.9.7" +#define VERSION_STRING " v0.9.7" diff --git a/third_party/libvpx/source/config/linux/x64/asm_enc_offsets.asm b/third_party/libvpx/source/config/linux/x64/asm_enc_offsets.asm new file mode 100644 index 000000000..9a0ccfd0d --- /dev/null +++ b/third_party/libvpx/source/config/linux/x64/asm_enc_offsets.asm @@ -0,0 +1,42 @@ +vp8_block_coeff EQU 8 +vp8_block_zbin EQU 40 +vp8_block_round EQU 56 +vp8_block_quant EQU 16 +vp8_block_quant_fast EQU 24 +vp8_block_zbin_extra EQU 64 +vp8_block_zrun_zbin_boost EQU 48 +vp8_block_quant_shift EQU 32 +vp8_blockd_qcoeff EQU 0 +vp8_blockd_dequant EQU 32 +vp8_blockd_dqcoeff EQU 8 +vp8_blockd_eob EQU 72 +vp8_block_base_src EQU 72 +vp8_block_src EQU 80 +vp8_block_src_diff EQU 0 +vp8_block_src_stride EQU 84 +vp8_blockd_predictor EQU 16 +vp8_writer_lowvalue EQU 0 +vp8_writer_range EQU 4 +vp8_writer_value EQU 8 +vp8_writer_count EQU 12 +vp8_writer_pos EQU 16 +vp8_writer_buffer EQU 24 +tokenextra_token EQU 10 +tokenextra_extra EQU 8 +tokenextra_context_tree EQU 0 +tokenextra_skip_eob_node EQU 11 +TOKENEXTRA_SZ EQU 16 +vp8_extra_bit_struct_sz EQU 24 +vp8_token_value EQU 0 +vp8_token_len EQU 4 +vp8_extra_bit_struct_tree EQU 0 +vp8_extra_bit_struct_prob EQU 8 +vp8_extra_bit_struct_len EQU 16 +vp8_extra_bit_struct_base_val EQU 20 +vp8_comp_tplist EQU 183912 +vp8_comp_common EQU 107360 +vp8_comp_bc2 EQU 130832 +tokenlist_start EQU 0 +tokenlist_stop EQU 8 +TOKENLIST_SZ EQU 16 +vp8_common_mb_rows EQU 13156 diff --git a/third_party/libvpx/source/config/linux/x64/obj_int_extract.c b/third_party/libvpx/source/config/linux/x64/obj_int_extract.c new file mode 100644 index 000000000..04e14a6c8 --- /dev/null +++ b/third_party/libvpx/source/config/linux/x64/obj_int_extract.c @@ -0,0 +1,914 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE 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. + */ + + +#include +#include +#include +#include + +#include "vpx_config.h" +#include "vpx/vpx_integer.h" + +typedef enum +{ + OUTPUT_FMT_PLAIN, + OUTPUT_FMT_RVDS, + OUTPUT_FMT_GAS, +} output_fmt_t; + +int log_msg(const char *fmt, ...) +{ + int res; + va_list ap; + va_start(ap, fmt); + res = vfprintf(stderr, fmt, ap); + va_end(ap); + return res; +} + +#if defined(__GNUC__) && __GNUC__ +#if defined(__MACH__) + +#include +#include + +int parse_macho(uint8_t *base_buf, size_t sz) +{ + int i, j; + struct mach_header header; + uint8_t *buf = base_buf; + int base_data_section = 0; + int bits = 0; + + /* We can read in mach_header for 32 and 64 bit architectures + * because it's identical to mach_header_64 except for the last + * element (uint32_t reserved), which we don't use. Then, when + * we know which architecture we're looking at, increment buf + * appropriately. + */ + memcpy(&header, buf, sizeof(struct mach_header)); + + if (header.magic == MH_MAGIC) + { + if (header.cputype == CPU_TYPE_ARM + || header.cputype == CPU_TYPE_X86) + { + bits = 32; + buf += sizeof(struct mach_header); + } + else + { + log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_[ARM|X86].\n"); + goto bail; + } + } + else if (header.magic == MH_MAGIC_64) + { + if (header.cputype == CPU_TYPE_X86_64) + { + bits = 64; + buf += sizeof(struct mach_header_64); + } + else + { + log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_X86_64.\n"); + goto bail; + } + } + else + { + log_msg("Bad magic number for object file. 0x%x or 0x%x expected, 0x%x found.\n", + MH_MAGIC, MH_MAGIC_64, header.magic); + goto bail; + } + + if (header.filetype != MH_OBJECT) + { + log_msg("Bad filetype for object file. Currently only tested for MH_OBJECT.\n"); + goto bail; + } + + for (i = 0; i < header.ncmds; i++) + { + struct load_command lc; + + memcpy(&lc, buf, sizeof(struct load_command)); + + if (lc.cmd == LC_SEGMENT) + { + uint8_t *seg_buf = buf; + struct section s; + struct segment_command seg_c; + + memcpy(&seg_c, seg_buf, sizeof(struct segment_command)); + seg_buf += sizeof(struct segment_command); + + /* Although each section is given it's own offset, nlist.n_value + * references the offset of the first section. This isn't + * apparent without debug information because the offset of the + * data section is the same as the first section. However, with + * debug sections mixed in, the offset of the debug section + * increases but n_value still references the first section. + */ + if (seg_c.nsects < 1) + { + log_msg("Not enough sections\n"); + goto bail; + } + + memcpy(&s, seg_buf, sizeof(struct section)); + base_data_section = s.offset; + } + else if (lc.cmd == LC_SEGMENT_64) + { + uint8_t *seg_buf = buf; + struct section_64 s; + struct segment_command_64 seg_c; + + memcpy(&seg_c, seg_buf, sizeof(struct segment_command_64)); + seg_buf += sizeof(struct segment_command_64); + + /* Explanation in LG_SEGMENT */ + if (seg_c.nsects < 1) + { + log_msg("Not enough sections\n"); + goto bail; + } + + memcpy(&s, seg_buf, sizeof(struct section_64)); + base_data_section = s.offset; + } + else if (lc.cmd == LC_SYMTAB) + { + if (base_data_section != 0) + { + struct symtab_command sc; + uint8_t *sym_buf = base_buf; + uint8_t *str_buf = base_buf; + + memcpy(&sc, buf, sizeof(struct symtab_command)); + + if (sc.cmdsize != sizeof(struct symtab_command)) + { + log_msg("Can't find symbol table!\n"); + goto bail; + } + + sym_buf += sc.symoff; + str_buf += sc.stroff; + + for (j = 0; j < sc.nsyms; j++) + { + /* Location of string is cacluated each time from the + * start of the string buffer. On darwin the symbols + * are prefixed by "_", so we bump the pointer by 1. + * The target value is defined as an int in asm_*_offsets.c, + * which is 4 bytes on all targets we currently use. + */ + if (bits == 32) + { + struct nlist nl; + int val; + + memcpy(&nl, sym_buf, sizeof(struct nlist)); + sym_buf += sizeof(struct nlist); + + memcpy(&val, base_buf + base_data_section + nl.n_value, + sizeof(val)); + printf("%-40s EQU %5d\n", + str_buf + nl.n_un.n_strx + 1, val); + } + else /* if (bits == 64) */ + { + struct nlist_64 nl; + int val; + + memcpy(&nl, sym_buf, sizeof(struct nlist_64)); + sym_buf += sizeof(struct nlist_64); + + memcpy(&val, base_buf + base_data_section + nl.n_value, + sizeof(val)); + printf("%-40s EQU %5d\n", + str_buf + nl.n_un.n_strx + 1, val); + } + } + } + } + + buf += lc.cmdsize; + } + + return 0; +bail: + return 1; + +} + +#elif defined(__ELF__) +#include "elf.h" + +#define COPY_STRUCT(dst, buf, ofst, sz) do {\ + if(ofst + sizeof((*(dst))) > sz) goto bail;\ + memcpy(dst, buf+ofst, sizeof((*(dst))));\ + } while(0) + +#define ENDIAN_ASSIGN(val, memb) do {\ + if(!elf->le_data) {log_msg("Big Endian data not supported yet!\n");goto bail;}\ + (val) = (memb);\ + } while(0) + +#define ENDIAN_ASSIGN_IN_PLACE(memb) do {\ + ENDIAN_ASSIGN(memb, memb);\ + } while(0) + +typedef struct +{ + uint8_t *buf; /* Buffer containing ELF data */ + size_t sz; /* Buffer size */ + int le_data; /* Data is little-endian */ + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + int bits; /* 32 or 64 */ + Elf32_Ehdr hdr32; + Elf64_Ehdr hdr64; +} elf_obj_t; + +int parse_elf_header(elf_obj_t *elf) +{ + int res; + /* Verify ELF Magic numbers */ + COPY_STRUCT(&elf->e_ident, elf->buf, 0, elf->sz); + res = elf->e_ident[EI_MAG0] == ELFMAG0; + res &= elf->e_ident[EI_MAG1] == ELFMAG1; + res &= elf->e_ident[EI_MAG2] == ELFMAG2; + res &= elf->e_ident[EI_MAG3] == ELFMAG3; + res &= elf->e_ident[EI_CLASS] == ELFCLASS32 + || elf->e_ident[EI_CLASS] == ELFCLASS64; + res &= elf->e_ident[EI_DATA] == ELFDATA2LSB; + + if (!res) goto bail; + + elf->le_data = elf->e_ident[EI_DATA] == ELFDATA2LSB; + + /* Read in relevant values */ + if (elf->e_ident[EI_CLASS] == ELFCLASS32) + { + elf->bits = 32; + COPY_STRUCT(&elf->hdr32, elf->buf, 0, elf->sz); + + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_type); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_machine); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_version); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_entry); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_flags); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_ehsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shstrndx); + } + else /* if (elf->e_ident[EI_CLASS] == ELFCLASS64) */ + { + elf->bits = 64; + COPY_STRUCT(&elf->hdr64, elf->buf, 0, elf->sz); + + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_type); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_machine); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_version); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_entry); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_flags); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_ehsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shstrndx); + } + + return 0; +bail: + log_msg("Failed to parse ELF file header"); + return 1; +} + +int parse_elf_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr32, Elf64_Shdr *hdr64) +{ + if (hdr32) + { + if (idx >= elf->hdr32.e_shnum) + goto bail; + + COPY_STRUCT(hdr32, elf->buf, elf->hdr32.e_shoff + idx * elf->hdr32.e_shentsize, + elf->sz); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_name); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_type); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_flags); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addr); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_offset); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_size); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_link); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_info); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addralign); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_entsize); + } + else /* if (hdr64) */ + { + if (idx >= elf->hdr64.e_shnum) + goto bail; + + COPY_STRUCT(hdr64, elf->buf, elf->hdr64.e_shoff + idx * elf->hdr64.e_shentsize, + elf->sz); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_name); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_type); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_flags); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addr); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_offset); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_size); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_link); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_info); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addralign); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_entsize); + } + + return 0; +bail: + return 1; +} + +char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx) +{ + if (elf->bits == 32) + { + Elf32_Shdr shdr; + + if (parse_elf_section(elf, s_idx, &shdr, NULL)) + { + log_msg("Failed to parse ELF string table: section %d, index %d\n", + s_idx, idx); + return ""; + } + + return (char *)(elf->buf + shdr.sh_offset + idx); + } + else /* if (elf->bits == 64) */ + { + Elf64_Shdr shdr; + + if (parse_elf_section(elf, s_idx, NULL, &shdr)) + { + log_msg("Failed to parse ELF string table: section %d, index %d\n", + s_idx, idx); + return ""; + } + + return (char *)(elf->buf + shdr.sh_offset + idx); + } +} + +int parse_elf_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym32, Elf64_Sym *sym64) +{ + if (sym32) + { + COPY_STRUCT(sym32, elf->buf, ofst, elf->sz); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_name); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_value); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_size); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_info); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_other); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_shndx); + } + else /* if (sym64) */ + { + COPY_STRUCT(sym64, elf->buf, ofst, elf->sz); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_name); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_value); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_size); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_info); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_other); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_shndx); + } + return 0; +bail: + return 1; +} + +int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode) +{ + elf_obj_t elf; + unsigned int ofst; + int i; + Elf32_Off strtab_off32; + Elf64_Off strtab_off64; /* save String Table offset for later use */ + + memset(&elf, 0, sizeof(elf)); + elf.buf = buf; + elf.sz = sz; + + /* Parse Header */ + if (parse_elf_header(&elf)) + goto bail; + + if (elf.bits == 32) + { + Elf32_Shdr shdr; + for (i = 0; i < elf.hdr32.e_shnum; i++) + { + parse_elf_section(&elf, i, &shdr, NULL); + + if (shdr.sh_type == SHT_STRTAB) + { + char strtsb_name[128]; + + strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name)); + + if (!(strcmp(strtsb_name, ".shstrtab"))) + { + /* log_msg("found section: %s\n", strtsb_name); */ + strtab_off32 = shdr.sh_offset; + break; + } + } + } + } + else /* if (elf.bits == 64) */ + { + Elf64_Shdr shdr; + for (i = 0; i < elf.hdr64.e_shnum; i++) + { + parse_elf_section(&elf, i, NULL, &shdr); + + if (shdr.sh_type == SHT_STRTAB) + { + char strtsb_name[128]; + + strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name)); + + if (!(strcmp(strtsb_name, ".shstrtab"))) + { + /* log_msg("found section: %s\n", strtsb_name); */ + strtab_off64 = shdr.sh_offset; + break; + } + } + } + } + + /* Parse all Symbol Tables */ + if (elf.bits == 32) + { + Elf32_Shdr shdr; + for (i = 0; i < elf.hdr32.e_shnum; i++) + { + parse_elf_section(&elf, i, &shdr, NULL); + + if (shdr.sh_type == SHT_SYMTAB) + { + for (ofst = shdr.sh_offset; + ofst < shdr.sh_offset + shdr.sh_size; + ofst += shdr.sh_entsize) + { + Elf32_Sym sym; + + parse_elf_symbol(&elf, ofst, &sym, NULL); + + /* For all OBJECTS (data objects), extract the value from the + * proper data segment. + */ + /* if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name) + log_msg("found data object %s\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name)); + */ + + if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT + && sym.st_size == 4) + { + Elf32_Shdr dhdr; + int val = 0; + char section_name[128]; + + parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL); + + /* For explanition - refer to _MSC_VER version of code */ + strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name)); + /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */ + + if (strcmp(section_name, ".bss")) + { + if (sizeof(val) != sym.st_size) + { + /* The target value is declared as an int in + * asm_*_offsets.c, which is 4 bytes on all + * targets we currently use. Complain loudly if + * this is not true. + */ + log_msg("Symbol size is wrong\n"); + goto bail; + } + + memcpy(&val, + elf.buf + dhdr.sh_offset + sym.st_value, + sym.st_size); + } + + if (!elf.le_data) + { + log_msg("Big Endian data not supported yet!\n"); + goto bail; + } + + switch (mode) + { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + case OUTPUT_FMT_GAS: + printf(".equ %-40s, %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + default: + printf("%s = %d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + } + } + } + } + } + } + else /* if (elf.bits == 64) */ + { + Elf64_Shdr shdr; + for (i = 0; i < elf.hdr64.e_shnum; i++) + { + parse_elf_section(&elf, i, NULL, &shdr); + + if (shdr.sh_type == SHT_SYMTAB) + { + for (ofst = shdr.sh_offset; + ofst < shdr.sh_offset + shdr.sh_size; + ofst += shdr.sh_entsize) + { + Elf64_Sym sym; + + parse_elf_symbol(&elf, ofst, NULL, &sym); + + /* For all OBJECTS (data objects), extract the value from the + * proper data segment. + */ + /* if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name) + log_msg("found data object %s\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name)); + */ + + if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT + && sym.st_size == 4) + { + Elf64_Shdr dhdr; + int val = 0; + char section_name[128]; + + parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr); + + /* For explanition - refer to _MSC_VER version of code */ + strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name)); + /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */ + + if ((strcmp(section_name, ".bss"))) + { + if (sizeof(val) != sym.st_size) + { + /* The target value is declared as an int in + * asm_*_offsets.c, which is 4 bytes on all + * targets we currently use. Complain loudly if + * this is not true. + */ + log_msg("Symbol size is wrong\n"); + goto bail; + } + + memcpy(&val, + elf.buf + dhdr.sh_offset + sym.st_value, + sym.st_size); + } + + if (!elf.le_data) + { + log_msg("Big Endian data not supported yet!\n"); + goto bail; + } + + switch (mode) + { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + case OUTPUT_FMT_GAS: + printf(".equ %-40s, %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + default: + printf("%s = %d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + } + } + } + } + } + } + + if (mode == OUTPUT_FMT_RVDS) + printf(" END\n"); + + return 0; +bail: + log_msg("Parse error: File does not appear to be valid ELF32 or ELF64\n"); + return 1; +} + +#endif +#endif /* defined(__GNUC__) && __GNUC__ */ + + +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) +/* See "Microsoft Portable Executable and Common Object File Format Specification" + for reference. +*/ +#define get_le32(x) ((*(x)) | (*(x+1)) << 8 |(*(x+2)) << 16 | (*(x+3)) << 24 ) +#define get_le16(x) ((*(x)) | (*(x+1)) << 8) + +int parse_coff(uint8_t *buf, size_t sz) +{ + unsigned int nsections, symtab_ptr, symtab_sz, strtab_ptr; + unsigned int sectionrawdata_ptr; + unsigned int i; + uint8_t *ptr; + uint32_t symoffset; + + char **sectionlist; //this array holds all section names in their correct order. + //it is used to check if the symbol is in .bss or .data section. + + nsections = get_le16(buf + 2); + symtab_ptr = get_le32(buf + 8); + symtab_sz = get_le32(buf + 12); + strtab_ptr = symtab_ptr + symtab_sz * 18; + + if (nsections > 96) + { + log_msg("Too many sections\n"); + return 1; + } + + sectionlist = malloc(nsections * sizeof(sectionlist)); + + if (sectionlist == NULL) + { + log_msg("Allocating first level of section list failed\n"); + return 1; + } + + //log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections); + + /* + The size of optional header is always zero for an obj file. So, the section header + follows the file header immediately. + */ + + ptr = buf + 20; //section header + + for (i = 0; i < nsections; i++) + { + char sectionname[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + strncpy(sectionname, ptr, 8); + //log_msg("COFF: Parsing section %s\n",sectionname); + + sectionlist[i] = malloc(strlen(sectionname) + 1); + + if (sectionlist[i] == NULL) + { + log_msg("Allocating storage for %s failed\n", sectionname); + goto bail; + } + strcpy(sectionlist[i], sectionname); + + if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20); + + ptr += 40; + } + + //log_msg("COFF: Symbol table at offset %u\n", symtab_ptr); + //log_msg("COFF: raw data pointer ofset for section .data is %u\n", sectionrawdata_ptr); + + /* The compiler puts the data with non-zero offset in .data section, but puts the data with + zero offset in .bss section. So, if the data in in .bss section, set offset=0. + Note from Wiki: In an object module compiled from C, the bss section contains + the local variables (but not functions) that were declared with the static keyword, + except for those with non-zero initial values. (In C, static variables are initialized + to zero by default.) It also contains the non-local (both extern and static) variables + that are also initialized to zero (either explicitly or by default). + */ + //move to symbol table + /* COFF symbol table: + offset field + 0 Name(*) + 8 Value + 12 SectionNumber + 14 Type + 16 StorageClass + 17 NumberOfAuxSymbols + */ + ptr = buf + symtab_ptr; + + for (i = 0; i < symtab_sz; i++) + { + int16_t section = get_le16(ptr + 12); //section number + + if (section > 0 && ptr[16] == 2) + { + //if(section > 0 && ptr[16] == 3 && get_le32(ptr+8)) { + + if (get_le32(ptr)) + { + char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + strncpy(name, ptr, 8); + //log_msg("COFF: Parsing symbol %s\n",name); + /* The 64bit Windows compiler doesn't prefix with an _. + * Check what's there, and bump if necessary + */ + if (name[0] == '_') + printf("%-40s EQU ", name + 1); + else + printf("%-40s EQU ", name); + } + else + { + //log_msg("COFF: Parsing symbol %s\n", + // buf + strtab_ptr + get_le32(ptr+4)); + if ((buf + strtab_ptr + get_le32(ptr + 4))[0] == '_') + printf("%-40s EQU ", + buf + strtab_ptr + get_le32(ptr + 4) + 1); + else + printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4)); + } + + if (!(strcmp(sectionlist[section-1], ".bss"))) + { + symoffset = 0; + } + else + { + symoffset = get_le32(buf + sectionrawdata_ptr + get_le32(ptr + 8)); + } + + //log_msg(" Section: %d\n",section); + //log_msg(" Class: %d\n",ptr[16]); + //log_msg(" Address: %u\n",get_le32(ptr+8)); + //log_msg(" Offset: %u\n", symoffset); + + printf("%5d\n", symoffset); + } + + ptr += 18; + } + + printf(" END\n"); + + for (i = 0; i < nsections; i++) + { + free(sectionlist[i]); + } + + free(sectionlist); + + return 0; +bail: + + for (i = 0; i < nsections; i++) + { + free(sectionlist[i]); + } + + free(sectionlist); + + return 1; +} +#endif /* defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) */ + +int main(int argc, char **argv) +{ + output_fmt_t mode = OUTPUT_FMT_PLAIN; + const char *f; + uint8_t *file_buf; + int res; + FILE *fp; + long int file_size; + + if (argc < 2 || argc > 3) + { + fprintf(stderr, "Usage: %s [output format] \n\n", argv[0]); + fprintf(stderr, " \tobject file to parse\n"); + fprintf(stderr, "Output Formats:\n"); + fprintf(stderr, " gas - compatible with GNU assembler\n"); + fprintf(stderr, " rvds - compatible with armasm\n"); + goto bail; + } + + f = argv[2]; + + if (!strcmp(argv[1], "rvds")) + mode = OUTPUT_FMT_RVDS; + else if (!strcmp(argv[1], "gas")) + mode = OUTPUT_FMT_GAS; + else + f = argv[1]; + + fp = fopen(f, "rb"); + + if (!fp) + { + perror("Unable to open file"); + goto bail; + } + + if (fseek(fp, 0, SEEK_END)) + { + perror("stat"); + goto bail; + } + + file_size = ftell(fp); + file_buf = malloc(file_size); + + if (!file_buf) + { + perror("malloc"); + goto bail; + } + + rewind(fp); + + if (fread(file_buf, sizeof(char), file_size, fp) != file_size) + { + perror("read"); + goto bail; + } + + if (fclose(fp)) + { + perror("close"); + goto bail; + } + +#if defined(__GNUC__) && __GNUC__ +#if defined(__MACH__) + res = parse_macho(file_buf, file_size); +#elif defined(__ELF__) + res = parse_elf(file_buf, file_size, mode); +#endif +#endif +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) + res = parse_coff(file_buf, file_size); +#endif + + free(file_buf); + + if (!res) + return EXIT_SUCCESS; + +bail: + return EXIT_FAILURE; +} diff --git a/third_party/libvpx/source/config/linux/x64/vpx_config.asm b/third_party/libvpx/source/config/linux/x64/vpx_config.asm index 6d5f85935..60dba0580 100644 --- a/third_party/libvpx/source/config/linux/x64/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/x64/vpx_config.asm @@ -22,6 +22,7 @@ HAVE_STDINT_H equ 1 HAVE_ALT_TREE_LAYOUT equ 0 HAVE_PTHREAD_H equ 1 HAVE_SYS_MMAN_H equ 1 +HAVE_UNISTD_H equ 1 CONFIG_EXTERNAL_BUILD equ 0 CONFIG_INSTALL_DOCS equ 0 CONFIG_INSTALL_BINS equ 1 @@ -47,7 +48,7 @@ CONFIG_DC_RECON equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_POSTPROC equ 1 CONFIG_MULTITHREAD equ 1 -CONFIG_PSNR equ 0 +CONFIG_INTERNAL_STATS equ 0 CONFIG_VP8_ENCODER equ 1 CONFIG_VP8_DECODER equ 1 CONFIG_VP8 equ 1 @@ -56,7 +57,9 @@ CONFIG_DECODERS equ 1 CONFIG_STATIC_MSVCRT equ 0 CONFIG_SPATIAL_RESAMPLING equ 1 CONFIG_REALTIME_ONLY equ 0 +CONFIG_ERROR_CONCEALMENT equ 1 CONFIG_SHARED equ 0 +CONFIG_STATIC equ 1 CONFIG_SMALL equ 0 CONFIG_POSTPROC_VISUALIZER equ 0 CONFIG_OS_SUPPORT equ 1 diff --git a/third_party/libvpx/source/config/linux/x64/vpx_config.c b/third_party/libvpx/source/config/linux/x64/vpx_config.c index 8b9b21ac3..ffebe4b66 100644 --- a/third_party/libvpx/source/config/linux/x64/vpx_config.c +++ b/third_party/libvpx/source/config/linux/x64/vpx_config.c @@ -1,2 +1,2 @@ -static const char* const cfg = "--target=x86_64-linux-gcc --enable-pic --disable-install-docs --disable-install-srcs --disable-examples --disable-psnr"; +static const char* const cfg = "--target=x86_64-linux-gcc --enable-pic --enable-error-concealment --disable-install-docs --disable-install-srcs --disable-examples --disable-internal-stats"; const char *vpx_codec_build_config(void) {return cfg;} diff --git a/third_party/libvpx/source/config/linux/x64/vpx_config.h b/third_party/libvpx/source/config/linux/x64/vpx_config.h index 1e7662bb1..a7bb74584 100644 --- a/third_party/libvpx/source/config/linux/x64/vpx_config.h +++ b/third_party/libvpx/source/config/linux/x64/vpx_config.h @@ -1,4 +1,6 @@ /* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_CONFIG_H +#define VPX_CONFIG_H #define RESTRICT #define ARCH_ARM 0 #define ARCH_MIPS 0 @@ -24,6 +26,7 @@ #define HAVE_ALT_TREE_LAYOUT 0 #define HAVE_PTHREAD_H 1 #define HAVE_SYS_MMAN_H 1 +#define HAVE_UNISTD_H 1 #define CONFIG_EXTERNAL_BUILD 0 #define CONFIG_INSTALL_DOCS 0 #define CONFIG_INSTALL_BINS 1 @@ -49,7 +52,7 @@ #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_POSTPROC 1 #define CONFIG_MULTITHREAD 1 -#define CONFIG_PSNR 0 +#define CONFIG_INTERNAL_STATS 0 #define CONFIG_VP8_ENCODER 1 #define CONFIG_VP8_DECODER 1 #define CONFIG_VP8 1 @@ -58,7 +61,10 @@ #define CONFIG_STATIC_MSVCRT 0 #define CONFIG_SPATIAL_RESAMPLING 1 #define CONFIG_REALTIME_ONLY 0 +#define CONFIG_ERROR_CONCEALMENT 1 #define CONFIG_SHARED 0 +#define CONFIG_STATIC 1 #define CONFIG_SMALL 0 #define CONFIG_POSTPROC_VISUALIZER 0 #define CONFIG_OS_SUPPORT 1 +#endif /* VPX_CONFIG_H */ diff --git a/third_party/libvpx/source/config/linux/x64/vpx_version.h b/third_party/libvpx/source/config/linux/x64/vpx_version.h index 1d8ba965d..5eedf6133 100644 --- a/third_party/libvpx/source/config/linux/x64/vpx_version.h +++ b/third_party/libvpx/source/config/linux/x64/vpx_version.h @@ -1,7 +1,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 9 -#define VERSION_PATCH 6 +#define VERSION_PATCH 7 #define VERSION_EXTRA "" #define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH)) -#define VERSION_STRING_NOSP "v0.9.6" -#define VERSION_STRING " v0.9.6" +#define VERSION_STRING_NOSP "v0.9.7" +#define VERSION_STRING " v0.9.7" diff --git a/third_party/libvpx/source/config/mac/ia32/asm_enc_offsets.asm b/third_party/libvpx/source/config/mac/ia32/asm_enc_offsets.asm new file mode 100644 index 000000000..3dfd4d820 --- /dev/null +++ b/third_party/libvpx/source/config/mac/ia32/asm_enc_offsets.asm @@ -0,0 +1,42 @@ +vp8_block_coeff EQU 4 +vp8_block_zbin EQU 20 +vp8_block_round EQU 28 +vp8_block_quant EQU 8 +vp8_block_quant_fast EQU 12 +vp8_block_zbin_extra EQU 32 +vp8_block_zrun_zbin_boost EQU 24 +vp8_block_quant_shift EQU 16 +vp8_blockd_qcoeff EQU 0 +vp8_blockd_dequant EQU 16 +vp8_blockd_dqcoeff EQU 4 +vp8_blockd_eob EQU 44 +vp8_block_base_src EQU 36 +vp8_block_src EQU 40 +vp8_block_src_diff EQU 0 +vp8_block_src_stride EQU 44 +vp8_blockd_predictor EQU 8 +vp8_writer_lowvalue EQU 0 +vp8_writer_range EQU 4 +vp8_writer_value EQU 8 +vp8_writer_count EQU 12 +vp8_writer_pos EQU 16 +vp8_writer_buffer EQU 20 +tokenextra_token EQU 6 +tokenextra_extra EQU 4 +tokenextra_context_tree EQU 0 +tokenextra_skip_eob_node EQU 7 +TOKENEXTRA_SZ EQU 8 +vp8_extra_bit_struct_sz EQU 16 +vp8_token_value EQU 0 +vp8_token_len EQU 4 +vp8_extra_bit_struct_tree EQU 0 +vp8_extra_bit_struct_prob EQU 4 +vp8_extra_bit_struct_len EQU 8 +vp8_extra_bit_struct_base_val EQU 12 +vp8_comp_tplist EQU 181220 +vp8_comp_common EQU 105408 +vp8_comp_bc2 EQU 128400 +tokenlist_start EQU 0 +tokenlist_stop EQU 4 +TOKENLIST_SZ EQU 8 +vp8_common_mb_rows EQU 12904 diff --git a/third_party/libvpx/source/config/mac/ia32/obj_int_extract.c b/third_party/libvpx/source/config/mac/ia32/obj_int_extract.c new file mode 100644 index 000000000..04e14a6c8 --- /dev/null +++ b/third_party/libvpx/source/config/mac/ia32/obj_int_extract.c @@ -0,0 +1,914 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE 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. + */ + + +#include +#include +#include +#include + +#include "vpx_config.h" +#include "vpx/vpx_integer.h" + +typedef enum +{ + OUTPUT_FMT_PLAIN, + OUTPUT_FMT_RVDS, + OUTPUT_FMT_GAS, +} output_fmt_t; + +int log_msg(const char *fmt, ...) +{ + int res; + va_list ap; + va_start(ap, fmt); + res = vfprintf(stderr, fmt, ap); + va_end(ap); + return res; +} + +#if defined(__GNUC__) && __GNUC__ +#if defined(__MACH__) + +#include +#include + +int parse_macho(uint8_t *base_buf, size_t sz) +{ + int i, j; + struct mach_header header; + uint8_t *buf = base_buf; + int base_data_section = 0; + int bits = 0; + + /* We can read in mach_header for 32 and 64 bit architectures + * because it's identical to mach_header_64 except for the last + * element (uint32_t reserved), which we don't use. Then, when + * we know which architecture we're looking at, increment buf + * appropriately. + */ + memcpy(&header, buf, sizeof(struct mach_header)); + + if (header.magic == MH_MAGIC) + { + if (header.cputype == CPU_TYPE_ARM + || header.cputype == CPU_TYPE_X86) + { + bits = 32; + buf += sizeof(struct mach_header); + } + else + { + log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_[ARM|X86].\n"); + goto bail; + } + } + else if (header.magic == MH_MAGIC_64) + { + if (header.cputype == CPU_TYPE_X86_64) + { + bits = 64; + buf += sizeof(struct mach_header_64); + } + else + { + log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_X86_64.\n"); + goto bail; + } + } + else + { + log_msg("Bad magic number for object file. 0x%x or 0x%x expected, 0x%x found.\n", + MH_MAGIC, MH_MAGIC_64, header.magic); + goto bail; + } + + if (header.filetype != MH_OBJECT) + { + log_msg("Bad filetype for object file. Currently only tested for MH_OBJECT.\n"); + goto bail; + } + + for (i = 0; i < header.ncmds; i++) + { + struct load_command lc; + + memcpy(&lc, buf, sizeof(struct load_command)); + + if (lc.cmd == LC_SEGMENT) + { + uint8_t *seg_buf = buf; + struct section s; + struct segment_command seg_c; + + memcpy(&seg_c, seg_buf, sizeof(struct segment_command)); + seg_buf += sizeof(struct segment_command); + + /* Although each section is given it's own offset, nlist.n_value + * references the offset of the first section. This isn't + * apparent without debug information because the offset of the + * data section is the same as the first section. However, with + * debug sections mixed in, the offset of the debug section + * increases but n_value still references the first section. + */ + if (seg_c.nsects < 1) + { + log_msg("Not enough sections\n"); + goto bail; + } + + memcpy(&s, seg_buf, sizeof(struct section)); + base_data_section = s.offset; + } + else if (lc.cmd == LC_SEGMENT_64) + { + uint8_t *seg_buf = buf; + struct section_64 s; + struct segment_command_64 seg_c; + + memcpy(&seg_c, seg_buf, sizeof(struct segment_command_64)); + seg_buf += sizeof(struct segment_command_64); + + /* Explanation in LG_SEGMENT */ + if (seg_c.nsects < 1) + { + log_msg("Not enough sections\n"); + goto bail; + } + + memcpy(&s, seg_buf, sizeof(struct section_64)); + base_data_section = s.offset; + } + else if (lc.cmd == LC_SYMTAB) + { + if (base_data_section != 0) + { + struct symtab_command sc; + uint8_t *sym_buf = base_buf; + uint8_t *str_buf = base_buf; + + memcpy(&sc, buf, sizeof(struct symtab_command)); + + if (sc.cmdsize != sizeof(struct symtab_command)) + { + log_msg("Can't find symbol table!\n"); + goto bail; + } + + sym_buf += sc.symoff; + str_buf += sc.stroff; + + for (j = 0; j < sc.nsyms; j++) + { + /* Location of string is cacluated each time from the + * start of the string buffer. On darwin the symbols + * are prefixed by "_", so we bump the pointer by 1. + * The target value is defined as an int in asm_*_offsets.c, + * which is 4 bytes on all targets we currently use. + */ + if (bits == 32) + { + struct nlist nl; + int val; + + memcpy(&nl, sym_buf, sizeof(struct nlist)); + sym_buf += sizeof(struct nlist); + + memcpy(&val, base_buf + base_data_section + nl.n_value, + sizeof(val)); + printf("%-40s EQU %5d\n", + str_buf + nl.n_un.n_strx + 1, val); + } + else /* if (bits == 64) */ + { + struct nlist_64 nl; + int val; + + memcpy(&nl, sym_buf, sizeof(struct nlist_64)); + sym_buf += sizeof(struct nlist_64); + + memcpy(&val, base_buf + base_data_section + nl.n_value, + sizeof(val)); + printf("%-40s EQU %5d\n", + str_buf + nl.n_un.n_strx + 1, val); + } + } + } + } + + buf += lc.cmdsize; + } + + return 0; +bail: + return 1; + +} + +#elif defined(__ELF__) +#include "elf.h" + +#define COPY_STRUCT(dst, buf, ofst, sz) do {\ + if(ofst + sizeof((*(dst))) > sz) goto bail;\ + memcpy(dst, buf+ofst, sizeof((*(dst))));\ + } while(0) + +#define ENDIAN_ASSIGN(val, memb) do {\ + if(!elf->le_data) {log_msg("Big Endian data not supported yet!\n");goto bail;}\ + (val) = (memb);\ + } while(0) + +#define ENDIAN_ASSIGN_IN_PLACE(memb) do {\ + ENDIAN_ASSIGN(memb, memb);\ + } while(0) + +typedef struct +{ + uint8_t *buf; /* Buffer containing ELF data */ + size_t sz; /* Buffer size */ + int le_data; /* Data is little-endian */ + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + int bits; /* 32 or 64 */ + Elf32_Ehdr hdr32; + Elf64_Ehdr hdr64; +} elf_obj_t; + +int parse_elf_header(elf_obj_t *elf) +{ + int res; + /* Verify ELF Magic numbers */ + COPY_STRUCT(&elf->e_ident, elf->buf, 0, elf->sz); + res = elf->e_ident[EI_MAG0] == ELFMAG0; + res &= elf->e_ident[EI_MAG1] == ELFMAG1; + res &= elf->e_ident[EI_MAG2] == ELFMAG2; + res &= elf->e_ident[EI_MAG3] == ELFMAG3; + res &= elf->e_ident[EI_CLASS] == ELFCLASS32 + || elf->e_ident[EI_CLASS] == ELFCLASS64; + res &= elf->e_ident[EI_DATA] == ELFDATA2LSB; + + if (!res) goto bail; + + elf->le_data = elf->e_ident[EI_DATA] == ELFDATA2LSB; + + /* Read in relevant values */ + if (elf->e_ident[EI_CLASS] == ELFCLASS32) + { + elf->bits = 32; + COPY_STRUCT(&elf->hdr32, elf->buf, 0, elf->sz); + + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_type); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_machine); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_version); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_entry); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_flags); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_ehsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shstrndx); + } + else /* if (elf->e_ident[EI_CLASS] == ELFCLASS64) */ + { + elf->bits = 64; + COPY_STRUCT(&elf->hdr64, elf->buf, 0, elf->sz); + + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_type); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_machine); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_version); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_entry); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_flags); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_ehsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shstrndx); + } + + return 0; +bail: + log_msg("Failed to parse ELF file header"); + return 1; +} + +int parse_elf_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr32, Elf64_Shdr *hdr64) +{ + if (hdr32) + { + if (idx >= elf->hdr32.e_shnum) + goto bail; + + COPY_STRUCT(hdr32, elf->buf, elf->hdr32.e_shoff + idx * elf->hdr32.e_shentsize, + elf->sz); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_name); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_type); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_flags); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addr); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_offset); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_size); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_link); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_info); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addralign); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_entsize); + } + else /* if (hdr64) */ + { + if (idx >= elf->hdr64.e_shnum) + goto bail; + + COPY_STRUCT(hdr64, elf->buf, elf->hdr64.e_shoff + idx * elf->hdr64.e_shentsize, + elf->sz); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_name); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_type); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_flags); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addr); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_offset); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_size); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_link); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_info); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addralign); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_entsize); + } + + return 0; +bail: + return 1; +} + +char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx) +{ + if (elf->bits == 32) + { + Elf32_Shdr shdr; + + if (parse_elf_section(elf, s_idx, &shdr, NULL)) + { + log_msg("Failed to parse ELF string table: section %d, index %d\n", + s_idx, idx); + return ""; + } + + return (char *)(elf->buf + shdr.sh_offset + idx); + } + else /* if (elf->bits == 64) */ + { + Elf64_Shdr shdr; + + if (parse_elf_section(elf, s_idx, NULL, &shdr)) + { + log_msg("Failed to parse ELF string table: section %d, index %d\n", + s_idx, idx); + return ""; + } + + return (char *)(elf->buf + shdr.sh_offset + idx); + } +} + +int parse_elf_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym32, Elf64_Sym *sym64) +{ + if (sym32) + { + COPY_STRUCT(sym32, elf->buf, ofst, elf->sz); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_name); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_value); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_size); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_info); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_other); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_shndx); + } + else /* if (sym64) */ + { + COPY_STRUCT(sym64, elf->buf, ofst, elf->sz); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_name); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_value); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_size); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_info); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_other); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_shndx); + } + return 0; +bail: + return 1; +} + +int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode) +{ + elf_obj_t elf; + unsigned int ofst; + int i; + Elf32_Off strtab_off32; + Elf64_Off strtab_off64; /* save String Table offset for later use */ + + memset(&elf, 0, sizeof(elf)); + elf.buf = buf; + elf.sz = sz; + + /* Parse Header */ + if (parse_elf_header(&elf)) + goto bail; + + if (elf.bits == 32) + { + Elf32_Shdr shdr; + for (i = 0; i < elf.hdr32.e_shnum; i++) + { + parse_elf_section(&elf, i, &shdr, NULL); + + if (shdr.sh_type == SHT_STRTAB) + { + char strtsb_name[128]; + + strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name)); + + if (!(strcmp(strtsb_name, ".shstrtab"))) + { + /* log_msg("found section: %s\n", strtsb_name); */ + strtab_off32 = shdr.sh_offset; + break; + } + } + } + } + else /* if (elf.bits == 64) */ + { + Elf64_Shdr shdr; + for (i = 0; i < elf.hdr64.e_shnum; i++) + { + parse_elf_section(&elf, i, NULL, &shdr); + + if (shdr.sh_type == SHT_STRTAB) + { + char strtsb_name[128]; + + strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name)); + + if (!(strcmp(strtsb_name, ".shstrtab"))) + { + /* log_msg("found section: %s\n", strtsb_name); */ + strtab_off64 = shdr.sh_offset; + break; + } + } + } + } + + /* Parse all Symbol Tables */ + if (elf.bits == 32) + { + Elf32_Shdr shdr; + for (i = 0; i < elf.hdr32.e_shnum; i++) + { + parse_elf_section(&elf, i, &shdr, NULL); + + if (shdr.sh_type == SHT_SYMTAB) + { + for (ofst = shdr.sh_offset; + ofst < shdr.sh_offset + shdr.sh_size; + ofst += shdr.sh_entsize) + { + Elf32_Sym sym; + + parse_elf_symbol(&elf, ofst, &sym, NULL); + + /* For all OBJECTS (data objects), extract the value from the + * proper data segment. + */ + /* if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name) + log_msg("found data object %s\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name)); + */ + + if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT + && sym.st_size == 4) + { + Elf32_Shdr dhdr; + int val = 0; + char section_name[128]; + + parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL); + + /* For explanition - refer to _MSC_VER version of code */ + strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name)); + /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */ + + if (strcmp(section_name, ".bss")) + { + if (sizeof(val) != sym.st_size) + { + /* The target value is declared as an int in + * asm_*_offsets.c, which is 4 bytes on all + * targets we currently use. Complain loudly if + * this is not true. + */ + log_msg("Symbol size is wrong\n"); + goto bail; + } + + memcpy(&val, + elf.buf + dhdr.sh_offset + sym.st_value, + sym.st_size); + } + + if (!elf.le_data) + { + log_msg("Big Endian data not supported yet!\n"); + goto bail; + } + + switch (mode) + { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + case OUTPUT_FMT_GAS: + printf(".equ %-40s, %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + default: + printf("%s = %d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + } + } + } + } + } + } + else /* if (elf.bits == 64) */ + { + Elf64_Shdr shdr; + for (i = 0; i < elf.hdr64.e_shnum; i++) + { + parse_elf_section(&elf, i, NULL, &shdr); + + if (shdr.sh_type == SHT_SYMTAB) + { + for (ofst = shdr.sh_offset; + ofst < shdr.sh_offset + shdr.sh_size; + ofst += shdr.sh_entsize) + { + Elf64_Sym sym; + + parse_elf_symbol(&elf, ofst, NULL, &sym); + + /* For all OBJECTS (data objects), extract the value from the + * proper data segment. + */ + /* if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name) + log_msg("found data object %s\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name)); + */ + + if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT + && sym.st_size == 4) + { + Elf64_Shdr dhdr; + int val = 0; + char section_name[128]; + + parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr); + + /* For explanition - refer to _MSC_VER version of code */ + strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name)); + /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */ + + if ((strcmp(section_name, ".bss"))) + { + if (sizeof(val) != sym.st_size) + { + /* The target value is declared as an int in + * asm_*_offsets.c, which is 4 bytes on all + * targets we currently use. Complain loudly if + * this is not true. + */ + log_msg("Symbol size is wrong\n"); + goto bail; + } + + memcpy(&val, + elf.buf + dhdr.sh_offset + sym.st_value, + sym.st_size); + } + + if (!elf.le_data) + { + log_msg("Big Endian data not supported yet!\n"); + goto bail; + } + + switch (mode) + { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + case OUTPUT_FMT_GAS: + printf(".equ %-40s, %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + default: + printf("%s = %d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + } + } + } + } + } + } + + if (mode == OUTPUT_FMT_RVDS) + printf(" END\n"); + + return 0; +bail: + log_msg("Parse error: File does not appear to be valid ELF32 or ELF64\n"); + return 1; +} + +#endif +#endif /* defined(__GNUC__) && __GNUC__ */ + + +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) +/* See "Microsoft Portable Executable and Common Object File Format Specification" + for reference. +*/ +#define get_le32(x) ((*(x)) | (*(x+1)) << 8 |(*(x+2)) << 16 | (*(x+3)) << 24 ) +#define get_le16(x) ((*(x)) | (*(x+1)) << 8) + +int parse_coff(uint8_t *buf, size_t sz) +{ + unsigned int nsections, symtab_ptr, symtab_sz, strtab_ptr; + unsigned int sectionrawdata_ptr; + unsigned int i; + uint8_t *ptr; + uint32_t symoffset; + + char **sectionlist; //this array holds all section names in their correct order. + //it is used to check if the symbol is in .bss or .data section. + + nsections = get_le16(buf + 2); + symtab_ptr = get_le32(buf + 8); + symtab_sz = get_le32(buf + 12); + strtab_ptr = symtab_ptr + symtab_sz * 18; + + if (nsections > 96) + { + log_msg("Too many sections\n"); + return 1; + } + + sectionlist = malloc(nsections * sizeof(sectionlist)); + + if (sectionlist == NULL) + { + log_msg("Allocating first level of section list failed\n"); + return 1; + } + + //log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections); + + /* + The size of optional header is always zero for an obj file. So, the section header + follows the file header immediately. + */ + + ptr = buf + 20; //section header + + for (i = 0; i < nsections; i++) + { + char sectionname[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + strncpy(sectionname, ptr, 8); + //log_msg("COFF: Parsing section %s\n",sectionname); + + sectionlist[i] = malloc(strlen(sectionname) + 1); + + if (sectionlist[i] == NULL) + { + log_msg("Allocating storage for %s failed\n", sectionname); + goto bail; + } + strcpy(sectionlist[i], sectionname); + + if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20); + + ptr += 40; + } + + //log_msg("COFF: Symbol table at offset %u\n", symtab_ptr); + //log_msg("COFF: raw data pointer ofset for section .data is %u\n", sectionrawdata_ptr); + + /* The compiler puts the data with non-zero offset in .data section, but puts the data with + zero offset in .bss section. So, if the data in in .bss section, set offset=0. + Note from Wiki: In an object module compiled from C, the bss section contains + the local variables (but not functions) that were declared with the static keyword, + except for those with non-zero initial values. (In C, static variables are initialized + to zero by default.) It also contains the non-local (both extern and static) variables + that are also initialized to zero (either explicitly or by default). + */ + //move to symbol table + /* COFF symbol table: + offset field + 0 Name(*) + 8 Value + 12 SectionNumber + 14 Type + 16 StorageClass + 17 NumberOfAuxSymbols + */ + ptr = buf + symtab_ptr; + + for (i = 0; i < symtab_sz; i++) + { + int16_t section = get_le16(ptr + 12); //section number + + if (section > 0 && ptr[16] == 2) + { + //if(section > 0 && ptr[16] == 3 && get_le32(ptr+8)) { + + if (get_le32(ptr)) + { + char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + strncpy(name, ptr, 8); + //log_msg("COFF: Parsing symbol %s\n",name); + /* The 64bit Windows compiler doesn't prefix with an _. + * Check what's there, and bump if necessary + */ + if (name[0] == '_') + printf("%-40s EQU ", name + 1); + else + printf("%-40s EQU ", name); + } + else + { + //log_msg("COFF: Parsing symbol %s\n", + // buf + strtab_ptr + get_le32(ptr+4)); + if ((buf + strtab_ptr + get_le32(ptr + 4))[0] == '_') + printf("%-40s EQU ", + buf + strtab_ptr + get_le32(ptr + 4) + 1); + else + printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4)); + } + + if (!(strcmp(sectionlist[section-1], ".bss"))) + { + symoffset = 0; + } + else + { + symoffset = get_le32(buf + sectionrawdata_ptr + get_le32(ptr + 8)); + } + + //log_msg(" Section: %d\n",section); + //log_msg(" Class: %d\n",ptr[16]); + //log_msg(" Address: %u\n",get_le32(ptr+8)); + //log_msg(" Offset: %u\n", symoffset); + + printf("%5d\n", symoffset); + } + + ptr += 18; + } + + printf(" END\n"); + + for (i = 0; i < nsections; i++) + { + free(sectionlist[i]); + } + + free(sectionlist); + + return 0; +bail: + + for (i = 0; i < nsections; i++) + { + free(sectionlist[i]); + } + + free(sectionlist); + + return 1; +} +#endif /* defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) */ + +int main(int argc, char **argv) +{ + output_fmt_t mode = OUTPUT_FMT_PLAIN; + const char *f; + uint8_t *file_buf; + int res; + FILE *fp; + long int file_size; + + if (argc < 2 || argc > 3) + { + fprintf(stderr, "Usage: %s [output format] \n\n", argv[0]); + fprintf(stderr, " \tobject file to parse\n"); + fprintf(stderr, "Output Formats:\n"); + fprintf(stderr, " gas - compatible with GNU assembler\n"); + fprintf(stderr, " rvds - compatible with armasm\n"); + goto bail; + } + + f = argv[2]; + + if (!strcmp(argv[1], "rvds")) + mode = OUTPUT_FMT_RVDS; + else if (!strcmp(argv[1], "gas")) + mode = OUTPUT_FMT_GAS; + else + f = argv[1]; + + fp = fopen(f, "rb"); + + if (!fp) + { + perror("Unable to open file"); + goto bail; + } + + if (fseek(fp, 0, SEEK_END)) + { + perror("stat"); + goto bail; + } + + file_size = ftell(fp); + file_buf = malloc(file_size); + + if (!file_buf) + { + perror("malloc"); + goto bail; + } + + rewind(fp); + + if (fread(file_buf, sizeof(char), file_size, fp) != file_size) + { + perror("read"); + goto bail; + } + + if (fclose(fp)) + { + perror("close"); + goto bail; + } + +#if defined(__GNUC__) && __GNUC__ +#if defined(__MACH__) + res = parse_macho(file_buf, file_size); +#elif defined(__ELF__) + res = parse_elf(file_buf, file_size, mode); +#endif +#endif +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) + res = parse_coff(file_buf, file_size); +#endif + + free(file_buf); + + if (!res) + return EXIT_SUCCESS; + +bail: + return EXIT_FAILURE; +} diff --git a/third_party/libvpx/source/config/mac/ia32/vpx_config.asm b/third_party/libvpx/source/config/mac/ia32/vpx_config.asm index 74276adba..85c92c22c 100644 --- a/third_party/libvpx/source/config/mac/ia32/vpx_config.asm +++ b/third_party/libvpx/source/config/mac/ia32/vpx_config.asm @@ -22,6 +22,7 @@ HAVE_STDINT_H equ 1 HAVE_ALT_TREE_LAYOUT equ 0 HAVE_PTHREAD_H equ 1 HAVE_SYS_MMAN_H equ 1 +HAVE_UNISTD_H equ 1 CONFIG_EXTERNAL_BUILD equ 0 CONFIG_INSTALL_DOCS equ 0 CONFIG_INSTALL_BINS equ 1 @@ -47,7 +48,7 @@ CONFIG_DC_RECON equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_POSTPROC equ 1 CONFIG_MULTITHREAD equ 1 -CONFIG_PSNR equ 0 +CONFIG_INTERNAL_STATS equ 0 CONFIG_VP8_ENCODER equ 1 CONFIG_VP8_DECODER equ 1 CONFIG_VP8 equ 1 @@ -56,7 +57,9 @@ CONFIG_DECODERS equ 1 CONFIG_STATIC_MSVCRT equ 0 CONFIG_SPATIAL_RESAMPLING equ 1 CONFIG_REALTIME_ONLY equ 0 +CONFIG_ERROR_CONCEALMENT equ 1 CONFIG_SHARED equ 0 +CONFIG_STATIC equ 1 CONFIG_SMALL equ 0 CONFIG_POSTPROC_VISUALIZER equ 0 CONFIG_OS_SUPPORT equ 1 diff --git a/third_party/libvpx/source/config/mac/ia32/vpx_config.c b/third_party/libvpx/source/config/mac/ia32/vpx_config.c index 9d5fe8125..eb2da7561 100644 --- a/third_party/libvpx/source/config/mac/ia32/vpx_config.c +++ b/third_party/libvpx/source/config/mac/ia32/vpx_config.c @@ -1,2 +1,2 @@ -static const char* const cfg = "--target=x86-darwin9-gcc --enable-pic --disable-install-docs --disable-install-srcs --disable-examples --disable-psnr"; +static const char* const cfg = "--target=x86-darwin9-gcc --enable-pic --enable-error-concealment --disable-install-docs --disable-install-srcs --disable-examples --disable-internal-stats"; const char *vpx_codec_build_config(void) {return cfg;} diff --git a/third_party/libvpx/source/config/mac/ia32/vpx_config.h b/third_party/libvpx/source/config/mac/ia32/vpx_config.h index 1a4998965..161db7808 100644 --- a/third_party/libvpx/source/config/mac/ia32/vpx_config.h +++ b/third_party/libvpx/source/config/mac/ia32/vpx_config.h @@ -1,4 +1,6 @@ /* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_CONFIG_H +#define VPX_CONFIG_H #define RESTRICT #define ARCH_ARM 0 #define ARCH_MIPS 0 @@ -24,6 +26,7 @@ #define HAVE_ALT_TREE_LAYOUT 0 #define HAVE_PTHREAD_H 1 #define HAVE_SYS_MMAN_H 1 +#define HAVE_UNISTD_H 1 #define CONFIG_EXTERNAL_BUILD 0 #define CONFIG_INSTALL_DOCS 0 #define CONFIG_INSTALL_BINS 1 @@ -49,7 +52,7 @@ #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_POSTPROC 1 #define CONFIG_MULTITHREAD 1 -#define CONFIG_PSNR 0 +#define CONFIG_INTERNAL_STATS 0 #define CONFIG_VP8_ENCODER 1 #define CONFIG_VP8_DECODER 1 #define CONFIG_VP8 1 @@ -58,7 +61,10 @@ #define CONFIG_STATIC_MSVCRT 0 #define CONFIG_SPATIAL_RESAMPLING 1 #define CONFIG_REALTIME_ONLY 0 +#define CONFIG_ERROR_CONCEALMENT 1 #define CONFIG_SHARED 0 +#define CONFIG_STATIC 1 #define CONFIG_SMALL 0 #define CONFIG_POSTPROC_VISUALIZER 0 #define CONFIG_OS_SUPPORT 1 +#endif /* VPX_CONFIG_H */ diff --git a/third_party/libvpx/source/config/mac/ia32/vpx_version.h b/third_party/libvpx/source/config/mac/ia32/vpx_version.h index 1d8ba965d..5eedf6133 100644 --- a/third_party/libvpx/source/config/mac/ia32/vpx_version.h +++ b/third_party/libvpx/source/config/mac/ia32/vpx_version.h @@ -1,7 +1,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 9 -#define VERSION_PATCH 6 +#define VERSION_PATCH 7 #define VERSION_EXTRA "" #define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH)) -#define VERSION_STRING_NOSP "v0.9.6" -#define VERSION_STRING " v0.9.6" +#define VERSION_STRING_NOSP "v0.9.7" +#define VERSION_STRING " v0.9.7" diff --git a/third_party/libvpx/source/config/mac/x64/asm_enc_offsets.asm b/third_party/libvpx/source/config/mac/x64/asm_enc_offsets.asm new file mode 100644 index 000000000..c79f21149 --- /dev/null +++ b/third_party/libvpx/source/config/mac/x64/asm_enc_offsets.asm @@ -0,0 +1,42 @@ +vp8_block_coeff EQU 8 +vp8_block_zbin EQU 40 +vp8_block_round EQU 56 +vp8_block_quant EQU 16 +vp8_block_quant_fast EQU 24 +vp8_block_zbin_extra EQU 64 +vp8_block_zrun_zbin_boost EQU 48 +vp8_block_quant_shift EQU 32 +vp8_blockd_qcoeff EQU 0 +vp8_blockd_dequant EQU 32 +vp8_blockd_dqcoeff EQU 8 +vp8_blockd_eob EQU 72 +vp8_block_base_src EQU 72 +vp8_block_src EQU 80 +vp8_block_src_diff EQU 0 +vp8_block_src_stride EQU 84 +vp8_blockd_predictor EQU 16 +vp8_writer_lowvalue EQU 0 +vp8_writer_range EQU 4 +vp8_writer_value EQU 8 +vp8_writer_count EQU 12 +vp8_writer_pos EQU 16 +vp8_writer_buffer EQU 24 +tokenextra_token EQU 10 +tokenextra_extra EQU 8 +tokenextra_context_tree EQU 0 +tokenextra_skip_eob_node EQU 11 +TOKENEXTRA_SZ EQU 16 +vp8_extra_bit_struct_sz EQU 24 +vp8_token_value EQU 0 +vp8_token_len EQU 4 +vp8_extra_bit_struct_tree EQU 0 +vp8_extra_bit_struct_prob EQU 8 +vp8_extra_bit_struct_len EQU 16 +vp8_extra_bit_struct_base_val EQU 20 +vp8_comp_tplist EQU 183768 +vp8_comp_common EQU 107360 +vp8_comp_bc2 EQU 130768 +tokenlist_start EQU 0 +tokenlist_stop EQU 8 +TOKENLIST_SZ EQU 16 +vp8_common_mb_rows EQU 13092 diff --git a/third_party/libvpx/source/config/mac/x64/obj_int_extract.c b/third_party/libvpx/source/config/mac/x64/obj_int_extract.c new file mode 100644 index 000000000..04e14a6c8 --- /dev/null +++ b/third_party/libvpx/source/config/mac/x64/obj_int_extract.c @@ -0,0 +1,914 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE 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. + */ + + +#include +#include +#include +#include + +#include "vpx_config.h" +#include "vpx/vpx_integer.h" + +typedef enum +{ + OUTPUT_FMT_PLAIN, + OUTPUT_FMT_RVDS, + OUTPUT_FMT_GAS, +} output_fmt_t; + +int log_msg(const char *fmt, ...) +{ + int res; + va_list ap; + va_start(ap, fmt); + res = vfprintf(stderr, fmt, ap); + va_end(ap); + return res; +} + +#if defined(__GNUC__) && __GNUC__ +#if defined(__MACH__) + +#include +#include + +int parse_macho(uint8_t *base_buf, size_t sz) +{ + int i, j; + struct mach_header header; + uint8_t *buf = base_buf; + int base_data_section = 0; + int bits = 0; + + /* We can read in mach_header for 32 and 64 bit architectures + * because it's identical to mach_header_64 except for the last + * element (uint32_t reserved), which we don't use. Then, when + * we know which architecture we're looking at, increment buf + * appropriately. + */ + memcpy(&header, buf, sizeof(struct mach_header)); + + if (header.magic == MH_MAGIC) + { + if (header.cputype == CPU_TYPE_ARM + || header.cputype == CPU_TYPE_X86) + { + bits = 32; + buf += sizeof(struct mach_header); + } + else + { + log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_[ARM|X86].\n"); + goto bail; + } + } + else if (header.magic == MH_MAGIC_64) + { + if (header.cputype == CPU_TYPE_X86_64) + { + bits = 64; + buf += sizeof(struct mach_header_64); + } + else + { + log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_X86_64.\n"); + goto bail; + } + } + else + { + log_msg("Bad magic number for object file. 0x%x or 0x%x expected, 0x%x found.\n", + MH_MAGIC, MH_MAGIC_64, header.magic); + goto bail; + } + + if (header.filetype != MH_OBJECT) + { + log_msg("Bad filetype for object file. Currently only tested for MH_OBJECT.\n"); + goto bail; + } + + for (i = 0; i < header.ncmds; i++) + { + struct load_command lc; + + memcpy(&lc, buf, sizeof(struct load_command)); + + if (lc.cmd == LC_SEGMENT) + { + uint8_t *seg_buf = buf; + struct section s; + struct segment_command seg_c; + + memcpy(&seg_c, seg_buf, sizeof(struct segment_command)); + seg_buf += sizeof(struct segment_command); + + /* Although each section is given it's own offset, nlist.n_value + * references the offset of the first section. This isn't + * apparent without debug information because the offset of the + * data section is the same as the first section. However, with + * debug sections mixed in, the offset of the debug section + * increases but n_value still references the first section. + */ + if (seg_c.nsects < 1) + { + log_msg("Not enough sections\n"); + goto bail; + } + + memcpy(&s, seg_buf, sizeof(struct section)); + base_data_section = s.offset; + } + else if (lc.cmd == LC_SEGMENT_64) + { + uint8_t *seg_buf = buf; + struct section_64 s; + struct segment_command_64 seg_c; + + memcpy(&seg_c, seg_buf, sizeof(struct segment_command_64)); + seg_buf += sizeof(struct segment_command_64); + + /* Explanation in LG_SEGMENT */ + if (seg_c.nsects < 1) + { + log_msg("Not enough sections\n"); + goto bail; + } + + memcpy(&s, seg_buf, sizeof(struct section_64)); + base_data_section = s.offset; + } + else if (lc.cmd == LC_SYMTAB) + { + if (base_data_section != 0) + { + struct symtab_command sc; + uint8_t *sym_buf = base_buf; + uint8_t *str_buf = base_buf; + + memcpy(&sc, buf, sizeof(struct symtab_command)); + + if (sc.cmdsize != sizeof(struct symtab_command)) + { + log_msg("Can't find symbol table!\n"); + goto bail; + } + + sym_buf += sc.symoff; + str_buf += sc.stroff; + + for (j = 0; j < sc.nsyms; j++) + { + /* Location of string is cacluated each time from the + * start of the string buffer. On darwin the symbols + * are prefixed by "_", so we bump the pointer by 1. + * The target value is defined as an int in asm_*_offsets.c, + * which is 4 bytes on all targets we currently use. + */ + if (bits == 32) + { + struct nlist nl; + int val; + + memcpy(&nl, sym_buf, sizeof(struct nlist)); + sym_buf += sizeof(struct nlist); + + memcpy(&val, base_buf + base_data_section + nl.n_value, + sizeof(val)); + printf("%-40s EQU %5d\n", + str_buf + nl.n_un.n_strx + 1, val); + } + else /* if (bits == 64) */ + { + struct nlist_64 nl; + int val; + + memcpy(&nl, sym_buf, sizeof(struct nlist_64)); + sym_buf += sizeof(struct nlist_64); + + memcpy(&val, base_buf + base_data_section + nl.n_value, + sizeof(val)); + printf("%-40s EQU %5d\n", + str_buf + nl.n_un.n_strx + 1, val); + } + } + } + } + + buf += lc.cmdsize; + } + + return 0; +bail: + return 1; + +} + +#elif defined(__ELF__) +#include "elf.h" + +#define COPY_STRUCT(dst, buf, ofst, sz) do {\ + if(ofst + sizeof((*(dst))) > sz) goto bail;\ + memcpy(dst, buf+ofst, sizeof((*(dst))));\ + } while(0) + +#define ENDIAN_ASSIGN(val, memb) do {\ + if(!elf->le_data) {log_msg("Big Endian data not supported yet!\n");goto bail;}\ + (val) = (memb);\ + } while(0) + +#define ENDIAN_ASSIGN_IN_PLACE(memb) do {\ + ENDIAN_ASSIGN(memb, memb);\ + } while(0) + +typedef struct +{ + uint8_t *buf; /* Buffer containing ELF data */ + size_t sz; /* Buffer size */ + int le_data; /* Data is little-endian */ + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + int bits; /* 32 or 64 */ + Elf32_Ehdr hdr32; + Elf64_Ehdr hdr64; +} elf_obj_t; + +int parse_elf_header(elf_obj_t *elf) +{ + int res; + /* Verify ELF Magic numbers */ + COPY_STRUCT(&elf->e_ident, elf->buf, 0, elf->sz); + res = elf->e_ident[EI_MAG0] == ELFMAG0; + res &= elf->e_ident[EI_MAG1] == ELFMAG1; + res &= elf->e_ident[EI_MAG2] == ELFMAG2; + res &= elf->e_ident[EI_MAG3] == ELFMAG3; + res &= elf->e_ident[EI_CLASS] == ELFCLASS32 + || elf->e_ident[EI_CLASS] == ELFCLASS64; + res &= elf->e_ident[EI_DATA] == ELFDATA2LSB; + + if (!res) goto bail; + + elf->le_data = elf->e_ident[EI_DATA] == ELFDATA2LSB; + + /* Read in relevant values */ + if (elf->e_ident[EI_CLASS] == ELFCLASS32) + { + elf->bits = 32; + COPY_STRUCT(&elf->hdr32, elf->buf, 0, elf->sz); + + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_type); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_machine); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_version); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_entry); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_flags); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_ehsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shstrndx); + } + else /* if (elf->e_ident[EI_CLASS] == ELFCLASS64) */ + { + elf->bits = 64; + COPY_STRUCT(&elf->hdr64, elf->buf, 0, elf->sz); + + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_type); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_machine); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_version); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_entry); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shoff); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_flags); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_ehsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shentsize); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shnum); + ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shstrndx); + } + + return 0; +bail: + log_msg("Failed to parse ELF file header"); + return 1; +} + +int parse_elf_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr32, Elf64_Shdr *hdr64) +{ + if (hdr32) + { + if (idx >= elf->hdr32.e_shnum) + goto bail; + + COPY_STRUCT(hdr32, elf->buf, elf->hdr32.e_shoff + idx * elf->hdr32.e_shentsize, + elf->sz); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_name); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_type); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_flags); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addr); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_offset); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_size); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_link); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_info); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addralign); + ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_entsize); + } + else /* if (hdr64) */ + { + if (idx >= elf->hdr64.e_shnum) + goto bail; + + COPY_STRUCT(hdr64, elf->buf, elf->hdr64.e_shoff + idx * elf->hdr64.e_shentsize, + elf->sz); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_name); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_type); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_flags); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addr); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_offset); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_size); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_link); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_info); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addralign); + ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_entsize); + } + + return 0; +bail: + return 1; +} + +char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx) +{ + if (elf->bits == 32) + { + Elf32_Shdr shdr; + + if (parse_elf_section(elf, s_idx, &shdr, NULL)) + { + log_msg("Failed to parse ELF string table: section %d, index %d\n", + s_idx, idx); + return ""; + } + + return (char *)(elf->buf + shdr.sh_offset + idx); + } + else /* if (elf->bits == 64) */ + { + Elf64_Shdr shdr; + + if (parse_elf_section(elf, s_idx, NULL, &shdr)) + { + log_msg("Failed to parse ELF string table: section %d, index %d\n", + s_idx, idx); + return ""; + } + + return (char *)(elf->buf + shdr.sh_offset + idx); + } +} + +int parse_elf_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym32, Elf64_Sym *sym64) +{ + if (sym32) + { + COPY_STRUCT(sym32, elf->buf, ofst, elf->sz); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_name); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_value); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_size); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_info); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_other); + ENDIAN_ASSIGN_IN_PLACE(sym32->st_shndx); + } + else /* if (sym64) */ + { + COPY_STRUCT(sym64, elf->buf, ofst, elf->sz); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_name); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_value); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_size); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_info); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_other); + ENDIAN_ASSIGN_IN_PLACE(sym64->st_shndx); + } + return 0; +bail: + return 1; +} + +int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode) +{ + elf_obj_t elf; + unsigned int ofst; + int i; + Elf32_Off strtab_off32; + Elf64_Off strtab_off64; /* save String Table offset for later use */ + + memset(&elf, 0, sizeof(elf)); + elf.buf = buf; + elf.sz = sz; + + /* Parse Header */ + if (parse_elf_header(&elf)) + goto bail; + + if (elf.bits == 32) + { + Elf32_Shdr shdr; + for (i = 0; i < elf.hdr32.e_shnum; i++) + { + parse_elf_section(&elf, i, &shdr, NULL); + + if (shdr.sh_type == SHT_STRTAB) + { + char strtsb_name[128]; + + strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name)); + + if (!(strcmp(strtsb_name, ".shstrtab"))) + { + /* log_msg("found section: %s\n", strtsb_name); */ + strtab_off32 = shdr.sh_offset; + break; + } + } + } + } + else /* if (elf.bits == 64) */ + { + Elf64_Shdr shdr; + for (i = 0; i < elf.hdr64.e_shnum; i++) + { + parse_elf_section(&elf, i, NULL, &shdr); + + if (shdr.sh_type == SHT_STRTAB) + { + char strtsb_name[128]; + + strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name)); + + if (!(strcmp(strtsb_name, ".shstrtab"))) + { + /* log_msg("found section: %s\n", strtsb_name); */ + strtab_off64 = shdr.sh_offset; + break; + } + } + } + } + + /* Parse all Symbol Tables */ + if (elf.bits == 32) + { + Elf32_Shdr shdr; + for (i = 0; i < elf.hdr32.e_shnum; i++) + { + parse_elf_section(&elf, i, &shdr, NULL); + + if (shdr.sh_type == SHT_SYMTAB) + { + for (ofst = shdr.sh_offset; + ofst < shdr.sh_offset + shdr.sh_size; + ofst += shdr.sh_entsize) + { + Elf32_Sym sym; + + parse_elf_symbol(&elf, ofst, &sym, NULL); + + /* For all OBJECTS (data objects), extract the value from the + * proper data segment. + */ + /* if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name) + log_msg("found data object %s\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name)); + */ + + if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT + && sym.st_size == 4) + { + Elf32_Shdr dhdr; + int val = 0; + char section_name[128]; + + parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL); + + /* For explanition - refer to _MSC_VER version of code */ + strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name)); + /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */ + + if (strcmp(section_name, ".bss")) + { + if (sizeof(val) != sym.st_size) + { + /* The target value is declared as an int in + * asm_*_offsets.c, which is 4 bytes on all + * targets we currently use. Complain loudly if + * this is not true. + */ + log_msg("Symbol size is wrong\n"); + goto bail; + } + + memcpy(&val, + elf.buf + dhdr.sh_offset + sym.st_value, + sym.st_size); + } + + if (!elf.le_data) + { + log_msg("Big Endian data not supported yet!\n"); + goto bail; + } + + switch (mode) + { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + case OUTPUT_FMT_GAS: + printf(".equ %-40s, %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + default: + printf("%s = %d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + } + } + } + } + } + } + else /* if (elf.bits == 64) */ + { + Elf64_Shdr shdr; + for (i = 0; i < elf.hdr64.e_shnum; i++) + { + parse_elf_section(&elf, i, NULL, &shdr); + + if (shdr.sh_type == SHT_SYMTAB) + { + for (ofst = shdr.sh_offset; + ofst < shdr.sh_offset + shdr.sh_size; + ofst += shdr.sh_entsize) + { + Elf64_Sym sym; + + parse_elf_symbol(&elf, ofst, NULL, &sym); + + /* For all OBJECTS (data objects), extract the value from the + * proper data segment. + */ + /* if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name) + log_msg("found data object %s\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name)); + */ + + if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT + && sym.st_size == 4) + { + Elf64_Shdr dhdr; + int val = 0; + char section_name[128]; + + parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr); + + /* For explanition - refer to _MSC_VER version of code */ + strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name)); + /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */ + + if ((strcmp(section_name, ".bss"))) + { + if (sizeof(val) != sym.st_size) + { + /* The target value is declared as an int in + * asm_*_offsets.c, which is 4 bytes on all + * targets we currently use. Complain loudly if + * this is not true. + */ + log_msg("Symbol size is wrong\n"); + goto bail; + } + + memcpy(&val, + elf.buf + dhdr.sh_offset + sym.st_value, + sym.st_size); + } + + if (!elf.le_data) + { + log_msg("Big Endian data not supported yet!\n"); + goto bail; + } + + switch (mode) + { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + case OUTPUT_FMT_GAS: + printf(".equ %-40s, %5d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + break; + default: + printf("%s = %d\n", + parse_elf_string_table(&elf, + shdr.sh_link, + sym.st_name), + val); + } + } + } + } + } + } + + if (mode == OUTPUT_FMT_RVDS) + printf(" END\n"); + + return 0; +bail: + log_msg("Parse error: File does not appear to be valid ELF32 or ELF64\n"); + return 1; +} + +#endif +#endif /* defined(__GNUC__) && __GNUC__ */ + + +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) +/* See "Microsoft Portable Executable and Common Object File Format Specification" + for reference. +*/ +#define get_le32(x) ((*(x)) | (*(x+1)) << 8 |(*(x+2)) << 16 | (*(x+3)) << 24 ) +#define get_le16(x) ((*(x)) | (*(x+1)) << 8) + +int parse_coff(uint8_t *buf, size_t sz) +{ + unsigned int nsections, symtab_ptr, symtab_sz, strtab_ptr; + unsigned int sectionrawdata_ptr; + unsigned int i; + uint8_t *ptr; + uint32_t symoffset; + + char **sectionlist; //this array holds all section names in their correct order. + //it is used to check if the symbol is in .bss or .data section. + + nsections = get_le16(buf + 2); + symtab_ptr = get_le32(buf + 8); + symtab_sz = get_le32(buf + 12); + strtab_ptr = symtab_ptr + symtab_sz * 18; + + if (nsections > 96) + { + log_msg("Too many sections\n"); + return 1; + } + + sectionlist = malloc(nsections * sizeof(sectionlist)); + + if (sectionlist == NULL) + { + log_msg("Allocating first level of section list failed\n"); + return 1; + } + + //log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections); + + /* + The size of optional header is always zero for an obj file. So, the section header + follows the file header immediately. + */ + + ptr = buf + 20; //section header + + for (i = 0; i < nsections; i++) + { + char sectionname[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + strncpy(sectionname, ptr, 8); + //log_msg("COFF: Parsing section %s\n",sectionname); + + sectionlist[i] = malloc(strlen(sectionname) + 1); + + if (sectionlist[i] == NULL) + { + log_msg("Allocating storage for %s failed\n", sectionname); + goto bail; + } + strcpy(sectionlist[i], sectionname); + + if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20); + + ptr += 40; + } + + //log_msg("COFF: Symbol table at offset %u\n", symtab_ptr); + //log_msg("COFF: raw data pointer ofset for section .data is %u\n", sectionrawdata_ptr); + + /* The compiler puts the data with non-zero offset in .data section, but puts the data with + zero offset in .bss section. So, if the data in in .bss section, set offset=0. + Note from Wiki: In an object module compiled from C, the bss section contains + the local variables (but not functions) that were declared with the static keyword, + except for those with non-zero initial values. (In C, static variables are initialized + to zero by default.) It also contains the non-local (both extern and static) variables + that are also initialized to zero (either explicitly or by default). + */ + //move to symbol table + /* COFF symbol table: + offset field + 0 Name(*) + 8 Value + 12 SectionNumber + 14 Type + 16 StorageClass + 17 NumberOfAuxSymbols + */ + ptr = buf + symtab_ptr; + + for (i = 0; i < symtab_sz; i++) + { + int16_t section = get_le16(ptr + 12); //section number + + if (section > 0 && ptr[16] == 2) + { + //if(section > 0 && ptr[16] == 3 && get_le32(ptr+8)) { + + if (get_le32(ptr)) + { + char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + strncpy(name, ptr, 8); + //log_msg("COFF: Parsing symbol %s\n",name); + /* The 64bit Windows compiler doesn't prefix with an _. + * Check what's there, and bump if necessary + */ + if (name[0] == '_') + printf("%-40s EQU ", name + 1); + else + printf("%-40s EQU ", name); + } + else + { + //log_msg("COFF: Parsing symbol %s\n", + // buf + strtab_ptr + get_le32(ptr+4)); + if ((buf + strtab_ptr + get_le32(ptr + 4))[0] == '_') + printf("%-40s EQU ", + buf + strtab_ptr + get_le32(ptr + 4) + 1); + else + printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4)); + } + + if (!(strcmp(sectionlist[section-1], ".bss"))) + { + symoffset = 0; + } + else + { + symoffset = get_le32(buf + sectionrawdata_ptr + get_le32(ptr + 8)); + } + + //log_msg(" Section: %d\n",section); + //log_msg(" Class: %d\n",ptr[16]); + //log_msg(" Address: %u\n",get_le32(ptr+8)); + //log_msg(" Offset: %u\n", symoffset); + + printf("%5d\n", symoffset); + } + + ptr += 18; + } + + printf(" END\n"); + + for (i = 0; i < nsections; i++) + { + free(sectionlist[i]); + } + + free(sectionlist); + + return 0; +bail: + + for (i = 0; i < nsections; i++) + { + free(sectionlist[i]); + } + + free(sectionlist); + + return 1; +} +#endif /* defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) */ + +int main(int argc, char **argv) +{ + output_fmt_t mode = OUTPUT_FMT_PLAIN; + const char *f; + uint8_t *file_buf; + int res; + FILE *fp; + long int file_size; + + if (argc < 2 || argc > 3) + { + fprintf(stderr, "Usage: %s [output format] \n\n", argv[0]); + fprintf(stderr, " \tobject file to parse\n"); + fprintf(stderr, "Output Formats:\n"); + fprintf(stderr, " gas - compatible with GNU assembler\n"); + fprintf(stderr, " rvds - compatible with armasm\n"); + goto bail; + } + + f = argv[2]; + + if (!strcmp(argv[1], "rvds")) + mode = OUTPUT_FMT_RVDS; + else if (!strcmp(argv[1], "gas")) + mode = OUTPUT_FMT_GAS; + else + f = argv[1]; + + fp = fopen(f, "rb"); + + if (!fp) + { + perror("Unable to open file"); + goto bail; + } + + if (fseek(fp, 0, SEEK_END)) + { + perror("stat"); + goto bail; + } + + file_size = ftell(fp); + file_buf = malloc(file_size); + + if (!file_buf) + { + perror("malloc"); + goto bail; + } + + rewind(fp); + + if (fread(file_buf, sizeof(char), file_size, fp) != file_size) + { + perror("read"); + goto bail; + } + + if (fclose(fp)) + { + perror("close"); + goto bail; + } + +#if defined(__GNUC__) && __GNUC__ +#if defined(__MACH__) + res = parse_macho(file_buf, file_size); +#elif defined(__ELF__) + res = parse_elf(file_buf, file_size, mode); +#endif +#endif +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) + res = parse_coff(file_buf, file_size); +#endif + + free(file_buf); + + if (!res) + return EXIT_SUCCESS; + +bail: + return EXIT_FAILURE; +} diff --git a/third_party/libvpx/source/config/mac/x64/vpx_config.asm b/third_party/libvpx/source/config/mac/x64/vpx_config.asm index 6d5f85935..60dba0580 100644 --- a/third_party/libvpx/source/config/mac/x64/vpx_config.asm +++ b/third_party/libvpx/source/config/mac/x64/vpx_config.asm @@ -22,6 +22,7 @@ HAVE_STDINT_H equ 1 HAVE_ALT_TREE_LAYOUT equ 0 HAVE_PTHREAD_H equ 1 HAVE_SYS_MMAN_H equ 1 +HAVE_UNISTD_H equ 1 CONFIG_EXTERNAL_BUILD equ 0 CONFIG_INSTALL_DOCS equ 0 CONFIG_INSTALL_BINS equ 1 @@ -47,7 +48,7 @@ CONFIG_DC_RECON equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_POSTPROC equ 1 CONFIG_MULTITHREAD equ 1 -CONFIG_PSNR equ 0 +CONFIG_INTERNAL_STATS equ 0 CONFIG_VP8_ENCODER equ 1 CONFIG_VP8_DECODER equ 1 CONFIG_VP8 equ 1 @@ -56,7 +57,9 @@ CONFIG_DECODERS equ 1 CONFIG_STATIC_MSVCRT equ 0 CONFIG_SPATIAL_RESAMPLING equ 1 CONFIG_REALTIME_ONLY equ 0 +CONFIG_ERROR_CONCEALMENT equ 1 CONFIG_SHARED equ 0 +CONFIG_STATIC equ 1 CONFIG_SMALL equ 0 CONFIG_POSTPROC_VISUALIZER equ 0 CONFIG_OS_SUPPORT equ 1 diff --git a/third_party/libvpx/source/config/mac/x64/vpx_config.c b/third_party/libvpx/source/config/mac/x64/vpx_config.c index 769a3fa17..af5c16eb5 100644 --- a/third_party/libvpx/source/config/mac/x64/vpx_config.c +++ b/third_party/libvpx/source/config/mac/x64/vpx_config.c @@ -1,2 +1,2 @@ -static const char* const cfg = "--target=x86_64-darwin10-gcc --enable-pic --disable-install-docs --disable-install-srcs --disable-examples --disable-psnr"; +static const char* const cfg = "--target=x86_64-darwin10-gcc --enable-pic --enable-error-concealment --disable-install-docs --disable-install-srcs --disable-examples --disable-internal-stats"; const char *vpx_codec_build_config(void) {return cfg;} diff --git a/third_party/libvpx/source/config/mac/x64/vpx_config.h b/third_party/libvpx/source/config/mac/x64/vpx_config.h index 1e7662bb1..a7bb74584 100644 --- a/third_party/libvpx/source/config/mac/x64/vpx_config.h +++ b/third_party/libvpx/source/config/mac/x64/vpx_config.h @@ -1,4 +1,6 @@ /* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_CONFIG_H +#define VPX_CONFIG_H #define RESTRICT #define ARCH_ARM 0 #define ARCH_MIPS 0 @@ -24,6 +26,7 @@ #define HAVE_ALT_TREE_LAYOUT 0 #define HAVE_PTHREAD_H 1 #define HAVE_SYS_MMAN_H 1 +#define HAVE_UNISTD_H 1 #define CONFIG_EXTERNAL_BUILD 0 #define CONFIG_INSTALL_DOCS 0 #define CONFIG_INSTALL_BINS 1 @@ -49,7 +52,7 @@ #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_POSTPROC 1 #define CONFIG_MULTITHREAD 1 -#define CONFIG_PSNR 0 +#define CONFIG_INTERNAL_STATS 0 #define CONFIG_VP8_ENCODER 1 #define CONFIG_VP8_DECODER 1 #define CONFIG_VP8 1 @@ -58,7 +61,10 @@ #define CONFIG_STATIC_MSVCRT 0 #define CONFIG_SPATIAL_RESAMPLING 1 #define CONFIG_REALTIME_ONLY 0 +#define CONFIG_ERROR_CONCEALMENT 1 #define CONFIG_SHARED 0 +#define CONFIG_STATIC 1 #define CONFIG_SMALL 0 #define CONFIG_POSTPROC_VISUALIZER 0 #define CONFIG_OS_SUPPORT 1 +#endif /* VPX_CONFIG_H */ diff --git a/third_party/libvpx/source/config/mac/x64/vpx_version.h b/third_party/libvpx/source/config/mac/x64/vpx_version.h index 1d8ba965d..5eedf6133 100644 --- a/third_party/libvpx/source/config/mac/x64/vpx_version.h +++ b/third_party/libvpx/source/config/mac/x64/vpx_version.h @@ -1,7 +1,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 9 -#define VERSION_PATCH 6 +#define VERSION_PATCH 7 #define VERSION_EXTRA "" #define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH)) -#define VERSION_STRING_NOSP "v0.9.6" -#define VERSION_STRING " v0.9.6" +#define VERSION_STRING_NOSP "v0.9.7" +#define VERSION_STRING " v0.9.7" diff --git a/third_party/libvpx/source/config/win/ia32/asm_com_offsets.asm b/third_party/libvpx/source/config/win/ia32/asm_com_offsets.asm new file mode 100644 index 000000000..8aba39d4c --- /dev/null +++ b/third_party/libvpx/source/config/win/ia32/asm_com_offsets.asm @@ -0,0 +1,12 @@ +yv12_buffer_config_y_width EQU 0 +yv12_buffer_config_y_height EQU 4 +yv12_buffer_config_y_stride EQU 8 +yv12_buffer_config_uv_width EQU 12 +yv12_buffer_config_uv_height EQU 16 +yv12_buffer_config_uv_stride EQU 20 +yv12_buffer_config_y_buffer EQU 24 +yv12_buffer_config_u_buffer EQU 28 +yv12_buffer_config_v_buffer EQU 32 +yv12_buffer_config_border EQU 40 +VP8BORDERINPIXELS_VAL EQU 32 + END diff --git a/third_party/libvpx/source/config/win/ia32/asm_dec_offsets.asm b/third_party/libvpx/source/config/win/ia32/asm_dec_offsets.asm new file mode 100644 index 000000000..4ae949d07 --- /dev/null +++ b/third_party/libvpx/source/config/win/ia32/asm_dec_offsets.asm @@ -0,0 +1,17 @@ +detok_scan EQU 0 +detok_ptr_block2leftabove EQU 4 +detok_coef_tree_ptr EQU 8 +detok_norm_ptr EQU 12 +detok_ptr_coef_bands_x EQU 16 +detok_A EQU 20 +detok_L EQU 24 +detok_qcoeff_start_ptr EQU 28 +detok_current_bc EQU 32 +detok_coef_probs EQU 36 +detok_eob EQU 52 +bool_decoder_user_buffer_end EQU 0 +bool_decoder_user_buffer EQU 4 +bool_decoder_value EQU 8 +bool_decoder_count EQU 12 +bool_decoder_range EQU 16 + END diff --git a/third_party/libvpx/source/config/win/ia32/asm_enc_offsets.asm b/third_party/libvpx/source/config/win/ia32/asm_enc_offsets.asm new file mode 100644 index 000000000..d69ffbe67 --- /dev/null +++ b/third_party/libvpx/source/config/win/ia32/asm_enc_offsets.asm @@ -0,0 +1,43 @@ +vp8_block_coeff EQU 4 +vp8_block_zbin EQU 20 +vp8_block_round EQU 28 +vp8_block_quant EQU 8 +vp8_block_quant_fast EQU 12 +vp8_block_zbin_extra EQU 32 +vp8_block_zrun_zbin_boost EQU 24 +vp8_block_quant_shift EQU 16 +vp8_blockd_qcoeff EQU 0 +vp8_blockd_dequant EQU 16 +vp8_blockd_dqcoeff EQU 4 +vp8_blockd_eob EQU 44 +vp8_block_base_src EQU 36 +vp8_block_src EQU 40 +vp8_block_src_diff EQU 0 +vp8_block_src_stride EQU 44 +vp8_blockd_predictor EQU 8 +vp8_writer_lowvalue EQU 0 +vp8_writer_range EQU 4 +vp8_writer_value EQU 8 +vp8_writer_count EQU 12 +vp8_writer_pos EQU 16 +vp8_writer_buffer EQU 20 +tokenextra_token EQU 6 +tokenextra_extra EQU 4 +tokenextra_context_tree EQU 0 +tokenextra_skip_eob_node EQU 7 +TOKENEXTRA_SZ EQU 8 +vp8_extra_bit_struct_sz EQU 16 +vp8_token_value EQU 0 +vp8_token_len EQU 4 +vp8_extra_bit_struct_tree EQU 0 +vp8_extra_bit_struct_prob EQU 4 +vp8_extra_bit_struct_len EQU 8 +vp8_extra_bit_struct_base_val EQU 12 +vp8_comp_tplist EQU 181240 +vp8_comp_common EQU 105408 +vp8_comp_bc2 EQU 128400 +tokenlist_start EQU 0 +tokenlist_stop EQU 4 +TOKENLIST_SZ EQU 8 +vp8_common_mb_rows EQU 12888 + END diff --git a/third_party/libvpx/source/config/win/ia32/vpx_config.asm b/third_party/libvpx/source/config/win/ia32/vpx_config.asm index 14467af8b..47dab7e87 100644 --- a/third_party/libvpx/source/config/win/ia32/vpx_config.asm +++ b/third_party/libvpx/source/config/win/ia32/vpx_config.asm @@ -22,6 +22,7 @@ HAVE_STDINT_H equ 0 HAVE_ALT_TREE_LAYOUT equ 0 HAVE_PTHREAD_H equ 0 HAVE_SYS_MMAN_H equ 0 +HAVE_UNISTD_H equ 0 CONFIG_EXTERNAL_BUILD equ 1 CONFIG_INSTALL_DOCS equ 0 CONFIG_INSTALL_BINS equ 1 @@ -47,7 +48,7 @@ CONFIG_DC_RECON equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_POSTPROC equ 1 CONFIG_MULTITHREAD equ 1 -CONFIG_PSNR equ 0 +CONFIG_INTERNAL_STATS equ 0 CONFIG_VP8_ENCODER equ 1 CONFIG_VP8_DECODER equ 1 CONFIG_VP8 equ 1 @@ -56,7 +57,9 @@ CONFIG_DECODERS equ 1 CONFIG_STATIC_MSVCRT equ 0 CONFIG_SPATIAL_RESAMPLING equ 1 CONFIG_REALTIME_ONLY equ 0 +CONFIG_ERROR_CONCEALMENT equ 1 CONFIG_SHARED equ 0 +CONFIG_STATIC equ 1 CONFIG_SMALL equ 0 CONFIG_POSTPROC_VISUALIZER equ 0 CONFIG_OS_SUPPORT equ 1 diff --git a/third_party/libvpx/source/config/win/ia32/vpx_config.c b/third_party/libvpx/source/config/win/ia32/vpx_config.c index aad402783..7eb4f1d33 100644 --- a/third_party/libvpx/source/config/win/ia32/vpx_config.c +++ b/third_party/libvpx/source/config/win/ia32/vpx_config.c @@ -1,2 +1,2 @@ -static const char* const cfg = "--target=x86-win32-vs8 --enable-pic --disable-install-docs --disable-install-srcs --disable-examples --disable-psnr"; +static const char* const cfg = "--target=x86-win32-vs9 --enable-pic --enable-error-concealment --disable-install-docs --disable-install-srcs --disable-examples --disable-internal-stats"; const char *vpx_codec_build_config(void) {return cfg;} diff --git a/third_party/libvpx/source/config/win/ia32/vpx_config.h b/third_party/libvpx/source/config/win/ia32/vpx_config.h index 8365b1be4..6829e3637 100644 --- a/third_party/libvpx/source/config/win/ia32/vpx_config.h +++ b/third_party/libvpx/source/config/win/ia32/vpx_config.h @@ -1,4 +1,6 @@ /* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_CONFIG_H +#define VPX_CONFIG_H #define RESTRICT #define ARCH_ARM 0 #define ARCH_MIPS 0 @@ -24,6 +26,7 @@ #define HAVE_ALT_TREE_LAYOUT 0 #define HAVE_PTHREAD_H 0 #define HAVE_SYS_MMAN_H 0 +#define HAVE_UNISTD_H 0 #define CONFIG_EXTERNAL_BUILD 1 #define CONFIG_INSTALL_DOCS 0 #define CONFIG_INSTALL_BINS 1 @@ -49,7 +52,7 @@ #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_POSTPROC 1 #define CONFIG_MULTITHREAD 1 -#define CONFIG_PSNR 0 +#define CONFIG_INTERNAL_STATS 0 #define CONFIG_VP8_ENCODER 1 #define CONFIG_VP8_DECODER 1 #define CONFIG_VP8 1 @@ -58,7 +61,10 @@ #define CONFIG_STATIC_MSVCRT 0 #define CONFIG_SPATIAL_RESAMPLING 1 #define CONFIG_REALTIME_ONLY 0 +#define CONFIG_ERROR_CONCEALMENT 1 #define CONFIG_SHARED 0 +#define CONFIG_STATIC 1 #define CONFIG_SMALL 0 #define CONFIG_POSTPROC_VISUALIZER 0 #define CONFIG_OS_SUPPORT 1 +#endif /* VPX_CONFIG_H */ diff --git a/third_party/libvpx/source/config/win/ia32/vpx_version.h b/third_party/libvpx/source/config/win/ia32/vpx_version.h index 1d8ba965d..5eedf6133 100644 --- a/third_party/libvpx/source/config/win/ia32/vpx_version.h +++ b/third_party/libvpx/source/config/win/ia32/vpx_version.h @@ -1,7 +1,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 9 -#define VERSION_PATCH 6 +#define VERSION_PATCH 7 #define VERSION_EXTRA "" #define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH)) -#define VERSION_STRING_NOSP "v0.9.6" -#define VERSION_STRING " v0.9.6" +#define VERSION_STRING_NOSP "v0.9.7" +#define VERSION_STRING " v0.9.7" diff --git a/third_party/libvpx/source/config/win/x64/asm_com_offsets.asm b/third_party/libvpx/source/config/win/x64/asm_com_offsets.asm new file mode 100644 index 000000000..c28816e15 --- /dev/null +++ b/third_party/libvpx/source/config/win/x64/asm_com_offsets.asm @@ -0,0 +1,12 @@ +yv12_buffer_config_y_width EQU 0 +yv12_buffer_config_y_height EQU 4 +yv12_buffer_config_y_stride EQU 8 +yv12_buffer_config_uv_width EQU 12 +yv12_buffer_config_uv_height EQU 16 +yv12_buffer_config_uv_stride EQU 20 +yv12_buffer_config_y_buffer EQU 24 +yv12_buffer_config_u_buffer EQU 32 +yv12_buffer_config_v_buffer EQU 40 +yv12_buffer_config_border EQU 56 +VP8BORDERINPIXELS_VAL EQU 32 + END diff --git a/third_party/libvpx/source/config/win/x64/asm_dec_offsets.asm b/third_party/libvpx/source/config/win/x64/asm_dec_offsets.asm new file mode 100644 index 000000000..406d89d81 --- /dev/null +++ b/third_party/libvpx/source/config/win/x64/asm_dec_offsets.asm @@ -0,0 +1,17 @@ +detok_scan EQU 0 +detok_ptr_block2leftabove EQU 8 +detok_coef_tree_ptr EQU 16 +detok_norm_ptr EQU 24 +detok_ptr_coef_bands_x EQU 32 +detok_A EQU 40 +detok_L EQU 48 +detok_qcoeff_start_ptr EQU 56 +detok_current_bc EQU 64 +detok_coef_probs EQU 72 +detok_eob EQU 104 +bool_decoder_user_buffer_end EQU 0 +bool_decoder_user_buffer EQU 8 +bool_decoder_value EQU 16 +bool_decoder_count EQU 24 +bool_decoder_range EQU 28 + END diff --git a/third_party/libvpx/source/config/win/x64/asm_enc_offsets.asm b/third_party/libvpx/source/config/win/x64/asm_enc_offsets.asm new file mode 100644 index 000000000..8291c7b38 --- /dev/null +++ b/third_party/libvpx/source/config/win/x64/asm_enc_offsets.asm @@ -0,0 +1,43 @@ +vp8_block_coeff EQU 8 +vp8_block_zbin EQU 40 +vp8_block_round EQU 56 +vp8_block_quant EQU 16 +vp8_block_quant_fast EQU 24 +vp8_block_zbin_extra EQU 64 +vp8_block_zrun_zbin_boost EQU 48 +vp8_block_quant_shift EQU 32 +vp8_blockd_qcoeff EQU 0 +vp8_blockd_dequant EQU 32 +vp8_blockd_dqcoeff EQU 8 +vp8_blockd_eob EQU 72 +vp8_block_base_src EQU 72 +vp8_block_src EQU 80 +vp8_block_src_diff EQU 0 +vp8_block_src_stride EQU 84 +vp8_blockd_predictor EQU 16 +vp8_writer_lowvalue EQU 0 +vp8_writer_range EQU 4 +vp8_writer_value EQU 8 +vp8_writer_count EQU 12 +vp8_writer_pos EQU 16 +vp8_writer_buffer EQU 24 +tokenextra_token EQU 10 +tokenextra_extra EQU 8 +tokenextra_context_tree EQU 0 +tokenextra_skip_eob_node EQU 11 +TOKENEXTRA_SZ EQU 16 +vp8_extra_bit_struct_sz EQU 24 +vp8_token_value EQU 0 +vp8_token_len EQU 4 +vp8_extra_bit_struct_tree EQU 0 +vp8_extra_bit_struct_prob EQU 8 +vp8_extra_bit_struct_len EQU 16 +vp8_extra_bit_struct_base_val EQU 20 +vp8_comp_tplist EQU 183872 +vp8_comp_common EQU 107360 +vp8_comp_bc2 EQU 130872 +tokenlist_start EQU 0 +tokenlist_stop EQU 8 +TOKENLIST_SZ EQU 16 +vp8_common_mb_rows EQU 13204 + END diff --git a/third_party/libvpx/source/config/win/x64/vpx_config.asm b/third_party/libvpx/source/config/win/x64/vpx_config.asm index d5e198aaf..46655b851 100644 --- a/third_party/libvpx/source/config/win/x64/vpx_config.asm +++ b/third_party/libvpx/source/config/win/x64/vpx_config.asm @@ -22,6 +22,7 @@ HAVE_STDINT_H equ 0 HAVE_ALT_TREE_LAYOUT equ 0 HAVE_PTHREAD_H equ 0 HAVE_SYS_MMAN_H equ 0 +HAVE_UNISTD_H equ 0 CONFIG_EXTERNAL_BUILD equ 1 CONFIG_INSTALL_DOCS equ 0 CONFIG_INSTALL_BINS equ 1 @@ -47,7 +48,7 @@ CONFIG_DC_RECON equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_POSTPROC equ 1 CONFIG_MULTITHREAD equ 1 -CONFIG_PSNR equ 0 +CONFIG_INTERNAL_STATS equ 0 CONFIG_VP8_ENCODER equ 1 CONFIG_VP8_DECODER equ 1 CONFIG_VP8 equ 1 @@ -56,7 +57,9 @@ CONFIG_DECODERS equ 1 CONFIG_STATIC_MSVCRT equ 0 CONFIG_SPATIAL_RESAMPLING equ 1 CONFIG_REALTIME_ONLY equ 0 +CONFIG_ERROR_CONCEALMENT equ 1 CONFIG_SHARED equ 0 +CONFIG_STATIC equ 1 CONFIG_SMALL equ 0 CONFIG_POSTPROC_VISUALIZER equ 0 CONFIG_OS_SUPPORT equ 1 diff --git a/third_party/libvpx/source/config/win/x64/vpx_config.c b/third_party/libvpx/source/config/win/x64/vpx_config.c index 36e540777..8003b3115 100644 --- a/third_party/libvpx/source/config/win/x64/vpx_config.c +++ b/third_party/libvpx/source/config/win/x64/vpx_config.c @@ -1,2 +1,2 @@ -static const char* const cfg = "--target=x86_64-win64-vs8 --enable-pic --disable-install-docs --disable-install-srcs --disable-examples --disable-psnr"; +static const char* const cfg = "--target=x86_64-win64-vs9 --enable-pic --enable-error-concealment --disable-install-docs --disable-install-srcs --disable-examples --disable-internal-stats"; const char *vpx_codec_build_config(void) {return cfg;} diff --git a/third_party/libvpx/source/config/win/x64/vpx_config.h b/third_party/libvpx/source/config/win/x64/vpx_config.h index 7186e1265..8437a565e 100644 --- a/third_party/libvpx/source/config/win/x64/vpx_config.h +++ b/third_party/libvpx/source/config/win/x64/vpx_config.h @@ -1,4 +1,6 @@ /* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_CONFIG_H +#define VPX_CONFIG_H #define RESTRICT #define ARCH_ARM 0 #define ARCH_MIPS 0 @@ -24,6 +26,7 @@ #define HAVE_ALT_TREE_LAYOUT 0 #define HAVE_PTHREAD_H 0 #define HAVE_SYS_MMAN_H 0 +#define HAVE_UNISTD_H 0 #define CONFIG_EXTERNAL_BUILD 1 #define CONFIG_INSTALL_DOCS 0 #define CONFIG_INSTALL_BINS 1 @@ -49,7 +52,7 @@ #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_POSTPROC 1 #define CONFIG_MULTITHREAD 1 -#define CONFIG_PSNR 0 +#define CONFIG_INTERNAL_STATS 0 #define CONFIG_VP8_ENCODER 1 #define CONFIG_VP8_DECODER 1 #define CONFIG_VP8 1 @@ -58,7 +61,10 @@ #define CONFIG_STATIC_MSVCRT 0 #define CONFIG_SPATIAL_RESAMPLING 1 #define CONFIG_REALTIME_ONLY 0 +#define CONFIG_ERROR_CONCEALMENT 1 #define CONFIG_SHARED 0 +#define CONFIG_STATIC 1 #define CONFIG_SMALL 0 #define CONFIG_POSTPROC_VISUALIZER 0 #define CONFIG_OS_SUPPORT 1 +#endif /* VPX_CONFIG_H */ diff --git a/third_party/libvpx/source/config/win/x64/vpx_version.h b/third_party/libvpx/source/config/win/x64/vpx_version.h index 1d8ba965d..5eedf6133 100644 --- a/third_party/libvpx/source/config/win/x64/vpx_version.h +++ b/third_party/libvpx/source/config/win/x64/vpx_version.h @@ -1,7 +1,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 9 -#define VERSION_PATCH 6 +#define VERSION_PATCH 7 #define VERSION_EXTRA "" #define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH)) -#define VERSION_STRING_NOSP "v0.9.6" -#define VERSION_STRING " v0.9.6" +#define VERSION_STRING_NOSP "v0.9.7" +#define VERSION_STRING " v0.9.7"