Includes clean up.

- Remove includes of config.h wrapped by HAVE_CONFIG_H. This
  is an obsolete vestige of our libvpx ancestry.
- Change (nearly) all remaining include sites; use proper path
  to the include relative to project root instead of ./.
- Correct include order where appropriate.
  - Note: This part of this patch is NOT exhaustive. In an
    attempt to be conseravative about the impact of this change
    I limited ordering and grouping changes to places that
    appear extremely unlikely to cause a problem. A more exhaustive
    follow up might be appropriate, but this issue can likely be
    handled organically from here on out.

Change-Id: I3b421ffd46c5da6ef78e43e7a6d3b9550cb30325
diff --git a/aom/aom.h b/aom/aom.h
index 9a95d17..c5ef251 100644
--- a/aom/aom.h
+++ b/aom/aom.h
@@ -31,8 +31,8 @@
 #ifndef AOM_AOM_H_
 #define AOM_AOM_H_
 
-#include "./aom_codec.h"
-#include "./aom_image.h"
+#include "aom/aom_codec.h"
+#include "aom/aom_image.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/aom/aom_codec.h b/aom/aom_codec.h
index a6c68cd..7c2e845 100644
--- a/aom/aom_codec.h
+++ b/aom/aom_codec.h
@@ -43,8 +43,8 @@
 extern "C" {
 #endif
 
-#include "./aom_integer.h"
-#include "./aom_image.h"
+#include "aom/aom_image.h"
+#include "aom/aom_integer.h"
 
 /*!\brief Decorator indicating a function is deprecated */
 #ifndef AOM_DEPRECATED
diff --git a/aom/aom_decoder.h b/aom/aom_decoder.h
index 56eff00..b16ca29 100644
--- a/aom/aom_decoder.h
+++ b/aom/aom_decoder.h
@@ -30,8 +30,8 @@
 extern "C" {
 #endif
 
-#include "./aom_codec.h"
-#include "./aom_frame_buffer.h"
+#include "aom/aom_codec.h"
+#include "aom/aom_frame_buffer.h"
 
 /*!\brief Current ABI version number
  *
diff --git a/aom/aom_encoder.h b/aom/aom_encoder.h
index 875e15c..56bbf89 100644
--- a/aom/aom_encoder.h
+++ b/aom/aom_encoder.h
@@ -30,7 +30,7 @@
 extern "C" {
 #endif
 
-#include "./aom_codec.h"
+#include "aom/aom_codec.h"
 
 /*!\brief Current ABI version number
  *
diff --git a/aom/aom_frame_buffer.h b/aom/aom_frame_buffer.h
index c87cf74..b979fcf 100644
--- a/aom/aom_frame_buffer.h
+++ b/aom/aom_frame_buffer.h
@@ -20,7 +20,7 @@
 extern "C" {
 #endif
 
-#include "./aom_integer.h"
+#include "aom/aom_integer.h"
 
 /*!\brief The maximum number of work buffers used by libaom.
  *  Support maximum 4 threads to decode video in parallel.
diff --git a/aom/aomcx.h b/aom/aomcx.h
index 544e2b5..4cdb5d3 100644
--- a/aom/aomcx.h
+++ b/aom/aomcx.h
@@ -16,8 +16,8 @@
  *
  * @{
  */
-#include "./aom.h"
-#include "./aom_encoder.h"
+#include "aom/aom.h"
+#include "aom/aom_encoder.h"
 
 /*!\file
  * \brief Provides definitions for using AOM or AV1 encoder algorithm within the
diff --git a/aom/aomdx.h b/aom/aomdx.h
index 1c50977..5adbdf6 100644
--- a/aom/aomdx.h
+++ b/aom/aomdx.h
@@ -26,7 +26,7 @@
 #endif
 
 /* Include controls common to both the encoder and decoder */
-#include "./aom.h"
+#include "aom/aom.h"
 
 /*!\name Algorithm interface for AV1
  *
diff --git a/aom_dsp/aom_simd.h b/aom_dsp/aom_simd.h
index 991ff0a..392b366 100644
--- a/aom_dsp/aom_simd.h
+++ b/aom_dsp/aom_simd.h
@@ -20,7 +20,7 @@
 
 #include "config/aom_config.h"
 
-#include "./aom_simd_inline.h"
+#include "aom_dsp/aom_simd_inline.h"
 
 #define SIMD_CHECK 1  // Sanity checks in C equivalents
 
diff --git a/aom_dsp/bitreader_buffer.c b/aom_dsp/bitreader_buffer.c
index c0055c9..68fc381 100644
--- a/aom_dsp/bitreader_buffer.c
+++ b/aom_dsp/bitreader_buffer.c
@@ -10,7 +10,7 @@
  */
 #include "config/aom_config.h"
 
-#include "./bitreader_buffer.h"
+#include "aom_dsp/bitreader_buffer.h"
 
 size_t aom_rb_bytes_read(struct aom_read_bit_buffer *rb) {
   return (rb->bit_offset + 7) >> 3;
diff --git a/aom_dsp/bitwriter_buffer.c b/aom_dsp/bitwriter_buffer.c
index 68389dc..21314eb 100644
--- a/aom_dsp/bitwriter_buffer.c
+++ b/aom_dsp/bitwriter_buffer.c
@@ -14,7 +14,7 @@
 
 #include "config/aom_config.h"
 
-#include "./bitwriter_buffer.h"
+#include "aom_dsp/bitwriter_buffer.h"
 
 int aom_wb_is_byte_aligned(const struct aom_write_bit_buffer *wb) {
   return (wb->bit_offset % CHAR_BIT == 0);
diff --git a/aom_dsp/entcode.c b/aom_dsp/entcode.c
index ad76b7e..aad96c6 100644
--- a/aom_dsp/entcode.c
+++ b/aom_dsp/entcode.c
@@ -9,10 +9,6 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "./config.h"
-#endif
-
 #include "aom_dsp/entcode.h"
 
 /*Given the current total integer number of bits used and the current value of
diff --git a/aom_dsp/entdec.c b/aom_dsp/entdec.c
index 0224892..b8e9078 100644
--- a/aom_dsp/entdec.c
+++ b/aom_dsp/entdec.c
@@ -9,10 +9,6 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "./config.h"
-#endif
-
 #include <assert.h>
 #include "aom_dsp/entdec.h"
 #include "aom_dsp/prob.h"
diff --git a/aom_dsp/entenc.c b/aom_dsp/entenc.c
index ab74ea0..6866de9 100644
--- a/aom_dsp/entenc.c
+++ b/aom_dsp/entenc.c
@@ -9,10 +9,6 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "./config.h"
-#endif
-
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
diff --git a/aom_dsp/mips/add_noise_msa.c b/aom_dsp/mips/add_noise_msa.c
index 4c6e201..96d04cf 100644
--- a/aom_dsp/mips/add_noise_msa.c
+++ b/aom_dsp/mips/add_noise_msa.c
@@ -10,7 +10,8 @@
  */
 
 #include <stdlib.h>
-#include "./macros_msa.h"
+
+#include "aom_dsp/mips/macros_msa.h"
 
 void aom_plane_add_noise_msa(uint8_t *start_ptr, char *noise,
                              char blackclamp[16], char whiteclamp[16],
diff --git a/aom_dsp/prob.h b/aom_dsp/prob.h
index c06f403..85dd424 100644
--- a/aom_dsp/prob.h
+++ b/aom_dsp/prob.h
@@ -17,13 +17,11 @@
 
 #include "config/aom_config.h"
 
-#include "./aom_dsp_common.h"
-
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_dsp/entcode.h"
 #include "aom_ports/bitops.h"
 #include "aom_ports/mem.h"
 
-#include "aom_dsp/entcode.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/aom_dsp/simd/v128_intrinsics.h b/aom_dsp/simd/v128_intrinsics.h
index 8f65093..d7910ec 100644
--- a/aom_dsp/simd/v128_intrinsics.h
+++ b/aom_dsp/simd/v128_intrinsics.h
@@ -15,8 +15,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "./v128_intrinsics_c.h"
-#include "./v64_intrinsics.h"
+
+#include "aom_dsp/simd/v128_intrinsics_c.h"
+#include "aom_dsp/simd/v64_intrinsics.h"
 
 /* Fallback to plain, unoptimised C. */
 
diff --git a/aom_dsp/simd/v128_intrinsics_arm.h b/aom_dsp/simd/v128_intrinsics_arm.h
index 88c64fa..6c48839 100644
--- a/aom_dsp/simd/v128_intrinsics_arm.h
+++ b/aom_dsp/simd/v128_intrinsics_arm.h
@@ -13,7 +13,8 @@
 #define _V128_INTRINSICS_H
 
 #include <arm_neon.h>
-#include "./v64_intrinsics_arm.h"
+
+#include "aom_dsp/simd/v64_intrinsics_arm.h"
 
 typedef int64x2_t v128;
 
diff --git a/aom_dsp/simd/v128_intrinsics_c.h b/aom_dsp/simd/v128_intrinsics_c.h
index 3404f03..237496f 100644
--- a/aom_dsp/simd/v128_intrinsics_c.h
+++ b/aom_dsp/simd/v128_intrinsics_c.h
@@ -14,10 +14,11 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "./v64_intrinsics_c.h"
 
 #include "config/aom_config.h"
 
+#include "aom_dsp/simd/v64_intrinsics_c.h"
+
 typedef union {
   uint8_t u8[16];
   uint16_t u16[8];
diff --git a/aom_dsp/simd/v128_intrinsics_x86.h b/aom_dsp/simd/v128_intrinsics_x86.h
index cca1788..c2b078f 100644
--- a/aom_dsp/simd/v128_intrinsics_x86.h
+++ b/aom_dsp/simd/v128_intrinsics_x86.h
@@ -12,7 +12,7 @@
 #ifndef _V128_INTRINSICS_H
 #define _V128_INTRINSICS_H
 
-#include "./v64_intrinsics_x86.h"
+#include "aom_dsp/simd/v64_intrinsics_x86.h"
 
 typedef __m128i v128;
 
diff --git a/aom_dsp/simd/v256_intrinsics.h b/aom_dsp/simd/v256_intrinsics.h
index 1896374..ae31ae7 100644
--- a/aom_dsp/simd/v256_intrinsics.h
+++ b/aom_dsp/simd/v256_intrinsics.h
@@ -15,9 +15,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "./v256_intrinsics_c.h"
-#include "./v128_intrinsics.h"
-#include "./v64_intrinsics.h"
+
+#include "aom_dsp/simd/v256_intrinsics_c.h"
+#include "aom_dsp/simd/v128_intrinsics.h"
+#include "aom_dsp/simd/v64_intrinsics.h"
 
 /* Fallback to plain, unoptimised C. */
 
diff --git a/aom_dsp/simd/v256_intrinsics_arm.h b/aom_dsp/simd/v256_intrinsics_arm.h
index ba4ed71..d966384 100644
--- a/aom_dsp/simd/v256_intrinsics_arm.h
+++ b/aom_dsp/simd/v256_intrinsics_arm.h
@@ -12,6 +12,6 @@
 #ifndef _V256_INTRINSICS_H
 #define _V256_INTRINSICS_H
 
-#include "./v256_intrinsics_v128.h"
+#include "aom_dsp/simd/v256_intrinsics_v128.h"
 
 #endif /* _V256_INTRINSICS_H */
diff --git a/aom_dsp/simd/v256_intrinsics_c.h b/aom_dsp/simd/v256_intrinsics_c.h
index 7520116..890178d 100644
--- a/aom_dsp/simd/v256_intrinsics_c.h
+++ b/aom_dsp/simd/v256_intrinsics_c.h
@@ -14,10 +14,11 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "./v128_intrinsics_c.h"
 
 #include "config/aom_config.h"
 
+#include "aom_dsp/simd/v128_intrinsics_c.h"
+
 typedef union {
   uint8_t u8[32];
   uint16_t u16[16];
diff --git a/aom_dsp/simd/v256_intrinsics_v128.h b/aom_dsp/simd/v256_intrinsics_v128.h
index 982312f..e6d6746 100644
--- a/aom_dsp/simd/v256_intrinsics_v128.h
+++ b/aom_dsp/simd/v256_intrinsics_v128.h
@@ -13,11 +13,11 @@
 #define _V256_INTRINSICS_V128_H
 
 #if HAVE_NEON
-#include "./v128_intrinsics_arm.h"
+#include "aom_dsp/simd/v128_intrinsics_arm.h"
 #elif HAVE_SSE2
-#include "./v128_intrinsics_x86.h"
+#include "aom_dsp/simd/v128_intrinsics_x86.h"
 #else
-#include "./v128_intrinsics.h"
+#include "aom_dsp/simd/v128_intrinsics.h"
 #endif
 
 typedef struct {
diff --git a/aom_dsp/simd/v256_intrinsics_x86.h b/aom_dsp/simd/v256_intrinsics_x86.h
index b82daab..f0cf452 100644
--- a/aom_dsp/simd/v256_intrinsics_x86.h
+++ b/aom_dsp/simd/v256_intrinsics_x86.h
@@ -14,7 +14,7 @@
 
 #if !defined(__AVX2__)
 
-#include "./v256_intrinsics_v128.h"
+#include "aom_dsp/simd/v256_intrinsics_v128.h"
 
 #else
 
@@ -26,7 +26,8 @@
 #endif
 
 #include <immintrin.h>
-#include "./v128_intrinsics_x86.h"
+
+#include "aom_dsp/simd/v128_intrinsics_x86.h"
 
 typedef __m256i v256;
 
diff --git a/aom_dsp/simd/v64_intrinsics.h b/aom_dsp/simd/v64_intrinsics.h
index 5c0042d..1d62ae7 100644
--- a/aom_dsp/simd/v64_intrinsics.h
+++ b/aom_dsp/simd/v64_intrinsics.h
@@ -14,7 +14,8 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "./v64_intrinsics_c.h"
+
+#include "aom_dsp/simd/v64_intrinsics_c.h"
 
 /* Fallback to plain, unoptimised C. */
 
diff --git a/aom_dsp/simd/v64_intrinsics_arm.h b/aom_dsp/simd/v64_intrinsics_arm.h
index c7574ee..3ef0bf9 100644
--- a/aom_dsp/simd/v64_intrinsics_arm.h
+++ b/aom_dsp/simd/v64_intrinsics_arm.h
@@ -13,7 +13,8 @@
 #define _V64_INTRINSICS_H
 
 #include <arm_neon.h>
-#include "./v64_intrinsics_arm.h"
+
+#include "aom_dsp/simd/v64_intrinsics_arm.h"
 #include "aom_ports/arm.h"
 
 #ifdef AOM_INCOMPATIBLE_GCC
diff --git a/aom_util/aom_thread.c b/aom_util/aom_thread.c
index 954b8f9..cae9f5e 100644
--- a/aom_util/aom_thread.c
+++ b/aom_util/aom_thread.c
@@ -16,8 +16,9 @@
 
 #include <assert.h>
 #include <string.h>  // for memset()
-#include "./aom_thread.h"
+
 #include "aom_mem/aom_mem.h"
+#include "aom_util/aom_thread.h"
 
 #if CONFIG_MULTITHREAD
 
diff --git a/av1/common/cdef_block.c b/av1/common/cdef_block.c
index e25580c..df1de89 100644
--- a/av1/common/cdef_block.c
+++ b/av1/common/cdef_block.c
@@ -12,14 +12,10 @@
 #include <math.h>
 #include <stdlib.h>
 
-#ifdef HAVE_CONFIG_H
-#include "./config.h"
-#endif
-
 #include "config/aom_dsp_rtcd.h"
 #include "config/av1_rtcd.h"
 
-#include "./cdef.h"
+#include "av1/common/cdef.h"
 
 /* Generated from gen_filter_tables.c. */
 DECLARE_ALIGNED(16, const int, cdef_directions[8][2]) = {
diff --git a/av1/common/cdef_block.h b/av1/common/cdef_block.h
index 91c7f89..81c6da0 100644
--- a/av1/common/cdef_block.h
+++ b/av1/common/cdef_block.h
@@ -12,7 +12,7 @@
 #if !defined(_CDEF_BLOCK_H)
 #define _CDEF_BLOCK_H (1)
 
-#include "./odintrin.h"
+#include "av1/common/odintrin.h"
 
 #define CDEF_BLOCKSIZE 64
 #define CDEF_BLOCKSIZE_LOG2 6
diff --git a/av1/common/cdef_block_avx2.c b/av1/common/cdef_block_avx2.c
index 5e48045..e2b85b3 100644
--- a/av1/common/cdef_block_avx2.c
+++ b/av1/common/cdef_block_avx2.c
@@ -11,4 +11,4 @@
 
 #include "aom_dsp/aom_simd.h"
 #define SIMD_FUNC(name) name##_avx2
-#include "./cdef_block_simd.h"
+#include "av1/common/cdef_block_simd.h"
diff --git a/av1/common/cdef_block_neon.c b/av1/common/cdef_block_neon.c
index 030b325..2d6bc65 100644
--- a/av1/common/cdef_block_neon.c
+++ b/av1/common/cdef_block_neon.c
@@ -11,4 +11,4 @@
 
 #include "aom_dsp/aom_simd.h"
 #define SIMD_FUNC(name) name##_neon
-#include "./cdef_block_simd.h"
+#include "av1/common/cdef_block_simd.h"
diff --git a/av1/common/cdef_block_simd.h b/av1/common/cdef_block_simd.h
index d2e4139..467824b 100644
--- a/av1/common/cdef_block_simd.h
+++ b/av1/common/cdef_block_simd.h
@@ -11,7 +11,7 @@
 
 #include "config/av1_rtcd.h"
 
-#include "./cdef_block.h"
+#include "av1/common/cdef_block.h"
 
 /* partial A is a 16-bit vector of the form:
    [x8 x7 x6 x5 x4 x3 x2 x1] and partial B has the form:
diff --git a/av1/common/cdef_block_sse2.c b/av1/common/cdef_block_sse2.c
index f3de763..73f115d 100644
--- a/av1/common/cdef_block_sse2.c
+++ b/av1/common/cdef_block_sse2.c
@@ -11,4 +11,4 @@
 
 #include "aom_dsp/aom_simd.h"
 #define SIMD_FUNC(name) name##_sse2
-#include "./cdef_block_simd.h"
+#include "av1/common/cdef_block_simd.h"
diff --git a/av1/common/cdef_block_sse4.c b/av1/common/cdef_block_sse4.c
index 27e9ff3..349329a 100644
--- a/av1/common/cdef_block_sse4.c
+++ b/av1/common/cdef_block_sse4.c
@@ -11,4 +11,4 @@
 
 #include "aom_dsp/aom_simd.h"
 #define SIMD_FUNC(name) name##_sse4_1
-#include "./cdef_block_simd.h"
+#include "av1/common/cdef_block_simd.h"
diff --git a/av1/common/cdef_block_ssse3.c b/av1/common/cdef_block_ssse3.c
index 8635221..3a93b15 100644
--- a/av1/common/cdef_block_ssse3.c
+++ b/av1/common/cdef_block_ssse3.c
@@ -11,4 +11,4 @@
 
 #include "aom_dsp/aom_simd.h"
 #define SIMD_FUNC(name) name##_ssse3
-#include "./cdef_block_simd.h"
+#include "av1/common/cdef_block_simd.h"
diff --git a/av1/decoder/accounting.c b/av1/decoder/accounting.c
index fdbb9a5..8d8f3df 100644
--- a/av1/decoder/accounting.c
+++ b/av1/decoder/accounting.c
@@ -15,7 +15,7 @@
 #include <string.h>
 
 #include "aom/aom_integer.h"
-#include "./accounting.h"
+#include "av1/decoder/accounting.h"
 
 static int aom_accounting_hash(const char *str) {
   uint32_t val;
diff --git a/common/args.c b/common/args.c
index 0ecbf4b..7131e24 100644
--- a/common/args.c
+++ b/common/args.c
@@ -9,10 +9,11 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
+#include "common/args.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
-#include "args.h"
 
 #include "aom/aom_integer.h"
 #include "aom_ports/msvc.h"
diff --git a/common/ivfdec.c b/common/ivfdec.c
index c3f7f0a..aa51bc8 100644
--- a/common/ivfdec.c
+++ b/common/ivfdec.c
@@ -9,6 +9,8 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
+#include "common/ivfdec.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -16,8 +18,6 @@
 #include "aom_ports/mem_ops.h"
 #include "aom_ports/sanitizer.h"
 
-#include "./ivfdec.h"
-
 static const char *IVF_SIGNATURE = "DKIF";
 
 static void fix_framerate(int *num, int *den) {
diff --git a/common/ivfdec.h b/common/ivfdec.h
index 36a6fb8..9e7f635 100644
--- a/common/ivfdec.h
+++ b/common/ivfdec.h
@@ -11,7 +11,7 @@
 #ifndef IVFDEC_H_
 #define IVFDEC_H_
 
-#include "./tools_common.h"
+#include "common/tools_common.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/common/ivfenc.c b/common/ivfenc.c
index 80f4d14..64715f4 100644
--- a/common/ivfenc.c
+++ b/common/ivfenc.c
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "./ivfenc.h"
+#include "common/ivfenc.h"
 
 #include "aom/aom_encoder.h"
 #include "aom_ports/mem_ops.h"
diff --git a/common/ivfenc.h b/common/ivfenc.h
index 62b3a91..f0cab81 100644
--- a/common/ivfenc.h
+++ b/common/ivfenc.h
@@ -11,7 +11,7 @@
 #ifndef IVFENC_H_
 #define IVFENC_H_
 
-#include "./tools_common.h"
+#include "common/tools_common.h"
 
 struct aom_codec_enc_cfg;
 struct aom_codec_cx_pkt;
diff --git a/common/obudec.c b/common/obudec.c
index f381fa4..3acce87 100644
--- a/common/obudec.c
+++ b/common/obudec.c
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "./obudec.h"
+#include "common/obudec.h"
 
 #include "aom_ports/mem_ops.h"
 #include "av1/common/common.h"
diff --git a/common/obudec.h b/common/obudec.h
index d1566d1..328846a 100644
--- a/common/obudec.h
+++ b/common/obudec.h
@@ -11,7 +11,7 @@
 #ifndef OBUDEC_H_
 #define OBUDEC_H_
 
-#include "./tools_common.h"
+#include "common/tools_common.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/common/tools_common.c b/common/tools_common.c
index 7abc20c..359ec73 100644
--- a/common/tools_common.c
+++ b/common/tools_common.c
@@ -9,14 +9,14 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
+#include "common/tools_common.h"
+
 #include <math.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "./tools_common.h"
-
 #if CONFIG_AV1_ENCODER
 #include "aom/aomcx.h"
 #endif
diff --git a/common/tools_common.h b/common/tools_common.h
index 904054b..abee4ea 100644
--- a/common/tools_common.h
+++ b/common/tools_common.h
@@ -21,7 +21,7 @@
 #include "aom_ports/msvc.h"
 
 #if CONFIG_AV1_ENCODER
-#include "./y4minput.h"
+#include "common/y4minput.h"
 #endif
 
 #if defined(_MSC_VER)
diff --git a/common/video_common.h b/common/video_common.h
index 1aa82f6..f96af4b 100644
--- a/common/video_common.h
+++ b/common/video_common.h
@@ -12,7 +12,7 @@
 #ifndef VIDEO_COMMON_H_
 #define VIDEO_COMMON_H_
 
-#include "./tools_common.h"
+#include "common/tools_common.h"
 
 typedef struct {
   uint32_t codec_fourcc;
diff --git a/common/video_reader.c b/common/video_reader.c
index 6a96af9..ac2f55e 100644
--- a/common/video_reader.c
+++ b/common/video_reader.c
@@ -8,14 +8,13 @@
  * Media Patent License 1.0 was not distributed with this source code in the
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
+#include "common/video_reader.h"
 
 #include <stdlib.h>
 #include <string.h>
 
-#include "./ivfdec.h"
-#include "./video_reader.h"
-
 #include "aom_ports/mem_ops.h"
+#include "common/ivfdec.h"
 
 static const char *const kIVFSignature = "DKIF";
 
diff --git a/common/video_reader.h b/common/video_reader.h
index 962c665..3ee9a34 100644
--- a/common/video_reader.h
+++ b/common/video_reader.h
@@ -12,7 +12,7 @@
 #ifndef VIDEO_READER_H_
 #define VIDEO_READER_H_
 
-#include "./video_common.h"
+#include "common/video_common.h"
 
 // The following code is work in progress. It is going to  support transparent
 // reading of input files. Right now only IVF format is supported for
diff --git a/common/video_writer.c b/common/video_writer.c
index 4e072c7..a7ec309 100644
--- a/common/video_writer.c
+++ b/common/video_writer.c
@@ -8,12 +8,12 @@
  * Media Patent License 1.0 was not distributed with this source code in the
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
+#include "common/video_writer.h"
 
 #include <stdlib.h>
 
-#include "./ivfenc.h"
-#include "./video_writer.h"
 #include "aom/aom_encoder.h"
+#include "common/ivfenc.h"
 
 struct AvxVideoWriterStruct {
   AvxVideoInfo info;
diff --git a/common/video_writer.h b/common/video_writer.h
index ad9e6eb..16655d3 100644
--- a/common/video_writer.h
+++ b/common/video_writer.h
@@ -12,7 +12,7 @@
 #ifndef VIDEO_WRITER_H_
 #define VIDEO_WRITER_H_
 
-#include "./video_common.h"
+#include "common/video_common.h"
 
 typedef enum { kContainerIVF } AvxContainer;
 
diff --git a/common/warnings.c b/common/warnings.c
index 16d5c6c..2facee2 100644
--- a/common/warnings.c
+++ b/common/warnings.c
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "./warnings.h"
+#include "common/warnings.h"
 
 #include <assert.h>
 #include <stdio.h>
@@ -17,9 +17,8 @@
 #include <string.h>
 
 #include "aom/aom_encoder.h"
-
-#include "./tools_common.h"
-#include "./aomenc.h"
+#include "apps/aomenc.h"
+#include "common/tools_common.h"
 
 static const char quantizer_warning_string[] =
     "Bad quantizer values. Quantizer values should not be equal, and should "
diff --git a/common/webmdec.cc b/common/webmdec.cc
index 27cfb23..17ac53c 100644
--- a/common/webmdec.cc
+++ b/common/webmdec.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "./webmdec.h"
+#include "common/webmdec.h"
 
 #include <cassert>
 #include <cstring>
diff --git a/common/webmdec.h b/common/webmdec.h
index 64d0b98..d5b472a 100644
--- a/common/webmdec.h
+++ b/common/webmdec.h
@@ -11,7 +11,7 @@
 #ifndef WEBMDEC_H_
 #define WEBMDEC_H_
 
-#include "./tools_common.h"
+#include "common/tools_common.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/common/webmenc.cc b/common/webmenc.cc
index 5e0f7a7..58ab336 100644
--- a/common/webmenc.cc
+++ b/common/webmenc.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "./webmenc.h"
+#include "common/webmenc.h"
 
 #include <string>
 
diff --git a/common/y4menc.c b/common/y4menc.c
index b094f74..d33d031 100644
--- a/common/y4menc.c
+++ b/common/y4menc.c
@@ -10,7 +10,8 @@
  */
 
 #include <assert.h>
-#include "./y4menc.h"
+
+#include "common/y4menc.h"
 
 int y4m_write_file_header(char *buf, size_t len, int width, int height,
                           const struct AvxRational *framerate,
diff --git a/common/y4menc.h b/common/y4menc.h
index cb75eeb..6344176 100644
--- a/common/y4menc.h
+++ b/common/y4menc.h
@@ -12,9 +12,8 @@
 #ifndef Y4MENC_H_
 #define Y4MENC_H_
 
-#include "./tools_common.h"
-
 #include "aom/aom_decoder.h"
+#include "common/tools_common.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/stats/aomstats.c b/stats/aomstats.c
index 0cfeea2..4a15adf 100644
--- a/stats/aomstats.c
+++ b/stats/aomstats.c
@@ -9,13 +9,13 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "./aomstats.h"
+#include "stats/aomstats.h"
 
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "./tools_common.h"
+#include "common/tools_common.h"
 
 int stats_open_file(stats_io_t *stats, const char *fpf, int pass) {
   int res;
diff --git a/stats/rate_hist.c b/stats/rate_hist.c
index ffc7b89..71eb78b 100644
--- a/stats/rate_hist.c
+++ b/stats/rate_hist.c
@@ -9,14 +9,14 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
+#include "stats/rate_hist.h"
+
 #include <assert.h>
 #include <stdlib.h>
 #include <limits.h>
 #include <stdio.h>
 #include <math.h>
 
-#include "./rate_hist.h"
-
 #define RATE_BINS 100
 #define HIST_BAR_MAX 40
 
diff --git a/test/decode_perf_test.cc b/test/decode_perf_test.cc
index 576a532..c00044c 100644
--- a/test/decode_perf_test.cc
+++ b/test/decode_perf_test.cc
@@ -10,6 +10,11 @@
  */
 
 #include <string>
+
+#include "./aom_version.h"
+
+#include "aom_ports/aom_timer.h"
+#include "common/ivfenc.h"
 #include "test/codec_factory.h"
 #include "test/decode_test_driver.h"
 #include "test/encode_test_driver.h"
@@ -18,9 +23,6 @@
 #include "test/md5_helper.h"
 #include "test/util.h"
 #include "test/webm_video_source.h"
-#include "aom_ports/aom_timer.h"
-#include "./ivfenc.h"
-#include "./aom_version.h"
 
 using ::testing::make_tuple;
 
diff --git a/test/md5_helper.h b/test/md5_helper.h
index 8c9d4f7..b2b14cf 100644
--- a/test/md5_helper.h
+++ b/test/md5_helper.h
@@ -12,8 +12,8 @@
 #ifndef TEST_MD5_HELPER_H_
 #define TEST_MD5_HELPER_H_
 
-#include "./md5_utils.h"
 #include "aom/aom_decoder.h"
+#include "common/md5_utils.h"
 
 namespace libaom_test {
 class MD5 {
diff --git a/test/noise_model_test.cc b/test/noise_model_test.cc
index 559e053..d454c31 100644
--- a/test/noise_model_test.cc
+++ b/test/noise_model_test.cc
@@ -2,8 +2,8 @@
 #include <algorithm>
 #include <vector>
 
-#include "./aom_dsp/noise_model.h"
-#include "./aom_dsp/noise_util.h"
+#include "aom_dsp/noise_model.h"
+#include "aom_dsp/noise_util.h"
 #include "test/acm_random.h"
 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
diff --git a/test/simd_avx2_test.cc b/test/simd_avx2_test.cc
index d54d201..8a012bf 100644
--- a/test/simd_avx2_test.cc
+++ b/test/simd_avx2_test.cc
@@ -12,4 +12,4 @@
 #define ARCH AVX2
 #define ARCH_POSTFIX(name) name##_avx2
 #define SIMD_NAMESPACE simd_test_avx2
-#include "./simd_impl.h"
+#include "test/simd_impl.h"
diff --git a/test/simd_cmp_avx2.cc b/test/simd_cmp_avx2.cc
index 47ae11c..cda632b 100644
--- a/test/simd_cmp_avx2.cc
+++ b/test/simd_cmp_avx2.cc
@@ -12,4 +12,4 @@
 #define ARCH AVX2
 #define ARCH_POSTFIX(name) name##_avx2
 #define SIMD_NAMESPACE simd_test_avx2
-#include "./simd_cmp_impl.h"
+#include "test/simd_cmp_impl.h"
diff --git a/test/simd_cmp_neon.cc b/test/simd_cmp_neon.cc
index c8004cc..53c1e2a 100644
--- a/test/simd_cmp_neon.cc
+++ b/test/simd_cmp_neon.cc
@@ -13,5 +13,5 @@
 #define ARCH NEON
 #define ARCH_POSTFIX(name) name##_neon
 #define SIMD_NAMESPACE simd_test_neon
-#include "./simd_cmp_impl.h"
+#include "test/simd_cmp_impl.h"
 #endif
diff --git a/test/simd_cmp_sse2.cc b/test/simd_cmp_sse2.cc
index 67cb43c..f7827a7 100644
--- a/test/simd_cmp_sse2.cc
+++ b/test/simd_cmp_sse2.cc
@@ -14,5 +14,5 @@
 #define ARCH SSE2
 #define ARCH_POSTFIX(name) name##_sse2
 #define SIMD_NAMESPACE simd_test_sse2
-#include "./simd_cmp_impl.h"
+#include "test/simd_cmp_impl.h"
 #endif
diff --git a/test/simd_cmp_sse4.cc b/test/simd_cmp_sse4.cc
index ba826d8..3566764 100644
--- a/test/simd_cmp_sse4.cc
+++ b/test/simd_cmp_sse4.cc
@@ -14,5 +14,5 @@
 #define ARCH SSE4_1
 #define ARCH_POSTFIX(name) name##_sse4_1
 #define SIMD_NAMESPACE simd_test_sse4_1
-#include "./simd_cmp_impl.h"
+#include "test/simd_cmp_impl.h"
 #endif
diff --git a/test/simd_cmp_ssse3.cc b/test/simd_cmp_ssse3.cc
index a6c7000..57bf135 100644
--- a/test/simd_cmp_ssse3.cc
+++ b/test/simd_cmp_ssse3.cc
@@ -14,5 +14,5 @@
 #define ARCH SSSE3
 #define ARCH_POSTFIX(name) name##_ssse3
 #define SIMD_NAMESPACE simd_test_ssse3
-#include "./simd_cmp_impl.h"
+#include "test/simd_cmp_impl.h"
 #endif
diff --git a/test/simd_neon_test.cc b/test/simd_neon_test.cc
index 0565fb4..b67b188 100644
--- a/test/simd_neon_test.cc
+++ b/test/simd_neon_test.cc
@@ -13,5 +13,5 @@
 #define ARCH NEON
 #define ARCH_POSTFIX(name) name##_neon
 #define SIMD_NAMESPACE simd_test_neon
-#include "./simd_impl.h"
+#include "test/simd_impl.h"
 #endif
diff --git a/test/simd_sse2_test.cc b/test/simd_sse2_test.cc
index a0b49d7..b37a931 100644
--- a/test/simd_sse2_test.cc
+++ b/test/simd_sse2_test.cc
@@ -14,5 +14,5 @@
 #define ARCH SSE2
 #define ARCH_POSTFIX(name) name##_sse2
 #define SIMD_NAMESPACE simd_test_sse2
-#include "./simd_impl.h"
+#include "test/simd_impl.h"
 #endif
diff --git a/test/simd_sse4_test.cc b/test/simd_sse4_test.cc
index 73c9642..b1c9d5c 100644
--- a/test/simd_sse4_test.cc
+++ b/test/simd_sse4_test.cc
@@ -14,5 +14,5 @@
 #define ARCH SSE4_1
 #define ARCH_POSTFIX(name) name##_sse4_1
 #define SIMD_NAMESPACE simd_test_sse4_1
-#include "./simd_impl.h"
+#include "test/simd_impl.h"
 #endif
diff --git a/test/simd_ssse3_test.cc b/test/simd_ssse3_test.cc
index 9ebeeef..d95c26f 100644
--- a/test/simd_ssse3_test.cc
+++ b/test/simd_ssse3_test.cc
@@ -14,5 +14,5 @@
 #define ARCH SSSE3
 #define ARCH_POSTFIX(name) name##_ssse3
 #define SIMD_NAMESPACE simd_test_ssse3
-#include "./simd_impl.h"
+#include "test/simd_impl.h"
 #endif
diff --git a/test/y4m_test.cc b/test/y4m_test.cc
index e8848fe..b801193 100644
--- a/test/y4m_test.cc
+++ b/test/y4m_test.cc
@@ -11,14 +11,13 @@
 
 #include <string>
 
-#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
-
 #include "config/aom_config.h"
 
-#include "./y4menc.h"
+#include "common/y4menc.h"
 #include "test/md5_helper.h"
 #include "test/util.h"
 #include "test/y4m_video_source.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 namespace {
 
diff --git a/test/y4m_video_source.h b/test/y4m_video_source.h
index f70c30b..277ded9 100644
--- a/test/y4m_video_source.h
+++ b/test/y4m_video_source.h
@@ -13,8 +13,8 @@
 #include <algorithm>
 #include <string>
 
+#include "common/y4minput.h"
 #include "test/video_source.h"
-#include "./y4minput.h"
 
 namespace libaom_test {
 
diff --git a/tools/txfm_analyzer/txfm_gen_code.cc b/tools/txfm_analyzer/txfm_gen_code.cc
index 2847a10..7c5400b 100644
--- a/tools/txfm_analyzer/txfm_gen_code.cc
+++ b/tools/txfm_analyzer/txfm_gen_code.cc
@@ -15,7 +15,7 @@
 #include <float.h>
 #include <string.h>
 
-#include "./txfm_graph.h"
+#include "tools/txfm_analyzer/txfm_graph.h"
 
 typedef enum CODE_TYPE {
   CODE_TYPE_C,
diff --git a/tools/txfm_analyzer/txfm_graph.cc b/tools/txfm_analyzer/txfm_graph.cc
index 22fe326..a249061 100644
--- a/tools/txfm_analyzer/txfm_graph.cc
+++ b/tools/txfm_analyzer/txfm_graph.cc
@@ -9,10 +9,11 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
+#include "tools/txfm_analyzer/txfm_graph.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#include "./txfm_graph.h"
 
 typedef struct Node Node;