Bug 763495 - Update libvpx source to 1.2.0. r=cpearce,glandium
authorJan Gerber <j@mailb.org>
Fri, 29 Nov 2013 06:02:00 -0800
changeset 167536 f0144998bab05494ca3cb9c4d12a41738488d431
parent 167535 612b104050ce2fe75aca45f1754a7740a6691ddb
child 167537 b906f5c777580f414dfe3cee74dcc07921195e02
push idunknown
push userunknown
push dateunknown
reviewerscpearce, glandium
bugs763495
milestone28.0a1
Bug 763495 - Update libvpx source to 1.2.0. r=cpearce,glandium This updates our in-tree copy of libvpx to match the 1.2.0 git tag. All but one of the patches we were carrying are in this upstream version. Our update.sh script should copy the new files needed but will not remove the old ones for you. Runtime cpu detection was rewritten upstream. We now generate per-platform headers for this and include the correct one from a vpx_rtcd.h wrapper like we were already doing for vpx_config.h This revision includes improved assembly optimizations and should be faster on all platforms. Includes work by Jan Gerber and Ralph Giles.
media/libvpx/I1bad27ea.patch
media/libvpx/I256a37c6.patch
media/libvpx/I3915d597.patch
media/libvpx/I42ab00e3.patch
media/libvpx/I6f2b218d.patch
media/libvpx/I8a35831e.patch
media/libvpx/I9713c9f0.patch
media/libvpx/Makefile.in
media/libvpx/README_MOZILLA
media/libvpx/bug640935.patch
media/libvpx/bug646815.patch
media/libvpx/bug666931.patch
media/libvpx/bug671818.patch
media/libvpx/bug696390.patch
media/libvpx/build/make/ads2gas.pl
media/libvpx/build/make/obj_int_extract.c
media/libvpx/compile_errors.patch
media/libvpx/moz.build
media/libvpx/solaris.patch
media/libvpx/stdint.patch
media/libvpx/textrels.patch
media/libvpx/update.sh
media/libvpx/variance-invoke.patch
media/libvpx/vp8/common/alloccommon.c
media/libvpx/vp8/common/arm/arm_systemdependent.c
media/libvpx/vp8/common/arm/armv6/idct_blk_v6.c
media/libvpx/vp8/common/arm/armv6/intra4x4_predict_v6.asm
media/libvpx/vp8/common/arm/armv6/vp8_mse16x16_armv6.asm
media/libvpx/vp8/common/arm/bilinearfilter_arm.c
media/libvpx/vp8/common/arm/dequantize_arm.c
media/libvpx/vp8/common/arm/dequantize_arm.h
media/libvpx/vp8/common/arm/filter_arm.c
media/libvpx/vp8/common/arm/idct_arm.h
media/libvpx/vp8/common/arm/loopfilter_arm.c
media/libvpx/vp8/common/arm/loopfilter_arm.h
media/libvpx/vp8/common/arm/neon/dc_only_idct_add_neon.asm
media/libvpx/vp8/common/arm/neon/idct_blk_neon.c
media/libvpx/vp8/common/arm/neon/save_neon_reg.asm
media/libvpx/vp8/common/arm/neon/save_reg_neon.asm
media/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm
media/libvpx/vp8/common/arm/neon/vp8_mse16x16_neon.asm
media/libvpx/vp8/common/arm/recon_arm.h
media/libvpx/vp8/common/arm/reconintra_arm.c
media/libvpx/vp8/common/arm/subpixel_arm.h
media/libvpx/vp8/common/arm/variance_arm.c
media/libvpx/vp8/common/arm/variance_arm.h
media/libvpx/vp8/common/asm_com_offsets.c
media/libvpx/vp8/common/blockd.h
media/libvpx/vp8/common/dequantize.c
media/libvpx/vp8/common/dequantize.h
media/libvpx/vp8/common/entropy.c
media/libvpx/vp8/common/entropy.h
media/libvpx/vp8/common/entropymode.c
media/libvpx/vp8/common/entropymode.h
media/libvpx/vp8/common/extend.c
media/libvpx/vp8/common/filter.c
media/libvpx/vp8/common/filter.h
media/libvpx/vp8/common/generic/systemdependent.c
media/libvpx/vp8/common/idct.h
media/libvpx/vp8/common/idct_blk.c
media/libvpx/vp8/common/invtrans.h
media/libvpx/vp8/common/loopfilter.c
media/libvpx/vp8/common/loopfilter.h
media/libvpx/vp8/common/loopfilter_filters.c
media/libvpx/vp8/common/mbpitch.c
media/libvpx/vp8/common/mfqe.c
media/libvpx/vp8/common/modecontext.c
media/libvpx/vp8/common/mv.h
media/libvpx/vp8/common/onyx.h
media/libvpx/vp8/common/onyxc_int.h
media/libvpx/vp8/common/onyxd.h
media/libvpx/vp8/common/postproc.c
media/libvpx/vp8/common/postproc.h
media/libvpx/vp8/common/quant_common.c
media/libvpx/vp8/common/recon.h
media/libvpx/vp8/common/reconinter.c
media/libvpx/vp8/common/reconinter.h
media/libvpx/vp8/common/reconintra.c
media/libvpx/vp8/common/reconintra.h
media/libvpx/vp8/common/reconintra4x4.c
media/libvpx/vp8/common/reconintra4x4.h
media/libvpx/vp8/common/rtcd.c
media/libvpx/vp8/common/sad_c.c
media/libvpx/vp8/common/setupintrarecon.c
media/libvpx/vp8/common/setupintrarecon.h
media/libvpx/vp8/common/subpixel.h
media/libvpx/vp8/common/threading.h
media/libvpx/vp8/common/variance.h
media/libvpx/vp8/common/variance_c.c
media/libvpx/vp8/common/vp8_entropymodedata.h
media/libvpx/vp8/common/x86/dequantize_mmx.asm
media/libvpx/vp8/common/x86/dequantize_x86.h
media/libvpx/vp8/common/x86/idct_blk_mmx.c
media/libvpx/vp8/common/x86/idct_blk_sse2.c
media/libvpx/vp8/common/x86/idct_x86.h
media/libvpx/vp8/common/x86/idctllm_mmx.asm
media/libvpx/vp8/common/x86/idctllm_sse2.asm
media/libvpx/vp8/common/x86/iwalsh_mmx.asm
media/libvpx/vp8/common/x86/iwalsh_sse2.asm
media/libvpx/vp8/common/x86/loopfilter_block_sse2.asm
media/libvpx/vp8/common/x86/loopfilter_mmx.asm
media/libvpx/vp8/common/x86/loopfilter_sse2.asm
media/libvpx/vp8/common/x86/loopfilter_x86.c
media/libvpx/vp8/common/x86/loopfilter_x86.h
media/libvpx/vp8/common/x86/mfqe_sse2.asm
media/libvpx/vp8/common/x86/postproc_mmx.asm
media/libvpx/vp8/common/x86/postproc_sse2.asm
media/libvpx/vp8/common/x86/postproc_x86.c
media/libvpx/vp8/common/x86/postproc_x86.h
media/libvpx/vp8/common/x86/recon_mmx.asm
media/libvpx/vp8/common/x86/recon_sse2.asm
media/libvpx/vp8/common/x86/recon_wrapper_sse2.c
media/libvpx/vp8/common/x86/recon_x86.h
media/libvpx/vp8/common/x86/sad_mmx.asm
media/libvpx/vp8/common/x86/sad_sse2.asm
media/libvpx/vp8/common/x86/sad_sse3.asm
media/libvpx/vp8/common/x86/sad_sse4.asm
media/libvpx/vp8/common/x86/sad_ssse3.asm
media/libvpx/vp8/common/x86/subpixel_mmx.asm
media/libvpx/vp8/common/x86/subpixel_sse2.asm
media/libvpx/vp8/common/x86/subpixel_ssse3.asm
media/libvpx/vp8/common/x86/subpixel_x86.h
media/libvpx/vp8/common/x86/variance_impl_mmx.asm
media/libvpx/vp8/common/x86/variance_impl_sse2.asm
media/libvpx/vp8/common/x86/variance_impl_ssse3.asm
media/libvpx/vp8/common/x86/variance_mmx.c
media/libvpx/vp8/common/x86/variance_sse2.c
media/libvpx/vp8/common/x86/variance_ssse3.c
media/libvpx/vp8/common/x86/variance_x86.h
media/libvpx/vp8/common/x86/vp8_asm_stubs.c
media/libvpx/vp8/common/x86/x86_systemdependent.c
media/libvpx/vp8/decoder/arm/arm_dsystemdependent.c
media/libvpx/vp8/decoder/dboolhuff.h
media/libvpx/vp8/decoder/decodemv.c
media/libvpx/vp8/decoder/decodframe.c
media/libvpx/vp8/decoder/detokenize.c
media/libvpx/vp8/decoder/error_concealment.c
media/libvpx/vp8/decoder/generic/dsystemdependent.c
media/libvpx/vp8/decoder/onyxd_if.c
media/libvpx/vp8/decoder/onyxd_int.h
media/libvpx/vp8/decoder/reconintra_mt.c
media/libvpx/vp8/decoder/reconintra_mt.h
media/libvpx/vp8/decoder/threading.c
media/libvpx/vp8/decoder/x86/x86_dsystemdependent.c
media/libvpx/vp8/encoder/arm/arm_csystemdependent.c
media/libvpx/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm
media/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm
media/libvpx/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
media/libvpx/vp8/encoder/arm/dct_arm.c
media/libvpx/vp8/encoder/arm/dct_arm.h
media/libvpx/vp8/encoder/arm/encodemb_arm.h
media/libvpx/vp8/encoder/arm/neon/picklpf_arm.c
media/libvpx/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
media/libvpx/vp8/encoder/arm/quantize_arm.c
media/libvpx/vp8/encoder/arm/quantize_arm.h
media/libvpx/vp8/encoder/asm_enc_offsets.c
media/libvpx/vp8/encoder/bitstream.c
media/libvpx/vp8/encoder/bitstream.h
media/libvpx/vp8/encoder/block.h
media/libvpx/vp8/encoder/boolhuff.c
media/libvpx/vp8/encoder/boolhuff.h
media/libvpx/vp8/encoder/dct.h
media/libvpx/vp8/encoder/dct_value_cost.h
media/libvpx/vp8/encoder/dct_value_tokens.h
media/libvpx/vp8/encoder/denoising.c
media/libvpx/vp8/encoder/denoising.h
media/libvpx/vp8/encoder/encodeframe.c
media/libvpx/vp8/encoder/encodeframe.h
media/libvpx/vp8/encoder/encodeintra.c
media/libvpx/vp8/encoder/encodeintra.h
media/libvpx/vp8/encoder/encodemb.c
media/libvpx/vp8/encoder/encodemb.h
media/libvpx/vp8/encoder/encodemv.c
media/libvpx/vp8/encoder/ethreading.c
media/libvpx/vp8/encoder/firstpass.c
media/libvpx/vp8/encoder/generic/csystemdependent.c
media/libvpx/vp8/encoder/lookahead.c
media/libvpx/vp8/encoder/lookahead.h
media/libvpx/vp8/encoder/mcomp.c
media/libvpx/vp8/encoder/mcomp.h
media/libvpx/vp8/encoder/modecosts.c
media/libvpx/vp8/encoder/mr_dissim.c
media/libvpx/vp8/encoder/mr_dissim.h
media/libvpx/vp8/encoder/onyx_if.c
media/libvpx/vp8/encoder/onyx_int.h
media/libvpx/vp8/encoder/pickinter.c
media/libvpx/vp8/encoder/pickinter.h
media/libvpx/vp8/encoder/picklpf.c
media/libvpx/vp8/encoder/psnr.c
media/libvpx/vp8/encoder/quantize.c
media/libvpx/vp8/encoder/quantize.h
media/libvpx/vp8/encoder/ratectrl.c
media/libvpx/vp8/encoder/ratectrl.h
media/libvpx/vp8/encoder/rdopt.c
media/libvpx/vp8/encoder/rdopt.h
media/libvpx/vp8/encoder/segmentation.c
media/libvpx/vp8/encoder/temporal_filter.c
media/libvpx/vp8/encoder/temporal_filter.h
media/libvpx/vp8/encoder/tokenize.c
media/libvpx/vp8/encoder/tokenize.h
media/libvpx/vp8/encoder/treewriter.c
media/libvpx/vp8/encoder/treewriter.h
media/libvpx/vp8/encoder/x86/dct_mmx.asm
media/libvpx/vp8/encoder/x86/dct_sse2.asm
media/libvpx/vp8/encoder/x86/dct_x86.h
media/libvpx/vp8/encoder/x86/denoising_sse2.c
media/libvpx/vp8/encoder/x86/encodemb_x86.h
media/libvpx/vp8/encoder/x86/encodeopt.asm
media/libvpx/vp8/encoder/x86/fwalsh_sse2.asm
media/libvpx/vp8/encoder/x86/mcomp_x86.h
media/libvpx/vp8/encoder/x86/quantize_mmx.asm
media/libvpx/vp8/encoder/x86/quantize_sse2.asm
media/libvpx/vp8/encoder/x86/quantize_sse4.asm
media/libvpx/vp8/encoder/x86/quantize_ssse3.asm
media/libvpx/vp8/encoder/x86/quantize_x86.h
media/libvpx/vp8/encoder/x86/ssim_opt.asm
media/libvpx/vp8/encoder/x86/subtract_mmx.asm
media/libvpx/vp8/encoder/x86/subtract_sse2.asm
media/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm
media/libvpx/vp8/encoder/x86/temporal_filter_x86.h
media/libvpx/vp8/encoder/x86/vp8_enc_stubs_mmx.c
media/libvpx/vp8/encoder/x86/vp8_enc_stubs_sse2.c
media/libvpx/vp8/encoder/x86/x86_csystemdependent.c
media/libvpx/vp8/vp8_cx_iface.c
media/libvpx/vp8/vp8_dx_iface.c
media/libvpx/vpx/internal/vpx_codec_internal.h
media/libvpx/vpx/src/vpx_decoder_compat.c
media/libvpx/vpx/src/vpx_encoder.c
media/libvpx/vpx/vp8.h
media/libvpx/vpx/vp8cx.h
media/libvpx/vpx/vp8e.h
media/libvpx/vpx/vpx_codec.h
media/libvpx/vpx/vpx_decoder.h
media/libvpx/vpx/vpx_decoder_compat.h
media/libvpx/vpx/vpx_encoder.h
media/libvpx/vpx/vpx_integer.h.orig
media/libvpx/vpx_config.h
media/libvpx/vpx_config_arm-linux-gcc.c
media/libvpx/vpx_config_arm-linux-gcc.h
media/libvpx/vpx_config_armv7-android-gcc.c
media/libvpx/vpx_config_armv7-android-gcc.h
media/libvpx/vpx_config_generic-gnu.c
media/libvpx/vpx_config_generic-gnu.h
media/libvpx/vpx_config_x86-darwin9-gcc.c
media/libvpx/vpx_config_x86-darwin9-gcc.h
media/libvpx/vpx_config_x86-linux-gcc.c
media/libvpx/vpx_config_x86-linux-gcc.h
media/libvpx/vpx_config_x86-win32-vs8.c
media/libvpx/vpx_config_x86-win32-vs8.h
media/libvpx/vpx_config_x86_64-darwin9-gcc.c
media/libvpx/vpx_config_x86_64-darwin9-gcc.h
media/libvpx/vpx_config_x86_64-linux-gcc.c
media/libvpx/vpx_config_x86_64-linux-gcc.h
media/libvpx/vpx_config_x86_64-win64-vs8.c
media/libvpx/vpx_config_x86_64-win64-vs8.h
media/libvpx/vpx_mem/include/vpx_mem_tracker.h
media/libvpx/vpx_ports/arm_cpudetect.c
media/libvpx/vpx_ports/asm_offsets.h
media/libvpx/vpx_ports/emms.asm
media/libvpx/vpx_ports/mem_ops.h
media/libvpx/vpx_ports/mem_ops_aligned.h
media/libvpx/vpx_ports/vpx_timer.h
media/libvpx/vpx_ports/vpxtypes.h
media/libvpx/vpx_ports/x86.h
media/libvpx/vpx_ports/x86_abi_support.asm
media/libvpx/vpx_ports/x86_cpuid.c
media/libvpx/vpx_rtcd.h
media/libvpx/vpx_rtcd_armv7-android-gcc.h
media/libvpx/vpx_rtcd_generic-gnu.h
media/libvpx/vpx_rtcd_x86-darwin9-gcc.h
media/libvpx/vpx_rtcd_x86-linux-gcc.h
media/libvpx/vpx_rtcd_x86-win32-vs8.h
media/libvpx/vpx_rtcd_x86_64-darwin9-gcc.h
media/libvpx/vpx_rtcd_x86_64-linux-gcc.h
media/libvpx/vpx_rtcd_x86_64-win64-vs8.h
media/libvpx/vpx_scale/arm/arm_scalesystemdependent.c
media/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
media/libvpx/vpx_scale/arm/neon/yv12extend_arm.c
media/libvpx/vpx_scale/arm/yv12extend_arm.h
media/libvpx/vpx_scale/generic/gen_scalers.c
media/libvpx/vpx_scale/generic/scalesystemdependent.c
media/libvpx/vpx_scale/generic/vpxscale.c
media/libvpx/vpx_scale/generic/yv12config.c
media/libvpx/vpx_scale/generic/yv12extend.c
media/libvpx/vpx_scale/include/generic/vpxscale_arbitrary.h
media/libvpx/vpx_scale/include/generic/vpxscale_depricated.h
media/libvpx/vpx_scale/scale_mode.h
media/libvpx/vpx_scale/vpxscale.h
media/libvpx/vpx_scale/yv12config.h
media/libvpx/vpx_scale/yv12extend.h
media/libvpx/vpx_version.h
media/libvpx/xcode4.patch
deleted file mode 100644
--- a/media/libvpx/I1bad27ea.patch
+++ /dev/null
@@ -1,624 +0,0 @@
-# HG changeset patch
-# Parent 5a1a0398f8503451582602525c3e7b35def5d0b9
-# User Timothy B. Terriberry <tterribe@vt.edu>
-Fix variance overflow
-
-Upstream Change-Id: I1bad27ea0720067def6d71a6da5f789508cec265
-
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm b/media/libvpx/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
---- a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
-+++ b/media/libvpx/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
-@@ -139,16 +139,16 @@ loop
-     subs    r12, r12, #1
- 
-     bne     loop
- 
-     ; return stuff
-     ldr     r6, [sp, #40]       ; get address of sse
-     mul     r0, r8, r8          ; sum * sum
-     str     r11, [r6]           ; store sse
--    sub     r0, r11, r0, asr #8 ; return (sse - ((sum * sum) >> 8))
-+    sub     r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
- 
-     ldmfd   sp!, {r4-r12, pc}
- 
-     ENDP
- 
-     END
- 
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm b/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
---- a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
-+++ b/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
-@@ -164,17 +164,17 @@ loop
-     subs    r12, r12, #1
- 
-     bne     loop
- 
-     ; return stuff
-     ldr     r6, [sp, #40]       ; get address of sse
-     mul     r0, r8, r8          ; sum * sum
-     str     r11, [r6]           ; store sse
--    sub     r0, r11, r0, asr #8 ; return (sse - ((sum * sum) >> 8))
-+    sub     r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
- 
-     ldmfd   sp!, {r4-r12, pc}
- 
-     ENDP
- 
- c80808080
-     DCD     0x80808080
- 
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm b/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
---- a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
-+++ b/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
-@@ -205,17 +205,17 @@ loop
-     smlad   r11, r7, r7, r11    ; dual signed multiply, add and accumulate (2)
- 
-     bne     loop
- 
-     ; return stuff
-     ldr     r6, [sp, #40]       ; get address of sse
-     mul     r0, r8, r8          ; sum * sum
-     str     r11, [r6]           ; store sse
--    sub     r0, r11, r0, asr #8 ; return (sse - ((sum * sum) >> 8))
-+    sub     r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
- 
-     ldmfd   sp!, {r4-r12, pc}
- 
-     ENDP
- 
- c80808080
-     DCD     0x80808080
- 
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm b/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
---- a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
-+++ b/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
-@@ -166,17 +166,17 @@ loop
-     subs    r12, r12, #1
- 
-     bne     loop
- 
-     ; return stuff
-     ldr     r6, [sp, #40]       ; get address of sse
-     mul     r0, r8, r8          ; sum * sum
-     str     r11, [r6]           ; store sse
--    sub     r0, r11, r0, asr #8 ; return (sse - ((sum * sum) >> 8))
-+    sub     r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
- 
-     ldmfd   sp!, {r4-r12, pc}
- 
-     ENDP
- 
- c80808080
-     DCD     0x80808080
- 
-diff --git a/media/libvpx/vp8/encoder/arm/neon/variance_neon.asm b/media/libvpx/vp8/encoder/arm/neon/variance_neon.asm
---- a/media/libvpx/vp8/encoder/arm/neon/variance_neon.asm
-+++ b/media/libvpx/vp8/encoder/arm/neon/variance_neon.asm
-@@ -72,24 +72,24 @@ variance16x16_neon_loop
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     ;vmov.32        r0, d0[0]                   ;this instruction costs a lot
-     ;vmov.32        r1, d1[0]
-     ;mul            r0, r0, r0
-     ;str            r1, [r12]
--    ;sub            r0, r1, r0, asr #8
-+    ;sub            r0, r1, r0, lsr #8
- 
--    ;sum is in [-255x256, 255x256]. sumxsum is 32-bit. Shift to right should
--    ;have sign-bit exension, which is vshr.s. Have to use s32 to make it right.
-+    ; while sum is signed, sum * sum is always positive and must be treated as
-+    ; unsigned to avoid propagating the sign bit.
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [r12]              ;store sse
--    vshr.s32        d10, d10, #8
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #8
-+    vsub.u32        d0, d1, d10
- 
-     vmov.32         r0, d0[0]                   ;return
-     bx              lr
- 
-     ENDP
- 
- ;================================
- ;unsigned int vp8_variance16x8_c(
-@@ -140,18 +140,18 @@ variance16x8_neon_loop
-     ldr             r12, [sp]                   ;load *sse from stack
- 
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [r12]              ;store sse
--    vshr.s32        d10, d10, #7
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #7
-+    vsub.u32        d0, d1, d10
- 
-     vmov.32         r0, d0[0]                   ;return
-     bx              lr
- 
-     ENDP
- 
- ;=================================
- ;unsigned int vp8_variance8x16_c(
-@@ -195,18 +195,18 @@ variance8x16_neon_loop
-     ldr             r12, [sp]                   ;load *sse from stack
- 
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [r12]              ;store sse
--    vshr.s32        d10, d10, #7
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #7
-+    vsub.u32        d0, d1, d10
- 
-     vmov.32         r0, d0[0]                   ;return
-     bx              lr
- 
-     ENDP
- 
- ;==================================
- ; r0    unsigned char *src_ptr
-@@ -260,17 +260,17 @@ variance8x8_neon_loop
-     ldr             r12, [sp]                   ;load *sse from stack
- 
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [r12]              ;store sse
--    vshr.s32        d10, d10, #6
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #6
-+    vsub.u32        d0, d1, d10
- 
-     vmov.32         r0, d0[0]                   ;return
-     bx              lr
- 
-     ENDP
- 
-     END
-diff --git a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm b/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
---- a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
-+++ b/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
-@@ -400,18 +400,18 @@ sub_pixel_variance16x16_neon_loop
-     vpaddl.s32      q0, q8                      ;accumulate sum
- 
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [r6]               ;store sse
--    vshr.s32        d10, d10, #8
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #8
-+    vsub.u32        d0, d1, d10
- 
-     add             sp, sp, #528
-     vmov.32         r0, d0[0]                   ;return
- 
-     pop             {r4-r6,pc}
- 
-     ENDP
- 
-diff --git a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm b/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
---- a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-+++ b/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-@@ -107,18 +107,18 @@ vp8_filt_fpo16x16s_4_0_loop_neon
-     vpaddl.s32      q0, q8                      ;accumulate sum
- 
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [lr]               ;store sse
--    vshr.s32        d10, d10, #8
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #8
-+    vsub.u32        d0, d1, d10
- 
-     vmov.32         r0, d0[0]                   ;return
-     pop             {pc}
-     ENDP
- 
- ;================================================
- ;unsigned int vp8_variance_halfpixvar16x16_v_neon
- ;(
-@@ -203,18 +203,18 @@ vp8_filt_spo16x16s_0_4_loop_neon
-     vpaddl.s32      q0, q8                      ;accumulate sum
- 
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [lr]               ;store sse
--    vshr.s32        d10, d10, #8
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #8
-+    vsub.u32        d0, d1, d10
- 
-     vmov.32         r0, d0[0]                   ;return
-     pop             {pc}
-     ENDP
- 
- ;================================================
- ;unsigned int vp8_variance_halfpixvar16x16_hv_neon
- ;(
-@@ -322,18 +322,18 @@ vp8_filt16x16s_4_4_loop_neon
-     vpaddl.s32      q0, q13                      ;accumulate sum
- 
-     vpaddl.u32      q1, q15
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [lr]               ;store sse
--    vshr.s32        d10, d10, #8
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #8
-+    vsub.u32        d0, d1, d10
- 
-     vmov.32         r0, d0[0]                   ;return
-     pop             {pc}
-     ENDP
- 
- ;==============================
- ; r0    unsigned char  *src_ptr,
- ; r1    int  src_pixels_per_line,
-@@ -555,18 +555,18 @@ sub_pixel_variance16x16s_neon_loop
-     vpaddl.s32      q0, q8                      ;accumulate sum
- 
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [lr]               ;store sse
--    vshr.s32        d10, d10, #8
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #8
-+    vsub.u32        d0, d1, d10
- 
-     add             sp, sp, #256
-     vmov.32         r0, d0[0]                   ;return
- 
-     pop             {r4, pc}
-     ENDP
- 
-     END
-diff --git a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm b/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
---- a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
-+++ b/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
-@@ -201,18 +201,18 @@ sub_pixel_variance8x8_neon_loop
-     vpaddl.s32      q0, q8                      ;accumulate sum
- 
-     vpaddl.u32      q1, q10
-     vadd.s64        d0, d0, d1
-     vadd.u64        d1, d2, d3
- 
-     vmull.s32       q5, d0, d0
-     vst1.32         {d1[0]}, [lr]               ;store sse
--    vshr.s32        d10, d10, #6
--    vsub.s32        d0, d1, d10
-+    vshr.u32        d10, d10, #6
-+    vsub.u32        d0, d1, d10
- 
-     vmov.32         r0, d0[0]                   ;return
-     pop             {r4-r5, pc}
- 
-     ENDP
- 
- ;-----------------
- 
-diff --git a/media/libvpx/vp8/encoder/variance_c.c b/media/libvpx/vp8/encoder/variance_c.c
---- a/media/libvpx/vp8/encoder/variance_c.c
-+++ b/media/libvpx/vp8/encoder/variance_c.c
-@@ -70,82 +70,82 @@ unsigned int vp8_variance16x16_c(
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
- 
-     variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg);
-     *sse = var;
--    return (var - ((avg * avg) >> 8));
-+    return (var - ((unsigned int)(avg * avg) >> 8));
- }
- 
- unsigned int vp8_variance8x16_c(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
- 
-     variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16, &var, &avg);
-     *sse = var;
--    return (var - ((avg * avg) >> 7));
-+    return (var - ((unsigned int)(avg * avg) >> 7));
- }
- 
- unsigned int vp8_variance16x8_c(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
- 
-     variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var, &avg);
-     *sse = var;
--    return (var - ((avg * avg) >> 7));
-+    return (var - ((unsigned int)(avg * avg) >> 7));
- }
- 
- 
- unsigned int vp8_variance8x8_c(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
- 
-     variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg);
-     *sse = var;
--    return (var - ((avg * avg) >> 6));
-+    return (var - ((unsigned int)(avg * avg) >> 6));
- }
- 
- unsigned int vp8_variance4x4_c(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
- 
-     variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 4, &var, &avg);
-     *sse = var;
--    return (var - ((avg * avg) >> 4));
-+    return (var - ((unsigned int)(avg * avg) >> 4));
- }
- 
- 
- unsigned int vp8_mse16x16_c(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-diff --git a/media/libvpx/vp8/encoder/x86/variance_mmx.c b/media/libvpx/vp8/encoder/x86/variance_mmx.c
---- a/media/libvpx/vp8/encoder/x86/variance_mmx.c
-+++ b/media/libvpx/vp8/encoder/x86/variance_mmx.c
-@@ -86,34 +86,34 @@ unsigned int vp8_variance4x4_mmx(
-     int  recon_stride,
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
-     vp8_get4x4var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg) ;
-     *sse = var;
--    return (var - ((avg * avg) >> 4));
-+    return (var - ((unsigned int)(avg * avg) >> 4));
- 
- }
- 
- unsigned int vp8_variance8x8_mmx(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
-     vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg) ;
-     *sse = var;
- 
--    return (var - ((avg * avg) >> 6));
-+    return (var - ((unsigned int)(avg * avg) >> 6));
- 
- }
- 
- unsigned int vp8_mse16x16_mmx(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-@@ -148,17 +148,17 @@ unsigned int vp8_variance16x16_mmx(
-     vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
-     vp8_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1, &sum1);
-     vp8_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * recon_stride, recon_stride, &sse2, &sum2) ;
-     vp8_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride, ref_ptr + 8 * recon_stride + 8, recon_stride, &sse3, &sum3);
- 
-     var = sse0 + sse1 + sse2 + sse3;
-     avg = sum0 + sum1 + sum2 + sum3;
-     *sse = var;
--    return (var - ((avg * avg) >> 8));
-+    return (var - ((unsigned int)(avg * avg) >> 8));
- }
- 
- unsigned int vp8_variance16x8_mmx(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-     unsigned int *sse)
-@@ -167,17 +167,17 @@ unsigned int vp8_variance16x8_mmx(
-     int sum0, sum1, avg;
- 
-     vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
-     vp8_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1, &sum1);
- 
-     var = sse0 + sse1;
-     avg = sum0 + sum1;
-     *sse = var;
--    return (var - ((avg * avg) >> 7));
-+    return (var - ((unsigned int)(avg * avg) >> 7));
- 
- }
- 
- 
- unsigned int vp8_variance8x16_mmx(
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-@@ -189,17 +189,17 @@ unsigned int vp8_variance8x16_mmx(
- 
-     vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
-     vp8_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * recon_stride, recon_stride, &sse1, &sum1) ;
- 
-     var = sse0 + sse1;
-     avg = sum0 + sum1;
-     *sse = var;
- 
--    return (var - ((avg * avg) >> 7));
-+    return (var - ((unsigned int)(avg * avg) >> 7));
- 
- }
- 
- 
- unsigned int vp8_sub_pixel_variance4x4_mmx
- (
-     const unsigned char  *src_ptr,
-     int  src_pixels_per_line,
-diff --git a/media/libvpx/vp8/encoder/x86/variance_sse2.c b/media/libvpx/vp8/encoder/x86/variance_sse2.c
---- a/media/libvpx/vp8/encoder/x86/variance_sse2.c
-+++ b/media/libvpx/vp8/encoder/x86/variance_sse2.c
-@@ -143,34 +143,34 @@ unsigned int vp8_variance4x4_wmt(
-     int  recon_stride,
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
-     vp8_get4x4var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg) ;
-     *sse = var;
--    return (var - ((avg * avg) >> 4));
-+    return (var - ((unsigned int)(avg * avg) >> 4));
- 
- }
- 
- unsigned int vp8_variance8x8_wmt
- (
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-     int  recon_stride,
-     unsigned int *sse)
- {
-     unsigned int var;
-     int avg;
- 
-     vp8_get8x8var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg) ;
-     *sse = var;
--    return (var - ((avg * avg) >> 6));
-+    return (var - ((unsigned int)(avg * avg) >> 6));
- 
- }
- 
- 
- unsigned int vp8_variance16x16_wmt
- (
-     const unsigned char *src_ptr,
-     int  source_stride,
-@@ -215,17 +215,17 @@ unsigned int vp8_variance16x8_wmt
-     int sum0, sum1, avg;
- 
-     vp8_get8x8var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
-     vp8_get8x8var_sse2(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1, &sum1);
- 
-     var = sse0 + sse1;
-     avg = sum0 + sum1;
-     *sse = var;
--    return (var - ((avg * avg) >> 7));
-+    return (var - ((unsigned int)(avg * avg) >> 7));
- 
- }
- 
- unsigned int vp8_variance8x16_wmt
- (
-     const unsigned char *src_ptr,
-     int  source_stride,
-     const unsigned char *ref_ptr,
-@@ -236,17 +236,17 @@ unsigned int vp8_variance8x16_wmt
-     int sum0, sum1, avg;
- 
-     vp8_get8x8var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
-     vp8_get8x8var_sse2(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * recon_stride, recon_stride, &sse1, &sum1) ;
- 
-     var = sse0 + sse1;
-     avg = sum0 + sum1;
-     *sse = var;
--    return (var - ((avg * avg) >> 7));
-+    return (var - ((unsigned int)(avg * avg) >> 7));
- 
- }
- 
- unsigned int vp8_sub_pixel_variance4x4_wmt
- (
-     const unsigned char  *src_ptr,
-     int  src_pixels_per_line,
-     int  xoffset,
-diff --git a/media/libvpx/vp8/encoder/x86/variance_ssse3.c b/media/libvpx/vp8/encoder/x86/variance_ssse3.c
---- a/media/libvpx/vp8/encoder/x86/variance_ssse3.c
-+++ b/media/libvpx/vp8/encoder/x86/variance_ssse3.c
-@@ -107,17 +107,17 @@ unsigned int vp8_sub_pixel_variance16x16
-         vp8_filter_block2d_bil_var_ssse3(
-             src_ptr, src_pixels_per_line,
-             dst_ptr, dst_pixels_per_line, 16,
-             xoffset, yoffset,
-             &xsum0, &xxsum0);
-     }
- 
-     *sse = xxsum0;
--    return (xxsum0 - ((xsum0 * xsum0) >> 8));
-+    return (xxsum0 - ((unsigned int)(xsum0 * xsum0) >> 8));
- }
- 
- unsigned int vp8_sub_pixel_variance16x8_ssse3
- (
-     const unsigned char  *src_ptr,
-     int  src_pixels_per_line,
-     int  xoffset,
-     int  yoffset,
-@@ -156,10 +156,10 @@ unsigned int vp8_sub_pixel_variance16x8_
-         vp8_filter_block2d_bil_var_ssse3(
-             src_ptr, src_pixels_per_line,
-             dst_ptr, dst_pixels_per_line, 8,
-             xoffset, yoffset,
-             &xsum0, &xxsum0);
-     }
- 
-     *sse = xxsum0;
--    return (xxsum0 - ((xsum0 * xsum0) >> 7));
-+    return (xxsum0 - ((unsigned int)(xsum0 * xsum0) >> 7));
- }
deleted file mode 100644
--- a/media/libvpx/I256a37c6.patch
+++ /dev/null
@@ -1,1932 +0,0 @@
-# HG changeset patch
-# Parent 677ab41568f1a8427e3e43a6ce9b0d7c822b1f7e
-# User Timothy B. Terriberry <tterribe@vt.edu>
-Move SAD and variance functions to common
-
-Upstream Change-Id: I256a37c6de079fe92ce744b1f11e16526d06b50a
-
-This patch contains substantial differences compared to the upstream
-one, as it still uses the old RTCD framework and does not include
-the extra short-circuiting work done in upstream change
-I05ce5b2d34e6d45fb3ec2a450aa99c4f3343bf3a.
-
-diff --git a/media/libvpx/vp8/common/arm/arm_systemdependent.c b/media/libvpx/vp8/common/arm/arm_systemdependent.c
---- a/media/libvpx/vp8/common/arm/arm_systemdependent.c
-+++ b/media/libvpx/vp8/common/arm/arm_systemdependent.c
-@@ -11,16 +11,17 @@
- 
- #include "vpx_config.h"
- #include "vpx_ports/arm.h"
- #include "vp8/common/pragmas.h"
- #include "vp8/common/subpixel.h"
- #include "vp8/common/loopfilter.h"
- #include "vp8/common/recon.h"
- #include "vp8/common/idct.h"
-+#include "vp8/common/variance.h"
- #include "vp8/common/onyxc_int.h"
- 
- void vp8_arch_arm_common_init(VP8_COMMON *ctx)
- {
- #if CONFIG_RUNTIME_CPU_DETECT
-     VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
-     int flags = arm_cpu_caps();
-     rtcd->flags = flags;
-@@ -63,16 +64,41 @@ void vp8_arch_arm_common_init(VP8_COMMON
-         rtcd->recon.copy8x4     = vp8_copy_mem8x4_v6;
-         rtcd->recon.intra4x4_predict = vp8_intra4x4_predict_armv6;
- 
-         rtcd->dequant.block               = vp8_dequantize_b_v6;
-         rtcd->dequant.idct_add            = vp8_dequant_idct_add_v6;
-         rtcd->dequant.idct_add_y_block    = vp8_dequant_idct_add_y_block_v6;
-         rtcd->dequant.idct_add_uv_block   = vp8_dequant_idct_add_uv_block_v6;
- 
-+        rtcd->variance.sad16x16              = vp8_sad16x16_armv6;
-+        /*rtcd->variance.sad16x8               = vp8_sad16x8_c;
-+        rtcd->variance.sad8x16               = vp8_sad8x16_c;
-+        rtcd->variance.sad8x8                = vp8_sad8x8_c;
-+        rtcd->variance.sad4x4                = vp8_sad4x4_c;*/
-+
-+        /*rtcd->variance.var4x4                = vp8_variance4x4_c;*/
-+        rtcd->variance.var8x8                = vp8_variance8x8_armv6;
-+        /*rtcd->variance.var8x16               = vp8_variance8x16_c;
-+        rtcd->variance.var16x8               = vp8_variance16x8_c;*/
-+        rtcd->variance.var16x16              = vp8_variance16x16_armv6;
-+
-+        /*rtcd->variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_c;*/
-+        rtcd->variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_armv6;
-+        /*rtcd->variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_c;
-+        rtcd->variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_c;*/
-+        rtcd->variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_armv6;
-+        rtcd->variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_armv6;
-+        rtcd->variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_armv6;
-+        rtcd->variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_armv6;
-+
-+        rtcd->variance.mse16x16              = vp8_mse16x16_armv6;
-+        /*rtcd->variance.getmbss               = vp8_get_mb_ss_c;*/
-+
-+        /*rtcd->variance.get4x4sse_cs          = vp8_get4x4sse_cs_c;*/
-     }
- #endif
- 
- #if HAVE_ARMV7
-     if (flags & HAS_NEON)
-     {
-         rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_neon;
-         rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_neon;
-@@ -103,13 +129,38 @@ void vp8_arch_arm_common_init(VP8_COMMON
-         rtcd->recon.build_intra_predictors_mby_s =
-             vp8_build_intra_predictors_mby_s_neon;
- 
-         rtcd->dequant.block               = vp8_dequantize_b_neon;
-         rtcd->dequant.idct_add            = vp8_dequant_idct_add_neon;
-         rtcd->dequant.idct_add_y_block    = vp8_dequant_idct_add_y_block_neon;
-         rtcd->dequant.idct_add_uv_block   = vp8_dequant_idct_add_uv_block_neon;
- 
-+        rtcd->variance.sad16x16              = vp8_sad16x16_neon;
-+        rtcd->variance.sad16x8               = vp8_sad16x8_neon;
-+        rtcd->variance.sad8x16               = vp8_sad8x16_neon;
-+        rtcd->variance.sad8x8                = vp8_sad8x8_neon;
-+        rtcd->variance.sad4x4                = vp8_sad4x4_neon;
-+
-+        /*rtcd->variance.var4x4                = vp8_variance4x4_c;*/
-+        rtcd->variance.var8x8                = vp8_variance8x8_neon;
-+        rtcd->variance.var8x16               = vp8_variance8x16_neon;
-+        rtcd->variance.var16x8               = vp8_variance16x8_neon;
-+        rtcd->variance.var16x16              = vp8_variance16x16_neon;
-+
-+        /*rtcd->variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_c;*/
-+        rtcd->variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_neon;
-+        /*rtcd->variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_c;
-+        rtcd->variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_c;*/
-+        rtcd->variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_neon;
-+        rtcd->variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_neon;
-+        rtcd->variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_neon;
-+        rtcd->variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_neon;
-+
-+        rtcd->variance.mse16x16              = vp8_mse16x16_neon;
-+        /*rtcd->variance.getmbss               = vp8_get_mb_ss_c;*/
-+
-+        rtcd->variance.get4x4sse_cs          = vp8_get4x4sse_cs_neon;
-     }
- #endif
- 
- #endif
- }
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm b/media/libvpx/vp8/common/arm/armv6/vp8_mse16x16_armv6.asm
-rename from media/libvpx/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
-rename to media/libvpx/vp8/common/arm/armv6/vp8_mse16x16_armv6.asm
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_sad16x16_armv6.asm b/media/libvpx/vp8/common/arm/armv6/vp8_sad16x16_armv6.asm
-rename from media/libvpx/vp8/encoder/arm/armv6/vp8_sad16x16_armv6.asm
-rename to media/libvpx/vp8/common/arm/armv6/vp8_sad16x16_armv6.asm
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm b/media/libvpx/vp8/common/arm/armv6/vp8_variance16x16_armv6.asm
-rename from media/libvpx/vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
-rename to media/libvpx/vp8/common/arm/armv6/vp8_variance16x16_armv6.asm
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm b/media/libvpx/vp8/common/arm/armv6/vp8_variance8x8_armv6.asm
-rename from media/libvpx/vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm
-rename to media/libvpx/vp8/common/arm/armv6/vp8_variance8x8_armv6.asm
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm b/media/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
-rename from media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
-rename to media/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm b/media/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
-rename from media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
-rename to media/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
-diff --git a/media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm b/media/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
-rename from media/libvpx/vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
-rename to media/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
-diff --git a/media/libvpx/vp8/encoder/arm/neon/sad16_neon.asm b/media/libvpx/vp8/common/arm/neon/sad16_neon.asm
-rename from media/libvpx/vp8/encoder/arm/neon/sad16_neon.asm
-rename to media/libvpx/vp8/common/arm/neon/sad16_neon.asm
-diff --git a/media/libvpx/vp8/encoder/arm/neon/sad8_neon.asm b/media/libvpx/vp8/common/arm/neon/sad8_neon.asm
-rename from media/libvpx/vp8/encoder/arm/neon/sad8_neon.asm
-rename to media/libvpx/vp8/common/arm/neon/sad8_neon.asm
-diff --git a/media/libvpx/vp8/encoder/arm/neon/variance_neon.asm b/media/libvpx/vp8/common/arm/neon/variance_neon.asm
-rename from media/libvpx/vp8/encoder/arm/neon/variance_neon.asm
-rename to media/libvpx/vp8/common/arm/neon/variance_neon.asm
-diff --git a/media/libvpx/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm b/media/libvpx/vp8/common/arm/neon/vp8_mse16x16_neon.asm
-rename from media/libvpx/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
-rename to media/libvpx/vp8/common/arm/neon/vp8_mse16x16_neon.asm
-diff --git a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm b/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm
-rename from media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
-rename to media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm
-diff --git a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm b/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-rename from media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-rename to media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-diff --git a/media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm b/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm
-rename from media/libvpx/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
-rename to media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm
-diff --git a/media/libvpx/vp8/encoder/arm/variance_arm.c b/media/libvpx/vp8/common/arm/variance_arm.c
-rename from media/libvpx/vp8/encoder/arm/variance_arm.c
-rename to media/libvpx/vp8/common/arm/variance_arm.c
---- a/media/libvpx/vp8/encoder/arm/variance_arm.c
-+++ b/media/libvpx/vp8/common/arm/variance_arm.c
-@@ -4,17 +4,17 @@
-  *  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 "vpx_config.h"
--#include "vp8/encoder/variance.h"
-+#include "vp8/common/variance.h"
- #include "vp8/common/filter.h"
- 
- #if HAVE_ARMV6
- #include "vp8/common/arm/bilinearfilter_arm.h"
- 
- unsigned int vp8_sub_pixel_variance8x8_armv6
- (
-     const unsigned char  *src_ptr,
-diff --git a/media/libvpx/vp8/encoder/arm/variance_arm.h b/media/libvpx/vp8/common/arm/variance_arm.h
-rename from media/libvpx/vp8/encoder/arm/variance_arm.h
-rename to media/libvpx/vp8/common/arm/variance_arm.h
-diff --git a/media/libvpx/vp8/common/generic/systemdependent.c b/media/libvpx/vp8/common/generic/systemdependent.c
---- a/media/libvpx/vp8/common/generic/systemdependent.c
-+++ b/media/libvpx/vp8/common/generic/systemdependent.c
-@@ -9,16 +9,17 @@
-  */
- 
- 
- #include "vpx_config.h"
- #include "vp8/common/subpixel.h"
- #include "vp8/common/loopfilter.h"
- #include "vp8/common/recon.h"
- #include "vp8/common/idct.h"
-+#include "vp8/common/variance.h"
- #include "vp8/common/onyxc_int.h"
- 
- #if CONFIG_MULTITHREAD
- #if HAVE_UNISTD_H
- #include <unistd.h>
- #elif defined(_WIN32)
- #include <windows.h>
- typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
-@@ -110,16 +111,67 @@ void vp8_machine_specific_config(VP8_COM
-     rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_c;
-     rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_c;
-     rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_c;
-     rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_c;
-     rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_c;
-     rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_c;
-     rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_c;
- 
-+    rtcd->variance.sad16x16              = vp8_sad16x16_c;
-+    rtcd->variance.sad16x8               = vp8_sad16x8_c;
-+    rtcd->variance.sad8x16               = vp8_sad8x16_c;
-+    rtcd->variance.sad8x8                = vp8_sad8x8_c;
-+    rtcd->variance.sad4x4                = vp8_sad4x4_c;
-+
-+    rtcd->variance.sad16x16x3            = vp8_sad16x16x3_c;
-+    rtcd->variance.sad16x8x3             = vp8_sad16x8x3_c;
-+    rtcd->variance.sad8x16x3             = vp8_sad8x16x3_c;
-+    rtcd->variance.sad8x8x3              = vp8_sad8x8x3_c;
-+    rtcd->variance.sad4x4x3              = vp8_sad4x4x3_c;
-+
-+    rtcd->variance.sad16x16x8            = vp8_sad16x16x8_c;
-+    rtcd->variance.sad16x8x8             = vp8_sad16x8x8_c;
-+    rtcd->variance.sad8x16x8             = vp8_sad8x16x8_c;
-+    rtcd->variance.sad8x8x8              = vp8_sad8x8x8_c;
-+    rtcd->variance.sad4x4x8              = vp8_sad4x4x8_c;
-+
-+    rtcd->variance.sad16x16x4d           = vp8_sad16x16x4d_c;
-+    rtcd->variance.sad16x8x4d            = vp8_sad16x8x4d_c;
-+    rtcd->variance.sad8x16x4d            = vp8_sad8x16x4d_c;
-+    rtcd->variance.sad8x8x4d             = vp8_sad8x8x4d_c;
-+    rtcd->variance.sad4x4x4d             = vp8_sad4x4x4d_c;
-+#if ARCH_X86 || ARCH_X86_64
-+    rtcd->variance.copy32xn              = vp8_copy32xn_c;
-+#endif
-+    rtcd->variance.var4x4                = vp8_variance4x4_c;
-+    rtcd->variance.var8x8                = vp8_variance8x8_c;
-+    rtcd->variance.var8x16               = vp8_variance8x16_c;
-+    rtcd->variance.var16x8               = vp8_variance16x8_c;
-+    rtcd->variance.var16x16              = vp8_variance16x16_c;
-+
-+    rtcd->variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_c;
-+    rtcd->variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_c;
-+    rtcd->variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_c;
-+    rtcd->variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_c;
-+    rtcd->variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_c;
-+    rtcd->variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_c;
-+    rtcd->variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_c;
-+    rtcd->variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_c;
-+    rtcd->variance.subpixmse16x16        = vp8_sub_pixel_mse16x16_c;
-+
-+    rtcd->variance.mse16x16              = vp8_mse16x16_c;
-+    rtcd->variance.getmbss               = vp8_get_mb_ss_c;
-+
-+    rtcd->variance.get4x4sse_cs          = vp8_get4x4sse_cs_c;
-+#if CONFIG_INTERNAL_STATS
-+    rtcd->variance.ssimpf_8x8            = vp8_ssim_parms_8x8_c;
-+    rtcd->variance.ssimpf_16x16          = vp8_ssim_parms_16x16_c;
-+#endif
-+
- #if CONFIG_POSTPROC || (CONFIG_VP8_ENCODER && CONFIG_INTERNAL_STATS)
-     rtcd->postproc.down             = vp8_mbpost_proc_down_c;
-     rtcd->postproc.across           = vp8_mbpost_proc_across_ip_c;
-     rtcd->postproc.downacross       = vp8_post_proc_down_and_across_c;
-     rtcd->postproc.addnoise         = vp8_plane_add_noise_c;
-     rtcd->postproc.blend_mb_inner   = vp8_blend_mb_inner_c;
-     rtcd->postproc.blend_mb_outer   = vp8_blend_mb_outer_c;
-     rtcd->postproc.blend_b          = vp8_blend_b_c;
-diff --git a/media/libvpx/vp8/common/onyxc_int.h b/media/libvpx/vp8/common/onyxc_int.h
---- a/media/libvpx/vp8/common/onyxc_int.h
-+++ b/media/libvpx/vp8/common/onyxc_int.h
-@@ -14,16 +14,17 @@
- 
- #include "vpx_config.h"
- #include "vpx/internal/vpx_codec_internal.h"
- #include "loopfilter.h"
- #include "entropymv.h"
- #include "entropy.h"
- #include "idct.h"
- #include "recon.h"
-+#include "variance.h"
- #if CONFIG_POSTPROC
- #include "postproc.h"
- #endif
- #include "dequantize.h"
- 
- /*#ifdef PACKET_TESTING*/
- #include "header.h"
- /*#endif*/
-@@ -74,16 +75,17 @@ typedef enum
- typedef struct VP8_COMMON_RTCD
- {
- #if CONFIG_RUNTIME_CPU_DETECT
-     vp8_dequant_rtcd_vtable_t        dequant;
-     vp8_idct_rtcd_vtable_t        idct;
-     vp8_recon_rtcd_vtable_t       recon;
-     vp8_subpix_rtcd_vtable_t      subpix;
-     vp8_loopfilter_rtcd_vtable_t  loopfilter;
-+    vp8_variance_rtcd_vtable_t    variance;
- #if CONFIG_POSTPROC
-     vp8_postproc_rtcd_vtable_t    postproc;
- #endif
-     int                           flags;
- #else
-     int unused;
- #endif
- } VP8_COMMON_RTCD;
-diff --git a/media/libvpx/vp8/common/postproc.c b/media/libvpx/vp8/common/postproc.c
---- a/media/libvpx/vp8/common/postproc.c
-+++ b/media/libvpx/vp8/common/postproc.c
-@@ -12,17 +12,17 @@
- #include "vpx_config.h"
- #include "vpx_scale/yv12config.h"
- #include "postproc.h"
- #include "common.h"
- #include "recon.h"
- #include "vpx_scale/yv12extend.h"
- #include "vpx_scale/vpxscale.h"
- #include "systemdependent.h"
--#include "../encoder/variance.h"
-+#include "variance.h"
- 
- #include <math.h>
- #include <stdlib.h>
- #include <stdio.h>
- 
- #define RGB_TO_YUV(t)                                                                       \
-     ( (0.257*(float)(t>>16)) + (0.504*(float)(t>>8&0xff)) + (0.098*(float)(t&0xff)) + 16),  \
-     (-(0.148*(float)(t>>16)) - (0.291*(float)(t>>8&0xff)) + (0.439*(float)(t&0xff)) + 128), \
-diff --git a/media/libvpx/vp8/encoder/sad_c.c b/media/libvpx/vp8/common/sad_c.c
-rename from media/libvpx/vp8/encoder/sad_c.c
-rename to media/libvpx/vp8/common/sad_c.c
-diff --git a/media/libvpx/vp8/encoder/variance.h b/media/libvpx/vp8/common/variance.h
-rename from media/libvpx/vp8/encoder/variance.h
-rename to media/libvpx/vp8/common/variance.h
---- a/media/libvpx/vp8/encoder/variance.h
-+++ b/media/libvpx/vp8/common/variance.h
-@@ -78,31 +78,31 @@
-     ( \
-       const unsigned char  *src_ptr, \
-       int  source_stride, \
-       int  xoffset, \
-       int  yoffset, \
-       const unsigned char *ref_ptr, \
-       int Refstride, \
-       unsigned int *sse \
--    );
-+    )
- 
- #define prototype_ssimpf(sym) \
-     void (sym) \
-       ( \
-         unsigned char *s, \
-         int sp, \
-         unsigned char *r, \
-         int rp, \
-         unsigned long *sum_s, \
-         unsigned long *sum_r, \
-         unsigned long *sum_sq_s, \
-         unsigned long *sum_sq_r, \
-         unsigned long *sum_sxr \
--      );
-+      )
- 
- #define prototype_getmbss(sym) unsigned int (sym)(const short *)
- 
- #define prototype_get16x16prederror(sym)\
-     unsigned int (sym)\
-     (\
-      const unsigned char *src_ptr, \
-      int source_stride, \
-@@ -318,22 +318,22 @@ extern prototype_variance(vp8_variance_m
- #ifndef vp8_variance_get4x4sse_cs
- #define vp8_variance_get4x4sse_cs vp8_get4x4sse_cs_c
- #endif
- extern prototype_get16x16prederror(vp8_variance_get4x4sse_cs);
- 
- #ifndef vp8_ssimpf_8x8
- #define vp8_ssimpf_8x8 vp8_ssim_parms_8x8_c
- #endif
--extern prototype_ssimpf(vp8_ssimpf_8x8)
-+extern prototype_ssimpf(vp8_ssimpf_8x8);
- 
- #ifndef vp8_ssimpf_16x16
- #define vp8_ssimpf_16x16 vp8_ssim_parms_16x16_c
- #endif
--extern prototype_ssimpf(vp8_ssimpf_16x16)
-+extern prototype_ssimpf(vp8_ssimpf_16x16);
- 
- typedef prototype_sad(*vp8_sad_fn_t);
- typedef prototype_sad_multi_same_address(*vp8_sad_multi_fn_t);
- typedef prototype_sad_multi_same_address_1(*vp8_sad_multi1_fn_t);
- typedef prototype_sad_multi_dif_address(*vp8_sad_multi_d_fn_t);
- typedef prototype_variance(*vp8_variance_fn_t);
- typedef prototype_variance2(*vp8_variance2_fn_t);
- typedef prototype_subpixvariance(*vp8_subpixvariance_fn_t);
-diff --git a/media/libvpx/vp8/encoder/variance_c.c b/media/libvpx/vp8/common/variance_c.c
-rename from media/libvpx/vp8/encoder/variance_c.c
-rename to media/libvpx/vp8/common/variance_c.c
---- a/media/libvpx/vp8/encoder/variance_c.c
-+++ b/media/libvpx/vp8/common/variance_c.c
-@@ -5,17 +5,17 @@
-  *  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 "variance.h"
--#include "vp8/common/filter.h"
-+#include "filter.h"
- 
- 
- unsigned int vp8_get_mb_ss_c
- (
-     const short *src_ptr
- )
- {
-     unsigned int i = 0, sum = 0;
-@@ -451,8 +451,34 @@ unsigned int vp8_sub_pixel_variance8x16_
-     VFilter = vp8_bilinear_filters[yoffset];
- 
- 
-     var_filter_block2d_bil_first_pass(src_ptr, FData3, src_pixels_per_line, 1, 17, 8, HFilter);
-     var_filter_block2d_bil_second_pass(FData3, temp2, 8, 8, 16, 8, VFilter);
- 
-     return vp8_variance8x16_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
- }
-+
-+unsigned int vp8_get4x4sse_cs_c
-+(
-+    const unsigned char *src_ptr,
-+    int  source_stride,
-+    const unsigned char *ref_ptr,
-+    int  recon_stride
-+)
-+{
-+    int distortion = 0;
-+    int r, c;
-+
-+    for (r = 0; r < 4; r++)
-+    {
-+        for (c = 0; c < 4; c++)
-+        {
-+            int diff = src_ptr[c] - ref_ptr[c];
-+            distortion += diff * diff;
-+        }
-+
-+        src_ptr += source_stride;
-+        ref_ptr += recon_stride;
-+    }
-+
-+    return distortion;
-+}
-diff --git a/media/libvpx/vp8/encoder/x86/sad_mmx.asm b/media/libvpx/vp8/common/x86/sad_mmx.asm
-rename from media/libvpx/vp8/encoder/x86/sad_mmx.asm
-rename to media/libvpx/vp8/common/x86/sad_mmx.asm
-diff --git a/media/libvpx/vp8/encoder/x86/sad_sse2.asm b/media/libvpx/vp8/common/x86/sad_sse2.asm
-rename from media/libvpx/vp8/encoder/x86/sad_sse2.asm
-rename to media/libvpx/vp8/common/x86/sad_sse2.asm
-diff --git a/media/libvpx/vp8/encoder/x86/sad_sse3.asm b/media/libvpx/vp8/common/x86/sad_sse3.asm
-rename from media/libvpx/vp8/encoder/x86/sad_sse3.asm
-rename to media/libvpx/vp8/common/x86/sad_sse3.asm
-diff --git a/media/libvpx/vp8/encoder/x86/sad_sse4.asm b/media/libvpx/vp8/common/x86/sad_sse4.asm
-rename from media/libvpx/vp8/encoder/x86/sad_sse4.asm
-rename to media/libvpx/vp8/common/x86/sad_sse4.asm
-diff --git a/media/libvpx/vp8/encoder/x86/sad_ssse3.asm b/media/libvpx/vp8/common/x86/sad_ssse3.asm
-rename from media/libvpx/vp8/encoder/x86/sad_ssse3.asm
-rename to media/libvpx/vp8/common/x86/sad_ssse3.asm
-diff --git a/media/libvpx/vp8/encoder/x86/variance_impl_mmx.asm b/media/libvpx/vp8/common/x86/variance_impl_mmx.asm
-rename from media/libvpx/vp8/encoder/x86/variance_impl_mmx.asm
-rename to media/libvpx/vp8/common/x86/variance_impl_mmx.asm
-diff --git a/media/libvpx/vp8/encoder/x86/variance_impl_sse2.asm b/media/libvpx/vp8/common/x86/variance_impl_sse2.asm
-rename from media/libvpx/vp8/encoder/x86/variance_impl_sse2.asm
-rename to media/libvpx/vp8/common/x86/variance_impl_sse2.asm
-diff --git a/media/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm b/media/libvpx/vp8/common/x86/variance_impl_ssse3.asm
-rename from media/libvpx/vp8/encoder/x86/variance_impl_ssse3.asm
-rename to media/libvpx/vp8/common/x86/variance_impl_ssse3.asm
-diff --git a/media/libvpx/vp8/encoder/x86/variance_mmx.c b/media/libvpx/vp8/common/x86/variance_mmx.c
-rename from media/libvpx/vp8/encoder/x86/variance_mmx.c
-rename to media/libvpx/vp8/common/x86/variance_mmx.c
---- a/media/libvpx/vp8/encoder/x86/variance_mmx.c
-+++ b/media/libvpx/vp8/common/x86/variance_mmx.c
-@@ -4,17 +4,17 @@
-  *  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 "vpx_config.h"
--#include "vp8/encoder/variance.h"
-+#include "vp8/common/variance.h"
- #include "vp8/common/pragmas.h"
- #include "vpx_ports/mem.h"
- #include "vp8/common/x86/filter_x86.h"
- 
- extern void filter_block1d_h6_mmx
- (
-     const unsigned char *src_ptr,
-     unsigned short *output_ptr,
-diff --git a/media/libvpx/vp8/encoder/x86/variance_sse2.c b/media/libvpx/vp8/common/x86/variance_sse2.c
-rename from media/libvpx/vp8/encoder/x86/variance_sse2.c
-rename to media/libvpx/vp8/common/x86/variance_sse2.c
---- a/media/libvpx/vp8/encoder/x86/variance_sse2.c
-+++ b/media/libvpx/vp8/common/x86/variance_sse2.c
-@@ -4,17 +4,17 @@
-  *  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 "vpx_config.h"
--#include "vp8/encoder/variance.h"
-+#include "vp8/common/variance.h"
- #include "vp8/common/pragmas.h"
- #include "vpx_ports/mem.h"
- #include "vp8/common/x86/filter_x86.h"
- 
- extern void filter_block1d_h6_mmx(const unsigned char *src_ptr, unsigned short *output_ptr, unsigned int src_pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, short *filter);
- extern void filter_block1d_v6_mmx(const short *src_ptr, unsigned char *output_ptr, unsigned int pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, short *filter);
- extern void filter_block1d8_h6_sse2(const unsigned char *src_ptr, unsigned short *output_ptr, unsigned int src_pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, short *filter);
- extern void filter_block1d8_v6_sse2(const short *src_ptr, unsigned char *output_ptr, unsigned int pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, short *filter);
-diff --git a/media/libvpx/vp8/encoder/x86/variance_ssse3.c b/media/libvpx/vp8/common/x86/variance_ssse3.c
-rename from media/libvpx/vp8/encoder/x86/variance_ssse3.c
-rename to media/libvpx/vp8/common/x86/variance_ssse3.c
---- a/media/libvpx/vp8/encoder/x86/variance_ssse3.c
-+++ b/media/libvpx/vp8/common/x86/variance_ssse3.c
-@@ -4,17 +4,17 @@
-  *  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 "vpx_config.h"
--#include "vp8/encoder/variance.h"
-+#include "vp8/common/variance.h"
- #include "vp8/common/pragmas.h"
- #include "vpx_ports/mem.h"
- 
- extern unsigned int vp8_get16x16var_sse2
- (
-     const unsigned char *src_ptr,
-     int source_stride,
-     const unsigned char *ref_ptr,
-diff --git a/media/libvpx/vp8/encoder/x86/variance_x86.h b/media/libvpx/vp8/common/x86/variance_x86.h
-rename from media/libvpx/vp8/encoder/x86/variance_x86.h
-rename to media/libvpx/vp8/common/x86/variance_x86.h
---- a/media/libvpx/vp8/encoder/x86/variance_x86.h
-+++ b/media/libvpx/vp8/common/x86/variance_x86.h
-@@ -135,18 +135,18 @@ extern prototype_subpixvariance(vp8_sub_
- extern prototype_variance(vp8_variance_halfpixvar16x16_h_wmt);
- extern prototype_variance(vp8_variance_halfpixvar16x16_v_wmt);
- extern prototype_variance(vp8_variance_halfpixvar16x16_hv_wmt);
- extern prototype_subpixvariance(vp8_sub_pixel_mse16x16_wmt);
- extern prototype_getmbss(vp8_get_mb_ss_sse2);
- extern prototype_variance(vp8_mse16x16_wmt);
- extern prototype_variance2(vp8_get8x8var_sse2);
- extern prototype_variance2(vp8_get16x16var_sse2);
--extern prototype_ssimpf(vp8_ssim_parms_8x8_sse2)
--extern prototype_ssimpf(vp8_ssim_parms_16x16_sse2)
-+extern prototype_ssimpf(vp8_ssim_parms_8x8_sse2);
-+extern prototype_ssimpf(vp8_ssim_parms_16x16_sse2);
- 
- #if !CONFIG_RUNTIME_CPU_DETECT
- #undef  vp8_variance_sad4x4
- #define vp8_variance_sad4x4 vp8_sad4x4_wmt
- 
- #undef  vp8_variance_sad8x8
- #define vp8_variance_sad8x8 vp8_sad8x8_wmt
- 
-diff --git a/media/libvpx/vp8/common/x86/x86_systemdependent.c b/media/libvpx/vp8/common/x86/x86_systemdependent.c
---- a/media/libvpx/vp8/common/x86/x86_systemdependent.c
-+++ b/media/libvpx/vp8/common/x86/x86_systemdependent.c
-@@ -10,16 +10,17 @@
- 
- 
- #include "vpx_config.h"
- #include "vpx_ports/x86.h"
- #include "vp8/common/subpixel.h"
- #include "vp8/common/loopfilter.h"
- #include "vp8/common/recon.h"
- #include "vp8/common/idct.h"
-+#include "vp8/common/variance.h"
- #include "vp8/common/pragmas.h"
- #include "vp8/common/onyxc_int.h"
- 
- void vp8_arch_x86_common_init(VP8_COMMON *ctx)
- {
- #if CONFIG_RUNTIME_CPU_DETECT
-     VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
-     int flags = x86_simd_caps();
-@@ -62,16 +63,43 @@ void vp8_arch_x86_common_init(VP8_COMMON
-         rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_mmx;
-         rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_mmx;
-         rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_mmx;
-         rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_mmx;
-         rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_mmx;
-         rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_mmx;
-         rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_mmx;
- 
-+        rtcd->variance.sad16x16              = vp8_sad16x16_mmx;
-+        rtcd->variance.sad16x8               = vp8_sad16x8_mmx;
-+        rtcd->variance.sad8x16               = vp8_sad8x16_mmx;
-+        rtcd->variance.sad8x8                = vp8_sad8x8_mmx;
-+        rtcd->variance.sad4x4                = vp8_sad4x4_mmx;
-+
-+        rtcd->variance.var4x4                = vp8_variance4x4_mmx;
-+        rtcd->variance.var8x8                = vp8_variance8x8_mmx;
-+        rtcd->variance.var8x16               = vp8_variance8x16_mmx;
-+        rtcd->variance.var16x8               = vp8_variance16x8_mmx;
-+        rtcd->variance.var16x16              = vp8_variance16x16_mmx;
-+
-+        rtcd->variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_mmx;
-+        rtcd->variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_mmx;
-+        rtcd->variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_mmx;
-+        rtcd->variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_mmx;
-+        rtcd->variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_mmx;
-+        rtcd->variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_mmx;
-+        rtcd->variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_mmx;
-+        rtcd->variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_mmx;
-+        rtcd->variance.subpixmse16x16        = vp8_sub_pixel_mse16x16_mmx;
-+
-+        rtcd->variance.mse16x16              = vp8_mse16x16_mmx;
-+        rtcd->variance.getmbss               = vp8_get_mb_ss_mmx;
-+
-+        rtcd->variance.get4x4sse_cs          = vp8_get4x4sse_cs_mmx;
-+
- #if CONFIG_POSTPROC
-         rtcd->postproc.down        = vp8_mbpost_proc_down_mmx;
-         /*rtcd->postproc.across      = vp8_mbpost_proc_across_ip_c;*/
-         rtcd->postproc.downacross  = vp8_post_proc_down_and_across_mmx;
-         rtcd->postproc.addnoise    = vp8_plane_add_noise_mmx;
- #endif
-     }
- 
-@@ -105,26 +133,81 @@ void vp8_arch_x86_common_init(VP8_COMMON
-         rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_sse2;
-         rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_sse2;
-         rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_sse2;
-         rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_sse2;
-         rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_sse2;
-         rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_sse2;
-         rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_sse2;
- 
-+        rtcd->variance.sad16x16              = vp8_sad16x16_wmt;
-+        rtcd->variance.sad16x8               = vp8_sad16x8_wmt;
-+        rtcd->variance.sad8x16               = vp8_sad8x16_wmt;
-+        rtcd->variance.sad8x8                = vp8_sad8x8_wmt;
-+        rtcd->variance.sad4x4                = vp8_sad4x4_wmt;
-+        rtcd->variance.copy32xn              = vp8_copy32xn_sse2;
-+
-+        rtcd->variance.var4x4                = vp8_variance4x4_wmt;
-+        rtcd->variance.var8x8                = vp8_variance8x8_wmt;
-+        rtcd->variance.var8x16               = vp8_variance8x16_wmt;
-+        rtcd->variance.var16x8               = vp8_variance16x8_wmt;
-+        rtcd->variance.var16x16              = vp8_variance16x16_wmt;
-+
-+        rtcd->variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_wmt;
-+        rtcd->variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_wmt;
-+        rtcd->variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_wmt;
-+        rtcd->variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_wmt;
-+        rtcd->variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_wmt;
-+        rtcd->variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_wmt;
-+        rtcd->variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_wmt;
-+        rtcd->variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_wmt;
-+        rtcd->variance.subpixmse16x16        = vp8_sub_pixel_mse16x16_wmt;
-+
-+        rtcd->variance.mse16x16              = vp8_mse16x16_wmt;
-+        rtcd->variance.getmbss               = vp8_get_mb_ss_sse2;
-+
-+        /* rtcd->variance.get4x4sse_cs  not implemented for wmt */;
-+
-+#if CONFIG_INTERNAL_STATS
-+#if ARCH_X86_64
-+        rtcd->variance.ssimpf_8x8            = vp8_ssim_parms_8x8_sse2;
-+        rtcd->variance.ssimpf_16x16          = vp8_ssim_parms_16x16_sse2;
-+#endif
-+#endif
-+
- #if CONFIG_POSTPROC
-         rtcd->postproc.down        = vp8_mbpost_proc_down_xmm;
-         rtcd->postproc.across      = vp8_mbpost_proc_across_ip_xmm;
-         rtcd->postproc.downacross  = vp8_post_proc_down_and_across_xmm;
-         rtcd->postproc.addnoise    = vp8_plane_add_noise_wmt;
- #endif
-     }
- 
- #endif
- 
-+#if HAVE_SSE3
-+
-+    if (flags & HAS_SSE3)
-+    {
-+        rtcd->variance.sad16x16              = vp8_sad16x16_sse3;
-+        rtcd->variance.sad16x16x3            = vp8_sad16x16x3_sse3;
-+        rtcd->variance.sad16x8x3             = vp8_sad16x8x3_sse3;
-+        rtcd->variance.sad8x16x3             = vp8_sad8x16x3_sse3;
-+        rtcd->variance.sad8x8x3              = vp8_sad8x8x3_sse3;
-+        rtcd->variance.sad4x4x3              = vp8_sad4x4x3_sse3;
-+        rtcd->variance.sad16x16x4d           = vp8_sad16x16x4d_sse3;
-+        rtcd->variance.sad16x8x4d            = vp8_sad16x8x4d_sse3;
-+        rtcd->variance.sad8x16x4d            = vp8_sad8x16x4d_sse3;
-+        rtcd->variance.sad8x8x4d             = vp8_sad8x8x4d_sse3;
-+        rtcd->variance.sad4x4x4d             = vp8_sad4x4x4d_sse3;
-+        rtcd->variance.copy32xn              = vp8_copy32xn_sse3;
-+
-+    }
-+#endif
-+
- #if HAVE_SSSE3
- 
-     if (flags & HAS_SSSE3)
-     {
-         rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_ssse3;
-         rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_ssse3;
-         rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_ssse3;
-         rtcd->subpix.sixtap4x4     = vp8_sixtap_predict4x4_ssse3;
-@@ -134,13 +217,30 @@ void vp8_arch_x86_common_init(VP8_COMMON
-         rtcd->recon.build_intra_predictors_mbuv =
-             vp8_build_intra_predictors_mbuv_ssse3;
-         rtcd->recon.build_intra_predictors_mbuv_s =
-             vp8_build_intra_predictors_mbuv_s_ssse3;
-         rtcd->recon.build_intra_predictors_mby =
-             vp8_build_intra_predictors_mby_ssse3;
-         rtcd->recon.build_intra_predictors_mby_s =
-             vp8_build_intra_predictors_mby_s_ssse3;
-+
-+        rtcd->variance.sad16x16x3            = vp8_sad16x16x3_ssse3;
-+        rtcd->variance.sad16x8x3             = vp8_sad16x8x3_ssse3;
-+
-+        rtcd->variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_ssse3;
-+        rtcd->variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_ssse3;
-+    }
-+#endif
-+
-+#if HAVE_SSE4_1
-+    if (flags & HAS_SSE4_1)
-+    {
-+        rtcd->variance.sad16x16x8            = vp8_sad16x16x8_sse4;
-+        rtcd->variance.sad16x8x8             = vp8_sad16x8x8_sse4;
-+        rtcd->variance.sad8x16x8             = vp8_sad8x16x8_sse4;
-+        rtcd->variance.sad8x8x8              = vp8_sad8x8x8_sse4;
-+        rtcd->variance.sad4x4x8              = vp8_sad4x4x8_sse4;
-     }
- #endif
- 
- #endif
- }
-diff --git a/media/libvpx/vp8/encoder/arm/arm_csystemdependent.c b/media/libvpx/vp8/encoder/arm/arm_csystemdependent.c
---- a/media/libvpx/vp8/encoder/arm/arm_csystemdependent.c
-+++ b/media/libvpx/vp8/encoder/arm/arm_csystemdependent.c
-@@ -6,17 +6,16 @@
-  *  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 "vpx_config.h"
- #include "vpx_ports/arm.h"
--#include "vp8/encoder/variance.h"
- #include "vp8/encoder/onyx_int.h"
- 
- extern void (*vp8_yv12_copy_partial_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc);
- extern void vp8_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc);
- extern void vp8_yv12_copy_partial_frame_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc);
- 
- void vp8_arch_arm_encoder_init(VP8_COMP *cpi)
- {
-@@ -27,42 +26,16 @@ void vp8_arch_arm_encoder_init(VP8_COMP 
-     if (flags & HAS_EDSP)
-     {
-     }
- #endif
- 
- #if HAVE_ARMV6
-     if (flags & HAS_MEDIA)
-     {
--        cpi->rtcd.variance.sad16x16              = vp8_sad16x16_armv6;
--        /*cpi->rtcd.variance.sad16x8               = vp8_sad16x8_c;
--        cpi->rtcd.variance.sad8x16               = vp8_sad8x16_c;
--        cpi->rtcd.variance.sad8x8                = vp8_sad8x8_c;
--        cpi->rtcd.variance.sad4x4                = vp8_sad4x4_c;*/
--
--        /*cpi->rtcd.variance.var4x4                = vp8_variance4x4_c;*/
--        cpi->rtcd.variance.var8x8                = vp8_variance8x8_armv6;
--        /*cpi->rtcd.variance.var8x16               = vp8_variance8x16_c;
--        cpi->rtcd.variance.var16x8               = vp8_variance16x8_c;*/
--        cpi->rtcd.variance.var16x16              = vp8_variance16x16_armv6;
--
--        /*cpi->rtcd.variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_c;*/
--        cpi->rtcd.variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_armv6;
--        /*cpi->rtcd.variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_c;
--        cpi->rtcd.variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_c;*/
--        cpi->rtcd.variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_armv6;
--        cpi->rtcd.variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_armv6;
--        cpi->rtcd.variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_armv6;
--        cpi->rtcd.variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_armv6;
--
--        cpi->rtcd.variance.mse16x16              = vp8_mse16x16_armv6;
--        /*cpi->rtcd.variance.getmbss               = vp8_get_mb_ss_c;*/
--
--        /*cpi->rtcd.variance.get4x4sse_cs          = vp8_get4x4sse_cs_c;*/
--
-         cpi->rtcd.fdct.short4x4                  = vp8_short_fdct4x4_armv6;
-         cpi->rtcd.fdct.short8x4                  = vp8_short_fdct8x4_armv6;
-         cpi->rtcd.fdct.fast4x4                   = vp8_short_fdct4x4_armv6;
-         cpi->rtcd.fdct.fast8x4                   = vp8_short_fdct8x4_armv6;
-         cpi->rtcd.fdct.walsh_short4x4            = vp8_short_walsh4x4_armv6;
- 
-         /*cpi->rtcd.encodemb.berr                  = vp8_block_error_c;
-         cpi->rtcd.encodemb.mberr                 = vp8_mbblock_error_c;
-@@ -74,42 +47,16 @@ void vp8_arch_arm_encoder_init(VP8_COMP 
-         /*cpi->rtcd.quantize.quantb                = vp8_regular_quantize_b;*/
-         cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_armv6;
-     }
- #endif
- 
- #if HAVE_ARMV7
-     if (flags & HAS_NEON)
-     {
--        cpi->rtcd.variance.sad16x16              = vp8_sad16x16_neon;
--        cpi->rtcd.variance.sad16x8               = vp8_sad16x8_neon;
--        cpi->rtcd.variance.sad8x16               = vp8_sad8x16_neon;
--        cpi->rtcd.variance.sad8x8                = vp8_sad8x8_neon;
--        cpi->rtcd.variance.sad4x4                = vp8_sad4x4_neon;
--
--        /*cpi->rtcd.variance.var4x4                = vp8_variance4x4_c;*/
--        cpi->rtcd.variance.var8x8                = vp8_variance8x8_neon;
--        cpi->rtcd.variance.var8x16               = vp8_variance8x16_neon;
--        cpi->rtcd.variance.var16x8               = vp8_variance16x8_neon;
--        cpi->rtcd.variance.var16x16              = vp8_variance16x16_neon;
--
--        /*cpi->rtcd.variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_c;*/
--        cpi->rtcd.variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_neon;
--        /*cpi->rtcd.variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_c;
--        cpi->rtcd.variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_c;*/
--        cpi->rtcd.variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_neon;
--        cpi->rtcd.variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_neon;
--        cpi->rtcd.variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_neon;
--        cpi->rtcd.variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_neon;
--
--        cpi->rtcd.variance.mse16x16              = vp8_mse16x16_neon;
--        /*cpi->rtcd.variance.getmbss               = vp8_get_mb_ss_c;*/
--
--        cpi->rtcd.variance.get4x4sse_cs          = vp8_get4x4sse_cs_neon;
--
-         cpi->rtcd.fdct.short4x4                  = vp8_short_fdct4x4_neon;
-         cpi->rtcd.fdct.short8x4                  = vp8_short_fdct8x4_neon;
-         cpi->rtcd.fdct.fast4x4                   = vp8_short_fdct4x4_neon;
-         cpi->rtcd.fdct.fast8x4                   = vp8_short_fdct8x4_neon;
-         cpi->rtcd.fdct.walsh_short4x4            = vp8_short_walsh4x4_neon;
- 
-         /*cpi->rtcd.encodemb.berr                  = vp8_block_error_c;
-         cpi->rtcd.encodemb.mberr                 = vp8_mbblock_error_c;
-diff --git a/media/libvpx/vp8/encoder/encodeframe.c b/media/libvpx/vp8/encoder/encodeframe.c
---- a/media/libvpx/vp8/encoder/encodeframe.c
-+++ b/media/libvpx/vp8/encoder/encodeframe.c
-@@ -93,17 +93,17 @@ static unsigned int tt_activity_measure(
-     unsigned int sse;
-     /* TODO: This could also be done over smaller areas (8x8), but that would
-      *  require extensive changes elsewhere, as lambda is assumed to be fixed
-      *  over an entire MB in most of the code.
-      * Another option is to compute four 8x8 variances, and pick a single
-      *  lambda using a non-linear combination (e.g., the smallest, or second
-      *  smallest, etc.).
-      */
--    act =     VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16)(x->src.y_buffer,
-+    act =     VARIANCE_INVOKE(&cpi->common.rtcd.variance, var16x16)(x->src.y_buffer,
-                     x->src.y_stride, VP8_VAR_OFFS, 0, &sse);
-     act = act<<4;
- 
-     /* If the region is flat, lower the activity some more. */
-     if (act < 8<<12)
-         act = act < 5<<12 ? act : 5<<12;
- 
-     return act;
-diff --git a/media/libvpx/vp8/encoder/encodeintra.c b/media/libvpx/vp8/encoder/encodeintra.c
---- a/media/libvpx/vp8/encoder/encodeintra.c
-+++ b/media/libvpx/vp8/encoder/encodeintra.c
-@@ -50,17 +50,17 @@ int vp8_encode_intra(VP8_COMP *cpi, MACR
-     {
-         for (i = 0; i < 16; i++)
-         {
-             x->e_mbd.block[i].bmi.as_mode = B_DC_PRED;
-             vp8_encode_intra4x4block(IF_RTCD(&cpi->rtcd), x, i);
-         }
-     }
- 
--    intra_pred_var = VARIANCE_INVOKE(&cpi->rtcd.variance, getmbss)(x->src_diff);
-+    intra_pred_var = VARIANCE_INVOKE(&cpi->common.rtcd.variance, getmbss)(x->src_diff);
- 
-     return intra_pred_var;
- }
- 
- void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd,
-                               MACROBLOCK *x, int ib)
- {
-     BLOCKD *b = &x->e_mbd.block[ib];
-diff --git a/media/libvpx/vp8/encoder/firstpass.c b/media/libvpx/vp8/encoder/firstpass.c
---- a/media/libvpx/vp8/encoder/firstpass.c
-+++ b/media/libvpx/vp8/encoder/firstpass.c
-@@ -7,17 +7,17 @@
-  *  in the file PATENTS.  All contributing project authors may
-  *  be found in the AUTHORS file in the root of the source tree.
-  */
- 
- #include "math.h"
- #include "limits.h"
- #include "block.h"
- #include "onyx_int.h"
--#include "variance.h"
-+#include "vp8/common/variance.h"
- #include "encodeintra.h"
- #include "vp8/common/setupintrarecon.h"
- #include "mcomp.h"
- #include "firstpass.h"
- #include "vpx_scale/vpxscale.h"
- #include "encodemb.h"
- #include "vp8/common/extend.h"
- #include "vp8/common/systemdependent.h"
-@@ -404,17 +404,17 @@ static void zz_motion_search( VP8_COMP *
-     unsigned char *ref_ptr;
-     int ref_stride=d->pre_stride;
- 
-     // Set up pointers for this macro block recon buffer
-     xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset;
- 
-     ref_ptr = (unsigned char *)(*(d->base_pre) + d->pre );
- 
--    VARIANCE_INVOKE(IF_RTCD(&cpi->rtcd.variance), mse16x16) ( src_ptr, src_stride, ref_ptr, ref_stride, (unsigned int *)(best_motion_err));
-+    VARIANCE_INVOKE(IF_RTCD(&cpi->common.rtcd.variance), mse16x16) ( src_ptr, src_stride, ref_ptr, ref_stride, (unsigned int *)(best_motion_err));
- }
- 
- static void first_pass_motion_search(VP8_COMP *cpi, MACROBLOCK *x,
-                                      int_mv *ref_mv, MV *best_mv,
-                                      YV12_BUFFER_CONFIG *recon_buffer,
-                                      int *best_motion_err, int recon_yoffset )
- {
-     MACROBLOCKD *const xd = & x->e_mbd;
-@@ -428,17 +428,17 @@ static void first_pass_motion_search(VP8
-     int tmp_err;
-     int step_param = 3;                                       //3;          // Dont search over full range for first pass
-     int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param; //3;
-     int n;
-     vp8_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
-     int new_mv_mode_penalty = 256;
- 
-     // override the default variance function to use MSE
--    v_fn_ptr.vf    = VARIANCE_INVOKE(IF_RTCD(&cpi->rtcd.variance), mse16x16);
-+    v_fn_ptr.vf    = VARIANCE_INVOKE(IF_RTCD(&cpi->common.rtcd.variance), mse16x16);
- 
-     // Set up pointers for this macro block recon buffer
-     xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset;
- 
-     // Initial step/diamond search centred on best mv
-     tmp_mv.as_int = 0;
-     ref_mv_full.as_mv.col = ref_mv->as_mv.col>>3;
-     ref_mv_full.as_mv.row = ref_mv->as_mv.row>>3;
-diff --git a/media/libvpx/vp8/encoder/generic/csystemdependent.c b/media/libvpx/vp8/encoder/generic/csystemdependent.c
---- a/media/libvpx/vp8/encoder/generic/csystemdependent.c
-+++ b/media/libvpx/vp8/encoder/generic/csystemdependent.c
-@@ -5,78 +5,31 @@
-  *  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 "vpx_config.h"
--#include "vp8/encoder/variance.h"
- #include "vp8/encoder/onyx_int.h"
- 
- 
- void vp8_arch_x86_encoder_init(VP8_COMP *cpi);
- void vp8_arch_arm_encoder_init(VP8_COMP *cpi);
- 
- void (*vp8_yv12_copy_partial_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc,
-                                         YV12_BUFFER_CONFIG *dst_ybc);
- extern void vp8_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc,
-                                         YV12_BUFFER_CONFIG *dst_ybc);
- 
- void vp8_cmachine_specific_config(VP8_COMP *cpi)
- {
- #if CONFIG_RUNTIME_CPU_DETECT
-     cpi->rtcd.common                    = &cpi->common.rtcd;
--    cpi->rtcd.variance.sad16x16              = vp8_sad16x16_c;
--    cpi->rtcd.variance.sad16x8               = vp8_sad16x8_c;
--    cpi->rtcd.variance.sad8x16               = vp8_sad8x16_c;
--    cpi->rtcd.variance.sad8x8                = vp8_sad8x8_c;
--    cpi->rtcd.variance.sad4x4                = vp8_sad4x4_c;
--
--    cpi->rtcd.variance.sad16x16x3            = vp8_sad16x16x3_c;
--    cpi->rtcd.variance.sad16x8x3             = vp8_sad16x8x3_c;
--    cpi->rtcd.variance.sad8x16x3             = vp8_sad8x16x3_c;
--    cpi->rtcd.variance.sad8x8x3              = vp8_sad8x8x3_c;
--    cpi->rtcd.variance.sad4x4x3              = vp8_sad4x4x3_c;
--
--    cpi->rtcd.variance.sad16x16x8            = vp8_sad16x16x8_c;
--    cpi->rtcd.variance.sad16x8x8             = vp8_sad16x8x8_c;
--    cpi->rtcd.variance.sad8x16x8             = vp8_sad8x16x8_c;
--    cpi->rtcd.variance.sad8x8x8              = vp8_sad8x8x8_c;
--    cpi->rtcd.variance.sad4x4x8              = vp8_sad4x4x8_c;
--
--    cpi->rtcd.variance.sad16x16x4d           = vp8_sad16x16x4d_c;
--    cpi->rtcd.variance.sad16x8x4d            = vp8_sad16x8x4d_c;
--    cpi->rtcd.variance.sad8x16x4d            = vp8_sad8x16x4d_c;
--    cpi->rtcd.variance.sad8x8x4d             = vp8_sad8x8x4d_c;
--    cpi->rtcd.variance.sad4x4x4d             = vp8_sad4x4x4d_c;
--#if ARCH_X86 || ARCH_X86_64
--    cpi->rtcd.variance.copy32xn              = vp8_copy32xn_c;
--#endif
--    cpi->rtcd.variance.var4x4                = vp8_variance4x4_c;
--    cpi->rtcd.variance.var8x8                = vp8_variance8x8_c;
--    cpi->rtcd.variance.var8x16               = vp8_variance8x16_c;
--    cpi->rtcd.variance.var16x8               = vp8_variance16x8_c;
--    cpi->rtcd.variance.var16x16              = vp8_variance16x16_c;
--
--    cpi->rtcd.variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_c;
--    cpi->rtcd.variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_c;
--    cpi->rtcd.variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_c;
--    cpi->rtcd.variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_c;
--    cpi->rtcd.variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_c;
--    cpi->rtcd.variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_c;
--    cpi->rtcd.variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_c;
--    cpi->rtcd.variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_c;
--    cpi->rtcd.variance.subpixmse16x16        = vp8_sub_pixel_mse16x16_c;
--
--    cpi->rtcd.variance.mse16x16              = vp8_mse16x16_c;
--    cpi->rtcd.variance.getmbss               = vp8_get_mb_ss_c;
--
--    cpi->rtcd.variance.get4x4sse_cs          = vp8_get4x4sse_cs_c;
- 
-     cpi->rtcd.fdct.short4x4                  = vp8_short_fdct4x4_c;
-     cpi->rtcd.fdct.short8x4                  = vp8_short_fdct8x4_c;
-     cpi->rtcd.fdct.fast4x4                   = vp8_short_fdct4x4_c;
-     cpi->rtcd.fdct.fast8x4                   = vp8_short_fdct8x4_c;
-     cpi->rtcd.fdct.walsh_short4x4            = vp8_short_walsh4x4_c;
- 
-     cpi->rtcd.encodemb.berr                  = vp8_block_error_c;
-@@ -91,20 +44,16 @@ void vp8_cmachine_specific_config(VP8_CO
-     cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_c;
-     cpi->rtcd.quantize.fastquantb_pair       = vp8_fast_quantize_b_pair_c;
-     cpi->rtcd.search.full_search             = vp8_full_search_sad;
-     cpi->rtcd.search.refining_search         = vp8_refining_search_sad;
-     cpi->rtcd.search.diamond_search          = vp8_diamond_search_sad;
- #if !(CONFIG_REALTIME_ONLY)
-     cpi->rtcd.temporal.apply                 = vp8_temporal_filter_apply_c;
- #endif
--#if CONFIG_INTERNAL_STATS
--    cpi->rtcd.variance.ssimpf_8x8            = vp8_ssim_parms_8x8_c;
--    cpi->rtcd.variance.ssimpf_16x16          = vp8_ssim_parms_16x16_c;
--#endif
- #endif
- 
-     // Pure C:
-     vp8_yv12_copy_partial_frame_ptr = vp8_yv12_copy_partial_frame;
- 
- #if ARCH_X86 || ARCH_X86_64
-     vp8_arch_x86_encoder_init(cpi);
- #endif
-diff --git a/media/libvpx/vp8/encoder/mcomp.h b/media/libvpx/vp8/encoder/mcomp.h
---- a/media/libvpx/vp8/encoder/mcomp.h
-+++ b/media/libvpx/vp8/encoder/mcomp.h
-@@ -8,17 +8,17 @@
-  *  be found in the AUTHORS file in the root of the source tree.
-  */
- 
- 
- #ifndef __INC_MCOMP_H
- #define __INC_MCOMP_H
- 
- #include "block.h"
--#include "variance.h"
-+#include "vp8/common/variance.h"
- 
- #ifdef ENTROPY_STATS
- extern void init_mv_ref_counts();
- extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
- #endif
- 
- 
- #define MAX_MVSEARCH_STEPS 8                                    // The maximum number of steps in a step search given the largest allowed initial step
-diff --git a/media/libvpx/vp8/encoder/onyx_if.c b/media/libvpx/vp8/encoder/onyx_if.c
---- a/media/libvpx/vp8/encoder/onyx_if.c
-+++ b/media/libvpx/vp8/encoder/onyx_if.c
-@@ -1948,72 +1948,72 @@ struct VP8_COMP* vp8_create_compressor(V
- #ifdef ENTROPY_STATS
-     init_mv_ref_counts();
- #endif
- 
- #if CONFIG_MULTITHREAD
-     vp8cx_create_encoder_threads(cpi);
- #endif
- 
--    cpi->fn_ptr[BLOCK_16X16].sdf            = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16);
--    cpi->fn_ptr[BLOCK_16X16].vf             = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16);
--    cpi->fn_ptr[BLOCK_16X16].svf            = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar16x16);
--    cpi->fn_ptr[BLOCK_16X16].svf_halfpix_h  = VARIANCE_INVOKE(&cpi->rtcd.variance, halfpixvar16x16_h);
--    cpi->fn_ptr[BLOCK_16X16].svf_halfpix_v  = VARIANCE_INVOKE(&cpi->rtcd.variance, halfpixvar16x16_v);
--    cpi->fn_ptr[BLOCK_16X16].svf_halfpix_hv = VARIANCE_INVOKE(&cpi->rtcd.variance, halfpixvar16x16_hv);
--    cpi->fn_ptr[BLOCK_16X16].sdx3f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x3);
--    cpi->fn_ptr[BLOCK_16X16].sdx8f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x8);
--    cpi->fn_ptr[BLOCK_16X16].sdx4df         = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16x4d);
--
--    cpi->fn_ptr[BLOCK_16X8].sdf            = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8);
--    cpi->fn_ptr[BLOCK_16X8].vf             = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x8);
--    cpi->fn_ptr[BLOCK_16X8].svf            = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar16x8);
-+    cpi->fn_ptr[BLOCK_16X16].sdf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad16x16);
-+    cpi->fn_ptr[BLOCK_16X16].vf             = VARIANCE_INVOKE(&cpi->common.rtcd.variance, var16x16);
-+    cpi->fn_ptr[BLOCK_16X16].svf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, subpixvar16x16);
-+    cpi->fn_ptr[BLOCK_16X16].svf_halfpix_h  = VARIANCE_INVOKE(&cpi->common.rtcd.variance, halfpixvar16x16_h);
-+    cpi->fn_ptr[BLOCK_16X16].svf_halfpix_v  = VARIANCE_INVOKE(&cpi->common.rtcd.variance, halfpixvar16x16_v);
-+    cpi->fn_ptr[BLOCK_16X16].svf_halfpix_hv = VARIANCE_INVOKE(&cpi->common.rtcd.variance, halfpixvar16x16_hv);
-+    cpi->fn_ptr[BLOCK_16X16].sdx3f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad16x16x3);
-+    cpi->fn_ptr[BLOCK_16X16].sdx8f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad16x16x8);
-+    cpi->fn_ptr[BLOCK_16X16].sdx4df         = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad16x16x4d);
-+
-+    cpi->fn_ptr[BLOCK_16X8].sdf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad16x8);
-+    cpi->fn_ptr[BLOCK_16X8].vf             = VARIANCE_INVOKE(&cpi->common.rtcd.variance, var16x8);
-+    cpi->fn_ptr[BLOCK_16X8].svf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, subpixvar16x8);
-     cpi->fn_ptr[BLOCK_16X8].svf_halfpix_h  = NULL;
-     cpi->fn_ptr[BLOCK_16X8].svf_halfpix_v  = NULL;
-     cpi->fn_ptr[BLOCK_16X8].svf_halfpix_hv = NULL;
--    cpi->fn_ptr[BLOCK_16X8].sdx3f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8x3);
--    cpi->fn_ptr[BLOCK_16X8].sdx8f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8x8);
--    cpi->fn_ptr[BLOCK_16X8].sdx4df         = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x8x4d);
--
--    cpi->fn_ptr[BLOCK_8X16].sdf            = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16);
--    cpi->fn_ptr[BLOCK_8X16].vf             = VARIANCE_INVOKE(&cpi->rtcd.variance, var8x16);
--    cpi->fn_ptr[BLOCK_8X16].svf            = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar8x16);
-+    cpi->fn_ptr[BLOCK_16X8].sdx3f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad16x8x3);
-+    cpi->fn_ptr[BLOCK_16X8].sdx8f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad16x8x8);
-+    cpi->fn_ptr[BLOCK_16X8].sdx4df         = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad16x8x4d);
-+
-+    cpi->fn_ptr[BLOCK_8X16].sdf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad8x16);
-+    cpi->fn_ptr[BLOCK_8X16].vf             = VARIANCE_INVOKE(&cpi->common.rtcd.variance, var8x16);
-+    cpi->fn_ptr[BLOCK_8X16].svf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, subpixvar8x16);
-     cpi->fn_ptr[BLOCK_8X16].svf_halfpix_h  = NULL;
-     cpi->fn_ptr[BLOCK_8X16].svf_halfpix_v  = NULL;
-     cpi->fn_ptr[BLOCK_8X16].svf_halfpix_hv = NULL;
--    cpi->fn_ptr[BLOCK_8X16].sdx3f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16x3);
--    cpi->fn_ptr[BLOCK_8X16].sdx8f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16x8);
--    cpi->fn_ptr[BLOCK_8X16].sdx4df         = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x16x4d);
--
--    cpi->fn_ptr[BLOCK_8X8].sdf            = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8);
--    cpi->fn_ptr[BLOCK_8X8].vf             = VARIANCE_INVOKE(&cpi->rtcd.variance, var8x8);
--    cpi->fn_ptr[BLOCK_8X8].svf            = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar8x8);
-+    cpi->fn_ptr[BLOCK_8X16].sdx3f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad8x16x3);
-+    cpi->fn_ptr[BLOCK_8X16].sdx8f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad8x16x8);
-+    cpi->fn_ptr[BLOCK_8X16].sdx4df         = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad8x16x4d);
-+
-+    cpi->fn_ptr[BLOCK_8X8].sdf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad8x8);
-+    cpi->fn_ptr[BLOCK_8X8].vf             = VARIANCE_INVOKE(&cpi->common.rtcd.variance, var8x8);
-+    cpi->fn_ptr[BLOCK_8X8].svf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, subpixvar8x8);
-     cpi->fn_ptr[BLOCK_8X8].svf_halfpix_h  = NULL;
-     cpi->fn_ptr[BLOCK_8X8].svf_halfpix_v  = NULL;
-     cpi->fn_ptr[BLOCK_8X8].svf_halfpix_hv = NULL;
--    cpi->fn_ptr[BLOCK_8X8].sdx3f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8x3);
--    cpi->fn_ptr[BLOCK_8X8].sdx8f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8x8);
--    cpi->fn_ptr[BLOCK_8X8].sdx4df         = VARIANCE_INVOKE(&cpi->rtcd.variance, sad8x8x4d);
--
--    cpi->fn_ptr[BLOCK_4X4].sdf            = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4);
--    cpi->fn_ptr[BLOCK_4X4].vf             = VARIANCE_INVOKE(&cpi->rtcd.variance, var4x4);
--    cpi->fn_ptr[BLOCK_4X4].svf            = VARIANCE_INVOKE(&cpi->rtcd.variance, subpixvar4x4);
-+    cpi->fn_ptr[BLOCK_8X8].sdx3f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad8x8x3);
-+    cpi->fn_ptr[BLOCK_8X8].sdx8f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad8x8x8);
-+    cpi->fn_ptr[BLOCK_8X8].sdx4df         = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad8x8x4d);
-+
-+    cpi->fn_ptr[BLOCK_4X4].sdf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad4x4);
-+    cpi->fn_ptr[BLOCK_4X4].vf             = VARIANCE_INVOKE(&cpi->common.rtcd.variance, var4x4);
-+    cpi->fn_ptr[BLOCK_4X4].svf            = VARIANCE_INVOKE(&cpi->common.rtcd.variance, subpixvar4x4);
-     cpi->fn_ptr[BLOCK_4X4].svf_halfpix_h  = NULL;
-     cpi->fn_ptr[BLOCK_4X4].svf_halfpix_v  = NULL;
-     cpi->fn_ptr[BLOCK_4X4].svf_halfpix_hv = NULL;
--    cpi->fn_ptr[BLOCK_4X4].sdx3f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4x3);
--    cpi->fn_ptr[BLOCK_4X4].sdx8f          = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4x8);
--    cpi->fn_ptr[BLOCK_4X4].sdx4df         = VARIANCE_INVOKE(&cpi->rtcd.variance, sad4x4x4d);
-+    cpi->fn_ptr[BLOCK_4X4].sdx3f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad4x4x3);
-+    cpi->fn_ptr[BLOCK_4X4].sdx8f          = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad4x4x8);
-+    cpi->fn_ptr[BLOCK_4X4].sdx4df         = VARIANCE_INVOKE(&cpi->common.rtcd.variance, sad4x4x4d);
- 
- #if ARCH_X86 || ARCH_X86_64
--    cpi->fn_ptr[BLOCK_16X16].copymem        = VARIANCE_INVOKE(&cpi->rtcd.variance, copy32xn);
--    cpi->fn_ptr[BLOCK_16X8].copymem        = VARIANCE_INVOKE(&cpi->rtcd.variance, copy32xn);
--    cpi->fn_ptr[BLOCK_8X16].copymem        = VARIANCE_INVOKE(&cpi->rtcd.variance, copy32xn);
--    cpi->fn_ptr[BLOCK_8X8].copymem        = VARIANCE_INVOKE(&cpi->rtcd.variance, copy32xn);
--    cpi->fn_ptr[BLOCK_4X4].copymem        = VARIANCE_INVOKE(&cpi->rtcd.variance, copy32xn);
-+    cpi->fn_ptr[BLOCK_16X16].copymem        = VARIANCE_INVOKE(&cpi->common.rtcd.variance, copy32xn);
-+    cpi->fn_ptr[BLOCK_16X8].copymem        = VARIANCE_INVOKE(&cpi->common.rtcd.variance, copy32xn);
-+    cpi->fn_ptr[BLOCK_8X16].copymem        = VARIANCE_INVOKE(&cpi->common.rtcd.variance, copy32xn);
-+    cpi->fn_ptr[BLOCK_8X8].copymem        = VARIANCE_INVOKE(&cpi->common.rtcd.variance, copy32xn);
-+    cpi->fn_ptr[BLOCK_4X4].copymem        = VARIANCE_INVOKE(&cpi->common.rtcd.variance, copy32xn);
- #endif
- 
-     cpi->full_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, full_search);
-     cpi->diamond_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, diamond_search);
-     cpi->refining_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, refining_search);
- 
-     // make sure frame 1 is okay
-     cpi->error_bins[0] = cpi->common.MBs;
-@@ -2410,38 +2410,38 @@ static void generate_psnr_packet(VP8_COM
-     int                      i;
-     unsigned int             width = cpi->common.Width;
-     unsigned int             height = cpi->common.Height;
- 
-     pkt.kind = VPX_CODEC_PSNR_PKT;
-     sse = calc_plane_error(orig->y_buffer, orig->y_stride,
-                            recon->y_buffer, recon->y_stride,
-                            width, height,
--                           IF_RTCD(&cpi->rtcd.variance));
-+                           IF_RTCD(&cpi->common.rtcd.variance));
-     pkt.data.psnr.sse[0] = sse;
-     pkt.data.psnr.sse[1] = sse;
-     pkt.data.psnr.samples[0] = width * height;
-     pkt.data.psnr.samples[1] = width * height;
- 
-     width = (width + 1) / 2;
-     height = (height + 1) / 2;
- 
-     sse = calc_plane_error(orig->u_buffer, orig->uv_stride,
-                            recon->u_buffer, recon->uv_stride,
-                            width, height,
--                           IF_RTCD(&cpi->rtcd.variance));
-+                           IF_RTCD(&cpi->common.rtcd.variance));
-     pkt.data.psnr.sse[0] += sse;
-     pkt.data.psnr.sse[2] = sse;
-     pkt.data.psnr.samples[0] += width * height;
-     pkt.data.psnr.samples[2] = width * height;
- 
-     sse = calc_plane_error(orig->v_buffer, orig->uv_stride,
-                            recon->v_buffer, recon->uv_stride,
-                            width, height,
--                           IF_RTCD(&cpi->rtcd.variance));
-+                           IF_RTCD(&cpi->common.rtcd.variance));
-     pkt.data.psnr.sse[0] += sse;
-     pkt.data.psnr.sse[3] = sse;
-     pkt.data.psnr.samples[0] += width * height;
-     pkt.data.psnr.samples[3] = width * height;
- 
-     for (i = 0; i < 4; i++)
-         pkt.data.psnr.psnr[i] = vp8_mse2psnr(pkt.data.psnr.samples[i], 255.0,
-                                              pkt.data.psnr.sse[i]);
-@@ -3821,17 +3821,17 @@ static void encode_frame_to_data_rate
- 
- #if !(CONFIG_REALTIME_ONLY)
-         // Special case handling for forced key frames
-         if ( (cm->frame_type == KEY_FRAME) && cpi->this_key_frame_forced )
-         {
-             int last_q = Q;
-             int kf_err = vp8_calc_ss_err(cpi->Source,
-                                          &cm->yv12_fb[cm->new_fb_idx],
--                                         IF_RTCD(&cpi->rtcd.variance));
-+                                         IF_RTCD(&cpi->common.rtcd.variance));
- 
-             // The key frame is not good enough
-             if ( kf_err > ((cpi->ambient_err * 7) >> 3) )
-             {
-                 // Lower q_high
-                 q_high = (Q > q_low) ? (Q - 1) : q_low;
- 
-                 // Adjust Q
-@@ -4018,17 +4018,17 @@ static void encode_frame_to_data_rate
- 
-     // Special case code to reduce pulsing when key frames are forced at a
-     // fixed interval. Note the reconstruction error if it is the frame before
-     // the force key frame
-     if ( cpi->next_key_frame_forced && (cpi->twopass.frames_to_key == 0) )
-     {
-         cpi->ambient_err = vp8_calc_ss_err(cpi->Source,
-                                            &cm->yv12_fb[cm->new_fb_idx],
--                                           IF_RTCD(&cpi->rtcd.variance));
-+                                           IF_RTCD(&cpi->common.rtcd.variance));
-     }
- 
-     /* This frame's MVs are saved and will be used in next frame's MV predictor.
-      * Last frame has one more line(add to bottom) and one more column(add to
-      * right) than cm->mip. The edge elements are initialized to 0.
-      */
- #if CONFIG_MULTI_RES_ENCODING
-     if(!cpi->oxcf.mr_encoder_id && cm->show_frame)
-@@ -4963,25 +4963,25 @@ int vp8_get_compressed_data(VP8_COMP *cp
-                 YV12_BUFFER_CONFIG      *pp = &cm->post_proc_buffer;
-                 int y_samples = orig->y_height * orig->y_width ;
-                 int uv_samples = orig->uv_height * orig->uv_width ;
-                 int t_samples = y_samples + 2 * uv_samples;
-                 int64_t sq_error, sq_error2;
- 
-                 ye = calc_plane_error(orig->y_buffer, orig->y_stride,
-                   recon->y_buffer, recon->y_stride, orig->y_width, orig->y_height,
--                  IF_RTCD(&cpi->rtcd.variance));
-+                  IF_RTCD(&cpi->common.rtcd.variance));
- 
-                 ue = calc_plane_error(orig->u_buffer, orig->uv_stride,
-                   recon->u_buffer, recon->uv_stride, orig->uv_width, orig->uv_height,
--                  IF_RTCD(&cpi->rtcd.variance));
-+                  IF_RTCD(&cpi->common.rtcd.variance));
- 
-                 ve = calc_plane_error(orig->v_buffer, orig->uv_stride,
-                   recon->v_buffer, recon->uv_stride, orig->uv_width, orig->uv_height,
--                  IF_RTCD(&cpi->rtcd.variance));
-+                  IF_RTCD(&cpi->common.rtcd.variance));
- 
-                 sq_error = ye + ue + ve;
- 
-                 frame_psnr = vp8_mse2psnr(t_samples, 255.0, sq_error);
- 
-                 cpi->total_y += vp8_mse2psnr(y_samples, 255.0, ye);
-                 cpi->total_u += vp8_mse2psnr(uv_samples, 255.0, ue);
-                 cpi->total_v += vp8_mse2psnr(uv_samples, 255.0, ve);
-@@ -4991,39 +4991,39 @@ int vp8_get_compressed_data(VP8_COMP *cp
-                     double frame_psnr2, frame_ssim2 = 0;
-                     double weight = 0;
- 
-                     vp8_deblock(cm->frame_to_show, &cm->post_proc_buffer, cm->filter_level * 10 / 6, 1, 0, IF_RTCD(&cm->rtcd.postproc));
-                     vp8_clear_system_state();
- 
-                     ye = calc_plane_error(orig->y_buffer, orig->y_stride,
-                       pp->y_buffer, pp->y_stride, orig->y_width, orig->y_height,
--                      IF_RTCD(&cpi->rtcd.variance));
-+                      IF_RTCD(&cpi->common.rtcd.variance));
- 
-                     ue = calc_plane_error(orig->u_buffer, orig->uv_stride,
-                       pp->u_buffer, pp->uv_stride, orig->uv_width, orig->uv_height,
--                      IF_RTCD(&cpi->rtcd.variance));
-+                      IF_RTCD(&cpi->common.rtcd.variance));
- 
-                     ve = calc_plane_error(orig->v_buffer, orig->uv_stride,
-                       pp->v_buffer, pp->uv_stride, orig->uv_width, orig->uv_height,
--                      IF_RTCD(&cpi->rtcd.variance));
-+                      IF_RTCD(&cpi->common.rtcd.variance));
- 
-                     sq_error2 = ye + ue + ve;
- 
-                     frame_psnr2 = vp8_mse2psnr(t_samples, 255.0, sq_error2);
- 
-                     cpi->totalp_y += vp8_mse2psnr(y_samples, 255.0, ye);
-                     cpi->totalp_u += vp8_mse2psnr(uv_samples, 255.0, ue);
-                     cpi->totalp_v += vp8_mse2psnr(uv_samples, 255.0, ve);
-                     cpi->total_sq_error2 += sq_error2;
-                     cpi->totalp  += frame_psnr2;
- 
-                     frame_ssim2 = vp8_calc_ssim(cpi->Source,
-                       &cm->post_proc_buffer, 1, &weight,
--                      IF_RTCD(&cpi->rtcd.variance));
-+                      IF_RTCD(&cpi->common.rtcd.variance));
- 
-                     cpi->summed_quality += frame_ssim2 * weight;
-                     cpi->summed_weights += weight;
- 
-                     if (cpi->oxcf.number_of_layers > 1)
-                     {
-                          int i;
- 
-@@ -5043,17 +5043,17 @@ int vp8_get_compressed_data(VP8_COMP *cp
-                     }
-                 }
-             }
- 
-             if (cpi->b_calculate_ssimg)
-             {
-                 double y, u, v, frame_all;
-                 frame_all =  vp8_calc_ssimg(cpi->Source, cm->frame_to_show,
--                    &y, &u, &v, IF_RTCD(&cpi->rtcd.variance));
-+                    &y, &u, &v, IF_RTCD(&cpi->common.rtcd.variance));
- 
-                 if (cpi->oxcf.number_of_layers > 1)
-                 {
-                     int i;
- 
-                     for (i=cpi->current_layer;
-                          i<cpi->oxcf.number_of_layers; i++)
-                     {
-diff --git a/media/libvpx/vp8/encoder/onyx_int.h b/media/libvpx/vp8/encoder/onyx_int.h
---- a/media/libvpx/vp8/encoder/onyx_int.h
-+++ b/media/libvpx/vp8/encoder/onyx_int.h
-@@ -13,17 +13,17 @@
- #define __INC_VP8_INT_H
- 
- #include <stdio.h>
- #include "vpx_config.h"
- #include "vp8/common/onyx.h"
- #include "treewriter.h"
- #include "tokenize.h"
- #include "vp8/common/onyxc_int.h"
--#include "variance.h"
-+#include "vp8/common/variance.h"
- #include "dct.h"
- #include "encodemb.h"
- #include "quantize.h"
- #include "vp8/common/entropy.h"
- #include "vp8/common/threading.h"
- #include "vpx_ports/mem.h"
- #include "vpx/internal/vpx_codec_internal.h"
- #include "mcomp.h"
-@@ -220,17 +220,16 @@ typedef struct
-     int ithread;
-     void *ptr1;
- } LPFTHREAD_DATA;
- 
- 
- typedef struct VP8_ENCODER_RTCD
- {
-     VP8_COMMON_RTCD            *common;
--    vp8_variance_rtcd_vtable_t  variance;
-     vp8_fdct_rtcd_vtable_t      fdct;
-     vp8_encodemb_rtcd_vtable_t  encodemb;
-     vp8_quantize_rtcd_vtable_t  quantize;
-     vp8_search_rtcd_vtable_t    search;
-     vp8_temporal_rtcd_vtable_t  temporal;
- } VP8_ENCODER_RTCD;
- 
- enum
-diff --git a/media/libvpx/vp8/encoder/pickinter.c b/media/libvpx/vp8/encoder/pickinter.c
---- a/media/libvpx/vp8/encoder/pickinter.c
-+++ b/media/libvpx/vp8/encoder/pickinter.c
-@@ -16,17 +16,17 @@
- #include "encodeintra.h"
- #include "vp8/common/entropymode.h"
- #include "pickinter.h"
- #include "vp8/common/findnearmv.h"
- #include "encodemb.h"
- #include "vp8/common/reconinter.h"
- #include "vp8/common/reconintra.h"
- #include "vp8/common/reconintra4x4.h"
--#include "variance.h"
-+#include "vp8/common/variance.h"
- #include "mcomp.h"
- #include "rdopt.h"
- #include "vpx_mem/vpx_mem.h"
- 
- #if CONFIG_RUNTIME_CPU_DETECT
- #define IF_RTCD(x) (x)
- #else
- #define IF_RTCD(x)  NULL
-@@ -90,42 +90,16 @@ static int get_inter_mbpred_error(MACROB
-     else
-     {
-         return vfp->vf(what, what_stride, in_what, in_what_stride, sse);
-     }
- 
- }
- 
- 
--unsigned int vp8_get4x4sse_cs_c
--(
--    const unsigned char *src_ptr,
--    int  source_stride,
--    const unsigned char *ref_ptr,
--    int  recon_stride
--)
--{
--    int distortion = 0;
--    int r, c;
--
--    for (r = 0; r < 4; r++)
--    {
--        for (c = 0; c < 4; c++)
--        {
--            int diff = src_ptr[c] - ref_ptr[c];
--            distortion += diff * diff;
--        }
--
--        src_ptr += source_stride;
--        ref_ptr += recon_stride;
--    }
--
--    return distortion;
--}
--
- static int get_prediction_error(BLOCK *be, BLOCKD *b, const vp8_variance_rtcd_vtable_t *rtcd)
- {
-     unsigned char *sptr;
-     unsigned char *dptr;
-     sptr = (*(be->base_src) + be->src);
-     dptr = b->predictor;
- 
-     return VARIANCE_INVOKE(rtcd, get4x4sse_cs)(sptr, be->src_stride, dptr, 16);
-@@ -153,17 +127,17 @@ static int pick_intra4x4block(
-     for (mode = B_DC_PRED; mode <= B_HE_PRED /*B_HU_PRED*/; mode++)
-     {
-         int this_rd;
- 
-         rate = mode_costs[mode];
-         RECON_INVOKE(&rtcd->common->recon, intra4x4_predict)
-                      (*(b->base_dst) + b->dst, b->dst_stride,
-                       mode, b->predictor, 16);
--        distortion = get_prediction_error(be, b, &rtcd->variance);
-+        distortion = get_prediction_error(be, b, &rtcd->common->variance);
-         this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
- 
-         if (this_rd < best_rd)
-         {
-             *bestrate = rate;
-             *bestdistortion = distortion;
-             best_rd = this_rd;
-             *best_mode = mode;
-@@ -671,17 +645,17 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, 
-             if (distortion2 == INT_MAX)
-             {
-                 this_rd = INT_MAX;
-             }
-             else
-             {
-                 rate2 += rate;
-                 distortion2 = VARIANCE_INVOKE
--                                (&cpi->rtcd.variance, var16x16)(
-+                                (&cpi->common.rtcd.variance, var16x16)(
-                                     *(b->base_src), b->src_stride,
-                                     x->e_mbd.predictor, 16, &sse);
-                 this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
- 
-                 if (this_rd < best_intra_rd)
-                 {
-                     best_intra_rd = this_rd;
-                     *returnintra = distortion2;
-@@ -696,17 +670,17 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, 
-             break;
- 
-         case DC_PRED:
-         case V_PRED:
-         case H_PRED:
-         case TM_PRED:
-             RECON_INVOKE(&cpi->common.rtcd.recon, build_intra_predictors_mby)
-                 (&x->e_mbd);
--            distortion2 = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16)
-+            distortion2 = VARIANCE_INVOKE(&cpi->common.rtcd.variance, var16x16)
-                                           (*(b->base_src), b->src_stride,
-                                           x->e_mbd.predictor, 16, &sse);
-             rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
-             this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
- 
-             if (this_rd < best_intra_rd)
-             {
-                 best_intra_rd = this_rd;
-@@ -933,17 +907,17 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, 
- 
-             this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
- 
-             if (sse < x->encode_breakout)
-             {
-                 // Check u and v to make sure skip is ok
-                 int sse2 = 0;
- 
--                sse2 = VP8_UVSSE(x, IF_RTCD(&cpi->rtcd.variance));
-+                sse2 = VP8_UVSSE(x, IF_RTCD(&cpi->common.rtcd.variance));
- 
-                 if (sse2 * 2 < x->encode_breakout)
-                     x->skip = 1;
-                 else
-                     x->skip = 0;
-             }
- 
-             break;
-@@ -1067,17 +1041,17 @@ void vp8_pick_intra_mode(VP8_COMP *cpi, 
- 
-     pick_intra_mbuv_mode(x);
- 
-     for (mode = DC_PRED; mode <= TM_PRED; mode ++)
-     {
-         x->e_mbd.mode_info_context->mbmi.mode = mode;
-         RECON_INVOKE(&cpi->common.rtcd.recon, build_intra_predictors_mby)
-             (&x->e_mbd);
--        distortion = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16)
-+        distortion = VARIANCE_INVOKE(&cpi->common.rtcd.variance, var16x16)
-             (*(b->base_src), b->src_stride, x->e_mbd.predictor, 16, &sse);
-         rate = x->mbmode_cost[x->e_mbd.frame_type][mode];
-         this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
- 
-         if (error16x16 > this_rd)
-         {
-             error16x16 = this_rd;
-             best_mode = mode;
-diff --git a/media/libvpx/vp8/encoder/picklpf.c b/media/libvpx/vp8/encoder/picklpf.c
---- a/media/libvpx/vp8/encoder/picklpf.c
-+++ b/media/libvpx/vp8/encoder/picklpf.c
-@@ -179,30 +179,30 @@ void vp8cx_pick_filter_level_fast(YV12_B
- 
-     // Get the err using the previous frame's filter value.
- 
-     /* Copy the unfiltered / processed recon buffer to the new buffer */
-     vp8_yv12_copy_partial_frame_ptr(saved_frame, cm->frame_to_show);
-     vp8_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
- 
-     best_err = calc_partial_ssl_err(sd, cm->frame_to_show,
--                                    IF_RTCD(&cpi->rtcd.variance));
-+                                    IF_RTCD(&cpi->common.rtcd.variance));
- 
-     filt_val -= 1 + (filt_val > 10);
- 
-     // Search lower filter levels
-     while (filt_val >= min_filter_level)
-     {
-         // Apply the loop filter
-         vp8_yv12_copy_partial_frame_ptr(saved_frame, cm->frame_to_show);
-         vp8_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
- 
-         // Get the err for filtered frame
-         filt_err = calc_partial_ssl_err(sd, cm->frame_to_show,
--                                        IF_RTCD(&cpi->rtcd.variance));
-+                                        IF_RTCD(&cpi->common.rtcd.variance));
- 
-         // Update the best case record or exit loop.
-         if (filt_err < best_err)
-         {
-             best_err = filt_err;
-             best_filt_val = filt_val;
-         }
-         else
-@@ -224,17 +224,17 @@ void vp8cx_pick_filter_level_fast(YV12_B
-         {
-             // Apply the loop filter
-             vp8_yv12_copy_partial_frame_ptr(saved_frame, cm->frame_to_show);
- 
-             vp8_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
- 
-             // Get the err for filtered frame
-             filt_err = calc_partial_ssl_err(sd, cm->frame_to_show,
--                                            IF_RTCD(&cpi->rtcd.variance));
-+                                            IF_RTCD(&cpi->common.rtcd.variance));
- 
-             // Update the best case record or exit loop.
-             if (filt_err < best_err)
-             {
-                 // Do not raise filter level if improvement is < 1 part in 4096
-                 best_err = filt_err - (filt_err >> 10);
- 
-                 best_filt_val = filt_val;
-@@ -318,17 +318,17 @@ void vp8cx_pick_filter_level(YV12_BUFFER
- 
-     /* Copy the unfiltered / processed recon buffer to the new buffer */
-     vp8_yv12_copy_y_ptr(saved_frame, cm->frame_to_show);
- 
-     vp8cx_set_alt_lf_level(cpi, filt_mid);
-     vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_mid);
- 
-     best_err = vp8_calc_ss_err(sd, cm->frame_to_show,
--                               IF_RTCD(&cpi->rtcd.variance));
-+                               IF_RTCD(&cpi->common.rtcd.variance));
- 
-     ss_err[filt_mid] = best_err;
- 
-     filt_best = filt_mid;
- 
-     while (filter_step > 0)
-     {
-         Bias = (best_err >> (15 - (filt_mid / 8))) * filter_step; //PGW change 12/12/06 for small images
-@@ -345,17 +345,17 @@ void vp8cx_pick_filter_level(YV12_BUFFER
-             if(ss_err[filt_low] == 0)
-             {
-                 // Get Low filter error score
-                 vp8_yv12_copy_y_ptr(saved_frame, cm->frame_to_show);
-                 vp8cx_set_alt_lf_level(cpi, filt_low);
-                 vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_low);
- 
-                 filt_err = vp8_calc_ss_err(sd, cm->frame_to_show,
--                                           IF_RTCD(&cpi->rtcd.variance));
-+                                           IF_RTCD(&cpi->common.rtcd.variance));
-                 ss_err[filt_low] = filt_err;
-             }
-             else
-                 filt_err = ss_err[filt_low];
- 
-             // If value is close to the best so far then bias towards a lower loop filter value.
-             if ((filt_err - Bias) < best_err)
-             {
-@@ -372,17 +372,17 @@ void vp8cx_pick_filter_level(YV12_BUFFER
-         {
-             if(ss_err[filt_high] == 0)
-             {
-                 vp8_yv12_copy_y_ptr(saved_frame, cm->frame_to_show);
-                 vp8cx_set_alt_lf_level(cpi, filt_high);
-                 vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_high);
- 
-                 filt_err = vp8_calc_ss_err(sd, cm->frame_to_show,
--                                           IF_RTCD(&cpi->rtcd.variance));
-+                                           IF_RTCD(&cpi->common.rtcd.variance));
-                 ss_err[filt_high] = filt_err;
-             }
-             else
-                 filt_err = ss_err[filt_high];
- 
-             // Was it better than the previous best?
-             if (filt_err < (best_err - Bias))
-             {
-diff --git a/media/libvpx/vp8/encoder/rdopt.c b/media/libvpx/vp8/encoder/rdopt.c
---- a/media/libvpx/vp8/encoder/rdopt.c
-+++ b/media/libvpx/vp8/encoder/rdopt.c
-@@ -23,17 +23,17 @@
- #include "vp8/common/entropymode.h"
- #include "vp8/common/reconinter.h"
- #include "vp8/common/reconintra.h"
- #include "vp8/common/reconintra4x4.h"
- #include "vp8/common/findnearmv.h"
- #include "encodemb.h"
- #include "quantize.h"
- #include "vp8/common/idct.h"
--#include "variance.h"
-+#include "vp8/common/variance.h"
- #include "mcomp.h"
- #include "rdopt.h"
- #include "vpx_mem/vpx_mem.h"
- #include "dct.h"
- #include "vp8/common/systemdependent.h"
- 
- #if CONFIG_RUNTIME_CPU_DETECT
- #define IF_RTCD(x)  (x)
-@@ -2132,30 +2132,30 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cp
-                 unsigned int sse;
-                 unsigned int var;
-                 int threshold = (xd->block[0].dequant[1]
-                             * xd->block[0].dequant[1] >>4);
- 
-                 if(threshold < x->encode_breakout)
-                     threshold = x->encode_breakout;
- 
--                var = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16)
-+                var = VARIANCE_INVOKE(&cpi->common.rtcd.variance, var16x16)
-                         (*(b->base_src), b->src_stride,
-                         x->e_mbd.predictor, 16, &sse);
- 
-                 if (sse < threshold)
-                 {
-                      unsigned int q2dc = xd->block[24].dequant[0];
-                     /* If theres is no codeable 2nd order dc
-                        or a very small uniform pixel change change */
-                     if ((sse - var < q2dc * q2dc >>4) ||
-                         (sse /2 > var && sse-var < 64))
-                     {
-                         // Check u and v to make sure skip is ok
--                        int sse2=  VP8_UVSSE(x, IF_RTCD(&cpi->rtcd.variance));
-+                        int sse2=  VP8_UVSSE(x, IF_RTCD(&cpi->common.rtcd.variance));
-                         if (sse2 * 2 < threshold)
-                         {
-                             x->skip = 1;
-                             distortion2 = sse + sse2;
-                             rate2 = 500;
- 
-                             /* for best_yrd calculation */
-                             rate_uv = 0;
-diff --git a/media/libvpx/vp8/encoder/x86/x86_csystemdependent.c b/media/libvpx/vp8/encoder/x86/x86_csystemdependent.c
---- a/media/libvpx/vp8/encoder/x86/x86_csystemdependent.c
-+++ b/media/libvpx/vp8/encoder/x86/x86_csystemdependent.c
-@@ -6,17 +6,16 @@
-  *  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 "vpx_config.h"
- #include "vpx_ports/x86.h"
--#include "vp8/encoder/variance.h"
- #include "vp8/encoder/onyx_int.h"
- 
- 
- #if HAVE_MMX
- void vp8_short_fdct8x4_mmx(short *input, short *output, int pitch)
- {
-     vp8_short_fdct4x4_mmx(input,   output,    pitch);
-     vp8_short_fdct4x4_mmx(input + 4, output + 16, pitch);
-@@ -122,43 +121,16 @@ void vp8_arch_x86_encoder_init(VP8_COMP 
-      * you modify any of the function mappings present in this file, be sure
-      * to also update them in static mapings (<arch>/filename_<arch>.h)
-      */
- 
-     /* Override default functions with fastest ones for this CPU. */
- #if HAVE_MMX
-     if (flags & HAS_MMX)
-     {
--        cpi->rtcd.variance.sad16x16              = vp8_sad16x16_mmx;
--        cpi->rtcd.variance.sad16x8               = vp8_sad16x8_mmx;
--        cpi->rtcd.variance.sad8x16               = vp8_sad8x16_mmx;
--        cpi->rtcd.variance.sad8x8                = vp8_sad8x8_mmx;
--        cpi->rtcd.variance.sad4x4                = vp8_sad4x4_mmx;
--
--        cpi->rtcd.variance.var4x4                = vp8_variance4x4_mmx;
--        cpi->rtcd.variance.var8x8                = vp8_variance8x8_mmx;
--        cpi->rtcd.variance.var8x16               = vp8_variance8x16_mmx;
--        cpi->rtcd.variance.var16x8               = vp8_variance16x8_mmx;
--        cpi->rtcd.variance.var16x16              = vp8_variance16x16_mmx;
--
--        cpi->rtcd.variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_mmx;
--        cpi->rtcd.variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_mmx;
--        cpi->rtcd.variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_mmx;
--        cpi->rtcd.variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_mmx;
--        cpi->rtcd.variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_mmx;
--        cpi->rtcd.variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_mmx;
--        cpi->rtcd.variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_mmx;
--        cpi->rtcd.variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_mmx;
--        cpi->rtcd.variance.subpixmse16x16        = vp8_sub_pixel_mse16x16_mmx;
--
--        cpi->rtcd.variance.mse16x16              = vp8_mse16x16_mmx;
--        cpi->rtcd.variance.getmbss               = vp8_get_mb_ss_mmx;
--
--        cpi->rtcd.variance.get4x4sse_cs          = vp8_get4x4sse_cs_mmx;
--
-         cpi->rtcd.fdct.short4x4                  = vp8_short_fdct4x4_mmx;
-         cpi->rtcd.fdct.short8x4                  = vp8_short_fdct8x4_mmx;
-         cpi->rtcd.fdct.fast4x4                   = vp8_short_fdct4x4_mmx;
-         cpi->rtcd.fdct.fast8x4                   = vp8_short_fdct8x4_mmx;
- 
-         cpi->rtcd.fdct.walsh_short4x4            = vp8_short_walsh4x4_c;
- 
-         cpi->rtcd.encodemb.berr                  = vp8_block_error_mmx;
-@@ -170,44 +142,16 @@ void vp8_arch_x86_encoder_init(VP8_COMP 
- 
-         /*cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_mmx;*/
-     }
- #endif
- 
- #if HAVE_SSE2
-     if (flags & HAS_SSE2)
-     {
--        cpi->rtcd.variance.sad16x16              = vp8_sad16x16_wmt;
--        cpi->rtcd.variance.sad16x8               = vp8_sad16x8_wmt;
--        cpi->rtcd.variance.sad8x16               = vp8_sad8x16_wmt;
--        cpi->rtcd.variance.sad8x8                = vp8_sad8x8_wmt;
--        cpi->rtcd.variance.sad4x4                = vp8_sad4x4_wmt;
--        cpi->rtcd.variance.copy32xn              = vp8_copy32xn_sse2;
--
--        cpi->rtcd.variance.var4x4                = vp8_variance4x4_wmt;
--        cpi->rtcd.variance.var8x8                = vp8_variance8x8_wmt;
--        cpi->rtcd.variance.var8x16               = vp8_variance8x16_wmt;
--        cpi->rtcd.variance.var16x8               = vp8_variance16x8_wmt;
--        cpi->rtcd.variance.var16x16              = vp8_variance16x16_wmt;
--
--        cpi->rtcd.variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_wmt;
--        cpi->rtcd.variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_wmt;
--        cpi->rtcd.variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_wmt;
--        cpi->rtcd.variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_wmt;
--        cpi->rtcd.variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_wmt;
--        cpi->rtcd.variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_wmt;
--        cpi->rtcd.variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_wmt;
--        cpi->rtcd.variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_wmt;
--        cpi->rtcd.variance.subpixmse16x16        = vp8_sub_pixel_mse16x16_wmt;
--
--        cpi->rtcd.variance.mse16x16              = vp8_mse16x16_wmt;
--        cpi->rtcd.variance.getmbss               = vp8_get_mb_ss_sse2;
--
--        /* cpi->rtcd.variance.get4x4sse_cs  not implemented for wmt */;
--
-         cpi->rtcd.fdct.short4x4                  = vp8_short_fdct4x4_sse2;
-         cpi->rtcd.fdct.short8x4                  = vp8_short_fdct8x4_sse2;
-         cpi->rtcd.fdct.fast4x4                   = vp8_short_fdct4x4_sse2;
-         cpi->rtcd.fdct.fast8x4                   = vp8_short_fdct8x4_sse2;
- 
-         cpi->rtcd.fdct.walsh_short4x4            = vp8_short_walsh4x4_sse2 ;
- 
-         cpi->rtcd.encodemb.berr                  = vp8_block_error_xmm;
-@@ -219,69 +163,40 @@ void vp8_arch_x86_encoder_init(VP8_COMP 
- 
-         cpi->rtcd.quantize.quantb                = vp8_regular_quantize_b_sse2;
-         cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_sse2;
- 
- #if !(CONFIG_REALTIME_ONLY)
-         cpi->rtcd.temporal.apply                 = vp8_temporal_filter_apply_sse2;
- #endif
- 
--#if CONFIG_INTERNAL_STATS
--#if ARCH_X86_64
--        cpi->rtcd.variance.ssimpf_8x8            = vp8_ssim_parms_8x8_sse2;
--        cpi->rtcd.variance.ssimpf_16x16          = vp8_ssim_parms_16x16_sse2;
--#endif
--#endif
-     }
- #endif
- 
- #if HAVE_SSE3
-     if (flags & HAS_SSE3)
-     {
--        cpi->rtcd.variance.sad16x16              = vp8_sad16x16_sse3;
--        cpi->rtcd.variance.sad16x16x3            = vp8_sad16x16x3_sse3;
--        cpi->rtcd.variance.sad16x8x3             = vp8_sad16x8x3_sse3;
--        cpi->rtcd.variance.sad8x16x3             = vp8_sad8x16x3_sse3;
--        cpi->rtcd.variance.sad8x8x3              = vp8_sad8x8x3_sse3;
--        cpi->rtcd.variance.sad4x4x3              = vp8_sad4x4x3_sse3;
-         cpi->rtcd.search.full_search             = vp8_full_search_sadx3;
--        cpi->rtcd.variance.sad16x16x4d           = vp8_sad16x16x4d_sse3;
--        cpi->rtcd.variance.sad16x8x4d            = vp8_sad16x8x4d_sse3;
--        cpi->rtcd.variance.sad8x16x4d            = vp8_sad8x16x4d_sse3;
--        cpi->rtcd.variance.sad8x8x4d             = vp8_sad8x8x4d_sse3;
--        cpi->rtcd.variance.sad4x4x4d             = vp8_sad4x4x4d_sse3;
--        cpi->rtcd.variance.copy32xn              = vp8_copy32xn_sse3;
-         cpi->rtcd.search.diamond_search          = vp8_diamond_search_sadx4;
-         cpi->rtcd.search.refining_search         = vp8_refining_search_sadx4;
-     }
- #endif
- 
- #if HAVE_SSSE3
-     if (flags & HAS_SSSE3)
-     {
--        cpi->rtcd.variance.sad16x16x3            = vp8_sad16x16x3_ssse3;
--        cpi->rtcd.variance.sad16x8x3             = vp8_sad16x8x3_ssse3;
--
--        cpi->rtcd.variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_ssse3;
--        cpi->rtcd.variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_ssse3;
--
-         cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_ssse3;
-     }
- #endif
- 
- 
- 
- #if HAVE_SSE4_1
-     if (flags & HAS_SSE4_1)
-     {
--        cpi->rtcd.variance.sad16x16x8            = vp8_sad16x16x8_sse4;
--        cpi->rtcd.variance.sad16x8x8             = vp8_sad16x8x8_sse4;
--        cpi->rtcd.variance.sad8x16x8             = vp8_sad8x16x8_sse4;
--        cpi->rtcd.variance.sad8x8x8              = vp8_sad8x8x8_sse4;
--        cpi->rtcd.variance.sad4x4x8              = vp8_sad4x4x8_sse4;
-         cpi->rtcd.search.full_search             = vp8_full_search_sadx8;
- 
-         cpi->rtcd.quantize.quantb                = vp8_regular_quantize_b_sse4;
-     }
- #endif
- 
- #endif
- }
deleted file mode 100644
--- a/media/libvpx/I3915d597.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-# HG changeset patch
-# Parent 0d104ba08fe98d5024014fbf45af06100ef7b6f9
-# User Timothy B. Terriberry <tterribe@vt.edu>
-Align internal mfqe framebuffer dimensions
-
-Upstream Change-Id: I3915d597cd66886a24f4ef39752751ebe6425066
-
-diff --git a/media/libvpx/vp8/common/postproc.c b/media/libvpx/vp8/common/postproc.c
---- a/media/libvpx/vp8/common/postproc.c
-+++ b/media/libvpx/vp8/common/postproc.c
-@@ -938,20 +938,26 @@ int vp8_post_proc_frame(VP8_COMMON *oci,
-         return 0;
-     }
- 
-     /* Allocate post_proc_buffer_int if needed */
-     if ((flags & VP8D_MFQE) && !oci->post_proc_buffer_int_used)
-     {
-         if ((flags & VP8D_DEBLOCK) || (flags & VP8D_DEMACROBLOCK))
-         {
--            if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer_int, oci->Width, oci->Height, VP8BORDERINPIXELS) >= 0)
--            {
--                oci->post_proc_buffer_int_used = 1;
--            }
-+            int width = (oci->Width + 15) & ~15;
-+            int height = (oci->Height + 15) & ~15;
-+
-+            if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer_int,
-+                                            width, height, VP8BORDERINPIXELS))
-+                vpx_internal_error(&oci->error, VPX_CODEC_MEM_ERROR,
-+                                   "Failed to allocate MFQE framebuffer");
-+
-+            oci->post_proc_buffer_int_used = 1;
-+
-             // insure that postproc is set to all 0's so that post proc
-             // doesn't pull random data in from edge
-             vpx_memset((&oci->post_proc_buffer_int)->buffer_alloc,126,(&oci->post_proc_buffer)->frame_size);
- 
-         }
-     }
- 
- #if ARCH_X86||ARCH_X86_64
deleted file mode 100644
--- a/media/libvpx/I42ab00e3.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-# HG changeset patch
-# Parent 5668c50552abba043eff64ffc5d8abde43d7964a
-# User Timothy B. Terriberry <tterribe@vt.edu>
-Support Android x86 NDK build
-
-Upstream Change-Id: I42ab00e3255208ba95d7f9b9a8a3605ff58da8e1
-
-diff --git a/media/libvpx/vp8/common/x86/postproc_x86.c b/media/libvpx/vp8/common/x86/postproc_x86.c
-new file mode 100644
---- /dev/null
-+++ b/media/libvpx/vp8/common/x86/postproc_x86.c
-@@ -0,0 +1,21 @@
-+/*
-+ *  Copyright (c) 2012 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.
-+ */
-+
-+/* On Android NDK, rand is inlined function, but postproc needs rand symbol */
-+#if defined(__ANDROID__)
-+#define rand __rand
-+#include <stdlib.h>
-+#undef rand
-+
-+extern int rand(void)
-+{
-+  return __rand();
-+}
-+#endif
deleted file mode 100644
--- a/media/libvpx/I6f2b218d.patch
+++ /dev/null
@@ -1,348 +0,0 @@
-# HG changeset patch
-# Parent d02aa133060bcdfd44634038c8c28654c718c2ff
-# User Timothy B. Terriberry <tterribe@vt.edu>
-remove __inline for compiler compatibility
-
-Upstream Change-Id: I6f2b218dfc808b73212bbb90c69e2b6cc1fa90ce
-
-diff --git a/media/libvpx/vp8/common/loopfilter_filters.c b/media/libvpx/vp8/common/loopfilter_filters.c
---- a/media/libvpx/vp8/common/loopfilter_filters.c
-+++ b/media/libvpx/vp8/common/loopfilter_filters.c
-@@ -10,50 +10,50 @@
- 
- 
- #include <stdlib.h>
- #include "loopfilter.h"
- #include "onyxc_int.h"
- 
- typedef unsigned char uc;
- 
--static __inline signed char vp8_signed_char_clamp(int t)
-+static signed char vp8_signed_char_clamp(int t)
- {
-     t = (t < -128 ? -128 : t);
-     t = (t > 127 ? 127 : t);
-     return (signed char) t;
- }
- 
- 
- /* should we apply any filter at all ( 11111111 yes, 00000000 no) */
--static __inline signed char vp8_filter_mask(uc limit, uc blimit,
--                                     uc p3, uc p2, uc p1, uc p0,
--                                     uc q0, uc q1, uc q2, uc q3)
-+static signed char vp8_filter_mask(uc limit, uc blimit,
-+                            uc p3, uc p2, uc p1, uc p0,
-+                            uc q0, uc q1, uc q2, uc q3)
- {
-     signed char mask = 0;
-     mask |= (abs(p3 - p2) > limit);
-     mask |= (abs(p2 - p1) > limit);
-     mask |= (abs(p1 - p0) > limit);
-     mask |= (abs(q1 - q0) > limit);
-     mask |= (abs(q2 - q1) > limit);
-     mask |= (abs(q3 - q2) > limit);
-     mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2  > blimit);
-     return mask - 1;
- }
- 
- /* is there high variance internal edge ( 11111111 yes, 00000000 no) */
--static __inline signed char vp8_hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1)
-+static signed char vp8_hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1)
- {
-     signed char hev = 0;
-     hev  |= (abs(p1 - p0) > thresh) * -1;
-     hev  |= (abs(q1 - q0) > thresh) * -1;
-     return hev;
- }
- 
--static __inline void vp8_filter(signed char mask, uc hev, uc *op1,
-+static void vp8_filter(signed char mask, uc hev, uc *op1,
-         uc *op0, uc *oq0, uc *oq1)
- 
- {
-     signed char ps0, qs0;
-     signed char ps1, qs1;
-     signed char vp8_filter, Filter1, Filter2;
-     signed char u;
- 
-@@ -153,17 +153,17 @@ void vp8_loop_filter_vertical_edge_c
- 
-         vp8_filter(mask, hev, s - 2, s - 1, s, s + 1);
- 
-         s += p;
-     }
-     while (++i < count * 8);
- }
- 
--static __inline void vp8_mbfilter(signed char mask, uc hev,
-+static void vp8_mbfilter(signed char mask, uc hev,
-                            uc *op2, uc *op1, uc *op0, uc *oq0, uc *oq1, uc *oq2)
- {
-     signed char s, u;
-     signed char vp8_filter, Filter1, Filter2;
-     signed char ps2 = (signed char) * op2 ^ 0x80;
-     signed char ps1 = (signed char) * op1 ^ 0x80;
-     signed char ps0 = (signed char) * op0 ^ 0x80;
-     signed char qs0 = (signed char) * oq0 ^ 0x80;
-@@ -274,27 +274,27 @@ void vp8_mbloop_filter_vertical_edge_c
- 
-         s += p;
-     }
-     while (++i < count * 8);
- 
- }
- 
- /* should we apply any filter at all ( 11111111 yes, 00000000 no) */
--static __inline signed char vp8_simple_filter_mask(uc blimit, uc p1, uc p0, uc q0, uc q1)
-+static signed char vp8_simple_filter_mask(uc blimit, uc p1, uc p0, uc q0, uc q1)
- {
- /* Why does this cause problems for win32?
-  * error C2143: syntax error : missing ';' before 'type'
-  *  (void) limit;
-  */
-     signed char mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2  <= blimit) * -1;
-     return mask;
- }
- 
--static __inline void vp8_simple_filter(signed char mask, uc *op1, uc *op0, uc *oq0, uc *oq1)
-+static void vp8_simple_filter(signed char mask, uc *op1, uc *op0, uc *oq0, uc *oq1)
- {
-     signed char vp8_filter, Filter1, Filter2;
-     signed char p1 = (signed char) * op1 ^ 0x80;
-     signed char p0 = (signed char) * op0 ^ 0x80;
-     signed char q0 = (signed char) * oq0 ^ 0x80;
-     signed char q1 = (signed char) * oq1 ^ 0x80;
-     signed char u;
- 
-diff --git a/media/libvpx/vp8/common/onyx.h b/media/libvpx/vp8/common/onyx.h
---- a/media/libvpx/vp8/common/onyx.h
-+++ b/media/libvpx/vp8/common/onyx.h
-@@ -67,17 +67,17 @@ extern "C"
-     {
-         FRAMEFLAGS_KEY    = 1,
-         FRAMEFLAGS_GOLDEN = 2,
-         FRAMEFLAGS_ALTREF = 4,
-     } FRAMETYPE_FLAGS;
- 
- 
- #include <assert.h>
--    static __inline void Scale2Ratio(int mode, int *hr, int *hs)
-+    static void Scale2Ratio(int mode, int *hr, int *hs)
-     {
-         switch (mode)
-         {
-         case    NORMAL:
-             *hr = 1;
-             *hs = 1;
-             break;
-         case    FOURFIVE:
-diff --git a/media/libvpx/vp8/encoder/encodemv.c b/media/libvpx/vp8/encoder/encodemv.c
---- a/media/libvpx/vp8/encoder/encodemv.c
-+++ b/media/libvpx/vp8/encoder/encodemv.c
-@@ -181,17 +181,17 @@ void vp8_build_component_cost_table(int 
- 
- // Motion vector probability table update depends on benefit.
- // Small correction allows for the fact that an update to an MV probability
- // may have benefit in subsequent frames as well as the current one.
- 
- #define MV_PROB_UPDATE_CORRECTION   -1
- 
- 
--__inline static void calc_prob(vp8_prob *p, const unsigned int ct[2])
-+static void calc_prob(vp8_prob *p, const unsigned int ct[2])
- {
-     const unsigned int tot = ct[0] + ct[1];
- 
-     if (tot)
-     {
-         const vp8_prob x = ((ct[0] * 255) / tot) & -2;
-         *p = x ? x : 1;
-     }
-diff --git a/media/libvpx/vp8/encoder/rdopt.c b/media/libvpx/vp8/encoder/rdopt.c
---- a/media/libvpx/vp8/encoder/rdopt.c
-+++ b/media/libvpx/vp8/encoder/rdopt.c
-@@ -1326,17 +1326,17 @@ static void rd_check_segment(VP8_COMP *c
-         {
-             bsi->mvs[i].as_mv = x->partition_info->bmi[i].mv.as_mv;
-             bsi->modes[i] = x->partition_info->bmi[i].mode;
-             bsi->eobs[i] = x->e_mbd.eobs[i];
-         }
-     }
- }
- 
--static __inline
-+static
- void vp8_cal_step_param(int sr, int *sp)
- {
-     int step = 0;
- 
-     if (sr > MAX_FIRST_STEP) sr = MAX_FIRST_STEP;
-     else if (sr < 1) sr = 1;
- 
-     while (sr>>=1)
-diff --git a/media/libvpx/vp8/encoder/sad_c.c b/media/libvpx/vp8/encoder/sad_c.c
---- a/media/libvpx/vp8/encoder/sad_c.c
-+++ b/media/libvpx/vp8/encoder/sad_c.c
-@@ -34,17 +34,17 @@ unsigned int vp8_sad16x16_c(
-         src_ptr += src_stride;
-         ref_ptr += ref_stride;
-     }
- 
-     return sad;
- }
- 
- 
--static __inline
-+static
- unsigned int sad_mx_n_c(
-     const unsigned char *src_ptr,
-     int  src_stride,
-     const unsigned char *ref_ptr,
-     int  ref_stride,
-     int m,
-     int n)
- {
-diff --git a/media/libvpx/vp8/encoder/tokenize.c b/media/libvpx/vp8/encoder/tokenize.c
---- a/media/libvpx/vp8/encoder/tokenize.c
-+++ b/media/libvpx/vp8/encoder/tokenize.c
-@@ -480,17 +480,17 @@ void print_context_counters()
- 
- 
- void vp8_tokenize_initialize()
- {
-     fill_value_tokens();
- }
- 
- 
--static __inline void stuff2nd_order_b
-+static void stuff2nd_order_b
- (
-     TOKENEXTRA **tp,
-     ENTROPY_CONTEXT *a,
-     ENTROPY_CONTEXT *l,
-     VP8_COMP *cpi
- )
- {
-     int pt; /* near block/prev token context index */
-@@ -504,17 +504,17 @@ static __inline void stuff2nd_order_b
-     ++t;
- 
-     *tp = t;
-     pt = 0;
-     *a = *l = pt;
- 
- }
- 
--static __inline void stuff1st_order_b
-+static void stuff1st_order_b
- (
-     TOKENEXTRA **tp,
-     ENTROPY_CONTEXT *a,
-     ENTROPY_CONTEXT *l,
-     int type,
-     VP8_COMP *cpi
- )
- {
-@@ -528,17 +528,17 @@ static __inline void stuff1st_order_b
-     t->skip_eob_node = 0;
-     ++cpi->coef_counts       [type] [band] [pt] [DCT_EOB_TOKEN];
-     ++t;
-     *tp = t;
-     pt = 0; /* 0 <-> all coeff data is zero */
-     *a = *l = pt;
- 
- }
--static __inline
-+static
- void stuff1st_order_buv
- (
-     TOKENEXTRA **tp,
-     ENTROPY_CONTEXT *a,
-     ENTROPY_CONTEXT *l,
-     VP8_COMP *cpi
- )
- {
-diff --git a/media/libvpx/vp8/encoder/treewriter.h b/media/libvpx/vp8/encoder/treewriter.h
---- a/media/libvpx/vp8/encoder/treewriter.h
-+++ b/media/libvpx/vp8/encoder/treewriter.h
-@@ -37,28 +37,28 @@ typedef BOOL_CODER vp8_writer;
- 
- #define vp8_cost_bit( x, b) vp8_cost_zero( (b)?  vp8_complement(x) : (x) )
- 
- /* VP8BC version is scaled by 2^20 rather than 2^8; see bool_coder.h */
- 
- 
- /* Both of these return bits, not scaled bits. */
- 
--static __inline unsigned int vp8_cost_branch(const unsigned int ct[2], vp8_prob p)
-+static unsigned int vp8_cost_branch(const unsigned int ct[2], vp8_prob p)
- {
-     /* Imitate existing calculation */
- 
-     return ((ct[0] * vp8_cost_zero(p))
-             + (ct[1] * vp8_cost_one(p))) >> 8;
- }
- 
- /* Small functions to write explicit values and tokens, as well as
-    estimate their lengths. */
- 
--static __inline void vp8_treed_write
-+static void vp8_treed_write
- (
-     vp8_writer *const w,
-     vp8_tree t,
-     const vp8_prob *const p,
-     int v,
-     int n               /* number of bits in v, assumed nonzero */
- )
- {
-@@ -67,28 +67,28 @@ static __inline void vp8_treed_write
-     do
-     {
-         const int b = (v >> --n) & 1;
-         vp8_write(w, b, p[i>>1]);
-         i = t[i+b];
-     }
-     while (n);
- }
--static __inline void vp8_write_token
-+static void vp8_write_token
- (
-     vp8_writer *const w,
-     vp8_tree t,
-     const vp8_prob *const p,
-     vp8_token *const x
- )
- {
-     vp8_treed_write(w, t, p, x->value, x->Len);
- }
- 
--static __inline int vp8_treed_cost(
-+static int vp8_treed_cost(
-     vp8_tree t,
-     const vp8_prob *const p,
-     int v,
-     int n               /* number of bits in v, assumed nonzero */
- )
- {
-     int c = 0;
-     vp8_tree_index i = 0;
-@@ -98,17 +98,17 @@ static __inline int vp8_treed_cost(
-         const int b = (v >> --n) & 1;
-         c += vp8_cost_bit(p[i>>1], b);
-         i = t[i+b];
-     }
-     while (n);
- 
-     return c;
- }
--static __inline int vp8_cost_token
-+static int vp8_cost_token
- (
-     vp8_tree t,
-     const vp8_prob *const p,
-     vp8_token *const x
- )
- {
-     return vp8_treed_cost(t, p, x->value, x->Len);
- }
deleted file mode 100644
--- a/media/libvpx/I8a35831e.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-# HG changeset patch
-# Parent 919fe109d4a2e1768470d78c59d5b8ecc1a34a53
-# User Timothy B. Terriberry <tterribe@vt.edu>
-fix potential use of uninitialized rate_y
-
-Upstream Change-Id: I8a35831e8f08b549806d0c2c6900d42af883f78f
-
-diff --git a/media/libvpx/vp8/encoder/rdopt.c b/media/libvpx/vp8/encoder/rdopt.c
---- a/media/libvpx/vp8/encoder/rdopt.c
-+++ b/media/libvpx/vp8/encoder/rdopt.c
-@@ -742,17 +742,17 @@ static int rd_pick_intra4x4mby_modes(VP8
-         if(total_rd >= (int64_t)best_rd)
-             break;
-     }
- 
-     if(total_rd >= (int64_t)best_rd)
-         return INT_MAX;
- 
-     *Rate = cost;
--    *rate_y += tot_rate_y;
-+    *rate_y = tot_rate_y;
-     *Distortion = distortion;
- 
-     return RDCOST(mb->rdmult, mb->rddiv, cost, distortion);
- }
- 
- 
- static int rd_pick_intra16x16mby_mode(VP8_COMP *cpi,
-                                       MACROBLOCK *x,
deleted file mode 100644
--- a/media/libvpx/I9713c9f0.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-# HG changeset patch
-# Parent d0bb669a2e26f138d416333b21f55151503dcdf9
-# User Timothy B. Terriberry <tterribe@vt.edu>
-decoder: reset segmentation map on keyframes
-
-Upstream Change-Id: I9713c9f070eb37b31b3b029d9ef96be9b6ea2def
-
-diff --git a/media/libvpx/vp8/decoder/decodframe.c b/media/libvpx/vp8/decoder/decodframe.c
---- a/media/libvpx/vp8/decoder/decodframe.c
-+++ b/media/libvpx/vp8/decoder/decodframe.c
-@@ -830,16 +830,22 @@ int vp8_decode_frame(VP8D_COMP *pbi)
-             for (i = 0; i < MB_FEATURE_TREE_PROBS; i++)
-             {
-                 /* If not explicitly set value is defaulted to 255 by memset above */
-                 if (vp8_read_bit(bc))
-                     xd->mb_segment_tree_probs[i] = (vp8_prob)vp8_read_literal(bc, 8);
-             }
-         }
-     }
-+    else
-+    {
-+        /* No segmentation updates on this frame */
-+        xd->update_mb_segmentation_map = 0;
-+        xd->update_mb_segmentation_data = 0;
-+    }
- 
-     /* Read the loop filter level and type */
-     pc->filter_type = (LOOPFILTERTYPE) vp8_read_bit(bc);
-     pc->filter_level = vp8_read_literal(bc, 6);
-     pc->sharpness_level = vp8_read_literal(bc, 3);
- 
-     /* Read in loop filter deltas applied at the MB level based on mode or ref frame. */
-     xd->mode_ref_lf_delta_update = 0;
--- a/media/libvpx/Makefile.in
+++ b/media/libvpx/Makefile.in
@@ -1,402 +1,126 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-LOCAL_INCLUDES += \
-  -I. \
-  -I$(topsrcdir)/media/libvpx \
-  -I$(topsrcdir)/media/libvpx/vp8/ \
-  -I$(topsrcdir)/media/libvpx/vp8/common/ \
-  -I$(topsrcdir)/media/libvpx/vp8/common/arm \
-  -I$(topsrcdir)/media/libvpx/vp8/common/x86 \
-  -I$(topsrcdir)/media/libvpx/vp8/decoder \
-  -I$(topsrcdir)/media/libvpx/vp8/decoder/arm \
-  -I$(topsrcdir)/media/libvpx/vp8/decoder/x86 \
-  -I$(topsrcdir)/media/libvpx/vpx_codec \
-  -I$(topsrcdir)/media/libvpx/vpx_mem/ \
-  -I$(topsrcdir)/media/libvpx/vpx_mem/include \
-  -I$(topsrcdir)/media/libvpx/vpx_ports/ \
-  -I$(topsrcdir)/media/libvpx/vpx_scale/ \
-  $(NULL)
-
-VPATH += \
-  $(srcdir)/build/make \
-  $(srcdir)/vpx \
-  $(srcdir)/vpx/src \
-  $(srcdir)/vpx_mem \
-  $(srcdir)/vpx_mem/include \
-  $(srcdir)/vpx_ports \
-  $(srcdir)/vpx_scale \
-  $(srcdir)/vpx_scale/arm \
-  $(srcdir)/vpx_scale/arm/neon \
-  $(srcdir)/vpx_scale/generic \
-  $(srcdir)/vp8 \
-  $(srcdir)/vp8/common \
-  $(srcdir)/vp8/common/arm \
-  $(srcdir)/vp8/common/arm/armv6 \
-  $(srcdir)/vp8/common/arm/neon \
-  $(srcdir)/vp8/common/generic \
-  $(srcdir)/vp8/common/x86 \
-  $(srcdir)/vp8/decoder \
-  $(srcdir)/vp8/decoder/arm \
-  $(srcdir)/vp8/decoder/arm/armv6 \
-  $(srcdir)/vp8/decoder/arm/neon \
-  $(srcdir)/vp8/decoder/generic \
-  $(srcdir)/vp8/decoder/x86 \
-  $(NULL)
-
 #Setup the libvpx assembler config.
 AS=$(VPX_AS)
 ASFLAGS=$(VPX_ASFLAGS) -I. -I$(topsrcdir)/media/libvpx/ -I$(topsrcdir)/media/libvpx/vpx_ports/
 AS_DASH_C_FLAG=$(VPX_DASH_C_FLAG)
 ASM_SUFFIX=$(VPX_ASM_SUFFIX)
 
-ifdef MOZ_VP8_ERROR_CONCEALMENT
-CSRCS += \
-  error_concealment.c \
-  $(NULL)
-endif
-
-ifdef MOZ_VP8_ENCODER
-VPATH += \
-  $(srcdir)/vp8/encoder \
-  $(srcdir)/vp8/encoder/arm \
-  $(srcdir)/vp8/encoder/arm/armv5te \
-  $(srcdir)/vp8/encoder/arm/armv6 \
-  $(srcdir)/vp8/encoder/arm/neon \
-  $(srcdir)/vp8/encoder/generic \
-  $(srcdir)/vp8/encoder/x86 \
-  $(srcdir)/vpx_scale/arm \
-  $(srcdir)/vpx_scale/arm/neon \
-  $(NULL)
-
-CSRCS += \
-  vp8_cx_iface.c \
-  bitstream.c \
-  dct.c \
-  encodeframe.c \
-  encodeintra.c \
-  encodemb.c \
-  encodemv.c \
-  ethreading.c \
-  firstpass.c \
-  lookahead.c \
-  mcomp.c \
-  modecosts.c \
-  mr_dissim.c \
-  onyx_if.c \
-  pickinter.c \
-  picklpf.c \
-  psnr.c \
-  quantize.c \
-  ratectrl.c \
-  rdopt.c \
-  segmentation.c \
-  temporal_filter.c \
-  tokenize.c \
-  treewriter.c \
-  csystemdependent.c \
-  $(NULL)
-endif
-
-ifdef VPX_X86_ASM
-# Building on an x86 platform with a supported assembler, include
-# the optimized assembly in the build.
-
-CSRCS += \
-  filter_x86.c \
-  idct_blk_mmx.c \
-  idct_blk_sse2.c \
-  loopfilter_x86.c \
-  postproc_x86.c \
-  recon_wrapper_sse2.c \
-  variance_mmx.c \
-  variance_sse2.c \
-  variance_ssse3.c \
-  vp8_asm_stubs.c \
-  x86_systemdependent.c \
-  x86_dsystemdependent.c \
-  $(NULL)
-
-ASFILES += \
-  dequantize_mmx.asm \
-  idctllm_mmx.asm \
-  idctllm_sse2.asm \
-  iwalsh_mmx.asm \
-  iwalsh_sse2.asm \
-  loopfilter_mmx.asm \
-  loopfilter_sse2.asm \
-  postproc_mmx.asm \
-  postproc_sse2.asm \
-  recon_mmx.asm \
-  recon_sse2.asm \
-  sad_mmx.asm \
-  sad_sse2.asm \
-  sad_sse3.asm \
-  sad_sse4.asm \
-  sad_ssse3.asm \
-  subpixel_mmx.asm \
-  subpixel_sse2.asm \
-  subpixel_ssse3.asm \
-  variance_impl_mmx.asm \
-  variance_impl_sse2.asm \
-  variance_impl_ssse3.asm \
-  emms.asm \
-  $(NULL)
-
-ifeq (64,$(findstring 64,$(OS_TEST)))
-ASFILES += loopfilter_block_sse2.asm
-endif
-
-ifdef MOZ_VP8_ENCODER
-
-CSRCS += \
-  x86_csystemdependent.c \
-  $(NULL)
-
-# Files which depend on asm_enc_offsets.asm
-VPX_ASM_ENC_OFFSETS_SRCS = \
-  quantize_sse2.asm \
-  quantize_sse4.asm \
-  quantize_ssse3.asm \
-  $(NULL)
-
-ASFILES += \
-  dct_mmx.asm \
-  dct_sse2.asm \
-  encodeopt.asm \
-  fwalsh_sse2.asm \
-  quantize_mmx.asm \
-  subtract_mmx.asm \
-  subtract_sse2.asm \
-  temporal_filter_apply_sse2.asm \
-  $(VPX_ASM_ENC_OFFSETS_SRCS) \
-  $(NULL)
-
-endif
-
-endif
-
 ifdef VPX_ARM_ASM
 # Building on an ARM platform with a supported assembler, include
 # the optimized assembly in the build.
 
 ifeq ($(OS_TARGET),Android)
 # For cpu-features.h
 LOCAL_INCLUDES += -I$(ANDROID_NDK)/sources/android/cpufeatures
 ifndef MOZ_WEBRTC
 # For cpu-features.c
 VPATH += $(ANDROID_NDK)/sources/android/cpufeatures
 CSRCS += cpu-features.c
 endif
 endif
 
-CSRCS += \
-  arm_cpudetect.c \
-  arm_systemdependent.c \
-  bilinearfilter_arm.c \
-  dequantize_arm.c \
-  filter_arm.c \
-  loopfilter_arm.c \
-  reconintra_arm.c \
-  variance_arm.c \
-  idct_blk_v6.c \
-  idct_blk_neon.c \
-  arm_dsystemdependent.c \
-  arm_scalesystemdependent.c \
-  yv12extend_arm.c \
-  $(NULL)
-
-# Files which depend on asm_com_offsets.asm
-VPX_ASM_COM_OFFSETS_SRCS = \
-  vp8_vpxyv12_copy_y_neon.asm \
-  vp8_vpxyv12_copyframe_func_neon.asm \
-  vp8_vpxyv12_extendframeborders_neon.asm \
-  $(NULL)
+ASM_OFFSETS = asm_com_offsets.asm
+ifdef MOZ_VP8_ENCODER
+ASM_OFFSETS += asm_enc_offsets.asm
+endif
 
-VPX_ASFILES = \
-  bilinearfilter_v6.asm \
-  copymem16x16_v6.asm \
-  copymem8x4_v6.asm \
-  copymem8x8_v6.asm \
-  dc_only_idct_add_v6.asm \
-  dequant_idct_v6.asm \
-  dequantize_v6.asm \
-  filter_v6.asm \
-  idct_v6.asm \
-  intra4x4_predict_v6.asm \
-  iwalsh_v6.asm \
-  loopfilter_v6.asm \
-  simpleloopfilter_v6.asm \
-  sixtappredict8x4_v6.asm \
-  bilinearpredict16x16_neon.asm \
-  bilinearpredict4x4_neon.asm \
-  bilinearpredict8x4_neon.asm \
-  bilinearpredict8x8_neon.asm \
-  buildintrapredictorsmby_neon.asm \
-  copymem16x16_neon.asm \
-  copymem8x4_neon.asm \
-  copymem8x8_neon.asm \
-  dc_only_idct_add_neon.asm \
-  dequant_idct_neon.asm \
-  dequantizeb_neon.asm \
-  idct_dequant_0_2x_neon.asm \
-  idct_dequant_full_2x_neon.asm \
-  iwalsh_neon.asm \
-  loopfilter_neon.asm \
-  loopfiltersimplehorizontaledge_neon.asm \
-  loopfiltersimpleverticaledge_neon.asm \
-  mbloopfilter_neon.asm \
-  save_neon_reg.asm \
-  vp8_mse16x16_armv6.asm \
-  vp8_sad16x16_armv6.asm \
-  vp8_variance16x16_armv6.asm \
-  vp8_variance8x8_armv6.asm \
-  vp8_variance_halfpixvar16x16_h_armv6.asm \
-  vp8_variance_halfpixvar16x16_hv_armv6.asm \
-  vp8_variance_halfpixvar16x16_v_armv6.asm \
-  shortidct4x4llm_neon.asm \
-  sad16_neon.asm \
-  sad8_neon.asm \
-  sixtappredict16x16_neon.asm \
-  sixtappredict4x4_neon.asm \
-  sixtappredict8x4_neon.asm \
-  sixtappredict8x8_neon.asm \
-  variance_neon.asm \
-  vp8_mse16x16_neon.asm \
-  vp8_subpixelvariance8x8_neon.asm \
-  vp8_subpixelvariance16x16_neon.asm \
-  vp8_subpixelvariance16x16s_neon.asm \
-  $(VPX_ASM_COM_OFFSETS_SRCS) \
-  $(NULL)
-
-ifdef MOZ_VP8_ENCODER
-CSRCS += \
-  arm_csystemdependent.c \
-  boolhuff_arm.c \
-  dct_arm.c \
-  picklpf_arm.c \
-  $(NULL)
-
-# Files which depend on asm_enc_offsets.asm
-VPX_ASM_ENC_OFFSETS_SRCS = \
-  boolhuff_armv5te.asm \
-  vp8_packtokens_armv5.asm \
-  vp8_packtokens_mbrow_armv5.asm \
-  vp8_packtokens_partitions_armv5.asm \
-  vp8_fast_quantize_b_armv6.asm \
-  vp8_subtract_armv6.asm \
-  fastquantizeb_neon.asm \
-  subtract_neon.asm \
-  $(NULL)
-
-VPX_ASFILES += \
-  vp8_short_fdct4x4_armv6.asm \
-  walsh_v6.asm \
-  shortfdct_neon.asm \
-  vp8_memcpy_neon.asm \
-  vp8_shortwalsh4x4_neon.asm \
-  $(VPX_ASM_ENC_OFFSETS_SRCS) \
-  $(NULL)
-
-endif
 
 ifdef VPX_AS_CONVERSION
 # The ARM asm is written in ARM RVCT syntax, but we actually build it with
 # gas using GNU syntax. Add some rules to perform the conversion.
-VPX_CONVERTED_ASFILES = $(addsuffix .$(ASM_SUFFIX), $(VPX_ASFILES))
 
-ASFILES += $(VPX_CONVERTED_ASFILES)
-GARBAGE += $(VPX_CONVERTED_ASFILES)
+GENERATED_DIRS += $(dir $(ASFILES))
 
-%.asm.$(ASM_SUFFIX): %.asm
+%.asm.$(ASM_SUFFIX): %.asm $(ASM_OFFSETS)
 	$(VPX_AS_CONVERSION) < $< > $@
-else
-ASFILES += $(VPX_ASFILES)
-endif
 
-else
-ifdef MOZ_VP8_ENCODER
-# boolhuff_armv5te.asm defines the same functions as boolhuff.c instead of
-# using RTCD, so we have to make sure we only add one of the two.
-CSRCS += boolhuff.c
 endif
 endif
 
 ifdef VPX_NEED_OBJ_INT_EXTRACT
 
 # We don't have a compiler that supports a compatible inline asm syntax, so we
 # have to resort to extracting asm offsets from a compiled object. This only
 # works if we have the appropriate system headers obj_int_extract needs to
 # parse that format, and so only has limited support for cross-compilation.
 
 ifdef VPX_ARM_ASM
 VPX_OIE_FORMAT := rvds
 else
 VPX_OIE_FORMAT := gas
 endif
 
-CSRCS += asm_com_offsets.c
-
 GARBAGE += asm_com_offsets.$(OBJ_SUFFIX) asm_com_offsets.asm
 
 ifdef MOZ_VP8_ENCODER
-CSRCS += asm_enc_offsets.c
 
 GARBAGE += asm_enc_offsets.$(OBJ_SUFFIX) asm_enc_offsets.asm
 endif
 
 else
 
 # We can extract the asm offsets directly from generated assembly using inline
 # asm. This is the preferred method.
 
 asm_com_offsets.s: CFLAGS += -DINLINE_ASM
 
 OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU'
 
 # This rule, as well as the rule for asm_enc_offsets.s further below are here
 # because the generic rule in rules.mk was made to not be implicit, and we
 # can't put the C files in CSRCS.
-asm_com_offsets.s: asm_com_offsets.c
+asm_com_offsets.s: $(srcdir)/vp8/common/asm_com_offsets.c
 	$(REPORT_BUILD)
 	$(CC) -S $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
 
 asm_com_offsets.asm: asm_com_offsets.s
 	grep $(OFFSET_PATTERN) $< | sed -e 's/[$$\#]//g' \
 	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
 
 GARBAGE += asm_com_offsets.s asm_com_offsets.asm
 
 ifdef MOZ_VP8_ENCODER
 
 asm_enc_offsets.s: CFLAGS += -DINLINE_ASM
 
-asm_enc_offsets.s: asm_enc_offsets.c
+asm_enc_offsets.s: $(srcdir)/vp8/encoder/asm_enc_offsets.c
 	$(REPORT_BUILD)
 	$(CC) -S $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
 
 asm_enc_offsets.asm: asm_enc_offsets.s
 	grep $(OFFSET_PATTERN) $< | sed -e 's/[$$\#]//g' \
 	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
 
 GARBAGE += asm_enc_offsets.s asm_enc_offsets.asm
 
+
 endif
 
 endif
 
 EXTRA_MDDEPEND_FILES = asm_enc_offsets.s.pp asm_enc_offsets.$(OBJ_SUFFIX).pp asm_com_offsets.s.pp asm_com_offsets.$(OBJ_SUFFIX).pp
 
 include $(topsrcdir)/config/rules.mk
 
 # This must be after rules.mk in order to use $(OBJ_SUFFIX) outside a
 # recursively-expanded variable.
+
+ifndef _MSC_VER
+%_sse2.$(OBJ_SUFFIX): CFLAGS += -msse2
+endif
+
+quantize_sse2.$(OBJ_SUFFIX): asm_enc_offsets.asm
+quantize_sse4.$(OBJ_SUFFIX): asm_enc_offsets.asm
+quantize_ssse3.$(OBJ_SUFFIX): asm_enc_offsets.asm
+
 ifdef VPX_NEED_OBJ_INT_EXTRACT
 
 # only for MSVC
 ifdef _MSC_VER
 NO_PROFILE_GUIDED_OPTIMIZE := asm_com_offsets.c
 endif
 
 asm_com_offsets.asm: asm_com_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM)
@@ -419,29 +143,16 @@ asm_enc_offsets.asm: asm_enc_offsets.$(O
 
 # Filter out this object, because we don't want to link against it.
 # It was generated solely so it could be parsed by obj_int_extract.
 OBJS := $(filter-out asm_enc_offsets.$(OBJ_SUFFIX),$(OBJS))
 
 endif
 endif
 
-# These dependencies are not generated automatically, so do it manually.
-ifdef VPX_AS_CONVERSION
-$(addsuffix .$(OBJ_SUFFIX), $(VPX_ASM_COM_OFFSETS_SRCS)): asm_com_offsets.asm
-ifdef MOZ_VP8_ENCODER
-$(addsuffix .$(OBJ_SUFFIX), $(VPX_ASM_ENC_OFFSETS_SRCS)): asm_enc_offsets.asm
-endif
-else
-$(patsubst %.$(ASM_SUFFIX),%.$(OBJ_SUFFIX), $(VPX_ASM_COM_OFFSETS_SRCS)): asm_com_offsets.asm
-ifdef MOZ_VP8_ENCODER
-$(patsubst %.$(ASM_SUFFIX),%.$(OBJ_SUFFIX), $(VPX_ASM_ENC_OFFSETS_SRCS)): asm_enc_offsets.asm
-endif
-endif
-
 # Workaround a bug of Sun Studio (CR 6963410)
 ifdef SOLARIS_SUNPRO_CC
 ifeq (86,$(findstring 86,$(OS_TEST)))
 filter.o: filter.c Makefile.in
 	$(REPORT_BUILD)
 	@$(MAKE_DEPS_AUTO_CC)
 	$(CC) -o $@ -c $(patsubst -xO[45],-xO3,$(COMPILE_CFLAGS)) $<
 endif
--- a/media/libvpx/README_MOZILLA
+++ b/media/libvpx/README_MOZILLA
@@ -1,2 +1,2 @@
-Using the v0.9.5 release pulled from
-http://webm.googlecode.com/files/libvpx-v0.9.5.zip
+Using the v1.2.0 release pulled from
+http://webm.googlecode.com/files/libvpx-v1.2.0.zip
deleted file mode 100644
--- a/media/libvpx/bug640935.patch
+++ /dev/null
@@ -1,317 +0,0 @@
-diff --git a/media/libvpx/vp8/common/arm/arm_systemdependent.c b/media/libvpx/vp8/common/arm/arm_systemdependent.c
---- a/media/libvpx/vp8/common/arm/arm_systemdependent.c
-+++ b/media/libvpx/vp8/common/arm/arm_systemdependent.c
-@@ -14,24 +14,16 @@
- #include "g_common.h"
- #include "pragmas.h"
- #include "subpixel.h"
- #include "loopfilter.h"
- #include "recon.h"
- #include "idct.h"
- #include "onyxc_int.h"
- 
--extern void (*vp8_build_intra_predictors_mby_ptr)(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x);
--
--extern void (*vp8_build_intra_predictors_mby_s_ptr)(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x);
--
- void vp8_arch_arm_common_init(VP8_COMMON *ctx)
- {
- #if CONFIG_RUNTIME_CPU_DETECT
-     VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
-     int flags = arm_cpu_caps();
-     int has_edsp = flags & HAS_EDSP;
-     int has_media = flags & HAS_MEDIA;
-     int has_neon = flags & HAS_NEON;
-@@ -101,36 +93,17 @@ void vp8_arch_arm_common_init(VP8_COMMON
- 
-         rtcd->recon.copy16x16   = vp8_copy_mem16x16_neon;
-         rtcd->recon.copy8x8     = vp8_copy_mem8x8_neon;
-         rtcd->recon.copy8x4     = vp8_copy_mem8x4_neon;
-         rtcd->recon.recon       = vp8_recon_b_neon;
-         rtcd->recon.recon2      = vp8_recon2b_neon;
-         rtcd->recon.recon4      = vp8_recon4b_neon;
-         rtcd->recon.recon_mb    = vp8_recon_mb_neon;
--
-+        rtcd->recon.build_intra_predictors_mby =
-+            vp8_build_intra_predictors_mby_neon;
-+        rtcd->recon.build_intra_predictors_mby_s =
-+            vp8_build_intra_predictors_mby_s_neon;
-     }
- #endif
- 
- #endif
--
--#if HAVE_ARMV6
--#if CONFIG_RUNTIME_CPU_DETECT
--    if (has_media)
--#endif
--    {
--        vp8_build_intra_predictors_mby_ptr = vp8_build_intra_predictors_mby;
--        vp8_build_intra_predictors_mby_s_ptr = vp8_build_intra_predictors_mby_s;
--    }
--#endif
--
--#if HAVE_ARMV7
--#if CONFIG_RUNTIME_CPU_DETECT
--    if (has_neon)
--#endif
--    {
--        vp8_build_intra_predictors_mby_ptr =
--         vp8_build_intra_predictors_mby_neon;
--        vp8_build_intra_predictors_mby_s_ptr =
--         vp8_build_intra_predictors_mby_s_neon;
--    }
--#endif
- }
-diff --git a/media/libvpx/vp8/common/arm/recon_arm.h b/media/libvpx/vp8/common/arm/recon_arm.h
---- a/media/libvpx/vp8/common/arm/recon_arm.h
-+++ b/media/libvpx/vp8/common/arm/recon_arm.h
-@@ -48,16 +48,19 @@ extern prototype_recon_block(vp8_recon2b
- extern prototype_recon_block(vp8_recon4b_neon);
- 
- extern prototype_copy_block(vp8_copy_mem8x8_neon);
- extern prototype_copy_block(vp8_copy_mem8x4_neon);
- extern prototype_copy_block(vp8_copy_mem16x16_neon);
- 
- extern prototype_recon_macroblock(vp8_recon_mb_neon);
- 
-+extern prototype_build_intra_predictors(vp8_build_intra_predictors_mby_neon);
-+extern prototype_build_intra_predictors(vp8_build_intra_predictors_mby_s_neon);
-+
- #if !CONFIG_RUNTIME_CPU_DETECT
- #undef  vp8_recon_recon
- #define vp8_recon_recon vp8_recon_b_neon
- 
- #undef  vp8_recon_recon2
- #define vp8_recon_recon2 vp8_recon2b_neon
- 
- #undef  vp8_recon_recon4
-@@ -69,12 +72,19 @@ extern prototype_recon_macroblock(vp8_re
- #undef  vp8_recon_copy8x4
- #define vp8_recon_copy8x4 vp8_copy_mem8x4_neon
- 
- #undef  vp8_recon_copy16x16
- #define vp8_recon_copy16x16 vp8_copy_mem16x16_neon
- 
- #undef  vp8_recon_recon_mb
- #define vp8_recon_recon_mb vp8_recon_mb_neon
-+
-+#undef  vp8_recon_build_intra_predictors_mby
-+#define vp8_recon_build_intra_predictors_mby vp8_build_intra_predictors_mby_neon
-+
-+#undef  vp8_recon_build_intra_predictors_mby_s
-+#define vp8_recon_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s_neon
-+
- #endif
- #endif
- 
- #endif
-diff --git a/media/libvpx/vp8/common/generic/systemdependent.c b/media/libvpx/vp8/common/generic/systemdependent.c
---- a/media/libvpx/vp8/common/generic/systemdependent.c
-+++ b/media/libvpx/vp8/common/generic/systemdependent.c
-@@ -15,22 +15,16 @@
- #include "loopfilter.h"
- #include "recon.h"
- #include "idct.h"
- #include "onyxc_int.h"
- 
- extern void vp8_arch_x86_common_init(VP8_COMMON *ctx);
- extern void vp8_arch_arm_common_init(VP8_COMMON *ctx);
- 
--void (*vp8_build_intra_predictors_mby_ptr)(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby(MACROBLOCKD *x);
--
--void (*vp8_build_intra_predictors_mby_s_ptr)(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x);
--
- void vp8_machine_specific_config(VP8_COMMON *ctx)
- {
- #if CONFIG_RUNTIME_CPU_DETECT
-     VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
- 
-     rtcd->idct.idct1        = vp8_short_idct4x4llm_1_c;
-     rtcd->idct.idct16       = vp8_short_idct4x4llm_c;
-     rtcd->idct.idct1_scalar_add = vp8_dc_only_idct_add_c;
-@@ -40,16 +34,20 @@ void vp8_machine_specific_config(VP8_COM
-     rtcd->recon.copy16x16   = vp8_copy_mem16x16_c;
-     rtcd->recon.copy8x8     = vp8_copy_mem8x8_c;
-     rtcd->recon.copy8x4     = vp8_copy_mem8x4_c;
-     rtcd->recon.recon       = vp8_recon_b_c;
-     rtcd->recon.recon2      = vp8_recon2b_c;
-     rtcd->recon.recon4      = vp8_recon4b_c;
-     rtcd->recon.recon_mb    = vp8_recon_mb_c;
-     rtcd->recon.recon_mby   = vp8_recon_mby_c;
-+    rtcd->recon.build_intra_predictors_mby =
-+        vp8_build_intra_predictors_mby;
-+    rtcd->recon.build_intra_predictors_mby_s =
-+        vp8_build_intra_predictors_mby_s;
- 
-     rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_c;
-     rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_c;
-     rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_c;
-     rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_c;
-     rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_c;
-     rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_c;
-     rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_c;
-@@ -68,19 +66,16 @@ void vp8_machine_specific_config(VP8_COM
-     rtcd->postproc.down        = vp8_mbpost_proc_down_c;
-     rtcd->postproc.across      = vp8_mbpost_proc_across_ip_c;
-     rtcd->postproc.downacross  = vp8_post_proc_down_and_across_c;
-     rtcd->postproc.addnoise    = vp8_plane_add_noise_c;
-     rtcd->postproc.blend_mb    = vp8_blend_mb_c;
- #endif
- 
- #endif
--    /* Pure C: */
--    vp8_build_intra_predictors_mby_ptr = vp8_build_intra_predictors_mby;
--    vp8_build_intra_predictors_mby_s_ptr = vp8_build_intra_predictors_mby_s;
- 
- #if ARCH_X86 || ARCH_X86_64
-     vp8_arch_x86_common_init(ctx);
- #endif
- 
- #if ARCH_ARM
-     vp8_arch_arm_common_init(ctx);
- #endif
-diff --git a/media/libvpx/vp8/common/recon.h b/media/libvpx/vp8/common/recon.h
---- a/media/libvpx/vp8/common/recon.h
-+++ b/media/libvpx/vp8/common/recon.h
-@@ -18,16 +18,19 @@
-     void sym(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch)
- 
- #define prototype_recon_block(sym) \
-     void sym(unsigned char *pred, short *diff, unsigned char *dst, int pitch)
- 
- #define prototype_recon_macroblock(sym) \
-     void sym(const struct vp8_recon_rtcd_vtable *rtcd, MACROBLOCKD *x)
- 
-+#define prototype_build_intra_predictors(sym) \
-+    void sym(MACROBLOCKD *x)
-+
- struct vp8_recon_rtcd_vtable;
- 
- #if ARCH_X86 || ARCH_X86_64
- #include "x86/recon_x86.h"
- #endif
- 
- #if ARCH_ARM
- #include "arm/recon_arm.h"
-@@ -68,29 +71,45 @@ extern prototype_recon_block(vp8_recon_r
- #endif
- extern prototype_recon_macroblock(vp8_recon_recon_mb);
- 
- #ifndef vp8_recon_recon_mby
- #define vp8_recon_recon_mby vp8_recon_mby_c
- #endif
- extern prototype_recon_macroblock(vp8_recon_recon_mby);
- 
-+#ifndef vp8_recon_build_intra_predictors_mby
-+#define vp8_recon_build_intra_predictors_mby vp8_build_intra_predictors_mby
-+#endif
-+extern prototype_build_intra_predictors\
-+    (vp8_recon_build_intra_predictors_mby);
-+
-+#ifndef vp8_recon_build_intra_predictors_mby_s
-+#define vp8_recon_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s
-+#endif
-+extern prototype_build_intra_predictors\
-+    (vp8_recon_build_intra_predictors_mby_s);
-+
-+
- typedef prototype_copy_block((*vp8_copy_block_fn_t));
- typedef prototype_recon_block((*vp8_recon_fn_t));
- typedef prototype_recon_macroblock((*vp8_recon_mb_fn_t));
-+typedef prototype_build_intra_predictors((*vp8_build_intra_pred_fn_t));
- typedef struct vp8_recon_rtcd_vtable
- {
-     vp8_copy_block_fn_t  copy16x16;
-     vp8_copy_block_fn_t  copy8x8;
-     vp8_copy_block_fn_t  copy8x4;
-     vp8_recon_fn_t       recon;
-     vp8_recon_fn_t       recon2;
-     vp8_recon_fn_t       recon4;
-     vp8_recon_mb_fn_t    recon_mb;
-     vp8_recon_mb_fn_t    recon_mby;
-+    vp8_build_intra_pred_fn_t  build_intra_predictors_mby_s;
-+    vp8_build_intra_pred_fn_t  build_intra_predictors_mby;
- } vp8_recon_rtcd_vtable_t;
- 
- #if CONFIG_RUNTIME_CPU_DETECT
- #define RECON_INVOKE(ctx,fn) (ctx)->fn
- #else
- #define RECON_INVOKE(ctx,fn) vp8_recon_##fn
- #endif
- 
-diff --git a/media/libvpx/vp8/common/reconintra.h b/media/libvpx/vp8/common/reconintra.h
---- a/media/libvpx/vp8/common/reconintra.h
-+++ b/media/libvpx/vp8/common/reconintra.h
-@@ -9,21 +9,14 @@
-  */
- 
- 
- #ifndef __INC_RECONINTRA_H
- #define __INC_RECONINTRA_H
- 
- extern void init_intra_left_above_pixels(MACROBLOCKD *x);
- 
--extern void (*vp8_build_intra_predictors_mby_ptr)(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x);
--extern void (*vp8_build_intra_predictors_mby_s_ptr)(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x);
--extern void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x);
--
- extern void vp8_build_intra_predictors_mbuv(MACROBLOCKD *x);
- extern void vp8_build_intra_predictors_mbuv_s(MACROBLOCKD *x);
- 
- extern void vp8_predict_intra4x4(BLOCKD *x, int b_mode, unsigned char *Predictor);
- 
- #endif
-diff --git a/media/libvpx/vp8/decoder/decodframe.c b/media/libvpx/vp8/decoder/decodframe.c
---- a/media/libvpx/vp8/decoder/decodframe.c
-+++ b/media/libvpx/vp8/decoder/decodframe.c
-@@ -111,18 +111,18 @@ void mb_init_dequantizer(VP8D_COMP *pbi,
-  *  to dst buffer, we can write the result directly to dst buffer. This eliminates unnecessary copy.
-  */
- static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd)
- {
-     if (xd->frame_type == KEY_FRAME  ||  xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
-     {
- 
-         vp8_build_intra_predictors_mbuv_s(xd);
--        vp8_build_intra_predictors_mby_s_ptr(xd);
--
-+        RECON_INVOKE(&pbi->common.rtcd.recon,
-+                     build_intra_predictors_mby_s)(xd);
-     }
-     else
-     {
-         vp8_build_inter_predictors_mb_s(xd);
-     }
- }
- 
- static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
-@@ -210,17 +210,18 @@ void vp8_decode_macroblock(VP8D_COMP *pb
- 
-     /* do prediction */
-     if (xd->frame_type == KEY_FRAME  ||  xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
-     {
-         vp8_build_intra_predictors_mbuv(xd);
- 
-         if (xd->mode_info_context->mbmi.mode != B_PRED)
-         {
--            vp8_build_intra_predictors_mby_ptr(xd);
-+            RECON_INVOKE(&pbi->common.rtcd.recon,
-+                         build_intra_predictors_mby)(xd);
-         } else {
-             vp8_intra_prediction_down_copy(xd);
-         }
-     }
-     else
-     {
-         vp8_build_inter_predictors_mb(xd);
-     }
deleted file mode 100644
--- a/media/libvpx/bug646815.patch
+++ /dev/null
@@ -1,683 +0,0 @@
-diff --git a/media/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm b/media/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
---- a/media/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
-+++ b/media/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
-@@ -27,17 +27,17 @@
-     stmdb       sp!, {r4 - r11, lr}
-     str         r3, [sp, #-184]!            ;reserve space on stack for temporary storage, store yoffset
- 
-     cmp         r2, #0                      ;skip first_pass filter if xoffset=0
-     add         lr, sp, #4                  ;point to temporary buffer
-     beq         skip_firstpass_filter
- 
- ;first-pass filter
--    ldr         r12, _filter8_coeff_
-+    adr         r12, filter8_coeff
-     sub         r0, r0, r1, lsl #1
- 
-     add         r2, r12, r2, lsl #4         ;calculate filter location
-     add         r0, r0, #3                  ;adjust src only for loading convinience
- 
-     ldr         r3, [r2]                    ; load up packed filter coefficients
-     ldr         r4, [r2, #4]
-     ldr         r5, [r2, #8]
-@@ -116,17 +116,17 @@
- secondpass_filter
-     ldr         r3, [sp], #4                ; load back yoffset
-     ldr         r0, [sp, #216]              ; load dst address from stack 180+36
-     ldr         r1, [sp, #220]              ; load dst stride from stack 180+40
- 
-     cmp         r3, #0
-     beq         skip_secondpass_filter
- 
--    ldr         r12, _filter8_coeff_
-+    adr         r12, filter8_coeff
-     add         lr, r12, r3, lsl #4         ;calculate filter location
- 
-     mov         r2, #0x00080000
- 
-     ldr         r3, [lr]                    ; load up packed filter coefficients
-     ldr         r4, [lr, #4]
-     ldr         r5, [lr, #8]
- 
-@@ -242,18 +242,16 @@ skip_secondpass_hloop
- 
-     ENDP
- 
- ;-----------------
-     AREA    subpelfilters8_dat, DATA, READWRITE         ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_filter8_coeff_
--    DCD     filter8_coeff
- filter8_coeff
-     DCD     0x00000000,     0x00000080,     0x00000000,     0x00000000
-     DCD     0xfffa0000,     0x000c007b,     0x0000ffff,     0x00000000
-     DCD     0xfff50002,     0x0024006c,     0x0001fff8,     0x00000000
-     DCD     0xfff70000,     0x0032005d,     0x0000fffa,     0x00000000
-     DCD     0xfff00003,     0x004d004d,     0x0003fff0,     0x00000000
-     DCD     0xfffa0000,     0x005d0032,     0x0000fff7,     0x00000000
-     DCD     0xfff80001,     0x006c0024,     0x0002fff5,     0x00000000
-diff --git a/media/libvpx/vp8/common/arm/neon/bilinearpredict16x16_neon.asm b/media/libvpx/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
-@@ -20,17 +20,17 @@
- ; r2    int  xoffset,
- ; r3    int  yoffset,
- ; r4    unsigned char *dst_ptr,
- ; stack(r5) int  dst_pitch
- 
- |vp8_bilinear_predict16x16_neon| PROC
-     push            {r4-r5, lr}
- 
--    ldr             r12, _bifilter16_coeff_
-+    adr             r12, bifilter16_coeff
-     ldr             r4, [sp, #12]           ;load parameters from stack
-     ldr             r5, [sp, #16]           ;load parameters from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             secondpass_bfilter16x16_only
- 
-     add             r2, r12, r2, lsl #3     ;calculate filter location
- 
-@@ -349,14 +349,12 @@ filt_blk2d_spo16x16_loop_neon
- 
-     ENDP
- 
- ;-----------------
-     AREA    bifilters16_dat, DATA, READWRITE            ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_bifilter16_coeff_
--    DCD     bifilter16_coeff
- bifilter16_coeff
-     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
- 
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/bilinearpredict4x4_neon.asm b/media/libvpx/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
-@@ -20,17 +20,17 @@
- ; r2    int  xoffset,
- ; r3    int  yoffset,
- ; r4    unsigned char *dst_ptr,
- ; stack(lr) int  dst_pitch
- 
- |vp8_bilinear_predict4x4_neon| PROC
-     push            {r4, lr}
- 
--    ldr             r12, _bifilter4_coeff_
-+    adr             r12, bifilter4_coeff
-     ldr             r4, [sp, #8]            ;load parameters from stack
-     ldr             lr, [sp, #12]           ;load parameters from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             skip_firstpass_filter
- 
- ;First pass: output_height lines x output_width columns (5x4)
-     vld1.u8         {d2}, [r0], r1          ;load src data
-@@ -122,14 +122,12 @@ skip_secondpass_filter
- 
-     ENDP
- 
- ;-----------------
-     AREA    bilinearfilters4_dat, DATA, READWRITE           ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_bifilter4_coeff_
--    DCD     bifilter4_coeff
- bifilter4_coeff
-     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
- 
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/bilinearpredict8x4_neon.asm b/media/libvpx/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
-@@ -20,17 +20,17 @@
- ; r2    int  xoffset,
- ; r3    int  yoffset,
- ; r4    unsigned char *dst_ptr,
- ; stack(lr) int  dst_pitch
- 
- |vp8_bilinear_predict8x4_neon| PROC
-     push            {r4, lr}
- 
--    ldr             r12, _bifilter8x4_coeff_
-+    adr             r12, bifilter8x4_coeff
-     ldr             r4, [sp, #8]            ;load parameters from stack
-     ldr             lr, [sp, #12]           ;load parameters from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             skip_firstpass_filter
- 
- ;First pass: output_height lines x output_width columns (5x8)
-     add             r2, r12, r2, lsl #3     ;calculate filter location
-@@ -127,14 +127,12 @@ skip_secondpass_filter
- 
-     ENDP
- 
- ;-----------------
-     AREA    bifilters8x4_dat, DATA, READWRITE           ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_bifilter8x4_coeff_
--    DCD     bifilter8x4_coeff
- bifilter8x4_coeff
-     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
- 
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/bilinearpredict8x8_neon.asm b/media/libvpx/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
-@@ -20,17 +20,17 @@
- ; r2    int  xoffset,
- ; r3    int  yoffset,
- ; r4    unsigned char *dst_ptr,
- ; stack(lr) int  dst_pitch
- 
- |vp8_bilinear_predict8x8_neon| PROC
-     push            {r4, lr}
- 
--    ldr             r12, _bifilter8_coeff_
-+    adr             r12, bifilter8_coeff
-     ldr             r4, [sp, #8]            ;load parameters from stack
-     ldr             lr, [sp, #12]           ;load parameters from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             skip_firstpass_filter
- 
- ;First pass: output_height lines x output_width columns (9x8)
-     add             r2, r12, r2, lsl #3     ;calculate filter location
-@@ -175,14 +175,12 @@ skip_secondpass_filter
- 
-     ENDP
- 
- ;-----------------
-     AREA    bifilters8_dat, DATA, READWRITE         ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_bifilter8_coeff_
--    DCD     bifilter8_coeff
- bifilter8_coeff
-     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
- 
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/loopfilter_neon.asm b/media/libvpx/vp8/common/arm/neon/loopfilter_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/loopfilter_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/loopfilter_neon.asm
-@@ -303,17 +303,17 @@
- ; q4    p2
- ; q5    p1
- ; q6    p0
- ; q7    q0
- ; q8    q1
- ; q9    q2
- ; q10   q3
- |vp8_loop_filter_neon| PROC
--    ldr         r12, _lf_coeff_
-+    adr         r12, lf_coeff
- 
-     ; vp8_filter_mask
-     vabd.u8     q11, q3, q4                 ; abs(p3 - p2)
-     vabd.u8     q12, q4, q5                 ; abs(p2 - p1)
-     vabd.u8     q13, q5, q6                 ; abs(p1 - p0)
-     vabd.u8     q14, q8, q7                 ; abs(q1 - q0)
-     vabd.u8     q3, q9, q8                  ; abs(q2 - q1)
-     vabd.u8     q4, q10, q9                 ; abs(q3 - q2)
-@@ -393,17 +393,15 @@
-     veor        q6, q11, q0                 ; *op0 = u^0x80
-     veor        q7, q10, q0                 ; *oq0 = u^0x80
-     veor        q8, q12, q0                 ; *oq1 = u^0x80
- 
-     bx          lr
-     ENDP        ; |vp8_loop_filter_horizontal_edge_y_neon|
- 
-     AREA    loopfilter_dat, DATA, READONLY
--_lf_coeff_
--    DCD     lf_coeff
- lf_coeff
-     DCD     0x80808080, 0x80808080, 0x80808080, 0x80808080
-     DCD     0x03030303, 0x03030303, 0x03030303, 0x03030303
-     DCD     0x04040404, 0x04040404, 0x04040404, 0x04040404
-     DCD     0x01010101, 0x01010101, 0x01010101, 0x01010101
- 
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm b/media/libvpx/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
-@@ -23,17 +23,17 @@
- ; r2    const signed char *flimit,
- ; r3    const signed char *limit,
- ; stack(r4) const signed char *thresh,
- ; //stack(r5)   int count --unused
- 
- |vp8_loop_filter_simple_horizontal_edge_neon| PROC
-     sub         r0, r0, r1, lsl #1          ; move src pointer down by 2 lines
- 
--    ldr         r12, _lfhy_coeff_
-+    adr         r12, lfhy_coeff
-     vld1.u8     {q5}, [r0], r1              ; p1
-     vld1.s8     {d2[], d3[]}, [r2]          ; flimit
-     vld1.s8     {d26[], d27[]}, [r3]        ; limit -> q13
-     vld1.u8     {q6}, [r0], r1              ; p0
-     vld1.u8     {q0}, [r12]!                ; 0x80
-     vld1.u8     {q7}, [r0], r1              ; q0
-     vld1.u8     {q10}, [r12]!               ; 0x03
-     vld1.u8     {q8}, [r0]                  ; q1
-@@ -103,16 +103,14 @@
-     bx          lr
-     ENDP        ; |vp8_loop_filter_simple_horizontal_edge_neon|
- 
- ;-----------------
-     AREA    hloopfiltery_dat, DATA, READWRITE           ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 16 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_lfhy_coeff_
--    DCD     lfhy_coeff
- lfhy_coeff
-     DCD     0x80808080, 0x80808080, 0x80808080, 0x80808080
-     DCD     0x03030303, 0x03030303, 0x03030303, 0x03030303
-     DCD     0x04040404, 0x04040404, 0x04040404, 0x04040404
- 
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm b/media/libvpx/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
-@@ -27,17 +27,17 @@
- 
- |vp8_loop_filter_simple_vertical_edge_neon| PROC
-     sub         r0, r0, #2                  ; move src pointer down by 2 columns
- 
-     vld4.8      {d6[0], d7[0], d8[0], d9[0]}, [r0], r1
-     vld1.s8     {d2[], d3[]}, [r2]          ; flimit
-     vld1.s8     {d26[], d27[]}, [r3]        ; limit -> q13
-     vld4.8      {d6[1], d7[1], d8[1], d9[1]}, [r0], r1
--    ldr         r12, _vlfy_coeff_
-+    adr         r12, vlfy_coeff
-     vld4.8      {d6[2], d7[2], d8[2], d9[2]}, [r0], r1
-     vld4.8      {d6[3], d7[3], d8[3], d9[3]}, [r0], r1
-     vld4.8      {d6[4], d7[4], d8[4], d9[4]}, [r0], r1
-     vld4.8      {d6[5], d7[5], d8[5], d9[5]}, [r0], r1
-     vld4.8      {d6[6], d7[6], d8[6], d9[6]}, [r0], r1
-     vld4.8      {d6[7], d7[7], d8[7], d9[7]}, [r0], r1
- 
-     vld4.8      {d10[0], d11[0], d12[0], d13[0]}, [r0], r1
-@@ -144,16 +144,14 @@
-     bx          lr
-     ENDP        ; |vp8_loop_filter_simple_vertical_edge_neon|
- 
- ;-----------------
-     AREA    vloopfiltery_dat, DATA, READWRITE           ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 16 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_vlfy_coeff_
--    DCD     vlfy_coeff
- vlfy_coeff
-     DCD     0x80808080, 0x80808080, 0x80808080, 0x80808080
-     DCD     0x03030303, 0x03030303, 0x03030303, 0x03030303
-     DCD     0x04040404, 0x04040404, 0x04040404, 0x04040404
- 
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/mbloopfilter_neon.asm b/media/libvpx/vp8/common/arm/neon/mbloopfilter_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/mbloopfilter_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/mbloopfilter_neon.asm
-@@ -367,17 +367,17 @@
- ; q5    p1
- ; q6    p0
- ; q7    q0
- ; q8    q1
- ; q9    q2
- ; q10   q3
- 
- |vp8_mbloop_filter_neon| PROC
--    ldr         r12, _mblf_coeff_
-+    adr         r12, mblf_coeff
- 
-     ; vp8_filter_mask
-     vabd.u8     q11, q3, q4                 ; abs(p3 - p2)
-     vabd.u8     q12, q4, q5                 ; abs(p2 - p1)
-     vabd.u8     q13, q5, q6                 ; abs(p1 - p0)
-     vabd.u8     q14, q8, q7                 ; abs(q1 - q0)
-     vabd.u8     q3, q9, q8                  ; abs(q2 - q1)
-     vabd.u8     q0, q10, q9                 ; abs(q3 - q2)
-@@ -501,18 +501,16 @@
-     veor        q5, q12, q0                 ; *op2 = s^0x80
-     veor        q7, q15, q0                 ; *oq0 = s^0x80
-     veor        q6, q14, q0                 ; *op0 = s^0x80
- 
-     bx          lr
-     ENDP        ; |vp8_mbloop_filter_neon|
- 
-     AREA    mbloopfilter_dat, DATA, READONLY
--_mblf_coeff_
--    DCD     mblf_coeff
- mblf_coeff
-     DCD     0x80808080, 0x80808080, 0x80808080, 0x80808080
-     DCD     0x03030303, 0x03030303, 0x03030303, 0x03030303
-     DCD     0x04040404, 0x04040404, 0x04040404, 0x04040404
-     DCD     0x003f003f, 0x003f003f, 0x003f003f, 0x003f003f
-     DCD     0x09090909, 0x09090909, 0x12121212, 0x12121212
-     DCD     0x1b1b1b1b, 0x1b1b1b1b
- 
-diff --git a/media/libvpx/vp8/common/arm/neon/shortidct4x4llm_neon.asm b/media/libvpx/vp8/common/arm/neon/shortidct4x4llm_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/shortidct4x4llm_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/shortidct4x4llm_neon.asm
-@@ -26,17 +26,17 @@
- ;static const int sinpi8sqrt2      =35468;
- ;static const int rounding = 0;
- ;Optimization note: The resulted data from dequantization are signed 13-bit data that is
- ;in the range of [-4096, 4095]. This allows to use "vqdmulh"(neon) instruction since
- ;it won't go out of range (13+16+1=30bits<32bits). This instruction gives the high half
- ;result of the multiplication that is needed in IDCT.
- 
- |vp8_short_idct4x4llm_neon| PROC
--    ldr             r12, _idct_coeff_
-+    adr             r12, idct_coeff
-     vld1.16         {q1, q2}, [r0]
-     vld1.16         {d0}, [r12]
- 
-     vswp            d3, d4                  ;q2(vp[4] vp[12])
- 
-     vqdmulh.s16     q3, q2, d0[2]
-     vqdmulh.s16     q4, q2, d0[0]
- 
-@@ -112,16 +112,14 @@
- 
-     ENDP
- 
- ;-----------------
-     AREA    idct4x4_dat, DATA, READWRITE            ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_idct_coeff_
--    DCD     idct_coeff
- idct_coeff
-     DCD     0x4e7b4e7b, 0x8a8c8a8c
- 
- ;20091, 20091, 35468, 35468
- 
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/sixtappredict16x16_neon.asm b/media/libvpx/vp8/common/arm/neon/sixtappredict16x16_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/sixtappredict16x16_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/sixtappredict16x16_neon.asm
-@@ -28,17 +28,17 @@
- ; that the result can be a large positive number (> 2^15-1), which could be confused as a
- ; negtive number. To avoid that error, apply filter coeffs in the order of 0, 1, 4 ,5 ,2,
- ; which ensures that the result stays in s16 range. Finally, saturated add the result by
- ; applying 3rd filter coeff. Same applys to other filter functions.
- 
- |vp8_sixtap_predict16x16_neon| PROC
-     push            {r4-r5, lr}
- 
--    ldr             r12, _filter16_coeff_
-+    adrl            r12, filter16_coeff
-     ldr             r4, [sp, #12]           ;load parameters from stack
-     ldr             r5, [sp, #16]           ;load parameters from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             secondpass_filter16x16_only
- 
-     add             r2, r12, r2, lsl #5     ;calculate filter location
- 
-@@ -475,18 +475,16 @@ secondpass_only_inner_loop_neon
- 
-     ENDP
- 
- ;-----------------
-     AREA    subpelfilters16_dat, DATA, READWRITE            ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_filter16_coeff_
--    DCD     filter16_coeff
- filter16_coeff
-     DCD     0,  0,  128,    0,   0,  0,   0,  0
-     DCD     0, -6,  123,   12,  -1,  0,   0,  0
-     DCD     2, -11, 108,   36,  -8,  1,   0,  0
-     DCD     0, -9,   93,   50,  -6,  0,   0,  0
-     DCD     3, -16,  77,   77, -16,  3,   0,  0
-     DCD     0, -6,   50,   93,  -9,  0,   0,  0
-     DCD     1, -8,   36,  108, -11,  2,   0,  0
-diff --git a/media/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm b/media/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm
-@@ -20,17 +20,17 @@
- ; r2    int  xoffset,
- ; r3    int  yoffset,
- ; stack(r4) unsigned char *dst_ptr,
- ; stack(lr) int  dst_pitch
- 
- |vp8_sixtap_predict_neon| PROC
-     push            {r4, lr}
- 
--    ldr             r12, _filter4_coeff_
-+    adrl            r12, filter4_coeff
-     ldr             r4, [sp, #8]            ;load parameters from stack
-     ldr             lr, [sp, #12]           ;load parameters from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             secondpass_filter4x4_only
- 
-     add             r2, r12, r2, lsl #5     ;calculate filter location
- 
-@@ -406,18 +406,16 @@ secondpass_filter4x4_only
- 
-     ENDP
- 
- ;-----------------
-     AREA    subpelfilters4_dat, DATA, READWRITE         ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_filter4_coeff_
--    DCD     filter4_coeff
- filter4_coeff
-     DCD     0,  0,  128,    0,   0,  0,   0,  0
-     DCD     0, -6,  123,   12,  -1,  0,   0,  0
-     DCD     2, -11, 108,   36,  -8,  1,   0,  0
-     DCD     0, -9,   93,   50,  -6,  0,   0,  0
-     DCD     3, -16,  77,   77, -16,  3,   0,  0
-     DCD     0, -6,   50,   93,  -9,  0,   0,  0
-     DCD     1, -8,   36,  108, -11,  2,   0,  0
-diff --git a/media/libvpx/vp8/common/arm/neon/sixtappredict8x4_neon.asm b/media/libvpx/vp8/common/arm/neon/sixtappredict8x4_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/sixtappredict8x4_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/sixtappredict8x4_neon.asm
-@@ -20,17 +20,17 @@
- ; r2    int  xoffset,
- ; r3    int  yoffset,
- ; r4    unsigned char *dst_ptr,
- ; stack(r5) int  dst_pitch
- 
- |vp8_sixtap_predict8x4_neon| PROC
-     push            {r4-r5, lr}
- 
--    ldr             r12, _filter8_coeff_
-+    adrl            r12, filter8_coeff
-     ldr             r4, [sp, #12]           ;load parameters from stack
-     ldr             r5, [sp, #16]           ;load parameters from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             secondpass_filter8x4_only
- 
-     add             r2, r12, r2, lsl #5     ;calculate filter location
- 
-@@ -457,18 +457,16 @@ secondpass_filter8x4_only
- 
-     ENDP
- 
- ;-----------------
-     AREA    subpelfilters8_dat, DATA, READWRITE         ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_filter8_coeff_
--    DCD     filter8_coeff
- filter8_coeff
-     DCD     0,  0,  128,    0,   0,  0,   0,  0
-     DCD     0, -6,  123,   12,  -1,  0,   0,  0
-     DCD     2, -11, 108,   36,  -8,  1,   0,  0
-     DCD     0, -9,   93,   50,  -6,  0,   0,  0
-     DCD     3, -16,  77,   77, -16,  3,   0,  0
-     DCD     0, -6,   50,   93,  -9,  0,   0,  0
-     DCD     1, -8,   36,  108, -11,  2,   0,  0
-diff --git a/media/libvpx/vp8/common/arm/neon/sixtappredict8x8_neon.asm b/media/libvpx/vp8/common/arm/neon/sixtappredict8x8_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/sixtappredict8x8_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/sixtappredict8x8_neon.asm
-@@ -20,17 +20,17 @@
- ; r2    int  xoffset,
- ; r3    int  yoffset,
- ; stack(r4) unsigned char *dst_ptr,
- ; stack(r5) int  dst_pitch
- 
- |vp8_sixtap_predict8x8_neon| PROC
-     push            {r4-r5, lr}
- 
--    ldr             r12, _filter8_coeff_
-+    adrl            r12, filter8_coeff
- 
-     ldr             r4, [sp, #12]           ;load parameters from stack
-     ldr             r5, [sp, #16]           ;load parameters from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             secondpass_filter8x8_only
- 
-     add             r2, r12, r2, lsl #5     ;calculate filter location
-@@ -508,18 +508,16 @@ filt_blk2d_spo8x8_loop_neon
- 
-     ENDP
- 
- ;-----------------
-     AREA    subpelfilters8_dat, DATA, READWRITE         ;read/write by default
- ;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
- ;One word each is reserved. Label filter_coeff can be used to access the data.
- ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
--_filter8_coeff_
--    DCD     filter8_coeff
- filter8_coeff
-     DCD     0,  0,  128,    0,   0,  0,   0,  0
-     DCD     0, -6,  123,   12,  -1,  0,   0,  0
-     DCD     2, -11, 108,   36,  -8,  1,   0,  0
-     DCD     0, -9,   93,   50,  -6,  0,   0,  0
-     DCD     3, -16,  77,   77, -16,  3,   0,  0
-     DCD     0, -6,   50,   93,  -9,  0,   0,  0
-     DCD     1, -8,   36,  108, -11,  2,   0,  0
-diff --git a/media/libvpx/vp8/decoder/arm/neon/dequant_idct_neon.asm b/media/libvpx/vp8/decoder/arm/neon/dequant_idct_neon.asm
---- a/media/libvpx/vp8/decoder/arm/neon/dequant_idct_neon.asm
-+++ b/media/libvpx/vp8/decoder/arm/neon/dequant_idct_neon.asm
-@@ -30,17 +30,17 @@
-     ldr             r1, [sp]                ; pitch
-     vld1.32         {d14[0]}, [r2], r1
-     vld1.32         {d14[1]}, [r2], r1
-     vld1.32         {d15[0]}, [r2], r1
-     vld1.32         {d15[1]}, [r2]
- 
-     ldr             r1, [sp, #4]            ; stride
- 
--    ldr             r12, _CONSTANTS_
-+    adr             r12, _CONSTANTS_
- 
-     vmul.i16        q1, q3, q5              ;input for short_idct4x4llm_neon
-     vmul.i16        q2, q4, q6
- 
- ;|short_idct4x4llm_neon| PROC
-     vld1.16         {d0}, [r12]
-     vswp            d3, d4                  ;q2(vp[4] vp[12])
- 
-@@ -118,13 +118,13 @@
-     vst1.32         {d1[0]}, [r3], r1
-     vst1.32         {d1[1]}, [r3]
- 
-     bx             lr
- 
-     ENDP           ; |vp8_dequant_idct_add_neon|
- 
- ; Constant Pool
--_CONSTANTS_       DCD cospi8sqrt2minus1
-+_CONSTANTS_       EQU cospi8sqrt2minus1
- cospi8sqrt2minus1 DCD 0x4e7b4e7b
- sinpi8sqrt2       DCD 0x8a8c8a8c
- 
-     END
-diff --git a/media/libvpx/vp8/decoder/arm/neon/idct_dequant_dc_full_2x_neon.asm b/media/libvpx/vp8/decoder/arm/neon/idct_dequant_dc_full_2x_neon.asm
---- a/media/libvpx/vp8/decoder/arm/neon/idct_dequant_dc_full_2x_neon.asm
-+++ b/media/libvpx/vp8/decoder/arm/neon/idct_dequant_dc_full_2x_neon.asm
-@@ -36,17 +36,17 @@
-     vld1.32         {d29[0]}, [r2], r1
-     vld1.32         {d29[1]}, [r12], r1
-     vld1.32         {d30[0]}, [r2], r1
-     vld1.32         {d30[1]}, [r12], r1
-     vld1.32         {d31[0]}, [r2]
-     ldr             r1, [sp, #4]
-     vld1.32         {d31[1]}, [r12]
- 
--    ldr             r2, _CONSTANTS_
-+    adr             r2, _CONSTANTS_
- 
-     ldrh            r12, [r1], #2           ; lo *dc
-     ldrh            r1, [r1]                ; hi *dc
- 
-     ; dequant: q[i] = q[i] * dq[i]
-     vmul.i16        q2, q2, q0
-     vmul.i16        q3, q3, q1
-     vmul.i16        q4, q4, q0
-@@ -193,14 +193,14 @@
-     vst1.32         {d3[0]}, [r3]
-     vst1.32         {d3[1]}, [r2]
- 
-     bx             lr
- 
-     ENDP           ; |idct_dequant_dc_full_2x_neon|
- 
- ; Constant Pool
--_CONSTANTS_       DCD cospi8sqrt2minus1
-+_CONSTANTS_       EQU cospi8sqrt2minus1
- cospi8sqrt2minus1 DCD 0x4e7b
- ; because the lowest bit in 0x8a8c is 0, we can pre-shift this
- sinpi8sqrt2       DCD 0x4546
- 
-     END
-diff --git a/media/libvpx/vp8/decoder/arm/neon/idct_dequant_full_2x_neon.asm b/media/libvpx/vp8/decoder/arm/neon/idct_dequant_full_2x_neon.asm
---- a/media/libvpx/vp8/decoder/arm/neon/idct_dequant_full_2x_neon.asm
-+++ b/media/libvpx/vp8/decoder/arm/neon/idct_dequant_full_2x_neon.asm
-@@ -35,17 +35,17 @@
-     vld1.32         {d28[1]}, [r12], r1     ; r pre
-     vld1.32         {d29[0]}, [r2], r1
-     vld1.32         {d29[1]}, [r12], r1
-     vld1.32         {d30[0]}, [r2], r1
-     vld1.32         {d30[1]}, [r12], r1
-     vld1.32         {d31[0]}, [r2]
-     vld1.32         {d31[1]}, [r12]
- 
--    ldr             r2, _CONSTANTS_
-+    adr             r2, _CONSTANTS_
- 
-     ; dequant: q[i] = q[i] * dq[i]
-     vmul.i16        q2, q2, q0
-     vmul.i16        q3, q3, q1
-     vmul.i16        q4, q4, q0
-     vmul.i16        q5, q5, q1
- 
-     vld1.16         {d0}, [r2]
-@@ -185,14 +185,14 @@
-     vst1.32         {d3[0]}, [r3]
-     vst1.32         {d3[1]}, [r2]
- 
-     bx             lr
- 
-     ENDP           ; |idct_dequant_full_2x_neon|
- 
- ; Constant Pool
--_CONSTANTS_       DCD cospi8sqrt2minus1
-+_CONSTANTS_       EQU cospi8sqrt2minus1
- cospi8sqrt2minus1 DCD 0x4e7b
- ; because the lowest bit in 0x8a8c is 0, we can pre-shift this
- sinpi8sqrt2       DCD 0x4546
- 
-     END
deleted file mode 100644
--- a/media/libvpx/bug666931.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-diff --git a/media/libvpx/build/make/ads2gas.pl b/media/libvpx/build/make/ads2gas.pl
---- a/media/libvpx/build/make/ads2gas.pl
-+++ b/media/libvpx/build/make/ads2gas.pl
-@@ -74,17 +74,20 @@ while (<STDIN>)
- 
-     # Convert INCLUDE to .INCLUDE "file"
-     s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/;
- 
-     # Code directive (ARM vs Thumb)
-     s/CODE([0-9][0-9])/.code $1/;
- 
-     # No AREA required
--    s/^\s*AREA.*$/.text/;
-+    # But ALIGNs in AREA must be obeyed
-+    s/^\s*AREA.*ALIGN=([0-9])$/.text\n.p2align $1/;
-+    # If no ALIGN, strip the AREA and align to 4 bytes
-+    s/^\s*AREA.*$/.text\n.p2align 2/;
- 
-     # DCD to .word
-     # This one is for incoming symbols
-     s/DCD\s+\|(\w*)\|/.long $1/;
- 
-     # DCW to .short
-     s/DCW\s+\|(\w*)\|/.short $1/;
-     s/DCW(.*)/.short $1/;
deleted file mode 100644
--- a/media/libvpx/bug671818.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-diff --git a/media/libvpx/vp8/vp8_dx_iface.c b/media/libvpx/vp8/vp8_dx_iface.c
---- a/media/libvpx/vp8/vp8_dx_iface.c
-+++ b/media/libvpx/vp8/vp8_dx_iface.c
-@@ -315,16 +315,46 @@ update_error_state(vpx_codec_alg_priv_t 
-     if ((res = error->error_code))
-         ctx->base.err_detail = error->has_detail
-                                ? error->detail
-                                : NULL;
- 
-     return res;
- }
- 
-+static void yuvconfig2image(vpx_image_t               *img,
-+                            const YV12_BUFFER_CONFIG  *yv12,
-+                            void                      *user_priv)
-+{
-+    /** vpx_img_wrap() doesn't allow specifying independent strides for
-+      * the Y, U, and V planes, nor other alignment adjustments that
-+      * might be representable by a YV12_BUFFER_CONFIG, so we just
-+      * initialize all the fields.*/
-+    img->fmt = yv12->clrtype == REG_YUV ?
-+        VPX_IMG_FMT_I420 : VPX_IMG_FMT_VPXI420;
-+    img->w = yv12->y_stride;
-+    img->h = (yv12->y_height + 2 * VP8BORDERINPIXELS + 15) & ~15;
-+    img->d_w = yv12->y_width;
-+    img->d_h = yv12->y_height;
-+    img->x_chroma_shift = 1;
-+    img->y_chroma_shift = 1;
-+    img->planes[VPX_PLANE_Y] = yv12->y_buffer;
-+    img->planes[VPX_PLANE_U] = yv12->u_buffer;
-+    img->planes[VPX_PLANE_V] = yv12->v_buffer;
-+    img->planes[VPX_PLANE_ALPHA] = NULL;
-+    img->stride[VPX_PLANE_Y] = yv12->y_stride;
-+    img->stride[VPX_PLANE_U] = yv12->uv_stride;
-+    img->stride[VPX_PLANE_V] = yv12->uv_stride;
-+    img->stride[VPX_PLANE_ALPHA] = yv12->y_stride;
-+    img->bps = 12;
-+    img->user_priv = user_priv;
-+    img->img_data = yv12->buffer_alloc;
-+    img->img_data_owner = 0;
-+    img->self_allocd = 0;
-+}
- 
- static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t  *ctx,
-                                   const uint8_t         *data,
-                                   unsigned int            data_sz,
-                                   void                    *user_priv,
-                                   long                    deadline)
- {
-     vpx_codec_err_t res = VPX_CODEC_OK;
-@@ -424,30 +454,18 @@ static vpx_codec_err_t vp8_decode(vpx_co
-         if (vp8dx_receive_compressed_data(ctx->pbi, data_sz, data, deadline))
-         {
-             VP8D_COMP *pbi = (VP8D_COMP *)ctx->pbi;
-             res = update_error_state(ctx, &pbi->common.error);
-         }
- 
-         if (!res && 0 == vp8dx_get_raw_frame(ctx->pbi, &sd, &time_stamp, &time_end_stamp, ppdeblocking, ppnoise, ppflag))
-         {
--            /* Align width/height */
--            unsigned int a_w = (sd.y_width + 15) & ~15;
--            unsigned int a_h = (sd.y_height + 15) & ~15;
--
--            vpx_img_wrap(&ctx->img, VPX_IMG_FMT_I420,
--                         a_w + 2 * VP8BORDERINPIXELS,
--                         a_h + 2 * VP8BORDERINPIXELS,
--                         1,
--                         sd.buffer_alloc);
--            vpx_img_set_rect(&ctx->img,
--                             VP8BORDERINPIXELS, VP8BORDERINPIXELS,
--                             sd.y_width, sd.y_height);
-+            yuvconfig2image(&ctx->img, &sd, user_priv);
-             ctx->img_avail = 1;
--
-         }
-     }
- 
-     return res;
- }
- 
- static vpx_image_t *vp8_get_frame(vpx_codec_alg_priv_t  *ctx,
-                                   vpx_codec_iter_t      *iter)
-diff --git a/media/libvpx/vpx_scale/generic/yv12config.c b/media/libvpx/vpx_scale/generic/yv12config.c
---- a/media/libvpx/vpx_scale/generic/yv12config.c
-+++ b/media/libvpx/vpx_scale/generic/yv12config.c
-@@ -42,50 +42,61 @@ vp8_yv12_de_alloc_frame_buffer(YV12_BUFF
- /****************************************************************************
-  *
-  ****************************************************************************/
- int
- vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border)
- {
- /*NOTE:*/
- 
--    int yplane_size = (height + 2 * border) * (width + 2 * border);
--    int uvplane_size = ((1 + height) / 2 + border) * ((1 + width) / 2 + border);
--
-     if (ybf)
-     {
-+        int y_stride = ((width + 2 * border) + 31) & ~31;
-+        int yplane_size = (height + 2 * border) * y_stride;
-+        /** There is currently a bunch of code which assumes
-+          *  uv_stride == y_stride/2, so enforce this here. */
-+        int uv_width = width >> 1;
-+        int uv_height = height >> 1;
-+        int uv_stride = y_stride >> 1;
-+        int uvplane_size = ((1 + height) / 2 + border) * uv_stride;
-+
-         vp8_yv12_de_alloc_frame_buffer(ybf);
- 
-+        /** Only support allocating buffers that have a height and width that
-+          *  are multiples of 16, and a border that's a multiple of 32.
-+          * The border restriction is required to get 16-byte alignment of the
-+          *  start of the chroma rows without intoducing an arbitrary gap
-+          *  between planes, which would break the semantics of things like
-+          *  vpx_img_set_rect(). */
-+        if ((width & 0xf) | (height & 0xf) | (border & 0x1f))
-+            return -3;
-+
-         ybf->y_width  = width;
-         ybf->y_height = height;
--        ybf->y_stride = width + 2 * border;
-+        ybf->y_stride = y_stride;
- 
--        ybf->uv_width = (1 + width) / 2;
--        ybf->uv_height = (1 + height) / 2;
--        ybf->uv_stride = ybf->uv_width + border;
-+        ybf->uv_width = uv_width;
-+        ybf->uv_height = uv_height;
-+        ybf->uv_stride = uv_stride;
- 
-         ybf->border = border;
-         ybf->frame_size = yplane_size + 2 * uvplane_size;
- 
-         /* Added 2 extra lines to framebuffer so that copy12x12 doesn't fail
-          * when we have a large motion vector in V on the last v block.
-          * Note : We never use these pixels anyway so this doesn't hurt.
-          */
--        ybf->buffer_alloc = (unsigned char *) duck_memalign(32,  ybf->frame_size + (ybf->y_stride * 2) + 32, 0);
-+        ybf->buffer_alloc = (unsigned char *) vpx_memalign(32,  ybf->frame_size);
- 
-         if (ybf->buffer_alloc == NULL)
-             return -1;
- 
--        ybf->y_buffer = ybf->buffer_alloc + (border * ybf->y_stride) + border;
--
--        if (yplane_size & 0xf)
--            yplane_size += 16 - (yplane_size & 0xf);
--
--        ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2  * ybf->uv_stride) + border / 2;
--        ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2  * ybf->uv_stride) + border / 2;
-+        ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
-+        ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2  * uv_stride) + border / 2;
-+        ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2  * uv_stride) + border / 2;
-     }
-     else
-     {
-         return -2;
-     }
- 
-     return 0;
- }
deleted file mode 100644
--- a/media/libvpx/bug696390.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/media/libvpx/vp8/decoder/decodemv.c b/media/libvpx/vp8/decoder/decodemv.c
---- a/media/libvpx/vp8/decoder/decodemv.c
-+++ b/media/libvpx/vp8/decoder/decodemv.c
-@@ -361,17 +361,17 @@ static void read_mb_modes_mv(VP8D_COMP *
-   #ifdef VPX_MODE_COUNT
-                     vp8_mv_cont_count[mv_contz][2]++;
-   #endif
-                     break;
-                 default:
-                     break;
-                 }
- 
--                mbmi->need_to_clamp_mvs = vp8_check_mv_bounds(&blockmv,
-+                mbmi->need_to_clamp_mvs |= vp8_check_mv_bounds(&blockmv,
-                                                           mb_to_left_edge,
-                                                           mb_to_right_edge,
-                                                           mb_to_top_edge,
-                                                           mb_to_bottom_edge);
- 
-                 {
-                     /* Fill (uniform) modes, mvs of jth subset.
-                      Must do it here because ensuing subsets can
--- a/media/libvpx/build/make/ads2gas.pl
+++ b/media/libvpx/build/make/ads2gas.pl
@@ -21,22 +21,32 @@ print "@ This file was created from a .a
 print "@  using the ads2gas.pl script.\n";
 print "\t.equ DO1STROUNDING, 0\n";
 
 # Stack of procedure names.
 @proc_stack = ();
 
 while (<STDIN>)
 {
+    undef $comment;
+    undef $line;
+    $comment_char = ";";
+    $comment_sub = "@";
+
+    # Handle comments.
+    if (/$comment_char/)
+    {
+      $comment = "";
+      ($line, $comment) = /(.*?)$comment_char(.*)/;
+      $_ = $line;
+    }
+
     # Load and store alignment
     s/@/,:/g;
 
-    # Comment character
-    s/;/@/g;
-
     # Hexadecimal constants prefaced by 0x
     s/#&/#0x/g;
 
     # Convert :OR: to |
     s/:OR:/ | /g;
 
     # Convert :AND: to &
     s/:AND:/ & /g;
@@ -46,26 +56,37 @@ while (<STDIN>)
 
     # Convert :SHL: to <<
     s/:SHL:/ << /g;
 
     # Convert :SHR: to >>
     s/:SHR:/ >> /g;
 
     # Convert ELSE to .else
-    s/ELSE/.else/g;
+    s/\bELSE\b/.else/g;
 
     # Convert ENDIF to .endif
-    s/ENDIF/.endif/g;
+    s/\bENDIF\b/.endif/g;
 
     # Convert ELSEIF to .elseif
-    s/ELSEIF/.elseif/g;
+    s/\bELSEIF\b/.elseif/g;
 
     # Convert LTORG to .ltorg
-    s/LTORG/.ltorg/g;
+    s/\bLTORG\b/.ltorg/g;
+
+    # Convert endfunc to nothing.
+    s/\bendfunc\b//ig;
+
+    # Convert FUNCTION to nothing.
+    s/\bFUNCTION\b//g;
+    s/\bfunction\b//g;
+
+    s/\bENTRY\b//g;
+    s/\bMSARMASM\b/0/g;
+    s/^\s+end\s+$//g;
 
     # Convert IF :DEF:to .if
     # gcc doesn't have the ability to do a conditional
     # if defined variable that is set by IF :DEF: on
     # armasm, so convert it to a normal .if and then
     # make sure to define a value elesewhere
     if (s/\bIF :DEF:\b/.if /g)
     {
@@ -101,39 +122,51 @@ while (<STDIN>)
     # Constants defined in scope
     s/DCD(.*)/.long $1/;
     s/DCB(.*)/.byte $1/;
 
     # RN to .req
     if (s/RN\s+([Rr]\d+|lr)/.req $1/)
     {
         print;
+        print "$comment_sub$comment\n" if defined $comment;
         next;
     }
 
     # Make function visible to linker, and make additional symbol with
     # prepended underscore
     s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/;
     s/IMPORT\s+\|([\$\w]*)\|/.global $1/;
 
+    s/EXPORT\s+([\$\w]*)/.global $1/;
+    s/export\s+([\$\w]*)/.global $1/;
+
     # No vertical bars required; make additional symbol with prepended
     # underscore
     s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
 
     # Labels need trailing colon
 #   s/^(\w+)/$1:/ if !/EQU/;
     # put the colon at the end of the line in the macro
     s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
 
     # ALIGN directive
-    s/ALIGN/.balign/g;
+    s/\bALIGN\b/.balign/g;
 
     # ARM code
     s/\sARM/.arm/g;
 
+    # push/pop
+    s/(push\s+)(r\d+)/stmdb sp\!, \{$2\}/g;
+    s/(pop\s+)(r\d+)/ldmia sp\!, \{$2\}/g;
+
+    # NEON code
+    s/(vld1.\d+\s+)(q\d+)/$1\{$2\}/g;
+    s/(vtbl.\d+\s+[^,]+),([^,]+)/$1,\{$2\}/g;
+
     # eabi_attributes numerical equivalents can be found in the
     # "ARM IHI 0045C" document.
 
     # REQUIRE8 Stack is required to be 8-byte aligned
     s/\sREQUIRE8/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g;
 
     # PRESERVE8 Stack 8-byte align is preserved
     s/\sPRESERVE8/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g;
@@ -152,27 +185,28 @@ while (<STDIN>)
     {
         my $proc;
         s/\bENDP\b/@ $&/;
         $proc = pop(@proc_stack);
         $_ = "\t.size $proc, .-$proc".$_ if ($proc);
     }
 
     # EQU directive
-    s/(.*)EQU(.*)/.equ $1, $2/;
+    s/(\S+\s+)EQU(\s+\S+)/.equ $1, $2/;
 
     # Begin macro definition
-    if (/MACRO/) {
+    if (/\bMACRO\b/) {
         $_ = <STDIN>;
         s/^/.macro/;
         s/\$//g;                # remove formal param reference
         s/;/@/g;                # change comment characters
     }
 
     # For macros, use \ to reference formal params
     s/\$/\\/g;                  # End macro definition
-    s/MEND/.endm/;              # No need to tell it where to stop assembling
+    s/\bMEND\b/.endm/;              # No need to tell it where to stop assembling
     next if /^\s*END\s*$/;
     print;
+    print "$comment_sub$comment\n" if defined $comment;
 }
 
 # Mark that this object doesn't need an executable stack.
 printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n");
--- a/media/libvpx/build/make/obj_int_extract.c
+++ b/media/libvpx/build/make/obj_int_extract.c
@@ -675,17 +675,17 @@ 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.
+    //it is used to check if the symbol is in .bss or .rdata 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)
     {
@@ -720,25 +720,25 @@ int parse_coff(uint8_t *buf, size_t sz)
 
         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);
+        if (!strcmp(sectionname, ".rdata")) 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);
+    //log_msg("COFF: raw data pointer ofset for section .rdata is %u\n", sectionrawdata_ptr);
 
-    /*  The compiler puts the data with non-zero offset in .data section, but puts the data with
+    /*  The compiler puts the data with non-zero offset in .rdata 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
deleted file mode 100644
--- a/media/libvpx/compile_errors.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-# HG changeset patch
-# Parent f73b7e96c0735448035ec4786f37dcf7d7644e00
-# User Timothy B. Terriberry <tterribe@vt.edu>
-Patch to fix errors including C headers in C++
-
-diff --git a/media/libvpx/vp8/common/onyx.h b/media/libvpx/vp8/common/onyx.h
---- a/media/libvpx/vp8/common/onyx.h
-+++ b/media/libvpx/vp8/common/onyx.h
-@@ -55,24 +55,24 @@ extern "C"
- 
-     typedef enum
-     {
-         MODE_REALTIME       = 0x0,
-         MODE_GOODQUALITY    = 0x1,
-         MODE_BESTQUALITY    = 0x2,
-         MODE_FIRSTPASS      = 0x3,
-         MODE_SECONDPASS     = 0x4,
--        MODE_SECONDPASS_BEST = 0x5,
-+        MODE_SECONDPASS_BEST = 0x5
-     } MODE;
- 
-     typedef enum
-     {
-         FRAMEFLAGS_KEY    = 1,
-         FRAMEFLAGS_GOLDEN = 2,
--        FRAMEFLAGS_ALTREF = 4,
-+        FRAMEFLAGS_ALTREF = 4
-     } FRAMETYPE_FLAGS;
- 
- 
- #include <assert.h>
-     static void Scale2Ratio(int mode, int *hr, int *hs)
-     {
-         switch (mode)
-         {
-diff --git a/media/libvpx/vp8/encoder/onyx_int.h b/media/libvpx/vp8/encoder/onyx_int.h
---- a/media/libvpx/vp8/encoder/onyx_int.h
-+++ b/media/libvpx/vp8/encoder/onyx_int.h
-@@ -158,17 +158,17 @@ typedef enum
-     THR_NEW1           = 13,
-     THR_NEW2           = 14,
-     THR_NEW3           = 15,
- 
-     THR_SPLIT1         = 16,
-     THR_SPLIT2         = 17,
-     THR_SPLIT3         = 18,
- 
--    THR_B_PRED         = 19,
-+    THR_B_PRED         = 19
- }
- THR_MODES;
- 
- typedef enum
- {
-     DIAMOND = 0,
-     NSTEP = 1,
-     HEX = 2
-diff --git a/media/libvpx/vpx/vp8.h b/media/libvpx/vpx/vp8.h
---- a/media/libvpx/vpx/vp8.h
-+++ b/media/libvpx/vpx/vp8.h
-@@ -41,34 +41,34 @@ enum vp8_com_control_id
-     VP8_SET_REFERENCE           = 1,    /**< pass in an external frame into decoder to be used as reference frame */
-     VP8_COPY_REFERENCE          = 2,    /**< get a copy of reference frame from the decoder */
-     VP8_SET_POSTPROC            = 3,    /**< set the decoder's post processing settings  */
-     VP8_SET_DBG_COLOR_REF_FRAME = 4,    /**< set the reference frames to color for each macroblock */
-     VP8_SET_DBG_COLOR_MB_MODES  = 5,    /**< set which macro block modes to color */
-     VP8_SET_DBG_COLOR_B_MODES   = 6,    /**< set which blocks modes to color */
-     VP8_SET_DBG_DISPLAY_MV      = 7,    /**< set which motion vector modes to draw */
-     VP8_COMMON_CTRL_ID_MAX,
--    VP8_DECODER_CTRL_ID_START   = 256,
-+    VP8_DECODER_CTRL_ID_START   = 256
- };
- 
- /*!\brief post process flags
-  *
-  * The set of macros define VP8 decoder post processing flags
-  */
- enum vp8_postproc_level
- {
-     VP8_NOFILTERING             = 0,
-     VP8_DEBLOCK                 = 1<<0,
-     VP8_DEMACROBLOCK            = 1<<1,
-     VP8_ADDNOISE                = 1<<2,
-     VP8_DEBUG_TXT_FRAME_INFO    = 1<<3, /**< print frame information */
-     VP8_DEBUG_TXT_MBLK_MODES    = 1<<4, /**< print macro block modes over each macro block */
-     VP8_DEBUG_TXT_DC_DIFF       = 1<<5, /**< print dc diff for each macro block */
-     VP8_DEBUG_TXT_RATE_INFO     = 1<<6, /**< print video rate info (encoder only) */
--    VP8_MFQE                    = 1<<10,
-+    VP8_MFQE                    = 1<<10
- };
- 
- /*!\brief post process flags
-  *
-  * This define a structure that describe the post processing settings. For
-  * the best objective measure (using the PSNR metric) set post_proc_flag
-  * to VP8_DEBLOCK and deblocking_level to 1.
-  */
-diff --git a/media/libvpx/vpx/vp8cx.h b/media/libvpx/vpx/vp8cx.h
---- a/media/libvpx/vpx/vp8cx.h
-+++ b/media/libvpx/vpx/vp8cx.h
-@@ -172,17 +172,17 @@ enum vp8e_enc_control_id
-      * per-frame bitrate, with the special (and default) value 0 meaning
-      * unlimited, or no additional clamping beyond the codec's built-in
-      * algorithm.
-      *
-      * For example, to allocate no more than 4.5 frames worth of bitrate
-      * to a keyframe, set this to 450.
-      *
-      */
--    VP8E_SET_MAX_INTRA_BITRATE_PCT,
-+    VP8E_SET_MAX_INTRA_BITRATE_PCT
- };
- 
- /*!\brief vpx 1-D scaling mode
-  *
-  * This set of constants define 1-D vpx scaling modes
-  */
- typedef enum vpx_scaling_mode_1d
- {
-@@ -253,17 +253,17 @@ typedef enum
-  *
-  */
- 
- typedef enum
- {
-     VP8_ONE_TOKENPARTITION   = 0,
-     VP8_TWO_TOKENPARTITION   = 1,
-     VP8_FOUR_TOKENPARTITION  = 2,
--    VP8_EIGHT_TOKENPARTITION = 3,
-+    VP8_EIGHT_TOKENPARTITION = 3
- } vp8e_token_partitions;
- 
- 
- /*!\brief VP8 model tuning parameters
-  *
-  * Changes the encoder to tune for certain types of input material.
-  *
-  */
--- a/media/libvpx/moz.build
+++ b/media/libvpx/moz.build
@@ -3,35 +3,32 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 EXPORTS.vpx += [
     'vpx/vp8.h',
     'vpx/vp8cx.h',
     'vpx/vp8dx.h',
-    'vpx/vp8e.h',
     'vpx/vpx_codec.h',
     'vpx/vpx_codec_impl_bottom.h',
     'vpx/vpx_codec_impl_top.h',
     'vpx/vpx_decoder.h',
-    'vpx/vpx_decoder_compat.h',
     'vpx/vpx_encoder.h',
     'vpx/vpx_image.h',
     'vpx/vpx_integer.h',
     'vpx_mem/include/vpx_mem_intrnl.h',
     'vpx_mem/vpx_mem.h',
     'vpx_ports/arm.h',
     'vpx_ports/mem.h',
     'vpx_ports/vpx_timer.h',
     'vpx_ports/x86.h',
     'vpx_scale/scale_mode.h',
     'vpx_scale/vpxscale.h',
     'vpx_scale/yv12config.h',
-    'vpx_scale/yv12extend.h',
 ]
 
 if CONFIG['VPX_NEED_OBJ_INT_EXTRACT']:
     HOST_SOURCES += [
         'build/make/obj_int_extract.c',
     ]
 
     HOST_PROGRAM = 'host_obj_int_extract'
@@ -49,50 +46,281 @@ SOURCES += [
     'vp8/common/findnearmv.c',
     'vp8/common/generic/systemdependent.c',
     'vp8/common/idct_blk.c',
     'vp8/common/idctllm.c',
     'vp8/common/loopfilter.c',
     'vp8/common/loopfilter_filters.c',
     'vp8/common/mbpitch.c',
     'vp8/common/modecont.c',
-    'vp8/common/modecontext.c',
-    'vp8/common/postproc.c',
     'vp8/common/quant_common.c',
     'vp8/common/reconinter.c',
     'vp8/common/reconintra.c',
     'vp8/common/reconintra4x4.c',
+    'vp8/common/rtcd.c',
     'vp8/common/sad_c.c',
     'vp8/common/setupintrarecon.c',
     'vp8/common/swapyv12buffer.c',
     'vp8/common/treecoder.c',
     'vp8/common/variance_c.c',
+    'vp8/decoder/asm_dec_offsets.c',
     'vp8/decoder/dboolhuff.c',
     'vp8/decoder/decodemv.c',
     'vp8/decoder/decodframe.c',
     'vp8/decoder/detokenize.c',
-    'vp8/decoder/generic/dsystemdependent.c',
     'vp8/decoder/onyxd_if.c',
-    'vp8/decoder/reconintra_mt.c',
     'vp8/decoder/threading.c',
     'vp8/vp8_dx_iface.c',
     'vpx/src/vpx_codec.c',
     'vpx/src/vpx_decoder.c',
-    'vpx/src/vpx_decoder_compat.c',
     'vpx/src/vpx_encoder.c',
     'vpx/src/vpx_image.c',
-    'vpx_config_c.c',
     'vpx_mem/vpx_mem.c',
     'vpx_scale/generic/gen_scalers.c',
-    'vpx_scale/generic/scalesystemdependent.c',
     'vpx_scale/generic/vpxscale.c',
     'vpx_scale/generic/yv12config.c',
     'vpx_scale/generic/yv12extend.c',
 ]
 
+if CONFIG['MOZ_VP8_ERROR_CONCEALMENT']:
+    SOURCES += [
+        'vp8/decoder/error_concealment.c'
+    ]
+
+if CONFIG['MOZ_VP8_ENCODER']:
+    SOURCES += [
+        'vp8/encoder/bitstream.c',
+        'vp8/encoder/dct.c',
+        'vp8/encoder/encodeframe.c',
+        'vp8/encoder/encodeintra.c',
+        'vp8/encoder/encodemb.c',
+        'vp8/encoder/encodemv.c',
+        'vp8/encoder/ethreading.c',
+        'vp8/encoder/firstpass.c',
+        'vp8/encoder/lookahead.c',
+        'vp8/encoder/mcomp.c',
+        'vp8/encoder/modecosts.c',
+        'vp8/encoder/mr_dissim.c',
+        'vp8/encoder/onyx_if.c',
+        'vp8/encoder/pickinter.c',
+        'vp8/encoder/picklpf.c',
+        'vp8/encoder/psnr.c',
+        'vp8/encoder/quantize.c',
+        'vp8/encoder/ratectrl.c',
+        'vp8/encoder/rdopt.c',
+        'vp8/encoder/segmentation.c',
+        'vp8/encoder/tokenize.c',
+        'vp8/encoder/treewriter.c',
+        'vp8/vp8_cx_iface.c',
+    ]
+
+#postproc is only enabled on x86 with asm
+if CONFIG['VPX_X86_ASM']:
+    SOURCES += [
+        'vp8/common/mfqe.c',
+        'vp8/common/postproc.c',
+        'vp8/encoder/temporal_filter.c',
+    ]
+
+if CONFIG['VPX_X86_ASM'] and CONFIG['OS_TARGET'] == 'WINNT':
+    SOURCES += [
+        'vp8/common/asm_com_offsets.c',
+    ]
+    if CONFIG['MOZ_VP8_ENCODER']:
+        SOURCES += [
+            'vp8/encoder/asm_enc_offsets.c',
+        ]
+
+if CONFIG['VPX_X86_ASM']:
+    SOURCES += [
+        'vp8/common/x86/filter_x86.c',
+        'vp8/common/x86/idct_blk_mmx.c',
+        'vp8/common/x86/idct_blk_sse2.c',
+        'vp8/common/x86/loopfilter_x86.c',
+        'vp8/common/x86/postproc_x86.c',
+        'vp8/common/x86/recon_wrapper_sse2.c',
+        'vp8/common/x86/variance_mmx.c',
+        'vp8/common/x86/variance_sse2.c',
+        'vp8/common/x86/variance_ssse3.c',
+        'vp8/common/x86/vp8_asm_stubs.c',
+        'vpx_ports/x86_cpuid.c',
+    ]
+    SOURCES += [
+        'vp8/common/x86/dequantize_mmx.asm',
+        'vp8/common/x86/idctllm_mmx.asm',
+        'vp8/common/x86/idctllm_sse2.asm',
+        'vp8/common/x86/iwalsh_mmx.asm',
+        'vp8/common/x86/iwalsh_sse2.asm',
+        'vp8/common/x86/loopfilter_mmx.asm',
+        'vp8/common/x86/loopfilter_sse2.asm',
+        'vp8/common/x86/mfqe_sse2.asm',
+        'vp8/common/x86/postproc_mmx.asm',
+        'vp8/common/x86/postproc_sse2.asm',
+        'vp8/common/x86/recon_mmx.asm',
+        'vp8/common/x86/recon_sse2.asm',
+        'vp8/common/x86/sad_mmx.asm',
+        'vp8/common/x86/sad_sse2.asm',
+        'vp8/common/x86/sad_sse3.asm',
+        'vp8/common/x86/sad_sse4.asm',
+        'vp8/common/x86/sad_ssse3.asm',
+        'vp8/common/x86/subpixel_mmx.asm',
+        'vp8/common/x86/subpixel_sse2.asm',
+        'vp8/common/x86/subpixel_ssse3.asm',
+        'vp8/common/x86/variance_impl_mmx.asm',
+        'vp8/common/x86/variance_impl_sse2.asm',
+        'vp8/common/x86/variance_impl_ssse3.asm',
+        'vpx_ports/emms.asm',
+    ]
+
+    if '64' in CONFIG['OS_TEST']:
+        SOURCES += [
+            'vp8/common/x86/loopfilter_block_sse2.asm',
+        ]
+
+if CONFIG['VPX_X86_ASM'] and CONFIG['MOZ_VP8_ENCODER']:
+    SOURCES += [
+        'vp8/encoder/x86/vp8_enc_stubs_mmx.c',
+        'vp8/encoder/x86/vp8_enc_stubs_sse2.c',
+    ]
+    SOURCES += [
+        'vp8/encoder/x86/dct_mmx.asm',
+        'vp8/encoder/x86/dct_sse2.asm',
+        'vp8/encoder/x86/encodeopt.asm',
+        'vp8/encoder/x86/fwalsh_sse2.asm',
+        'vp8/encoder/x86/quantize_mmx.asm',
+        'vp8/encoder/x86/quantize_sse2.asm',
+        'vp8/encoder/x86/quantize_sse4.asm',
+        'vp8/encoder/x86/quantize_ssse3.asm',
+        'vp8/encoder/x86/subtract_mmx.asm',
+        'vp8/encoder/x86/subtract_sse2.asm',
+        'vp8/encoder/x86/temporal_filter_apply_sse2.asm',
+
+    ]
+
+if CONFIG['MOZ_VP8_ENCODER']:
+    SOURCES += [
+        'vp8/encoder/denoising.c',
+    ]
+    if CONFIG['VPX_X86_ASM']:
+        SOURCES += [
+            'vp8/encoder/x86/denoising_sse2.c',
+        ]
+
+arm_asm_files = []
+
+if CONFIG['VPX_ARM_ASM']:
+    SOURCES += [
+        'vp8/common/arm/armv6/idct_blk_v6.c',
+        'vp8/common/arm/bilinearfilter_arm.c',
+        'vp8/common/arm/dequantize_arm.c',
+        'vp8/common/arm/filter_arm.c',
+        'vp8/common/arm/loopfilter_arm.c',
+        'vp8/common/arm/neon/idct_blk_neon.c',
+        'vp8/common/arm/reconintra_arm.c',
+        'vp8/common/arm/variance_arm.c',
+        'vpx_ports/arm_cpudetect.c',
+        'vpx_scale/arm/neon/yv12extend_arm.c',
+    ]
+    arm_asm_files += [
+        'vp8/common/arm/armv6/bilinearfilter_v6.asm',
+        'vp8/common/arm/armv6/copymem16x16_v6.asm',
+        'vp8/common/arm/armv6/copymem8x4_v6.asm',
+        'vp8/common/arm/armv6/copymem8x8_v6.asm',
+        'vp8/common/arm/armv6/dc_only_idct_add_v6.asm',
+        'vp8/common/arm/armv6/dequant_idct_v6.asm',
+        'vp8/common/arm/armv6/dequantize_v6.asm',
+        'vp8/common/arm/armv6/filter_v6.asm',
+        'vp8/common/arm/armv6/idct_v6.asm',
+        'vp8/common/arm/armv6/intra4x4_predict_v6.asm',
+        'vp8/common/arm/armv6/iwalsh_v6.asm',
+        'vp8/common/arm/armv6/loopfilter_v6.asm',
+        'vp8/common/arm/armv6/simpleloopfilter_v6.asm',
+        'vp8/common/arm/armv6/sixtappredict8x4_v6.asm',
+        'vp8/common/arm/armv6/vp8_sad16x16_armv6.asm',
+        'vp8/common/arm/armv6/vp8_variance16x16_armv6.asm',
+        'vp8/common/arm/armv6/vp8_variance8x8_armv6.asm',
+        'vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm',
+        'vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm',
+        'vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm',
+        'vp8/common/arm/neon/bilinearpredict16x16_neon.asm',
+        'vp8/common/arm/neon/bilinearpredict4x4_neon.asm',
+        'vp8/common/arm/neon/bilinearpredict8x4_neon.asm',
+        'vp8/common/arm/neon/bilinearpredict8x8_neon.asm',
+        'vp8/common/arm/neon/buildintrapredictorsmby_neon.asm',
+        'vp8/common/arm/neon/copymem16x16_neon.asm',
+        'vp8/common/arm/neon/copymem8x4_neon.asm',
+        'vp8/common/arm/neon/copymem8x8_neon.asm',
+        'vp8/common/arm/neon/dc_only_idct_add_neon.asm',
+        'vp8/common/arm/neon/dequant_idct_neon.asm',
+        'vp8/common/arm/neon/dequantizeb_neon.asm',
+        'vp8/common/arm/neon/idct_dequant_0_2x_neon.asm',
+        'vp8/common/arm/neon/idct_dequant_full_2x_neon.asm',
+        'vp8/common/arm/neon/iwalsh_neon.asm',
+        'vp8/common/arm/neon/loopfilter_neon.asm',
+        'vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm',
+        'vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm',
+        'vp8/common/arm/neon/mbloopfilter_neon.asm',
+        'vp8/common/arm/neon/sad16_neon.asm',
+        'vp8/common/arm/neon/sad8_neon.asm',
+        'vp8/common/arm/neon/save_reg_neon.asm',
+        'vp8/common/arm/neon/shortidct4x4llm_neon.asm',
+        'vp8/common/arm/neon/sixtappredict16x16_neon.asm',
+        'vp8/common/arm/neon/sixtappredict4x4_neon.asm',
+        'vp8/common/arm/neon/sixtappredict8x4_neon.asm',
+        'vp8/common/arm/neon/sixtappredict8x8_neon.asm',
+        'vp8/common/arm/neon/variance_neon.asm',
+        'vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm',
+        'vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm',
+        'vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm',
+        'vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm',
+        'vp8/encoder/arm/neon/vp8_mse16x16_neon.asm',
+        'vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm',
+        'vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm',
+        'vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm',
+        'vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm',
+    ]
+
+if CONFIG['VPX_ARM_ASM'] and CONFIG['MOZ_VP8_ENCODER']:
+    SOURCES += [
+        'vp8/encoder/arm/boolhuff_arm.c',
+        'vp8/encoder/arm/dct_arm.c',
+        'vp8/encoder/arm/neon/picklpf_arm.c',
+        'vp8/encoder/arm/quantize_arm.c',
+    ]
+    arm_asm_files += [
+        'vp8/encoder/arm/armv5te/boolhuff_armv5te.asm',
+        'vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm',
+        'vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm',
+        'vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm',
+        'vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm',
+        'vp8/encoder/arm/armv6/vp8_short_fdct4x4_armv6.asm',
+        'vp8/encoder/arm/armv6/vp8_subtract_armv6.asm',
+        'vp8/encoder/arm/armv6/walsh_v6.asm',
+        'vp8/encoder/arm/neon/fastquantizeb_neon.asm',
+        'vp8/encoder/arm/neon/shortfdct_neon.asm',
+        'vp8/encoder/arm/neon/subtract_neon.asm',
+        'vp8/encoder/arm/neon/vp8_memcpy_neon.asm',
+        'vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm',
+    ]
+
+if arm_asm_files:
+    if CONFIG['VPX_AS_CONVERSION']:
+        GENERATED_SOURCES += [ "%s.%s" % (f, CONFIG['VPX_ASM_SUFFIX'])
+            for f in sorted(arm_asm_files)]
+    else:
+        SOURCES += sorted(arm_asm_files)
+
+# boolhuff_armv5te.asm defines the same functions as boolhuff.c instead of
+# using RTCD, so we have to make sure we only add one of the two.
+if CONFIG['MOZ_VP8_ENCODER'] \
+    and 'vp8/encoder/arm/armv5te/boolhuff_armv5te.asm' not in arm_asm_files:
+    SOURCES += [
+        'vp8/encoder/boolhuff.c',
+    ]
+
 MSVC_ENABLE_PGO = True
 
 if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
 
 DEFINES['HAVE_CONFIG_H'] = 'vpx_config.h'
deleted file mode 100644
--- a/media/libvpx/solaris.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-diff --git a/media/libvpx/vpx_ports/mem.h b/media/libvpx/vpx_ports/mem.h
---- a/media/libvpx/vpx_ports/mem.h
-+++ b/media/libvpx/vpx_ports/mem.h
-@@ -9,17 +9,17 @@
-  */
- 
- 
- #ifndef VPX_PORTS_MEM_H
- #define VPX_PORTS_MEM_H
- #include "vpx_config.h"
- #include "vpx/vpx_integer.h"
- 
--#if defined(__GNUC__) && __GNUC__
-+#if (defined(__GNUC__) && __GNUC__) || defined(__SUNPRO_C)
- #define DECLARE_ALIGNED(n,typ,val)  typ val __attribute__ ((aligned (n)))
- #elif defined(_MSC_VER)
- #define DECLARE_ALIGNED(n,typ,val)  __declspec(align(n)) typ val
- #else
- #warning No alignment directives known for this compiler.
- #define DECLARE_ALIGNED(n,typ,val)  typ val
- #endif
- #endif
-diff --git a/media/libvpx/vpx_ports/x86.h b/media/libvpx/vpx_ports/x86.h
---- a/media/libvpx/vpx_ports/x86.h
-+++ b/media/libvpx/vpx_ports/x86.h
-@@ -45,16 +45,36 @@ typedef enum
- #define cpuid(func,ax,bx,cx,dx)\
-     __asm__ __volatile__ (\
-                           "mov %%ebx, %%edi   \n\t" \
-                           "cpuid              \n\t" \
-                           "xchg %%edi, %%ebx  \n\t" \
-                           : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
-                           : "a" (func));
- #endif
-+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-+#if ARCH_X86_64
-+#define cpuid(func,ax,bx,cx,dx)\
-+    asm volatile (\
-+                  "xchg %rsi, %rbx \n\t" \
-+                  "cpuid           \n\t" \
-+                  "movl %ebx, %edi \n\t" \
-+                  "xchg %rsi, %rbx \n\t" \
-+                  : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
-+                  : "a"  (func));
-+#else
-+#define cpuid(func,ax,bx,cx,dx)\
-+    asm volatile (\
-+                  "pushl %ebx       \n\t" \
-+                  "cpuid            \n\t" \
-+                  "movl %ebx, %edi  \n\t" \
-+                  "popl %ebx        \n\t" \
-+                  : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
-+                  : "a" (func));
-+#endif
- #else
- #if ARCH_X86_64
- void __cpuid(int CPUInfo[4], int info_type);
- #pragma intrinsic(__cpuid)
- #define cpuid(func,a,b,c,d) do{\
-         int regs[4];\
-         __cpuid(regs,func); a=regs[0];  b=regs[1];  c=regs[2];  d=regs[3];\
-     } while(0)
-@@ -131,29 +151,36 @@ unsigned __int64 __rdtsc(void);
- #endif
- static unsigned int
- x86_readtsc(void)
- {
- #if defined(__GNUC__) && __GNUC__
-     unsigned int tsc;
-     __asm__ __volatile__("rdtsc\n\t":"=a"(tsc):);
-     return tsc;
-+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-+    unsigned int tsc;
-+    asm volatile("rdtsc\n\t":"=a"(tsc):);
-+    return tsc;
- #else
- #if ARCH_X86_64
-     return __rdtsc();
- #else
-     __asm  rdtsc;
- #endif
- #endif
- }
- 
- 
- #if defined(__GNUC__) && __GNUC__
- #define x86_pause_hint()\
-     __asm__ __volatile__ ("pause \n\t")
-+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-+#define x86_pause_hint()\
-+    asm volatile ("pause \n\t")
- #else
- #if ARCH_X86_64
- #define x86_pause_hint()\
-     _mm_pause();
- #else
- #define x86_pause_hint()\
-     __asm pause
- #endif
-@@ -167,16 +194,29 @@ x87_set_control_word(unsigned short mode
- }
- static unsigned short
- x87_get_control_word(void)
- {
-     unsigned short mode;
-     __asm__ __volatile__("fstcw %0\n\t":"=m"(*&mode):);
-     return mode;
- }
-+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-+static void
-+x87_set_control_word(unsigned short mode)
-+{
-+    asm volatile("fldcw %0" : : "m"(*&mode));
-+}
-+static unsigned short
-+x87_get_control_word(void)
-+{
-+    unsigned short mode;
-+    asm volatile("fstcw %0\n\t":"=m"(*&mode):);
-+    return mode;
-+}
- #elif ARCH_X86_64
- /* No fldcw intrinsics on Windows x64, punt to external asm */
- extern void           vpx_winx64_fldcw(unsigned short mode);
- extern unsigned short vpx_winx64_fstcw(void);
- #define x87_set_control_word vpx_winx64_fldcw
- #define x87_get_control_word vpx_winx64_fstcw
- #else
- static void
--- a/media/libvpx/stdint.patch
+++ b/media/libvpx/stdint.patch
@@ -1,10 +1,8 @@
-diff --git a/media/libvpx/stdint.patch b/media/libvpx/stdint.patch
-new file mode 100644
 diff --git a/media/libvpx/vpx/vpx_integer.h b/media/libvpx/vpx/vpx_integer.h
 --- a/media/libvpx/vpx/vpx_integer.h
 +++ b/media/libvpx/vpx/vpx_integer.h
 @@ -10,16 +10,18 @@
  
  
  #ifndef VPX_INTEGER_H
  #define VPX_INTEGER_H
deleted file mode 100644
--- a/media/libvpx/textrels.patch
+++ /dev/null
@@ -1,164 +0,0 @@
-# HG changeset patch
-# Parent f7a8c8a419870421138438970a0514e79353ae34
-# User Timothy B. Terriberry <tterribe@vt.edu>
-Bug 730903 - Fix text relocations in libvpx variance functions.
-
-diff --git a/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm b/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm
-@@ -4,16 +4,21 @@
- ;  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.
- ;
- 
- 
-+bilinear_taps_coeff
-+    DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
-+
-+;-----------------
-+
-     EXPORT  |vp8_sub_pixel_variance16x16_neon_func|
-     ARM
-     REQUIRE8
-     PRESERVE8
- 
-     AREA ||.text||, CODE, READONLY, ALIGN=2
- ; r0    unsigned char  *src_ptr,
- ; r1    int  src_pixels_per_line,
-@@ -22,17 +27,17 @@
- ; stack(r4) unsigned char *dst_ptr,
- ; stack(r5) int dst_pixels_per_line,
- ; stack(r6) unsigned int *sse
- ;note: most of the code is copied from bilinear_predict16x16_neon and vp8_variance16x16_neon.
- 
- |vp8_sub_pixel_variance16x16_neon_func| PROC
-     push            {r4-r6, lr}
- 
--    ldr             r12, _BilinearTaps_coeff_
-+    adr             r12, bilinear_taps_coeff
-     ldr             r4, [sp, #16]           ;load *dst_ptr from stack
-     ldr             r5, [sp, #20]           ;load dst_pixels_per_line from stack
-     ldr             r6, [sp, #24]           ;load *sse from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             secondpass_bfilter16x16_only
- 
-     add             r2, r12, r2, lsl #3     ;calculate filter location
-@@ -410,16 +415,9 @@ sub_pixel_variance16x16_neon_loop
- 
-     add             sp, sp, #528
-     vmov.32         r0, d0[0]                   ;return
- 
-     pop             {r4-r6,pc}
- 
-     ENDP
- 
--;-----------------
--
--_BilinearTaps_coeff_
--    DCD     bilinear_taps_coeff
--bilinear_taps_coeff
--    DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
--
-     END
-diff --git a/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm b/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm
---- a/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm
-+++ b/media/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm
-@@ -22,17 +22,17 @@
- ; stack(r4) unsigned char *dst_ptr,
- ; stack(r5) int dst_pixels_per_line,
- ; stack(r6) unsigned int *sse
- ;note: most of the code is copied from bilinear_predict8x8_neon and vp8_variance8x8_neon.
- 
- |vp8_sub_pixel_variance8x8_neon| PROC
-     push            {r4-r5, lr}
- 
--    ldr             r12, _BilinearTaps_coeff_
-+    adr             r12, bilinear_taps_coeff
-     ldr             r4, [sp, #12]           ;load *dst_ptr from stack
-     ldr             r5, [sp, #16]           ;load dst_pixels_per_line from stack
-     ldr             lr, [sp, #20]           ;load *sse from stack
- 
-     cmp             r2, #0                  ;skip first_pass filter if xoffset=0
-     beq             skip_firstpass_filter
- 
- ;First pass: output_height lines x output_width columns (9x8)
-@@ -211,14 +211,12 @@ sub_pixel_variance8x8_neon_loop
- 
-     vmov.32         r0, d0[0]                   ;return
-     pop             {r4-r5, pc}
- 
-     ENDP
- 
- ;-----------------
- 
--_BilinearTaps_coeff_
--    DCD     bilinear_taps_coeff
- bilinear_taps_coeff
-     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
- 
-     END
-diff --git a/media/libvpx/vp8/encoder/arm/neon/fastquantizeb_neon.asm b/media/libvpx/vp8/encoder/arm/neon/fastquantizeb_neon.asm
---- a/media/libvpx/vp8/encoder/arm/neon/fastquantizeb_neon.asm
-+++ b/media/libvpx/vp8/encoder/arm/neon/fastquantizeb_neon.asm
-@@ -93,17 +93,17 @@
-     vsub.s16        q10, q12            ; x2=(y^sz)-sz = (y^sz)-(-1) (2's complement)
-     vsub.s16        q11, q13
- 
-     ldr             r6, [r3, #vp8_blockd_qcoeff]
- 
-     vmul.s16        q2, q6, q4          ; x * Dequant
-     vmul.s16        q3, q7, q5
- 
--    ldr             r0, _inv_zig_zag_   ; load ptr of inverse zigzag table
-+    adr             r0, inv_zig_zag     ; load ptr of inverse zigzag table
- 
-     vceq.s16        q8, q8              ; set q8 to all 1
- 
-     vst1.s16        {q10, q11}, [r6]    ; store: qcoeff = x2
- 
-     vmul.s16        q12, q6, q10        ; x2 * Dequant
-     vmul.s16        q13, q7, q11
- 
-@@ -176,17 +176,17 @@
-     vshr.s16        q3, q1, #15
- 
-     vld1.s16        {q14, q15}, [r5@128]; load round_ptr [0-15]
-     vld1.s16        {q8, q9}, [r4@128]  ; load quant_ptr [0-15]
- 
-     vadd.s16        q12, q14            ; x + Round
-     vadd.s16        q13, q15
- 
--    ldr             r0, _inv_zig_zag_   ; load ptr of inverse zigzag table
-+    adr             r0, inv_zig_zag     ; load ptr of inverse zigzag table
- 
-     vqdmulh.s16     q12, q8             ; y = ((Round+abs(z)) * Quant) >> 16
-     vqdmulh.s16     q13, q9
- 
-     vld1.16         {q10, q11}, [r0@128]; load inverse scan order
- 
-     vceq.s16        q8, q8              ; set q8 to all 1
- 
-@@ -242,19 +242,16 @@ zero_output
-     vst1.s16        {q0, q1}, [r7@128]  ; dqcoeff = 0
- 
-     ldmfd           sp!, {r4-r7}
-     bx              lr
- 
-     ENDP
- 
- ; default inverse zigzag table is defined in vp8/common/entropy.c
--_inv_zig_zag_
--    DCD inv_zig_zag
--
-     ALIGN 16    ; enable use of @128 bit aligned loads
- inv_zig_zag
-     DCW 0x0001, 0x0002, 0x0006, 0x0007
-     DCW 0x0003, 0x0005, 0x0008, 0x000d
-     DCW 0x0004, 0x0009, 0x000c, 0x000e
-     DCW 0x000a, 0x000b, 0x000f, 0x0010
- 
-     END
--- a/media/libvpx/update.sh
+++ b/media/libvpx/update.sh
@@ -1,483 +1,362 @@
 #!/bin/bash
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+set -e
+
+PLATFORMS='
+  x86-win32-vs8
+  x86_64-win64-vs8
+  x86-linux-gcc
+  x86_64-linux-gcc
+  generic-gnu
+  x86-darwin9-gcc
+  x86_64-darwin9-gcc
+  armv7-android-gcc
+  '
 
 if [ $# -lt 1 ]; then
   echo Usage: update.sh /path/to/libvpx/
   echo The libvpx dir must contain a directory "objdir" with the following directories configured in it:
-  echo   * objdir/x86-win32-vs8
-  echo   * objdir/x86-linux-gcc
-  echo   * objdir/generic-gnu
-  echo   * objdir/x86-darwin9-gcc
-  echo   * objdir/x86_64-darwin9-gcc
-  echo   * objdir/armv7-linux-gcc
-  echo You can configure these from objdir/$target with the following command:
-  echo $ ../../configure --target=$target --disable-vp8-encoder --disable-examples --disable-install-docs
-  echo On Mac, you also need --enable-pic
+  for target in ${PLATFORMS}; do
+    echo -e "   * objdir/${target}"
+  done
+  echo You can configure these from objdir/\$target with the following command:
+  echo $ ../../configure --target=\$target --disable-examples --disable-install-docs
+  echo For Android you need --sdk-path=/path/to/android-ndk-r\$REV
+  echo For Mac, you also need --enable-pic
   exit -1
 fi
 
 # These are relative to SDK source dir.
 commonFiles=(
-  vp8/vp8_cx_iface.c
-  vp8/vp8_dx_iface.c
+  LICENSE
+  PATENTS
+  build/make/ads2gas.pl
+  build/make/obj_int_extract.c
   vp8/common/alloccommon.c
-  vp8/common/asm_com_offsets.c
-  vp8/common/blockd.c
-  vp8/common/debugmodes.c
-  vp8/common/dequantize.c
-  vp8/common/entropy.c
-  vp8/common/entropymode.c
-  vp8/common/entropymv.c
-  vp8/common/extend.c
-  vp8/common/filter.c
-  vp8/common/findnearmv.c
-  vp8/common/idct_blk.c
-  vp8/common/idctllm.c
-  vp8/common/loopfilter.c
-  vp8/common/loopfilter_filters.c
-  vp8/common/mbpitch.c
-  vp8/common/modecont.c
-  vp8/common/modecontext.c
-  vp8/common/postproc.c
-  vp8/common/quant_common.c
-  vp8/common/reconinter.c
-  vp8/common/reconintra.c
-  vp8/common/reconintra4x4.c
-  vp8/common/setupintrarecon.c
-  vp8/common/swapyv12buffer.c
-  vp8/common/treecoder.c
-  vp8/common/arm/arm_systemdependent.c
-  vp8/common/arm/bilinearfilter_arm.c
-  vp8/common/arm/dequantize_arm.c
-  vp8/common/arm/filter_arm.c
-  vp8/common/arm/loopfilter_arm.c
-  vp8/common/arm/reconintra_arm.c
-  vp8/common/arm/armv6/idct_blk_v6.c
-  vp8/common/arm/neon/idct_blk_neon.c
-  vp8/common/generic/systemdependent.c
-  vp8/common/x86/filter_x86.c
-  vp8/common/x86/idct_blk_mmx.c
-  vp8/common/x86/idct_blk_sse2.c
-  vp8/common/x86/loopfilter_x86.c
-  vp8/common/x86/recon_wrapper_sse2.c
-  vp8/common/x86/vp8_asm_stubs.c
-  vp8/common/x86/x86_systemdependent.c
-  vp8/decoder/asm_dec_offsets.c
-  vp8/decoder/dboolhuff.c
-  vp8/decoder/decodemv.c
-  vp8/decoder/decodframe.c
-  vp8/decoder/detokenize.c
-  vp8/decoder/error_concealment.c
-  vp8/decoder/onyxd_if.c
-  vp8/decoder/reconintra_mt.c
-  vp8/decoder/threading.c
-  vp8/decoder/arm/arm_dsystemdependent.c
-  vp8/decoder/generic/dsystemdependent.c
-  vp8/decoder/x86/x86_dsystemdependent.c
-  vp8/encoder/asm_enc_offsets.c
-  vp8/encoder/bitstream.c
-  vp8/encoder/boolhuff.c
-  vp8/encoder/dct.c
-  vp8/encoder/encodeframe.c
-  vp8/encoder/encodeintra.c
-  vp8/encoder/encodemb.c
-  vp8/encoder/encodemv.c
-  vp8/encoder/ethreading.c
-  vp8/encoder/firstpass.c
-  vp8/encoder/lookahead.c
-  vp8/encoder/mcomp.c
-  vp8/encoder/modecosts.c
-  vp8/encoder/mr_dissim.c
-  vp8/encoder/onyx_if.c
-  vp8/encoder/pickinter.c
-  vp8/encoder/picklpf.c
-  vp8/encoder/psnr.c
-  vp8/encoder/quantize.c
-  vp8/encoder/ratectrl.c
-  vp8/encoder/rdopt.c
-  vp8/encoder/sad_c.c
-  vp8/encoder/segmentation.c
-  vp8/encoder/temporal_filter.c
-  vp8/encoder/tokenize.c
-  vp8/encoder/treewriter.c
-  vp8/encoder/variance_c.c
-  vp8/encoder/arm/arm_csystemdependent.c
-  vp8/encoder/arm/boolhuff_arm.c
-  vp8/encoder/arm/dct_arm.c
-  vp8/encoder/arm/quantize_arm.c
-  vp8/encoder/arm/variance_arm.c
-  vp8/encoder/arm/neon/picklpf_arm.c
-  vp8/encoder/generic/csystemdependent.c
-  vp8/encoder/x86/variance_mmx.c
-  vp8/encoder/x86/variance_sse2.c
-  vp8/encoder/x86/variance_ssse3.c
-  vp8/encoder/x86/x86_csystemdependent.c
-  vpx/src/vpx_codec.c
-  vpx/src/vpx_decoder.c
-  vpx/src/vpx_decoder_compat.c
-  vpx/src/vpx_encoder.c
-  vpx/src/vpx_image.c
-  vpx_mem/vpx_mem.c
-  vpx_ports/arm_cpudetect.c
-  vpx_scale/arm/neon/yv12extend_arm.c
-  vpx_scale/generic/gen_scalers.c
-  vpx_scale/generic/scalesystemdependent.c
-  vpx_scale/generic/vpxscale.c
-  vpx_scale/generic/yv12config.c
-  vpx_scale/generic/yv12extend.c
   vp8/common/alloccommon.h
-  vp8/common/blockd.h
-  vp8/common/coefupdateprobs.h
-  vp8/common/common.h
-  vp8/common/default_coef_probs.h
-  vp8/common/dequantize.h
-  vp8/common/entropy.h
-  vp8/common/entropymode.h
-  vp8/common/entropymv.h
-  vp8/common/extend.h
-  vp8/common/filter.h
-  vp8/common/findnearmv.h
-  vp8/common/header.h
-  vp8/common/idct.h
-  vp8/common/invtrans.h
-  vp8/common/loopfilter.h
-  vp8/common/modecont.h
-  vp8/common/mv.h
-  vp8/common/onyx.h
-  vp8/common/onyxc_int.h
-  vp8/common/onyxd.h
-  vp8/common/postproc.h
-  vp8/common/ppflags.h
-  vp8/common/pragmas.h
-  vp8/common/quant_common.h
-  vp8/common/recon.h
-  vp8/common/reconinter.h
-  vp8/common/reconintra.h
-  vp8/common/reconintra4x4.h
-  vp8/common/setupintrarecon.h
-  vp8/common/subpixel.h
-  vp8/common/swapyv12buffer.h
-  vp8/common/systemdependent.h
-  vp8/common/threading.h
-  vp8/common/treecoder.h
-  vp8/common/arm/bilinearfilter_arm.h
-  vp8/common/arm/dequantize_arm.h
-  vp8/common/arm/idct_arm.h
-  vp8/common/arm/loopfilter_arm.h
-  vp8/common/arm/recon_arm.h
-  vp8/common/arm/subpixel_arm.h
-  vp8/common/x86/dequantize_x86.h
-  vp8/common/x86/filter_x86.h
-  vp8/common/x86/idct_x86.h
-  vp8/common/x86/loopfilter_x86.h
-  vp8/common/x86/postproc_x86.h
-  vp8/common/x86/recon_x86.h
-  vp8/common/x86/subpixel_x86.h
-  vp8/decoder/dboolhuff.h
-  vp8/decoder/decodemv.h
-  vp8/decoder/decoderthreading.h
-  vp8/decoder/detokenize.h
-  vp8/decoder/ec_types.h
-  vp8/decoder/error_concealment.h
-  vp8/decoder/onyxd_int.h
-  vp8/decoder/reconintra_mt.h
-  vp8/decoder/treereader.h
-  vp8/encoder/bitstream.h
-  vp8/encoder/block.h
-  vp8/encoder/boolhuff.h
-  vp8/encoder/dct.h
-  vp8/encoder/defaultcoefcounts.h
-  vp8/encoder/encodeintra.h
-  vp8/encoder/encodemb.h
-  vp8/encoder/encodemv.h
-  vp8/encoder/firstpass.h
-  vp8/encoder/lookahead.h
-  vp8/encoder/mcomp.h
-  vp8/encoder/modecosts.h
-  vp8/encoder/mr_dissim.h
-  vp8/encoder/onyx_int.h
-  vp8/encoder/pickinter.h
-  vp8/encoder/psnr.h
-  vp8/encoder/quantize.h
-  vp8/encoder/ratectrl.h
-  vp8/encoder/rdopt.h
-  vp8/encoder/segmentation.h
-  vp8/encoder/temporal_filter.h
-  vp8/encoder/tokenize.h
-  vp8/encoder/treewriter.h
-  vp8/encoder/variance.h
-  vp8/encoder/arm/dct_arm.h
-  vp8/encoder/arm/encodemb_arm.h
-  vp8/encoder/arm/quantize_arm.h
-  vp8/encoder/arm/variance_arm.h
-  vp8/encoder/x86/dct_x86.h
-  vp8/encoder/x86/encodemb_x86.h
-  vp8/encoder/x86/mcomp_x86.h
-  vp8/encoder/x86/quantize_x86.h
-  vp8/encoder/x86/temporal_filter_x86.h
-  vp8/encoder/x86/variance_x86.h
-  vpx/internal/vpx_codec_internal.h
-  vpx/vp8cx.h
-  vpx/vp8dx.h
-  vpx/vp8e.h
-  vpx/vp8.h
-  vpx/vpx_codec.h
-  vpx/vpx_codec_impl_bottom.h
-  vpx/vpx_codec_impl_top.h
-  vpx/vpx_decoder_compat.h
-  vpx/vpx_decoder.h
-  vpx/vpx_encoder.h
-  vpx/vpx_image.h
-  vpx/vpx_integer.h
-  vpx_mem/include/vpx_mem_intrnl.h
-  vpx_mem/vpx_mem.h
-  vpx_ports/arm.h
-  vpx_ports/asm_offsets.h
-  vpx_ports/mem.h
-  vpx_ports/vpx_timer.h
-  vpx_ports/x86.h
-  vpx_scale/scale_mode.h
-  vpx_scale/vpxscale.h
-  vpx_scale/yv12config.h
-  vpx_scale/yv12extend.h
-  vpx_scale/arm/yv12extend_arm.h
-  vpx_scale/generic/yv12extend_generic.h
   vp8/common/arm/armv6/bilinearfilter_v6.asm
   vp8/common/arm/armv6/copymem16x16_v6.asm
   vp8/common/arm/armv6/copymem8x4_v6.asm
   vp8/common/arm/armv6/copymem8x8_v6.asm
   vp8/common/arm/armv6/dc_only_idct_add_v6.asm
   vp8/common/arm/armv6/dequant_idct_v6.asm
   vp8/common/arm/armv6/dequantize_v6.asm
-  vp8/common/arm/armv6/iwalsh_v6.asm
   vp8/common/arm/armv6/filter_v6.asm
+  vp8/common/arm/armv6/idct_blk_v6.c
   vp8/common/arm/armv6/idct_v6.asm
   vp8/common/arm/armv6/intra4x4_predict_v6.asm
   vp8/common/arm/armv6/iwalsh_v6.asm
   vp8/common/arm/armv6/loopfilter_v6.asm
   vp8/common/arm/armv6/simpleloopfilter_v6.asm
   vp8/common/arm/armv6/sixtappredict8x4_v6.asm
+  vp8/common/arm/armv6/vp8_sad16x16_armv6.asm
+  vp8/common/arm/armv6/vp8_variance16x16_armv6.asm
+  vp8/common/arm/armv6/vp8_variance8x8_armv6.asm
+  vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
+  vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
+  vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
+  vp8/common/arm/bilinearfilter_arm.c
+  vp8/common/arm/bilinearfilter_arm.h
+  vp8/common/arm/dequantize_arm.c
+  vp8/common/arm/filter_arm.c
+  vp8/common/arm/loopfilter_arm.c
   vp8/common/arm/neon/bilinearpredict16x16_neon.asm
   vp8/common/arm/neon/bilinearpredict4x4_neon.asm
   vp8/common/arm/neon/bilinearpredict8x4_neon.asm
   vp8/common/arm/neon/bilinearpredict8x8_neon.asm
   vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
   vp8/common/arm/neon/copymem16x16_neon.asm
   vp8/common/arm/neon/copymem8x4_neon.asm
   vp8/common/arm/neon/copymem8x8_neon.asm
   vp8/common/arm/neon/dc_only_idct_add_neon.asm
   vp8/common/arm/neon/dequant_idct_neon.asm
   vp8/common/arm/neon/dequantizeb_neon.asm
+  vp8/common/arm/neon/idct_blk_neon.c
   vp8/common/arm/neon/idct_dequant_0_2x_neon.asm
   vp8/common/arm/neon/idct_dequant_full_2x_neon.asm
   vp8/common/arm/neon/iwalsh_neon.asm
   vp8/common/arm/neon/loopfilter_neon.asm
   vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
   vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
   vp8/common/arm/neon/mbloopfilter_neon.asm
-  vp8/common/arm/neon/save_neon_reg.asm
+  vp8/common/arm/neon/sad16_neon.asm
+  vp8/common/arm/neon/sad8_neon.asm
+  vp8/common/arm/neon/save_reg_neon.asm
   vp8/common/arm/neon/shortidct4x4llm_neon.asm
   vp8/common/arm/neon/sixtappredict16x16_neon.asm
   vp8/common/arm/neon/sixtappredict4x4_neon.asm
   vp8/common/arm/neon/sixtappredict8x4_neon.asm
   vp8/common/arm/neon/sixtappredict8x8_neon.asm
+  vp8/common/arm/neon/variance_neon.asm
+  vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm
+  vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm
+  vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm
+  vp8/common/arm/reconintra_arm.c
+  vp8/common/arm/variance_arm.c
+  vp8/common/asm_com_offsets.c
+  vp8/common/blockd.c
+  vp8/common/blockd.h
+  vp8/common/coefupdateprobs.h
+  vp8/common/common.h
+  vp8/common/debugmodes.c
+  vp8/common/default_coef_probs.h
+  vp8/common/dequantize.c
+  vp8/common/entropy.c
+  vp8/common/entropy.h
+  vp8/common/entropymode.c
+  vp8/common/entropymode.h
+  vp8/common/entropymv.c
+  vp8/common/entropymv.h
+  vp8/common/extend.c
+  vp8/common/extend.h
+  vp8/common/filter.c
+  vp8/common/filter.h
+  vp8/common/findnearmv.c
+  vp8/common/findnearmv.h
+  vp8/common/generic/systemdependent.c
+  vp8/common/header.h
+  vp8/common/idct_blk.c
+  vp8/common/idctllm.c
+  vp8/common/invtrans.h
+  vp8/common/loopfilter.c
+  vp8/common/loopfilter.h
+  vp8/common/loopfilter_filters.c
+  vp8/common/mbpitch.c
+  vp8/common/mfqe.c
+  vp8/common/modecont.c
+  vp8/common/modecont.h
+  vp8/common/mv.h
+  vp8/common/onyx.h
+  vp8/common/onyxc_int.h
+  vp8/common/onyxd.h
+  vp8/common/postproc.c
+  vp8/common/postproc.h
+  vp8/common/ppflags.h
+  vp8/common/pragmas.h
+  vp8/common/quant_common.c
+  vp8/common/quant_common.h
+  vp8/common/reconinter.c
+  vp8/common/reconinter.h
+  vp8/common/reconintra.c
+  vp8/common/reconintra4x4.c
+  vp8/common/reconintra4x4.h
+  vp8/common/rtcd.c
+  vp8/common/sad_c.c
+  vp8/common/setupintrarecon.c
+  vp8/common/setupintrarecon.h
+  vp8/common/swapyv12buffer.c
+  vp8/common/swapyv12buffer.h
+  vp8/common/systemdependent.h
+  vp8/common/threading.h
+  vp8/common/treecoder.c
+  vp8/common/treecoder.h
+  vp8/common/variance.h
+  vp8/common/variance_c.c
+  vp8/common/vp8_entropymodedata.h
   vp8/common/x86/dequantize_mmx.asm
+  vp8/common/x86/filter_x86.c
+  vp8/common/x86/filter_x86.h
+  vp8/common/x86/idct_blk_mmx.c
+  vp8/common/x86/idct_blk_sse2.c
   vp8/common/x86/idctllm_mmx.asm
   vp8/common/x86/idctllm_sse2.asm
   vp8/common/x86/iwalsh_mmx.asm
   vp8/common/x86/iwalsh_sse2.asm
   vp8/common/x86/loopfilter_block_sse2.asm
   vp8/common/x86/loopfilter_mmx.asm
   vp8/common/x86/loopfilter_sse2.asm
+  vp8/common/x86/loopfilter_x86.c
+  vp8/common/x86/mfqe_sse2.asm
   vp8/common/x86/postproc_mmx.asm
   vp8/common/x86/postproc_sse2.asm
+  vp8/common/x86/postproc_x86.c
   vp8/common/x86/recon_mmx.asm
   vp8/common/x86/recon_sse2.asm
+  vp8/common/x86/recon_wrapper_sse2.c
+  vp8/common/x86/sad_mmx.asm
+  vp8/common/x86/sad_sse2.asm
+  vp8/common/x86/sad_sse3.asm
+  vp8/common/x86/sad_sse4.asm
+  vp8/common/x86/sad_ssse3.asm
   vp8/common/x86/subpixel_mmx.asm
   vp8/common/x86/subpixel_sse2.asm
   vp8/common/x86/subpixel_ssse3.asm
+  vp8/common/x86/variance_impl_mmx.asm
+  vp8/common/x86/variance_impl_sse2.asm
+  vp8/common/x86/variance_impl_ssse3.asm
+  vp8/common/x86/variance_mmx.c
+  vp8/common/x86/variance_sse2.c
+  vp8/common/x86/variance_ssse3.c
+  vp8/common/x86/vp8_asm_stubs.c
+  vp8/decoder/asm_dec_offsets.c
+  vp8/decoder/dboolhuff.c
+  vp8/decoder/dboolhuff.h
+  vp8/decoder/decodemv.c
+  vp8/decoder/decodemv.h
+  vp8/decoder/decoderthreading.h
+  vp8/decoder/decodframe.c
+  vp8/decoder/detokenize.c
+  vp8/decoder/detokenize.h
+  vp8/decoder/ec_types.h
+  vp8/decoder/error_concealment.c
+  vp8/decoder/error_concealment.h
+  vp8/decoder/onyxd_if.c
+  vp8/decoder/onyxd_int.h
+  vp8/decoder/threading.c
+  vp8/decoder/treereader.h
   vp8/encoder/arm/armv5te/boolhuff_armv5te.asm
   vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm
   vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm
   vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm
   vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm
   vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
-  vp8/encoder/arm/armv6/vp8_sad16x16_armv6.asm
   vp8/encoder/arm/armv6/vp8_short_fdct4x4_armv6.asm
   vp8/encoder/arm/armv6/vp8_subtract_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
   vp8/encoder/arm/armv6/walsh_v6.asm
+  vp8/encoder/arm/boolhuff_arm.c
+  vp8/encoder/arm/dct_arm.c
   vp8/encoder/arm/neon/fastquantizeb_neon.asm
-  vp8/encoder/arm/neon/sad16_neon.asm
-  vp8/encoder/arm/neon/sad8_neon.asm
+  vp8/encoder/arm/neon/picklpf_arm.c
   vp8/encoder/arm/neon/shortfdct_neon.asm
   vp8/encoder/arm/neon/subtract_neon.asm
-  vp8/encoder/arm/neon/variance_neon.asm
   vp8/encoder/arm/neon/vp8_memcpy_neon.asm
   vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
   vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
-  vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
-  vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-  vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
+  vp8/encoder/arm/quantize_arm.c
+  vp8/encoder/asm_enc_offsets.c
+  vp8/encoder/bitstream.c
+  vp8/encoder/bitstream.h
+  vp8/encoder/block.h
+  vp8/encoder/boolhuff.c
+  vp8/encoder/boolhuff.h
+  vp8/encoder/dct.c
+  vp8/encoder/dct_value_cost.h
+  vp8/encoder/dct_value_tokens.h
+  vp8/encoder/defaultcoefcounts.h
+  vp8/encoder/denoising.c
+  vp8/encoder/denoising.h
+  vp8/encoder/encodeframe.c
+  vp8/encoder/encodeframe.h
+  vp8/encoder/encodeintra.c
+  vp8/encoder/encodeintra.h
+  vp8/encoder/encodemb.c
+  vp8/encoder/encodemb.h
+  vp8/encoder/encodemv.c
+  vp8/encoder/encodemv.h
+  vp8/encoder/ethreading.c
+  vp8/encoder/firstpass.c
+  vp8/encoder/firstpass.h
+  vp8/encoder/lookahead.c
+  vp8/encoder/lookahead.h
+  vp8/encoder/mcomp.c
+  vp8/encoder/mcomp.h
+  vp8/encoder/modecosts.c
+  vp8/encoder/modecosts.h
+  vp8/encoder/mr_dissim.c
+  vp8/encoder/mr_dissim.h
+  vp8/encoder/onyx_if.c
+  vp8/encoder/onyx_int.h
+  vp8/encoder/pickinter.c
+  vp8/encoder/pickinter.h
+  vp8/encoder/picklpf.c
+  vp8/encoder/psnr.c
+  vp8/encoder/psnr.h
+  vp8/encoder/quantize.c
+  vp8/encoder/quantize.h
+  vp8/encoder/ratectrl.c
+  vp8/encoder/ratectrl.h
+  vp8/encoder/rdopt.c
+  vp8/encoder/rdopt.h
+  vp8/encoder/segmentation.c
+  vp8/encoder/segmentation.h
+  vp8/encoder/temporal_filter.c
+  vp8/encoder/tokenize.c
+  vp8/encoder/tokenize.h
+  vp8/encoder/treewriter.c
+  vp8/encoder/treewriter.h
   vp8/encoder/x86/dct_mmx.asm
   vp8/encoder/x86/dct_sse2.asm
+  vp8/encoder/x86/denoising_sse2.c
   vp8/encoder/x86/encodeopt.asm
   vp8/encoder/x86/fwalsh_sse2.asm
   vp8/encoder/x86/quantize_mmx.asm
   vp8/encoder/x86/quantize_sse2.asm
+  vp8/encoder/x86/quantize_sse4.asm
   vp8/encoder/x86/quantize_ssse3.asm
-  vp8/encoder/x86/quantize_sse4.asm
-  vp8/encoder/x86/sad_mmx.asm
-  vp8/encoder/x86/sad_sse2.asm
-  vp8/encoder/x86/sad_sse3.asm
-  vp8/encoder/x86/sad_ssse3.asm
-  vp8/encoder/x86/sad_sse4.asm
+  vp8/encoder/x86/ssim_opt.asm
   vp8/encoder/x86/subtract_mmx.asm
   vp8/encoder/x86/subtract_sse2.asm
   vp8/encoder/x86/temporal_filter_apply_sse2.asm
-  vp8/encoder/x86/variance_impl_mmx.asm
-  vp8/encoder/x86/variance_impl_sse2.asm
-  vp8/encoder/x86/variance_impl_ssse3.asm
+  vp8/encoder/x86/vp8_enc_stubs_mmx.c
+  vp8/encoder/x86/vp8_enc_stubs_sse2.c
+  vp8/vp8_cx_iface.c
+  vp8/vp8_dx_iface.c
+  vpx/internal/vpx_codec_internal.h
+  vpx/src/vpx_codec.c
+  vpx/src/vpx_decoder.c
+  vpx/src/vpx_encoder.c
+  vpx/src/vpx_image.c
+  vpx/vp8.h
+  vpx/vp8cx.h
+  vpx/vp8dx.h
+  vpx/vpx_codec.h
+  vpx/vpx_codec_impl_bottom.h
+  vpx/vpx_codec_impl_top.h
+  vpx/vpx_decoder.h
+  vpx/vpx_encoder.h
+  vpx/vpx_image.h
+  vpx/vpx_integer.h
+  vpx_mem/include/vpx_mem_intrnl.h
+  vpx_mem/include/vpx_mem_tracker.h
+  vpx_mem/vpx_mem.c
+  vpx_mem/vpx_mem.h
+  vpx_ports/arm.h
+  vpx_ports/arm_cpudetect.c
+  vpx_ports/asm_offsets.h
   vpx_ports/emms.asm
+  vpx_ports/mem.h
+  vpx_ports/mem_ops.h
+  vpx_ports/mem_ops_aligned.h
+  vpx_ports/vpx_timer.h
+  vpx_ports/vpxtypes.h
+  vpx_ports/x86.h
   vpx_ports/x86_abi_support.asm
+  vpx_ports/x86_cpuid.c
   vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm
   vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
+  vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
   vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
-  build/make/ads2gas.pl
-  build/make/obj_int_extract.c
-  LICENSE
-  PATENTS
+  vpx_scale/arm/neon/yv12extend_arm.c
+  vpx_scale/generic/gen_scalers.c
+  vpx_scale/generic/vpxscale.c
+  vpx_scale/generic/yv12config.c
+  vpx_scale/generic/yv12extend.c
+  vpx_scale/generic/yv12extend_generic.h
+  vpx_scale/include/generic/vpxscale_arbitrary.h
+  vpx_scale/include/generic/vpxscale_depricated.h
+  vpx_scale/scale_mode.h
+  vpx_scale/vpxscale.h
+  vpx_scale/yv12config.h
 )
 
-# configure files specific to x86-win32-vs8
-cp $1/objdir/x86-win32-vs8/vpx_config.c vpx_config_x86-win32-vs8.c
-cp $1/objdir/x86-win32-vs8/vpx_config.asm vpx_config_x86-win32-vs8.asm
-cp $1/objdir/x86-win32-vs8/vpx_config.h vpx_config_x86-win32-vs8.h
-
-# Should be same for all platforms...
-cp $1/objdir/x86-win32-vs8/vpx_version.h vpx_version.h
-
-# Config files for x86-linux-gcc and other x86 elf platforms
-cp $1/objdir/x86-linux-gcc/vpx_config.c vpx_config_x86-linux-gcc.c
-cp $1/objdir/x86-linux-gcc/vpx_config.asm vpx_config_x86-linux-gcc.asm
-cp $1/objdir/x86-linux-gcc/vpx_config.h vpx_config_x86-linux-gcc.h
-
-# Config files for x86_64-linux-gcc and other x86_64 elf platforms
-cp $1/objdir/x86_64-linux-gcc/vpx_config.c vpx_config_x86_64-linux-gcc.c
-cp $1/objdir/x86_64-linux-gcc/vpx_config.asm vpx_config_x86_64-linux-gcc.asm
-cp $1/objdir/x86_64-linux-gcc/vpx_config.h vpx_config_x86_64-linux-gcc.h
+# Copy configuration files for each platform
+for target in ${PLATFORMS}; do
+  cp ${1}/objdir/${target}/vpx_config.h vpx_config_${target}.h
+  cp ${1}/objdir/${target}/vpx_config.c vpx_config_${target}.c
+  cp ${1}/objdir/${target}/vpx_rtcd.h vpx_rtcd_${target}.h
+done
 
-# Copy config files for mac...
-cp $1/objdir/x86-darwin9-gcc/vpx_config.c vpx_config_x86-darwin9-gcc.c
-cp $1/objdir/x86-darwin9-gcc/vpx_config.asm vpx_config_x86-darwin9-gcc.asm
-cp $1/objdir/x86-darwin9-gcc/vpx_config.h vpx_config_x86-darwin9-gcc.h
-
-# Copy config files for Mac64
-cp $1/objdir/x86_64-darwin9-gcc/vpx_config.c vpx_config_x86_64-darwin9-gcc.c
-cp $1/objdir/x86_64-darwin9-gcc/vpx_config.asm vpx_config_x86_64-darwin9-gcc.asm
-cp $1/objdir/x86_64-darwin9-gcc/vpx_config.h vpx_config_x86_64-darwin9-gcc.h
-
-# Config files for arm-linux-gcc
-cp $1/objdir/armv7-linux-gcc/vpx_config.c vpx_config_arm-linux-gcc.c
-cp $1/objdir/armv7-linux-gcc/vpx_config.h vpx_config_arm-linux-gcc.h
-
-# Config files for generic-gnu
-cp $1/objdir/generic-gnu/vpx_config.c vpx_config_generic-gnu.c
-cp $1/objdir/generic-gnu/vpx_config.h vpx_config_generic-gnu.h
+# Copy vpx_version.h from one of the build targets
+cp ${1}/objdir/x86-linux-gcc/vpx_version.h vpx_version.h
 
 # Copy common source files into mozilla tree.
 for f in ${commonFiles[@]}
 do
   mkdir -p -v `dirname $f`
   cp -v $1/$f $f
 done
 
-# This has to be renamed because there's already a scalesystemdependent.c in
-# vpx_scale/generic/
-cp -v $1/vpx_scale/arm/scalesystemdependent.c \
-         vpx_scale/arm/arm_scalesystemdependent.c
-
-# Upstream patch to fix variance overflow.
-patch -p3 < I1bad27ea.patch
-
-# Upstream patch to remove __inline for compiler compatibility.
-patch -p3 < I6f2b218d.patch
-
-# Patch to move SAD and variance functions to common (based on an upstream
-# patch).
-patch -p3 < I256a37c6.patch
-
-# These get moved by I256a37c6.patch above, but patch won't do the actual move
-# for us.
-encoderMovedFiles=(
-  vp8/encoder/sad_c.c
-  vp8/encoder/variance_c.c
-  vp8/encoder/arm/variance_arm.c
-  vp8/encoder/x86/variance_mmx.c
-  vp8/encoder/x86/variance_sse2.c
-  vp8/encoder/x86/variance_ssse3.c
-  vp8/encoder/variance.h
-  vp8/encoder/arm/variance_arm.h
-  vp8/encoder/x86/variance_x86.h
-  vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
-  vp8/encoder/arm/armv6/vp8_sad16x16_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
-  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
-  vp8/encoder/arm/neon/sad16_neon.asm
-  vp8/encoder/arm/neon/sad8_neon.asm
-  vp8/encoder/arm/neon/variance_neon.asm
-  vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
-  vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
-  vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-  vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
-  vp8/encoder/x86/sad_mmx.asm
-  vp8/encoder/x86/sad_sse2.asm
-  vp8/encoder/x86/sad_sse3.asm
-  vp8/encoder/x86/sad_ssse3.asm
-  vp8/encoder/x86/sad_sse4.asm
-  vp8/encoder/x86/variance_impl_mmx.asm
-  vp8/encoder/x86/variance_impl_sse2.asm
-  vp8/encoder/x86/variance_impl_ssse3.asm
-)
-
-# Move encoder source files into the common tree.
-for f in ${encoderMovedFiles[@]}
-do
-  mv -v $f ${f/encoder/common}
-done
-
-# Patch to fix text relocations in the variance functions.
-patch -p3 < textrels.patch
-
-# Patch to use VARIANCE_INVOKE in multiframe_quality_enhance_block().
-patch -p3 < variance-invoke.patch
-
-# Upstream patch to fix potential use of uninitialized rate_y.
-patch -p3 < I8a35831e.patch
-
-# Upstream patch to reset segmentation map on keyframes.
-patch -p3 < I9713c9f0.patch
-
-# Upstream patch to support Android x86 NDK build.
-patch -p3 < I42ab00e3.patch
-
-# Upstream patch to align internal mfqe framebuffer dimensions.
-patch -p3 < I3915d597.patch
-
-# Patch to compile with Sun Studio on Solaris
-patch -p3 < solaris.patch
-
-# Patch to fix errors including C headers in C++
-patch -p3 < compile_errors.patch
-
 # Patch to permit vpx users to specify their own <stdint.h> types.
 patch -p3 < stdint.patch
deleted file mode 100644
--- a/media/libvpx/variance-invoke.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-# HG changeset patch
-# Parent 4c655dd10f74c0782893d34f660e50b36494c88b
-# User Timothy B. Terriberry <tterribe@vt.edu>
-Bug 730907 - Use VARIANCE_INVOKE in multiframe_quality_enhance_block()
-
-diff -r 4c655dd10f74 media/libvpx/vp8/common/postproc.c
---- a/media/libvpx/vp8/common/postproc.c	Mon Jul 09 05:46:16 2012 -0700
-+++ b/media/libvpx/vp8/common/postproc.c	Mon Jul 09 06:23:11 2012 -0700
-@@ -706,17 +706,18 @@ static void multiframe_quality_enhance_b
-     unsigned char *u,
-     unsigned char *v,
-     int y_stride,
-     int uv_stride,
-     unsigned char *yd,
-     unsigned char *ud,
-     unsigned char *vd,
-     int yd_stride,
--    int uvd_stride
-+    int uvd_stride,
-+    vp8_variance_rtcd_vtable_t *rtcd
- )
- {
-     static const unsigned char VP8_ZEROS[16]=
-     {
-          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-     };
-     int blksizeby2 = blksize >> 1;
-     int qdiff = qcurr - qprev;
-@@ -727,28 +728,28 @@ static void multiframe_quality_enhance_b
-     unsigned char *up;
-     unsigned char *udp;
-     unsigned char *vp;
-     unsigned char *vdp;
- 
-     unsigned int act, sse, sad, thr;
-     if (blksize == 16)
-     {
--        act = (vp8_variance_var16x16(yd, yd_stride, VP8_ZEROS, 0, &sse)+128)>>8;
--        sad = (vp8_variance_sad16x16(y, y_stride, yd, yd_stride, 0)+128)>>8;
-+        act = (VARIANCE_INVOKE(rtcd, var16x16)(yd, yd_stride, VP8_ZEROS, 0, &sse)+128)>>8;
-+        sad = (VARIANCE_INVOKE(rtcd, sad16x16)(y, y_stride, yd, yd_stride, 0)+128)>>8;
-     }
-     else if (blksize == 8)
-     {
--        act = (vp8_variance_var8x8(yd, yd_stride, VP8_ZEROS, 0, &sse)+32)>>6;
--        sad = (vp8_variance_sad8x8(y, y_stride, yd, yd_stride, 0)+32)>>6;
-+        act = (VARIANCE_INVOKE(rtcd, var8x8)(yd, yd_stride, VP8_ZEROS, 0, &sse)+32)>>6;
-+        sad = (VARIANCE_INVOKE(rtcd, sad8x8)(y, y_stride, yd, yd_stride, 0)+32)>>6;
-     }
-     else
-     {
--        act = (vp8_variance_var4x4(yd, yd_stride, VP8_ZEROS, 0, &sse)+8)>>4;
--        sad = (vp8_variance_sad4x4(y, y_stride, yd, yd_stride, 0)+8)>>4;
-+        act = (VARIANCE_INVOKE(rtcd, var4x4)(yd, yd_stride, VP8_ZEROS, 0, &sse)+8)>>4;
-+        sad = (VARIANCE_INVOKE(rtcd, sad4x4)(y, y_stride, yd, yd_stride, 0)+8)>>4;
-     }
-     /* thr = qdiff/8 + log2(act) + log4(qprev) */
-     thr = (qdiff>>3);
-     while (act>>=1) thr++;
-     while (qprev>>=2) thr++;
-     if (sad < thr)
-     {
-         static const int roundoff = (1 << (MFQE_PRECISION - 1));
-@@ -800,18 +801,20 @@ static void multiframe_quality_enhance_b
-             for (vp = v, vdp = vd, i = 0; i < blksizeby2; ++i, vp += uv_stride, vdp += uvd_stride)
-                 vpx_memcpy(vdp, vp, blksizeby2);
-         }
-     }
- }
- 
- #if CONFIG_RUNTIME_CPU_DETECT
- #define RTCD_VTABLE(oci) (&(oci)->rtcd.postproc)
-+#define RTCD_VARIANCE(oci) (&(oci)->rtcd.variance)
- #else
- #define RTCD_VTABLE(oci) NULL
-+#define RTCD_VARIANCE(oci) NULL
- #endif
- 
- void vp8_multiframe_quality_enhance
- (
-     VP8_COMMON *cm
- )
- {
-     YV12_BUFFER_CONFIG *show = cm->frame_to_show;
-@@ -859,33 +862,35 @@ void vp8_multiframe_quality_enhance
-                                                              u_ptr + 4*(i*show->uv_stride+j),
-                                                              v_ptr + 4*(i*show->uv_stride+j),
-                                                              show->y_stride,
-                                                              show->uv_stride,
-                                                              yd_ptr + 8*(i*dest->y_stride+j),
-                                                              ud_ptr + 4*(i*dest->uv_stride+j),
-                                                              vd_ptr + 4*(i*dest->uv_stride+j),
-                                                              dest->y_stride,
--                                                             dest->uv_stride);
-+                                                             dest->uv_stride,
-+                                                             RTCD_VARIANCE(cm));
-                 }
-                 else
-                 {
-                     multiframe_quality_enhance_block(16,
-                                                      qcurr,
-                                                      qprev,
-                                                      y_ptr,
-                                                      u_ptr,
-                                                      v_ptr,
-                                                      show->y_stride,
-                                                      show->uv_stride,
-                                                      yd_ptr,
-                                                      ud_ptr,
-                                                      vd_ptr,
-                                                      dest->y_stride,
--                                                     dest->uv_stride);
-+                                                     dest->uv_stride,
-+                                                     RTCD_VARIANCE(cm));
- 
-                 }
-             }
-             else
-             {
-                 vp8_recon_copy16x16(y_ptr, show->y_stride, yd_ptr, dest->y_stride);
-                 vp8_recon_copy8x8(u_ptr, show->uv_stride, ud_ptr, dest->uv_stride);
-                 vp8_recon_copy8x8(v_ptr, show->uv_stride, vd_ptr, dest->uv_stride);
-diff -r 4c655dd10f74 media/libvpx/vp8/encoder/pickinter.c
---- a/media/libvpx/vp8/encoder/pickinter.c	Mon Jul 09 05:46:16 2012 -0700
-+++ b/media/libvpx/vp8/encoder/pickinter.c	Mon Jul 09 06:23:11 2012 -0700
-@@ -127,17 +127,17 @@ static int pick_intra4x4block(
-     for (mode = B_DC_PRED; mode <= B_HE_PRED /*B_HU_PRED*/; mode++)
-     {
-         int this_rd;
- 
-         rate = mode_costs[mode];
-         RECON_INVOKE(&rtcd->common->recon, intra4x4_predict)
-                      (*(b->base_dst) + b->dst, b->dst_stride,
-                       mode, b->predictor, 16);
--        distortion = get_prediction_error(be, b, &rtcd->common->variance);
-+        distortion = get_prediction_error(be, b, IF_RTCD(&rtcd->common->variance));
-         this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
- 
-         if (this_rd < best_rd)
-         {
-             *bestrate = rate;
-             *bestdistortion = distortion;
-             best_rd = this_rd;
-             *best_mode = mode;
--- a/media/libvpx/vp8/common/alloccommon.c
+++ b/media/libvpx/vp8/common/alloccommon.c
@@ -12,53 +12,41 @@
 #include "vpx_config.h"
 #include "blockd.h"
 #include "vpx_mem/vpx_mem.h"
 #include "onyxc_int.h"
 #include "findnearmv.h"
 #include "entropymode.h"
 #include "systemdependent.h"
 
-
-extern  void vp8_init_scan_order_mask();
-
-static void update_mode_info_border(MODE_INFO *mi, int rows, int cols)
-{
-    int i;
-    vpx_memset(mi - cols - 2, 0, sizeof(MODE_INFO) * (cols + 1));
-
-    for (i = 0; i < rows; i++)
-    {
-        /* TODO(holmer): Bug? This updates the last element of each row
-         * rather than the border element!
-         */
-        vpx_memset(&mi[i*cols-1], 0, sizeof(MODE_INFO));
-    }
-}
-
 void vp8_de_alloc_frame_buffers(VP8_COMMON *oci)
 {
     int i;
-
     for (i = 0; i < NUM_YV12_BUFFERS; i++)
         vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
 
     vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
+#if CONFIG_POSTPROC
     vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
     if (oci->post_proc_buffer_int_used)
         vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer_int);
 
+    vpx_free(oci->pp_limits_buffer);
+    oci->pp_limits_buffer = NULL;
+#endif
+
     vpx_free(oci->above_context);
     vpx_free(oci->mip);
+#if CONFIG_ERROR_CONCEALMENT
     vpx_free(oci->prev_mip);
+    oci->prev_mip = NULL;
+#endif
 
-    oci->above_context = 0;
-    oci->mip = 0;
-    oci->prev_mip = 0;
-
+    oci->above_context = NULL;
+    oci->mip = NULL;
 }
 
 int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
 {
     int i;
 
     vp8_de_alloc_frame_buffers(oci);
 
@@ -70,91 +58,76 @@ int vp8_alloc_frame_buffers(VP8_COMMON *
         height += 16 - (height & 0xf);
 
 
     for (i = 0; i < NUM_YV12_BUFFERS; i++)
     {
         oci->fb_idx_ref_cnt[i] = 0;
         oci->yv12_fb[i].flags = 0;
         if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0)
-        {
-            vp8_de_alloc_frame_buffers(oci);
-            return 1;
-        }
+            goto allocation_fail;
     }
 
     oci->new_fb_idx = 0;
     oci->lst_fb_idx = 1;
     oci->gld_fb_idx = 2;
     oci->alt_fb_idx = 3;
 
     oci->fb_idx_ref_cnt[0] = 1;
     oci->fb_idx_ref_cnt[1] = 1;
     oci->fb_idx_ref_cnt[2] = 1;
     oci->fb_idx_ref_cnt[3] = 1;
 
     if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame,   width, 16, VP8BORDERINPIXELS) < 0)
-    {
-        vp8_de_alloc_frame_buffers(oci);
-        return 1;
-    }
-
-    if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0)
-    {
-        vp8_de_alloc_frame_buffers(oci);
-        return 1;
-    }
-
-    oci->post_proc_buffer_int_used = 0;
+        goto allocation_fail;
 
     oci->mb_rows = height >> 4;
     oci->mb_cols = width >> 4;
     oci->MBs = oci->mb_rows * oci->mb_cols;
     oci->mode_info_stride = oci->mb_cols + 1;
     oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
 
     if (!oci->mip)
-    {
-        vp8_de_alloc_frame_buffers(oci);
-        return 1;
-    }
+        goto allocation_fail;
 
     oci->mi = oci->mip + oci->mode_info_stride + 1;
 
-    /* allocate memory for last frame MODE_INFO array */
-#if CONFIG_ERROR_CONCEALMENT
-    oci->prev_mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
-
-    if (!oci->prev_mip)
-    {
-        vp8_de_alloc_frame_buffers(oci);
-        return 1;
-    }
-
-    oci->prev_mi = oci->prev_mip + oci->mode_info_stride + 1;
-#else
-    oci->prev_mip = NULL;
-    oci->prev_mi = NULL;
-#endif
+    /* Allocation of previous mode info will be done in vp8_decode_frame()
+     * as it is a decoder only data */
 
     oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
 
     if (!oci->above_context)
-    {
-        vp8_de_alloc_frame_buffers(oci);
-        return 1;
-    }
+        goto allocation_fail;
+
+#if CONFIG_POSTPROC
+    if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0)
+        goto allocation_fail;
 
-    update_mode_info_border(oci->mi, oci->mb_rows, oci->mb_cols);
-#if CONFIG_ERROR_CONCEALMENT
-    update_mode_info_border(oci->prev_mi, oci->mb_rows, oci->mb_cols);
+    oci->post_proc_buffer_int_used = 0;
+    vpx_memset(&oci->postproc_state, 0, sizeof(oci->postproc_state));
+    vpx_memset(oci->post_proc_buffer.buffer_alloc, 128,
+               oci->post_proc_buffer.frame_size);
+
+    /* Allocate buffer to store post-processing filter coefficients.
+     *
+     * Note: Round up mb_cols to support SIMD reads
+     */
+    oci->pp_limits_buffer = vpx_memalign(16, 24 * ((oci->mb_cols + 1) & ~1));
+    if (!oci->pp_limits_buffer)
+        goto allocation_fail;
 #endif
 
     return 0;
+
+allocation_fail:
+    vp8_de_alloc_frame_buffers(oci);
+    return 1;
 }
+
 void vp8_setup_version(VP8_COMMON *cm)
 {
     switch (cm->version)
     {
     case 0:
         cm->no_lpf = 0;
         cm->filter_type = NORMAL_LOOPFILTER;
         cm->use_bilinear_mc_filter = 0;
@@ -198,30 +171,20 @@ void vp8_create_common(VP8_COMMON *oci)
     oci->no_lpf = 0;
     oci->filter_type = NORMAL_LOOPFILTER;
     oci->use_bilinear_mc_filter = 0;
     oci->full_pixel = 0;
     oci->multi_token_partition = ONE_PARTITION;
     oci->clr_type = REG_YUV;
     oci->clamp_type = RECON_CLAMP_REQUIRED;
 
-    /* Initialise reference frame sign bias structure to defaults */
+    /* Initialize reference frame sign bias structure to defaults */
     vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
 
     /* Default disable buffer to buffer copying */
     oci->copy_buffer_to_gf = 0;
     oci->copy_buffer_to_arf = 0;
 }
 
 void vp8_remove_common(VP8_COMMON *oci)
 {
     vp8_de_alloc_frame_buffers(oci);
 }
-
-void vp8_initialize_common()
-{
-    vp8_coef_tree_initialize();
-
-    vp8_entropy_mode_init();
-
-    vp8_init_scan_order_mask();
-
-}
deleted file mode 100644
--- a/media/libvpx/vp8/common/arm/arm_systemdependent.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- *  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 "vpx_config.h"
-#include "vpx_ports/arm.h"
-#include "vp8/common/pragmas.h"
-#include "vp8/common/subpixel.h"
-#include "vp8/common/loopfilter.h"
-#include "vp8/common/recon.h"
-#include "vp8/common/idct.h"
-#include "vp8/common/variance.h"
-#include "vp8/common/onyxc_int.h"
-
-void vp8_arch_arm_common_init(VP8_COMMON *ctx)
-{
-#if CONFIG_RUNTIME_CPU_DETECT
-    VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
-    int flags = arm_cpu_caps();
-    rtcd->flags = flags;
-
-    /* Override default functions with fastest ones for this CPU. */
-#if HAVE_ARMV5TE
-    if (flags & HAS_EDSP)
-    {
-    }
-#endif
-
-#if HAVE_ARMV6
-    if (flags & HAS_MEDIA)
-    {
-        rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_armv6;
-        rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_armv6;
-        rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_armv6;
-        rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_armv6;
-        rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
-        rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_armv6;
-        rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_armv6;
-        rtcd->subpix.bilinear4x4   = vp8_bilinear_predict4x4_armv6;
-
-        rtcd->idct.idct16       = vp8_short_idct4x4llm_v6_dual;
-        rtcd->idct.iwalsh16     = vp8_short_inv_walsh4x4_v6;
-
-        rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
-        rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_armv6;
-        rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_armv6;
-        rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_armv6;
-        rtcd->loopfilter.simple_mb_v =
-                vp8_loop_filter_simple_vertical_edge_armv6;
-        rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_armv6;
-        rtcd->loopfilter.simple_mb_h =
-                vp8_loop_filter_simple_horizontal_edge_armv6;
-        rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_armv6;
-
-        rtcd->recon.copy16x16   = vp8_copy_mem16x16_v6;
-        rtcd->recon.copy8x8     = vp8_copy_mem8x8_v6;
-        rtcd->recon.copy8x4     = vp8_copy_mem8x4_v6;
-        rtcd->recon.intra4x4_predict = vp8_intra4x4_predict_armv6;
-
-        rtcd->dequant.block               = vp8_dequantize_b_v6;
-        rtcd->dequant.idct_add            = vp8_dequant_idct_add_v6;
-        rtcd->dequant.idct_add_y_block    = vp8_dequant_idct_add_y_block_v6;
-        rtcd->dequant.idct_add_uv_block   = vp8_dequant_idct_add_uv_block_v6;
-
-        rtcd->variance.sad16x16              = vp8_sad16x16_armv6;
-        /*rtcd->variance.sad16x8               = vp8_sad16x8_c;
-        rtcd->variance.sad8x16               = vp8_sad8x16_c;
-        rtcd->variance.sad8x8                = vp8_sad8x8_c;
-        rtcd->variance.sad4x4                = vp8_sad4x4_c;*/
-
-        /*rtcd->variance.var4x4                = vp8_variance4x4_c;*/
-        rtcd->variance.var8x8                = vp8_variance8x8_armv6;
-        /*rtcd->variance.var8x16               = vp8_variance8x16_c;
-        rtcd->variance.var16x8               = vp8_variance16x8_c;*/
-        rtcd->variance.var16x16              = vp8_variance16x16_armv6;
-
-        /*rtcd->variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_c;*/
-        rtcd->variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_armv6;
-        /*rtcd->variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_c;
-        rtcd->variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_c;*/
-        rtcd->variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_armv6;
-        rtcd->variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_armv6;
-        rtcd->variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_armv6;
-        rtcd->variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_armv6;
-
-        rtcd->variance.mse16x16              = vp8_mse16x16_armv6;
-        /*rtcd->variance.getmbss               = vp8_get_mb_ss_c;*/
-
-        /*rtcd->variance.get4x4sse_cs          = vp8_get4x4sse_cs_c;*/
-    }
-#endif
-
-#if HAVE_ARMV7
-    if (flags & HAS_NEON)
-    {
-        rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_neon;
-        rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_neon;
-        rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_neon;
-        rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_neon;
-        rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
-        rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_neon;
-        rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_neon;
-        rtcd->subpix.bilinear4x4   = vp8_bilinear_predict4x4_neon;
-
-        rtcd->idct.idct16       = vp8_short_idct4x4llm_neon;
-        rtcd->idct.iwalsh16     = vp8_short_inv_walsh4x4_neon;
-
-        rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
-        rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_neon;
-        rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_neon;
-        rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_neon;
-        rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_neon;
-        rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_neon;
-        rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_neon;
-        rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_neon;
-
-        rtcd->recon.copy16x16   = vp8_copy_mem16x16_neon;
-        rtcd->recon.copy8x8     = vp8_copy_mem8x8_neon;
-        rtcd->recon.copy8x4     = vp8_copy_mem8x4_neon;
-        rtcd->recon.build_intra_predictors_mby =
-            vp8_build_intra_predictors_mby_neon;
-        rtcd->recon.build_intra_predictors_mby_s =
-            vp8_build_intra_predictors_mby_s_neon;
-
-        rtcd->dequant.block               = vp8_dequantize_b_neon;
-        rtcd->dequant.idct_add            = vp8_dequant_idct_add_neon;
-        rtcd->dequant.idct_add_y_block    = vp8_dequant_idct_add_y_block_neon;
-        rtcd->dequant.idct_add_uv_block   = vp8_dequant_idct_add_uv_block_neon;
-
-        rtcd->variance.sad16x16              = vp8_sad16x16_neon;
-        rtcd->variance.sad16x8               = vp8_sad16x8_neon;
-        rtcd->variance.sad8x16               = vp8_sad8x16_neon;
-        rtcd->variance.sad8x8                = vp8_sad8x8_neon;
-        rtcd->variance.sad4x4                = vp8_sad4x4_neon;
-
-        /*rtcd->variance.var4x4                = vp8_variance4x4_c;*/
-        rtcd->variance.var8x8                = vp8_variance8x8_neon;
-        rtcd->variance.var8x16               = vp8_variance8x16_neon;
-        rtcd->variance.var16x8               = vp8_variance16x8_neon;
-        rtcd->variance.var16x16              = vp8_variance16x16_neon;
-
-        /*rtcd->variance.subpixvar4x4          = vp8_sub_pixel_variance4x4_c;*/
-        rtcd->variance.subpixvar8x8          = vp8_sub_pixel_variance8x8_neon;
-        /*rtcd->variance.subpixvar8x16         = vp8_sub_pixel_variance8x16_c;
-        rtcd->variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_c;*/
-        rtcd->variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_neon;
-        rtcd->variance.halfpixvar16x16_h     = vp8_variance_halfpixvar16x16_h_neon;
-        rtcd->variance.halfpixvar16x16_v     = vp8_variance_halfpixvar16x16_v_neon;
-        rtcd->variance.halfpixvar16x16_hv    = vp8_variance_halfpixvar16x16_hv_neon;
-
-        rtcd->variance.mse16x16              = vp8_mse16x16_neon;
-        /*rtcd->variance.getmbss               = vp8_get_mb_ss_c;*/
-
-        rtcd->variance.get4x4sse_cs          = vp8_get4x4sse_cs_neon;
-    }
-#endif
-
-#endif
-}
--- a/media/libvpx/vp8/common/arm/armv6/idct_blk_v6.c
+++ b/media/libvpx/vp8/common/arm/armv6/idct_blk_v6.c
@@ -4,18 +4,17 @@
  *  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 "vpx_config.h"
-#include "vp8/common/idct.h"
-#include "vp8/common/dequantize.h"
+#include "vpx_rtcd.h"
 
 
 void vp8_dequant_idct_add_y_block_v6(short *q, short *dq,
                                      unsigned char *dst,
                                      int stride, char *eobs)
 {
     int i;
 
--- a/media/libvpx/vp8/common/arm/armv6/intra4x4_predict_v6.asm
+++ b/media/libvpx/vp8/common/arm/armv6/intra4x4_predict_v6.asm
@@ -13,78 +13,85 @@
 
     ARM
     REQUIRE8
     PRESERVE8
 
     AREA ||.text||, CODE, READONLY, ALIGN=2
 
 
-;void vp8_intra4x4_predict(unsigned char *src, int src_stride, int b_mode,
-;                          unsigned char *dst, int dst_stride)
+;void vp8_intra4x4_predict_armv6(unsigned char *Above, unsigned char *yleft,
+;                                B_PREDICTION_MODE left_stride, int b_mode,
+;                                unsigned char *dst, int dst_stride,
+;                                unsigned char top_left)
 
+; r0: *Above
+; r1: *yleft
+; r2: left_stride
+; r3: b_mode
+; sp + #40: dst
+; sp + #44: dst_stride
+; sp + #48: top_left
 |vp8_intra4x4_predict_armv6| PROC
     push        {r4-r12, lr}
 
-
-    cmp         r2, #10
-    addlt       pc, pc, r2, lsl #2       ; position independent switch
+    cmp         r3, #10
+    addlt       pc, pc, r3, lsl #2       ; position independent switch
     pop         {r4-r12, pc}             ; default
     b           b_dc_pred
     b           b_tm_pred
     b           b_ve_pred
     b           b_he_pred
     b           b_ld_pred
     b           b_rd_pred
     b           b_vr_pred
     b           b_vl_pred
     b           b_hd_pred
     b           b_hu_pred
 
 b_dc_pred
     ; load values
-    ldr         r8, [r0, -r1]            ; Above
-    ldrb        r4, [r0, #-1]!           ; Left[0]
+    ldr         r8, [r0]                 ; Above
+    ldrb        r4, [r1], r2             ; Left[0]
     mov         r9, #0
-    ldrb        r5, [r0, r1]             ; Left[1]
-    ldrb        r6, [r0, r1, lsl #1]!    ; Left[2]
+    ldrb        r5, [r1], r2             ; Left[1]
+    ldrb        r6, [r1], r2             ; Left[2]
     usad8       r12, r8, r9
-    ldrb        r7, [r0, r1]             ; Left[3]
+    ldrb        r7, [r1]                 ; Left[3]
 
     ; calculate dc
     add         r4, r4, r5
     add         r4, r4, r6
     add         r4, r4, r7
     add         r4, r4, r12
     add         r4, r4, #4
-    ldr         r0, [sp, #40]           ; load stride
+    ldr         r0, [sp, #44]           ; dst_stride
     mov         r12, r4, asr #3         ; (expected_dc + 4) >> 3
 
     add         r12, r12, r12, lsl #8
-    add         r3, r3, r0
+    ldr         r3, [sp, #40]           ; dst
     add         r12, r12, r12, lsl #16
 
     ; store values
-    str         r12, [r3, -r0]
+    str         r12, [r3], r0
+    str         r12, [r3], r0
+    str         r12, [r3], r0
     str         r12, [r3]
-    str         r12, [r3, r0]
-    str         r12, [r3, r0, lsl #1]
 
     pop        {r4-r12, pc}
 
 b_tm_pred
-    sub         r10, r0, #1             ; Left
-    ldr         r8, [r0, -r1]           ; Above
-    ldrb        r9, [r10, -r1]          ; top_left
-    ldrb        r4, [r0, #-1]!          ; Left[0]
-    ldrb        r5, [r10, r1]!          ; Left[1]
-    ldrb        r6, [r0, r1, lsl #1]    ; Left[2]
-    ldrb        r7, [r10, r1, lsl #1]   ; Left[3]
-    ldr         r0, [sp, #40]           ; load stride
-
+    ldr         r8, [r0]                ; Above
+    ldrb        r9, [sp, #48]           ; top_left
+    ldrb        r4, [r1], r2            ; Left[0]
+    ldrb        r5, [r1], r2            ; Left[1]
+    ldrb        r6, [r1], r2            ; Left[2]
+    ldrb        r7, [r1]                ; Left[3]
+    ldr         r0, [sp, #44]           ; dst_stride
+    ldr         r3, [sp, #40]           ; dst
 
     add         r9, r9, r9, lsl #16     ; [tl|tl]
     uxtb16      r10, r8                 ; a[2|0]
     uxtb16      r11, r8, ror #8         ; a[3|1]
     ssub16      r10, r10, r9            ; a[2|0] - [tl|tl]
     ssub16      r11, r11, r9            ; a[3|1] - [tl|tl]
 
     add         r4, r4, r4, lsl #16     ; l[0|0]
@@ -121,63 +128,62 @@ b_tm_pred
     add         r12, r1, r2, lsl #8     ; [3|2|1|0]
 
     usat16      r4, #8, r4
     usat16      r5, #8, r5
 
     str         r12, [r3], r0
 
     add         r12, r4, r5, lsl #8     ; [3|2|1|0]
-    str         r12, [r3], r0
+    str         r12, [r3]
 
     pop        {r4-r12, pc}
 
 b_ve_pred
-    ldr         r8, [r0, -r1]!          ; a[3|2|1|0]
+    ldr         r8, [r0]                ; a[3|2|1|0]
     ldr         r11, c00FF00FF
-    ldrb        r9, [r0, #-1]           ; top_left
+    ldrb        r9, [sp, #48]           ; top_left
     ldrb        r10, [r0, #4]           ; a[4]
 
     ldr         r0, c00020002
 
     uxtb16      r4, r8                  ; a[2|0]
     uxtb16      r5, r8, ror #8          ; a[3|1]
-    ldr         r2, [sp, #40]           ; stride
+    ldr         r2, [sp, #44]           ; dst_stride
     pkhbt       r9, r9, r5, lsl #16     ; a[1|-1]
 
     add         r9, r9, r4, lsl #1      ;[a[1]+2*a[2]       | tl+2*a[0]       ]
     uxtab16     r9, r9, r5              ;[a[1]+2*a[2]+a[3]  | tl+2*a[0]+a[1]  ]
+    ldr         r3, [sp, #40]           ; dst
     uxtab16     r9, r9, r0              ;[a[1]+2*a[2]+a[3]+2| tl+2*a[0]+a[1]+2]
 
     add         r0, r0, r10, lsl #16    ;[a[4]+2            |                 2]
     add         r0, r0, r4, asr #16     ;[a[4]+2            |            a[2]+2]
     add         r0, r0, r5, lsl #1      ;[a[4]+2*a[3]+2     |     a[2]+2*a[1]+2]
     uadd16      r4, r4, r0              ;[a[4]+2*a[3]+a[2]+2|a[2]+2*a[1]+a[0]+2]
 
     and         r9, r11, r9, asr #2
     and         r4, r11, r4, asr #2
-    add         r3, r3, r2              ; dst + dst_stride
     add         r9, r9, r4, lsl #8
 
     ; store values
-    str         r9, [r3, -r2]
+    str         r9, [r3], r2
+    str         r9, [r3], r2
+    str         r9, [r3], r2
     str         r9, [r3]
-    str         r9, [r3, r2]
-    str         r9, [r3, r2, lsl #1]
 
     pop        {r4-r12, pc}
 
 
 b_he_pred
-    sub         r10, r0, #1             ; Left
-    ldrb        r4, [r0, #-1]!          ; Left[0]
-    ldrb        r8, [r10, -r1]          ; top_left
-    ldrb        r5, [r10, r1]!          ; Left[1]
-    ldrb        r6, [r0, r1, lsl #1]    ; Left[2]
-    ldrb        r7, [r10, r1, lsl #1]   ; Left[3]
+    ldrb        r4, [r1], r2            ; Left[0]
+    ldrb        r8, [sp, #48]           ; top_left
+    ldrb        r5, [r1], r2            ; Left[1]
+    ldrb        r6, [r1], r2            ; Left[2]
+    ldrb        r7, [r1]                ; Left[3]
 
     add         r8, r8, r4              ; tl   + l[0]
     add         r9, r4, r5              ; l[0] + l[1]
     add         r10, r5, r6             ; l[1] + l[2]
     add         r11, r6, r7             ; l[2] + l[3]
 
     mov         r0, #2<<14
 
@@ -192,45 +198,45 @@ b_he_pred
     add         r10,r0, r5, lsl #14     ; (l[1] + 2*l[2] + l[3])>>2 in top half
     add         r11,r0, r6, lsl #14     ; (l[2] + 2*l[3] + l[3])>>2 in top half
 
     pkhtb       r8, r8, r8, asr #16     ; l[-|0|-|0]
     pkhtb       r9, r9, r9, asr #16     ; l[-|1|-|1]
     pkhtb       r10, r10, r10, asr #16  ; l[-|2|-|2]
     pkhtb       r11, r11, r11, asr #16  ; l[-|3|-|3]
 
-    ldr         r0, [sp, #40]           ; stride
+    ldr         r0, [sp, #44]           ; dst_stride
+    ldr         r3, [sp, #40]           ; dst
 
     add         r8, r8, r8, lsl #8      ; l[0|0|0|0]
     add         r9, r9, r9, lsl #8      ; l[1|1|1|1]
     add         r10, r10, r10, lsl #8   ; l[2|2|2|2]
     add         r11, r11, r11, lsl #8   ; l[3|3|3|3]
 
     ; store values
     str         r8, [r3], r0
-    str         r9, [r3]
-    str         r10, [r3, r0]
-    str         r11, [r3, r0, lsl #1]
+    str         r9, [r3], r0
+    str         r10, [r3], r0
+    str         r11, [r3]
 
     pop        {r4-r12, pc}
 
 b_ld_pred
-    ldr         r4, [r0, -r1]!          ; Above
+    ldr         r4, [r0]                ; Above[0-3]
     ldr         r12, c00020002
-    ldr         r5, [r0, #4]
+    ldr         r5, [r0, #4]            ; Above[4-7]
     ldr         lr,  c00FF00FF
 
     uxtb16      r6, r4                  ; a[2|0]
     uxtb16      r7, r4, ror #8          ; a[3|1]
     uxtb16      r8, r5                  ; a[6|4]
     uxtb16      r9, r5, ror #8          ; a[7|5]
     pkhtb       r10, r6, r8             ; a[2|4]
     pkhtb       r11, r7, r9             ; a[3|5]
 
-
     add         r4, r6, r7, lsl #1      ; [a2+2*a3      |      a0+2*a1]
     add         r4, r4, r10, ror #16    ; [a2+2*a3+a4   |   a0+2*a1+a2]
     uxtab16     r4, r4, r12             ; [a2+2*a3+a4+2 | a0+2*a1+a2+2]
 
     add         r5, r7, r10, ror #15    ; [a3+2*a4      |      a1+2*a2]
     add         r5, r5, r11, ror #16    ; [a3+2*a4+a5   |   a1+2*a2+a3]
     uxtab16     r5, r5, r12             ; [a3+2*a4+a5+2 | a1+2*a2+a3+2]
 
@@ -239,17 +245,18 @@ b_ld_pred
     uadd16      r6, r6, r7              ; [a6+2*a7+a7   |   a4+2*a5+a6]
     uxtab16     r6, r6, r12             ; [a6+2*a7+a7+2 | a4+2*a5+a6+2]
 
     uxth        r7, r9                  ; [                         a5]
     add         r7, r7, r8, asr #15     ; [                    a5+2*a6]
     add         r7, r7, r9, asr #16     ; [                 a5+2*a6+a7]
     uxtah       r7, r7, r12             ; [               a5+2*a6+a7+2]
 
-    ldr         r0, [sp, #40]           ; stride
+    ldr         r0, [sp, #44]           ; dst_stride
+    ldr         r3, [sp, #40]           ; dst
 
     ; scale down
     and         r4, lr, r4, asr #2
     and         r5, lr, r5, asr #2