Merge "vp10: code reference_mode in uncompressed header."
diff --git a/test/test.mk b/test/test.mk
index fde9703..bb5186b 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -168,7 +168,7 @@
 TEST_INTRA_PRED_SPEED_SRCS-$(CONFIG_VP9) += ../md5_utils.h ../md5_utils.c
 
 ## VP10
-LIBVPX_TEST_SRCS-$(CONFIG_VP10) += vp10_dct_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_dct_test.cc
 LIBVPX_TEST_SRCS-$(CONFIG_VP10) += vp10_inv_txfm_test.cc
 
 endif # CONFIG_SHARED
diff --git a/test/vp10_dct_test.cc b/test/vp10_dct_test.cc
index 8fb5f4f..8e49609 100644
--- a/test/vp10_dct_test.cc
+++ b/test/vp10_dct_test.cc
@@ -17,7 +17,10 @@
 #include "test/util.h"
 #include "./vpx_config.h"
 #include "vpx_ports/msvc.h"
-#include "vp10/encoder/dct.h"
+
+#undef CONFIG_COEFFICIENT_RANGE_CHECKING
+#define CONFIG_COEFFICIENT_RANGE_CHECKING 1
+#include "vp10/encoder/dct.c"
 
 using libvpx_test::ACMRandom;
 
@@ -102,8 +105,8 @@
 INSTANTIATE_TEST_CASE_P(
     C, Vp10FwdTxfm,
     ::testing::Values(
-        FdctParam(&vp10_fdct4, &reference_dct_1d, 4, 1),
-        FdctParam(&vp10_fdct8, &reference_dct_1d, 8, 1),
-        FdctParam(&vp10_fdct16, &reference_dct_1d, 16, 2),
-        FdctParam(&vp10_fdct32_local, &reference_dct_1d, 32, 4)));
+        FdctParam(&fdct4, &reference_dct_1d, 4, 1),
+        FdctParam(&fdct8, &reference_dct_1d, 8, 1),
+        FdctParam(&fdct16, &reference_dct_1d, 16, 2),
+        FdctParam(&fdct32, &reference_dct_1d, 32, 4)));
 }  // namespace
diff --git a/vp10/encoder/dct.c b/vp10/encoder/dct.c
index 78f151e..80ace06 100644
--- a/vp10/encoder/dct.c
+++ b/vp10/encoder/dct.c
@@ -34,7 +34,7 @@
 #endif
 }
 
-void vp10_fdct4(const tran_low_t *input, tran_low_t *output) {
+static void fdct4(const tran_low_t *input, tran_low_t *output) {
   tran_high_t temp;
   tran_low_t step[4];
 
@@ -70,7 +70,7 @@
   range_check(output, 4, 13);
 }
 
-void vp10_fdct8(const tran_low_t *input, tran_low_t *output) {
+static void fdct8(const tran_low_t *input, tran_low_t *output) {
   tran_high_t temp;
   tran_low_t step[8];
 
@@ -148,7 +148,7 @@
   range_check(output, 8, 14);
 }
 
-void vp10_fdct16(const tran_low_t *input, tran_low_t *output) {
+static void fdct16(const tran_low_t *input, tran_low_t *output) {
   tran_high_t temp;
   tran_low_t step[16];
 
@@ -322,8 +322,7 @@
   range_check(output, 16, 16);
 }
 
-// TODO(angiebird): Unify this with vp10_fwd_txfm.c: vp10_fdct32
-void vp10_fdct32_local(const tran_low_t *input, tran_low_t *output) {
+static void fdct32(const tran_low_t *input, tran_low_t *output) {
   tran_high_t temp;
   tran_low_t step[32];
 
@@ -996,24 +995,24 @@
 }
 
 static const transform_2d FHT_4[] = {
-  { vp10_fdct4, vp10_fdct4 },  // DCT_DCT  = 0
-  { fadst4,     vp10_fdct4 },  // ADST_DCT = 1
-  { vp10_fdct4, fadst4     },  // DCT_ADST = 2
-  { fadst4,     fadst4     }   // ADST_ADST = 3
+  { fdct4,  fdct4  },  // DCT_DCT  = 0
+  { fadst4, fdct4  },  // ADST_DCT = 1
+  { fdct4,  fadst4 },  // DCT_ADST = 2
+  { fadst4, fadst4 }   // ADST_ADST = 3
 };
 
 static const transform_2d FHT_8[] = {
-  { vp10_fdct8, vp10_fdct8 },  // DCT_DCT  = 0
-  { fadst8,     vp10_fdct8 },  // ADST_DCT = 1
-  { vp10_fdct8, fadst8     },  // DCT_ADST = 2
-  { fadst8,     fadst8     }   // ADST_ADST = 3
+  { fdct8,  fdct8  },  // DCT_DCT  = 0
+  { fadst8, fdct8  },  // ADST_DCT = 1
+  { fdct8,  fadst8 },  // DCT_ADST = 2
+  { fadst8, fadst8 }   // ADST_ADST = 3
 };
 
 static const transform_2d FHT_16[] = {
-  { vp10_fdct16, vp10_fdct16 },  // DCT_DCT  = 0
-  { fadst16,     vp10_fdct16 },  // ADST_DCT = 1
-  { vp10_fdct16, fadst16     },  // DCT_ADST = 2
-  { fadst16,     fadst16     }   // ADST_ADST = 3
+  { fdct16,  fdct16  },  // DCT_DCT  = 0
+  { fadst16, fdct16  },  // ADST_DCT = 1
+  { fdct16,  fadst16 },  // DCT_ADST = 2
+  { fadst16, fadst16 }   // ADST_ADST = 3
 };
 
 void vp10_fht4x4_c(const int16_t *input, tran_low_t *output,
@@ -1124,7 +1123,7 @@
 
   // Rows
   for (i = 0; i < 8; ++i) {
-    vp10_fdct8(&intermediate[i * 8], &coeff_ptr[i * 8]);
+    fdct8(&intermediate[i * 8], &coeff_ptr[i * 8]);
     for (j = 0; j < 8; ++j)
       coeff_ptr[j + i * 8] /= 2;
   }
diff --git a/vp10/encoder/dct.h b/vp10/encoder/dct.h
deleted file mode 100644
index ab0db93..0000000
--- a/vp10/encoder/dct.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Copyright (c) 2015 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.
- */
-#ifndef VP10_ENCODER_DCT_H_
-#define VP10_ENCODER_DCT_H_
-
-#include "vpx_dsp/vpx_dsp_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp10_fdct4(const tran_low_t *input, tran_low_t *output);
-void vp10_fdct8(const tran_low_t *input, tran_low_t *output);
-void vp10_fdct16(const tran_low_t *input, tran_low_t *output);
-void vp10_fdct32_local(const tran_low_t *input, tran_low_t *output);
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // VP10_ENCODER_DCT_H_
diff --git a/vp10/encoder/encoder.c b/vp10/encoder/encoder.c
index b455bbb..1d95d7d 100644
--- a/vp10/encoder/encoder.c
+++ b/vp10/encoder/encoder.c
@@ -1820,14 +1820,15 @@
   snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
 
 void vp10_remove_compressor(VP10_COMP *cpi) {
-  VP10_COMMON *const cm = &cpi->common;
+  VP10_COMMON *cm;
   unsigned int i;
   int t;
 
   if (!cpi)
     return;
 
-  if (cpi && (cm->current_video_frame > 0)) {
+  cm = &cpi->common;
+  if (cm->current_video_frame > 0) {
 #if CONFIG_INTERNAL_STATS
     vpx_clear_system_state();
 
diff --git a/vp10/vp10cx.mk b/vp10/vp10cx.mk
index 7393a4e..ead993a 100644
--- a/vp10/vp10cx.mk
+++ b/vp10/vp10cx.mk
@@ -23,7 +23,6 @@
 VP10_CX_SRCS-yes += encoder/context_tree.h
 VP10_CX_SRCS-yes += encoder/cost.h
 VP10_CX_SRCS-yes += encoder/cost.c
-VP10_CX_SRCS-yes += encoder/dct.h
 VP10_CX_SRCS-yes += encoder/dct.c
 VP10_CX_SRCS-$(CONFIG_VP9_TEMPORAL_DENOISING) += encoder/denoiser.c
 VP10_CX_SRCS-$(CONFIG_VP9_TEMPORAL_DENOISING) += encoder/denoiser.h
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index eb0d360..b2e800d 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1930,14 +1930,15 @@
   snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
 
 void vp9_remove_compressor(VP9_COMP *cpi) {
-  VP9_COMMON *const cm = &cpi->common;
+  VP9_COMMON *cm;
   unsigned int i;
   int t;
 
   if (!cpi)
     return;
 
-  if (cpi && (cm->current_video_frame > 0)) {
+  cm = &cpi->common;
+  if (cm->current_video_frame > 0) {
 #if CONFIG_INTERNAL_STATS
     vpx_clear_system_state();