Convert "vpx" to "aom"

Change the name of source files to replace "vpx" with "aom".
Change occurences of "vpx" in the code to "aom".

Change-Id: I002c0eaa2c350cf1a895bf01bea5788c61328027
diff --git a/av1/encoder/aq_complexity.c b/av1/encoder/aq_complexity.c
index f812aec..0f632b8 100644
--- a/av1/encoder/aq_complexity.c
+++ b/av1/encoder/aq_complexity.c
@@ -17,7 +17,7 @@
 #include "av1/encoder/encodeframe.h"
 #include "av1/common/seg_common.h"
 #include "av1/encoder/segmentation.h"
-#include "aom_dsp/vpx_dsp_common.h"
+#include "aom_dsp/aom_dsp_common.h"
 #include "aom_ports/system_state.h"
 
 #define AQ_C_SEGMENTS 5
@@ -41,7 +41,7 @@
 
 #define DEFAULT_COMPLEXITY 64
 
-static int get_aq_c_strength(int q_index, vpx_bit_depth_t bit_depth) {
+static int get_aq_c_strength(int q_index, aom_bit_depth_t bit_depth) {
   // Approximate base quatizer (truncated to int)
   const int base_quant = vp10_ac_quant(q_index, 0, bit_depth) / 4;
   return (base_quant > 10) + (base_quant > 25);
@@ -52,7 +52,7 @@
   struct segmentation *const seg = &cm->seg;
 
   // Make SURE use of floating point in this function is safe.
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   if (frame_is_intra_only(cm) || cm->error_resilient_mode ||
       cpi->refresh_alt_ref_frame ||
@@ -135,7 +135,7 @@
     double low_var_thresh;
     const int aq_strength = get_aq_c_strength(cm->base_qindex, cm->bit_depth);
 
-    vpx_clear_system_state();
+    aom_clear_system_state();
     low_var_thresh = (cpi->oxcf.pass == 2) ? VPXMAX(cpi->twopass.mb_av_energy,
                                                     MIN_DEFAULT_LV_THRESH)
                                            : DEFAULT_LV_THRESH;
diff --git a/av1/encoder/aq_cyclicrefresh.c b/av1/encoder/aq_cyclicrefresh.c
index d7ee3d8..3d48c14 100644
--- a/av1/encoder/aq_cyclicrefresh.c
+++ b/av1/encoder/aq_cyclicrefresh.c
@@ -16,7 +16,7 @@
 #include "av1/encoder/aq_cyclicrefresh.h"
 #include "av1/encoder/ratectrl.h"
 #include "av1/encoder/segmentation.h"
-#include "aom_dsp/vpx_dsp_common.h"
+#include "aom_dsp/aom_dsp_common.h"
 #include "aom_ports/system_state.h"
 
 struct CYCLIC_REFRESH {
@@ -59,18 +59,18 @@
 
 CYCLIC_REFRESH *vp10_cyclic_refresh_alloc(int mi_rows, int mi_cols) {
   size_t last_coded_q_map_size;
-  CYCLIC_REFRESH *const cr = vpx_calloc(1, sizeof(*cr));
+  CYCLIC_REFRESH *const cr = aom_calloc(1, sizeof(*cr));
   if (cr == NULL) return NULL;
 
-  cr->map = vpx_calloc(mi_rows * mi_cols, sizeof(*cr->map));
+  cr->map = aom_calloc(mi_rows * mi_cols, sizeof(*cr->map));
   if (cr->map == NULL) {
-    vpx_free(cr);
+    aom_free(cr);
     return NULL;
   }
   last_coded_q_map_size = mi_rows * mi_cols * sizeof(*cr->last_coded_q_map);
-  cr->last_coded_q_map = vpx_malloc(last_coded_q_map_size);
+  cr->last_coded_q_map = aom_malloc(last_coded_q_map_size);
   if (cr->last_coded_q_map == NULL) {
-    vpx_free(cr);
+    aom_free(cr);
     return NULL;
   }
   assert(MAXQ <= 255);
@@ -80,9 +80,9 @@
 }
 
 void vp10_cyclic_refresh_free(CYCLIC_REFRESH *cr) {
-  vpx_free(cr->map);
-  vpx_free(cr->last_coded_q_map);
-  vpx_free(cr);
+  aom_free(cr->map);
+  aom_free(cr->last_coded_q_map);
+  aom_free(cr);
 }
 
 // Check if we should turn off cyclic refresh based on bitrate condition.
@@ -500,7 +500,7 @@
     int qindex_delta = 0;
     int qindex2;
     const double q = vp10_convert_qindex_to_q(cm->base_qindex, cm->bit_depth);
-    vpx_clear_system_state();
+    aom_clear_system_state();
     // Set rate threshold to some multiple (set to 2 for now) of the target
     // rate (target is given by sb64_target_rate and scaled by 256).
     cr->thresh_rate_sb = ((int64_t)(rc->sb64_target_rate) << 8) << 2;
diff --git a/av1/encoder/aq_variance.c b/av1/encoder/aq_variance.c
index 3976476..37e53f6 100644
--- a/av1/encoder/aq_variance.c
+++ b/av1/encoder/aq_variance.c
@@ -56,7 +56,7 @@
 
     seg->abs_delta = SEGMENT_DELTADATA;
 
-    vpx_clear_system_state();
+    aom_clear_system_state();
 
     for (i = 0; i < MAX_SEGMENTS; ++i) {
       int qindex_delta =
@@ -188,7 +188,7 @@
 
 double vp10_log_block_var(VP10_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) {
   unsigned int var = block_variance(cpi, x, bs);
-  vpx_clear_system_state();
+  aom_clear_system_state();
   return log(var + 1.0);
 }
 
@@ -196,7 +196,7 @@
 int vp10_block_energy(VP10_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) {
   double energy;
   double energy_midpoint;
-  vpx_clear_system_state();
+  aom_clear_system_state();
   energy_midpoint =
       (cpi->oxcf.pass == 2) ? cpi->twopass.mb_av_energy : DEFAULT_E_MIDPOINT;
   energy = vp10_log_block_var(cpi, x, bs) - energy_midpoint;
diff --git a/av1/encoder/arm/neon/dct_neon.c b/av1/encoder/arm/neon/dct_neon.c
index 9424c5b..947b41a 100644
--- a/av1/encoder/arm/neon/dct_neon.c
+++ b/av1/encoder/arm/neon/dct_neon.c
@@ -12,8 +12,8 @@
 #include <arm_neon.h>
 
 #include "./av1_rtcd.h"
-#include "./vpx_config.h"
-#include "./vpx_dsp_rtcd.h"
+#include "./aom_config.h"
+#include "./aom_dsp_rtcd.h"
 
 #include "av1/common/blockd.h"
 #include "aom_dsp/txfm_common.h"
@@ -27,7 +27,7 @@
   int16_t temp_buffer[64];
   (void)coeff_ptr;
 
-  vpx_fdct8x8_neon(input, temp_buffer, stride);
+  aom_fdct8x8_neon(input, temp_buffer, stride);
   vp10_quantize_fp_neon(temp_buffer, n_coeffs, skip_block, zbin_ptr, round_ptr,
                         quant_ptr, quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr,
                         dequant_ptr, eob_ptr, scan_ptr, iscan_ptr);
diff --git a/av1/encoder/arm/neon/quantize_neon.c b/av1/encoder/arm/neon/quantize_neon.c
index 09c5132..ded962d 100644
--- a/av1/encoder/arm/neon/quantize_neon.c
+++ b/av1/encoder/arm/neon/quantize_neon.c
@@ -13,7 +13,7 @@
 
 #include <math.h>
 
-#include "aom_mem/vpx_mem.h"
+#include "aom_mem/aom_mem.h"
 
 #include "av1/common/quant_common.h"
 #include "av1/common/seg_common.h"
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 57626d8..3f1ccc6 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -13,10 +13,10 @@
 #include <stdio.h>
 #include <limits.h>
 
-#include "aom/vpx_encoder.h"
+#include "aom/aom_encoder.h"
 #include "aom_dsp/bitwriter_buffer.h"
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem_ops.h"
 #include "aom_ports/system_state.h"
 
@@ -61,27 +61,27 @@
   vp10_tokens_from_tree(ext_tx_encodings, vp10_ext_tx_tree);
 }
 
-static void write_intra_mode(vpx_writer *w, PREDICTION_MODE mode,
-                             const vpx_prob *probs) {
+static void write_intra_mode(aom_writer *w, PREDICTION_MODE mode,
+                             const aom_prob *probs) {
   vp10_write_token(w, vp10_intra_mode_tree, probs, &intra_mode_encodings[mode]);
 }
 
-static void write_inter_mode(vpx_writer *w, PREDICTION_MODE mode,
-                             const vpx_prob *probs) {
+static void write_inter_mode(aom_writer *w, PREDICTION_MODE mode,
+                             const aom_prob *probs) {
   assert(is_inter_mode(mode));
   vp10_write_token(w, vp10_inter_mode_tree, probs,
                    &inter_mode_encodings[INTER_OFFSET(mode)]);
 }
 
-static void encode_unsigned_max(struct vpx_write_bit_buffer *wb, int data,
+static void encode_unsigned_max(struct aom_write_bit_buffer *wb, int data,
                                 int max) {
-  vpx_wb_write_literal(wb, data, get_unsigned_bits(max));
+  aom_wb_write_literal(wb, data, get_unsigned_bits(max));
 }
 
-static void prob_diff_update(const vpx_tree_index *tree,
-                             vpx_prob probs[/*n - 1*/],
+static void prob_diff_update(const aom_tree_index *tree,
+                             aom_prob probs[/*n - 1*/],
                              const unsigned int counts[/*n - 1*/], int n,
-                             vpx_writer *w) {
+                             aom_writer *w) {
   int i;
   unsigned int branch_ct[32][2];
 
@@ -93,8 +93,8 @@
     vp10_cond_prob_diff_update(w, &probs[i], branch_ct[i]);
 }
 
-static int prob_diff_update_savings(const vpx_tree_index *tree,
-                                    vpx_prob probs[/*n - 1*/],
+static int prob_diff_update_savings(const aom_tree_index *tree,
+                                    aom_prob probs[/*n - 1*/],
                                     const unsigned int counts[/*n - 1*/],
                                     int n) {
   int i;
@@ -111,32 +111,32 @@
 }
 
 static void write_selected_tx_size(const VP10_COMMON *cm, const MACROBLOCKD *xd,
-                                   vpx_writer *w) {
+                                   aom_writer *w) {
   TX_SIZE tx_size = xd->mi[0]->mbmi.tx_size;
   BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
   const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
-  const vpx_prob *const tx_probs =
+  const aom_prob *const tx_probs =
       get_tx_probs2(max_tx_size, xd, &cm->fc->tx_probs);
-  vpx_write(w, tx_size != TX_4X4, tx_probs[0]);
+  aom_write(w, tx_size != TX_4X4, tx_probs[0]);
   if (tx_size != TX_4X4 && max_tx_size >= TX_16X16) {
-    vpx_write(w, tx_size != TX_8X8, tx_probs[1]);
+    aom_write(w, tx_size != TX_8X8, tx_probs[1]);
     if (tx_size != TX_8X8 && max_tx_size >= TX_32X32)
-      vpx_write(w, tx_size != TX_16X16, tx_probs[2]);
+      aom_write(w, tx_size != TX_16X16, tx_probs[2]);
   }
 }
 
 static int write_skip(const VP10_COMMON *cm, const MACROBLOCKD *xd,
-                      int segment_id, const MODE_INFO *mi, vpx_writer *w) {
+                      int segment_id, const MODE_INFO *mi, aom_writer *w) {
   if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
     return 1;
   } else {
     const int skip = mi->mbmi.skip;
-    vpx_write(w, skip, vp10_get_skip_prob(cm, xd));
+    aom_write(w, skip, vp10_get_skip_prob(cm, xd));
     return skip;
   }
 }
 
-static void update_skip_probs(VP10_COMMON *cm, vpx_writer *w,
+static void update_skip_probs(VP10_COMMON *cm, aom_writer *w,
                               FRAME_COUNTS *counts) {
   int k;
 
@@ -144,7 +144,7 @@
     vp10_cond_prob_diff_update(w, &cm->fc->skip_probs[k], counts->skip[k]);
 }
 
-static void update_switchable_interp_probs(VP10_COMMON *cm, vpx_writer *w,
+static void update_switchable_interp_probs(VP10_COMMON *cm, aom_writer *w,
                                            FRAME_COUNTS *counts) {
   int j;
   for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j)
@@ -153,7 +153,7 @@
                      counts->switchable_interp[j], SWITCHABLE_FILTERS, w);
 }
 
-static void update_ext_tx_probs(VP10_COMMON *cm, vpx_writer *w) {
+static void update_ext_tx_probs(VP10_COMMON *cm, aom_writer *w) {
   const int savings_thresh = vp10_cost_one(GROUP_DIFF_UPDATE_PROB) -
                              vp10_cost_zero(GROUP_DIFF_UPDATE_PROB);
   int i, j;
@@ -167,7 +167,7 @@
           cm->counts.intra_ext_tx[i][j], TX_TYPES);
   }
   do_update = savings > savings_thresh;
-  vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
+  aom_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
   if (do_update) {
     for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
       for (j = 0; j < TX_TYPES; ++j)
@@ -182,7 +182,7 @@
                                  cm->counts.inter_ext_tx[i], TX_TYPES);
   }
   do_update = savings > savings_thresh;
-  vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
+  aom_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
   if (do_update) {
     for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
       prob_diff_update(vp10_ext_tx_tree, cm->fc->inter_ext_tx_prob[i],
@@ -191,9 +191,9 @@
   }
 }
 
-static void pack_mb_tokens(vpx_writer *w, TOKENEXTRA **tp,
+static void pack_mb_tokens(aom_writer *w, TOKENEXTRA **tp,
                            const TOKENEXTRA *const stop,
-                           vpx_bit_depth_t bit_depth, const TX_SIZE tx) {
+                           aom_bit_depth_t bit_depth, const TX_SIZE tx) {
   TOKENEXTRA *p = *tp;
 #if !CONFIG_MISC_FIXES
   (void)tx;
@@ -263,13 +263,13 @@
             skip_bits--;
             assert(!bb);
           } else {
-            vpx_write(w, bb, pb[i >> 1]);
+            aom_write(w, bb, pb[i >> 1]);
           }
           i = b->tree[i + bb];
         } while (n);
       }
 
-      vpx_write_bit(w, e & 1);
+      aom_write_bit(w, e & 1);
     }
     ++p;
   }
@@ -277,7 +277,7 @@
   *tp = p;
 }
 
-static void write_segment_id(vpx_writer *w, const struct segmentation *seg,
+static void write_segment_id(aom_writer *w, const struct segmentation *seg,
                              const struct segmentation_probs *segp,
                              int segment_id) {
   if (seg->enabled && seg->update_map)
@@ -286,7 +286,7 @@
 
 // This function encodes the reference frame
 static void write_ref_frames(const VP10_COMMON *cm, const MACROBLOCKD *xd,
-                             vpx_writer *w) {
+                             aom_writer *w) {
   const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
   const int is_compound = has_second_ref(mbmi);
   const int segment_id = mbmi->segment_id;
@@ -301,27 +301,27 @@
     // does the feature use compound prediction or not
     // (if not specified at the frame/segment level)
     if (cm->reference_mode == REFERENCE_MODE_SELECT) {
-      vpx_write(w, is_compound, vp10_get_reference_mode_prob(cm, xd));
+      aom_write(w, is_compound, vp10_get_reference_mode_prob(cm, xd));
     } else {
       assert((!is_compound) == (cm->reference_mode == SINGLE_REFERENCE));
     }
 
     if (is_compound) {
-      vpx_write(w, mbmi->ref_frame[0] == GOLDEN_FRAME,
+      aom_write(w, mbmi->ref_frame[0] == GOLDEN_FRAME,
                 vp10_get_pred_prob_comp_ref_p(cm, xd));
     } else {
       const int bit0 = mbmi->ref_frame[0] != LAST_FRAME;
-      vpx_write(w, bit0, vp10_get_pred_prob_single_ref_p1(cm, xd));
+      aom_write(w, bit0, vp10_get_pred_prob_single_ref_p1(cm, xd));
       if (bit0) {
         const int bit1 = mbmi->ref_frame[0] != GOLDEN_FRAME;
-        vpx_write(w, bit1, vp10_get_pred_prob_single_ref_p2(cm, xd));
+        aom_write(w, bit1, vp10_get_pred_prob_single_ref_p2(cm, xd));
       }
     }
   }
 }
 
 static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
-                                vpx_writer *w) {
+                                aom_writer *w) {
   VP10_COMMON *const cm = &cpi->common;
   const nmv_context *nmvc = &cm->fc->nmvc;
   const MACROBLOCK *const x = &cpi->td.mb;
@@ -345,8 +345,8 @@
   if (seg->update_map) {
     if (seg->temporal_update) {
       const int pred_flag = mbmi->seg_id_predicted;
-      vpx_prob pred_prob = vp10_get_pred_prob_seg_id(segp, xd);
-      vpx_write(w, pred_flag, pred_prob);
+      aom_prob pred_prob = vp10_get_pred_prob_seg_id(segp, xd);
+      aom_write(w, pred_flag, pred_prob);
       if (!pred_flag) write_segment_id(w, seg, segp, segment_id);
     } else {
       write_segment_id(w, seg, segp, segment_id);
@@ -356,7 +356,7 @@
   skip = write_skip(cm, xd, segment_id, mi, w);
 
   if (!segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
-    vpx_write(w, is_inter, vp10_get_intra_inter_prob(cm, xd));
+    aom_write(w, is_inter, vp10_get_intra_inter_prob(cm, xd));
 
   if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
       !(is_inter && skip) && !xd->lossless[segment_id]) {
@@ -380,7 +380,7 @@
     write_intra_mode(w, mbmi->uv_mode, cm->fc->uv_mode_prob[mode]);
   } else {
     const int mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]];
-    const vpx_prob *const inter_probs = cm->fc->inter_mode_probs[mode_ctx];
+    const aom_prob *const inter_probs = cm->fc->inter_mode_probs[mode_ctx];
     write_ref_frames(cm, xd, w);
 
     // If segment skip is not enabled code the mode.
@@ -445,7 +445,7 @@
 }
 
 static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
-                              MODE_INFO **mi_8x8, vpx_writer *w) {
+                              MODE_INFO **mi_8x8, aom_writer *w) {
   const struct segmentation *const seg = &cm->seg;
 #if CONFIG_MISC_FIXES
   const struct segmentation_probs *const segp = &cm->fc->seg;
@@ -496,7 +496,7 @@
 }
 
 static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
-                          vpx_writer *w, TOKENEXTRA **tok,
+                          aom_writer *w, TOKENEXTRA **tok,
                           const TOKENEXTRA *const tok_end, int mi_row,
                           int mi_col) {
   const VP10_COMMON *const cm = &cpi->common;
@@ -533,9 +533,9 @@
 static void write_partition(const VP10_COMMON *const cm,
                             const MACROBLOCKD *const xd, int hbs, int mi_row,
                             int mi_col, PARTITION_TYPE p, BLOCK_SIZE bsize,
-                            vpx_writer *w) {
+                            aom_writer *w) {
   const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
-  const vpx_prob *const probs = cm->fc->partition_prob[ctx];
+  const aom_prob *const probs = cm->fc->partition_prob[ctx];
   const int has_rows = (mi_row + hbs) < cm->mi_rows;
   const int has_cols = (mi_col + hbs) < cm->mi_cols;
 
@@ -543,17 +543,17 @@
     vp10_write_token(w, vp10_partition_tree, probs, &partition_encodings[p]);
   } else if (!has_rows && has_cols) {
     assert(p == PARTITION_SPLIT || p == PARTITION_HORZ);
-    vpx_write(w, p == PARTITION_SPLIT, probs[1]);
+    aom_write(w, p == PARTITION_SPLIT, probs[1]);
   } else if (has_rows && !has_cols) {
     assert(p == PARTITION_SPLIT || p == PARTITION_VERT);
-    vpx_write(w, p == PARTITION_SPLIT, probs[2]);
+    aom_write(w, p == PARTITION_SPLIT, probs[2]);
   } else {
     assert(p == PARTITION_SPLIT);
   }
 }
 
 static void write_modes_sb(VP10_COMP *cpi, const TileInfo *const tile,
-                           vpx_writer *w, TOKENEXTRA **tok,
+                           aom_writer *w, TOKENEXTRA **tok,
                            const TOKENEXTRA *const tok_end, int mi_row,
                            int mi_col, BLOCK_SIZE bsize) {
   const VP10_COMMON *const cm = &cpi->common;
@@ -610,7 +610,7 @@
 #if DERING_REFINEMENT
   if (bsize == BLOCK_64X64 && cm->dering_level != 0 &&
       !sb_all_skip(cm, mi_row, mi_col)) {
-    vpx_write_literal(
+    aom_write_literal(
         w, cm->mi_grid_visible[mi_row*cm->mi_stride + mi_col]->mbmi.dering_gain,
         DERING_REFINEMENT_BITS);
   }
@@ -618,7 +618,7 @@
 }
 
 static void write_modes(VP10_COMP *cpi, const TileInfo *const tile,
-                        vpx_writer *w, TOKENEXTRA **tok,
+                        aom_writer *w, TOKENEXTRA **tok,
                         const TOKENEXTRA *const tok_end) {
   MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
   int mi_row, mi_col;
@@ -659,12 +659,12 @@
   }
 }
 
-static void update_coef_probs_common(vpx_writer *const bc, VP10_COMP *cpi,
+static void update_coef_probs_common(aom_writer *const bc, VP10_COMP *cpi,
                                      TX_SIZE tx_size,
                                      vp10_coeff_stats *frame_branch_ct,
                                      vp10_coeff_probs_model *new_coef_probs) {
   vp10_coeff_probs_model *old_coef_probs = cpi->common.fc->coef_probs[tx_size];
-  const vpx_prob upd = DIFF_UPDATE_PROB;
+  const aom_prob upd = DIFF_UPDATE_PROB;
   const int entropy_nodes_update = UNCONSTRAINED_NODES;
   int i, j, k, l, t;
   int stepsize = cpi->sf.coeff_prob_appx_step;
@@ -679,8 +679,8 @@
           for (k = 0; k < COEF_BANDS; ++k) {
             for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
               for (t = 0; t < entropy_nodes_update; ++t) {
-                vpx_prob newp = new_coef_probs[i][j][k][l][t];
-                const vpx_prob oldp = old_coef_probs[i][j][k][l][t];
+                aom_prob newp = new_coef_probs[i][j][k][l][t];
+                const aom_prob oldp = old_coef_probs[i][j][k][l][t];
                 int s;
                 int u = 0;
                 if (t == PIVOT_NODE)
@@ -705,19 +705,19 @@
       // printf("Update %d %d, savings %d\n", update[0], update[1], savings);
       /* Is coef updated at all */
       if (update[1] == 0 || savings < 0) {
-        vpx_write_bit(bc, 0);
+        aom_write_bit(bc, 0);
         return;
       }
-      vpx_write_bit(bc, 1);
+      aom_write_bit(bc, 1);
       for (i = 0; i < PLANE_TYPES; ++i) {
         for (j = 0; j < REF_TYPES; ++j) {
           for (k = 0; k < COEF_BANDS; ++k) {
             for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
               // calc probs and branch cts for this frame only
               for (t = 0; t < entropy_nodes_update; ++t) {
-                vpx_prob newp = new_coef_probs[i][j][k][l][t];
-                vpx_prob *oldp = old_coef_probs[i][j][k][l] + t;
-                const vpx_prob upd = DIFF_UPDATE_PROB;
+                aom_prob newp = new_coef_probs[i][j][k][l][t];
+                aom_prob *oldp = old_coef_probs[i][j][k][l] + t;
+                const aom_prob upd = DIFF_UPDATE_PROB;
                 int s;
                 int u = 0;
                 if (t == PIVOT_NODE)
@@ -728,7 +728,7 @@
                   s = vp10_prob_diff_update_savings_search(
                       frame_branch_ct[i][j][k][l][t], *oldp, &newp, upd);
                 if (s > 0 && newp != *oldp) u = 1;
-                vpx_write(bc, u, upd);
+                aom_write(bc, u, upd);
                 if (u) {
                   /* send/use new probability */
                   vp10_write_prob_diff_update(bc, newp, *oldp);
@@ -751,8 +751,8 @@
             for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
               // calc probs and branch cts for this frame only
               for (t = 0; t < entropy_nodes_update; ++t) {
-                vpx_prob newp = new_coef_probs[i][j][k][l][t];
-                vpx_prob *oldp = old_coef_probs[i][j][k][l] + t;
+                aom_prob newp = new_coef_probs[i][j][k][l][t];
+                aom_prob *oldp = old_coef_probs[i][j][k][l] + t;
                 int s;
                 int u = 0;
 
@@ -774,11 +774,11 @@
                 if (u == 1 && updates == 1) {
                   int v;
                   // first update
-                  vpx_write_bit(bc, 1);
+                  aom_write_bit(bc, 1);
                   for (v = 0; v < noupdates_before_first; ++v)
-                    vpx_write(bc, 0, upd);
+                    aom_write(bc, 0, upd);
                 }
-                vpx_write(bc, u, upd);
+                aom_write(bc, u, upd);
                 if (u) {
                   /* send/use new probability */
                   vp10_write_prob_diff_update(bc, newp, *oldp);
@@ -790,7 +790,7 @@
         }
       }
       if (updates == 0) {
-        vpx_write_bit(bc, 0);  // no updates
+        aom_write_bit(bc, 0);  // no updates
       }
       return;
     }
@@ -798,7 +798,7 @@
   }
 }
 
-static void update_coef_probs(VP10_COMP *cpi, vpx_writer *w) {
+static void update_coef_probs(VP10_COMP *cpi, aom_writer *w) {
   const TX_MODE tx_mode = cpi->common.tx_mode;
   const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
   TX_SIZE tx_size;
@@ -807,7 +807,7 @@
     vp10_coeff_probs_model frame_coef_probs[PLANE_TYPES];
     if (cpi->td.counts->tx.tx_totals[tx_size] <= 20 ||
         (tx_size >= TX_16X16 && cpi->sf.tx_size_search_method == USE_TX_8X8)) {
-      vpx_write_bit(w, 0);
+      aom_write_bit(w, 0);
     } else {
       build_tree_distribution(cpi, tx_size, frame_branch_ct, frame_coef_probs);
       update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
@@ -817,37 +817,37 @@
 }
 
 static void encode_loopfilter(struct loopfilter *lf,
-                              struct vpx_write_bit_buffer *wb) {
+                              struct aom_write_bit_buffer *wb) {
   int i;
 
   // Encode the loop filter level and type
-  vpx_wb_write_literal(wb, lf->filter_level, 6);
-  vpx_wb_write_literal(wb, lf->sharpness_level, 3);
+  aom_wb_write_literal(wb, lf->filter_level, 6);
+  aom_wb_write_literal(wb, lf->sharpness_level, 3);
 
   // Write out loop filter deltas applied at the MB level based on mode or
   // ref frame (if they are enabled).
-  vpx_wb_write_bit(wb, lf->mode_ref_delta_enabled);
+  aom_wb_write_bit(wb, lf->mode_ref_delta_enabled);
 
   if (lf->mode_ref_delta_enabled) {
-    vpx_wb_write_bit(wb, lf->mode_ref_delta_update);
+    aom_wb_write_bit(wb, lf->mode_ref_delta_update);
     if (lf->mode_ref_delta_update) {
       for (i = 0; i < MAX_REF_FRAMES; i++) {
         const int delta = lf->ref_deltas[i];
         const int changed = delta != lf->last_ref_deltas[i];
-        vpx_wb_write_bit(wb, changed);
+        aom_wb_write_bit(wb, changed);
         if (changed) {
           lf->last_ref_deltas[i] = delta;
-          vpx_wb_write_inv_signed_literal(wb, delta, 6);
+          aom_wb_write_inv_signed_literal(wb, delta, 6);
         }
       }
 
       for (i = 0; i < MAX_MODE_LF_DELTAS; i++) {
         const int delta = lf->mode_deltas[i];
         const int changed = delta != lf->last_mode_deltas[i];
-        vpx_wb_write_bit(wb, changed);
+        aom_wb_write_bit(wb, changed);
         if (changed) {
           lf->last_mode_deltas[i] = delta;
-          vpx_wb_write_inv_signed_literal(wb, delta, 6);
+          aom_wb_write_inv_signed_literal(wb, delta, 6);
         }
       }
     }
@@ -856,43 +856,43 @@
 
 #if CONFIG_CLPF
 static void encode_clpf(const VP10_COMMON *cm,
-                        struct vpx_write_bit_buffer *wb) {
-  vpx_wb_write_literal(wb, cm->clpf, 1);
+                        struct aom_write_bit_buffer *wb) {
+  aom_wb_write_literal(wb, cm->clpf, 1);
 }
 #endif
 
 #if CONFIG_DERING
-static void encode_dering(int level, struct vpx_write_bit_buffer *wb) {
-  vpx_wb_write_literal(wb, level, DERING_LEVEL_BITS);
+static void encode_dering(int level, struct aom_write_bit_buffer *wb) {
+  aom_wb_write_literal(wb, level, DERING_LEVEL_BITS);
 }
 #endif  // CONFIG_DERING
 
-static void write_delta_q(struct vpx_write_bit_buffer *wb, int delta_q) {
+static void write_delta_q(struct aom_write_bit_buffer *wb, int delta_q) {
   if (delta_q != 0) {
-    vpx_wb_write_bit(wb, 1);
-    vpx_wb_write_inv_signed_literal(wb, delta_q, CONFIG_MISC_FIXES ? 6 : 4);
+    aom_wb_write_bit(wb, 1);
+    aom_wb_write_inv_signed_literal(wb, delta_q, CONFIG_MISC_FIXES ? 6 : 4);
   } else {
-    vpx_wb_write_bit(wb, 0);
+    aom_wb_write_bit(wb, 0);
   }
 }
 
 static void encode_quantization(const VP10_COMMON *const cm,
-                                struct vpx_write_bit_buffer *wb) {
-  vpx_wb_write_literal(wb, cm->base_qindex, QINDEX_BITS);
+                                struct aom_write_bit_buffer *wb) {
+  aom_wb_write_literal(wb, cm->base_qindex, QINDEX_BITS);
   write_delta_q(wb, cm->y_dc_delta_q);
   write_delta_q(wb, cm->uv_dc_delta_q);
   write_delta_q(wb, cm->uv_ac_delta_q);
 #if CONFIG_AOM_QM
-  vpx_wb_write_bit(wb, cm->using_qmatrix);
+  aom_wb_write_bit(wb, cm->using_qmatrix);
   if (cm->using_qmatrix) {
-    vpx_wb_write_literal(wb, cm->min_qmlevel, QM_LEVEL_BITS);
-    vpx_wb_write_literal(wb, cm->max_qmlevel, QM_LEVEL_BITS);
+    aom_wb_write_literal(wb, cm->min_qmlevel, QM_LEVEL_BITS);
+    aom_wb_write_literal(wb, cm->max_qmlevel, QM_LEVEL_BITS);
   }
 #endif
 }
 
 static void encode_segmentation(VP10_COMMON *cm, MACROBLOCKD *xd,
-                                struct vpx_write_bit_buffer *wb) {
+                                struct aom_write_bit_buffer *wb) {
   int i, j;
 
   const struct segmentation *seg = &cm->seg;
@@ -900,12 +900,12 @@
   const struct segmentation_probs *segp = &cm->segp;
 #endif
 
-  vpx_wb_write_bit(wb, seg->enabled);
+  aom_wb_write_bit(wb, seg->enabled);
   if (!seg->enabled) return;
 
   // Segmentation map
   if (!frame_is_intra_only(cm) && !cm->error_resilient_mode) {
-    vpx_wb_write_bit(wb, seg->update_map);
+    aom_wb_write_bit(wb, seg->update_map);
   } else {
     assert(seg->update_map == 1);
   }
@@ -917,14 +917,14 @@
     for (i = 0; i < SEG_TREE_PROBS; i++) {
       const int prob = segp->tree_probs[i];
       const int update = prob != MAX_PROB;
-      vpx_wb_write_bit(wb, update);
-      if (update) vpx_wb_write_literal(wb, prob, 8);
+      aom_wb_write_bit(wb, update);
+      if (update) aom_wb_write_literal(wb, prob, 8);
     }
 #endif
 
     // Write out the chosen coding method.
     if (!frame_is_intra_only(cm) && !cm->error_resilient_mode) {
-      vpx_wb_write_bit(wb, seg->temporal_update);
+      aom_wb_write_bit(wb, seg->temporal_update);
     } else {
       assert(seg->temporal_update == 0);
     }
@@ -934,29 +934,29 @@
       for (i = 0; i < PREDICTION_PROBS; i++) {
         const int prob = segp->pred_probs[i];
         const int update = prob != MAX_PROB;
-        vpx_wb_write_bit(wb, update);
-        if (update) vpx_wb_write_literal(wb, prob, 8);
+        aom_wb_write_bit(wb, update);
+        if (update) aom_wb_write_literal(wb, prob, 8);
       }
     }
 #endif
   }
 
   // Segmentation data
-  vpx_wb_write_bit(wb, seg->update_data);
+  aom_wb_write_bit(wb, seg->update_data);
   if (seg->update_data) {
-    vpx_wb_write_bit(wb, seg->abs_delta);
+    aom_wb_write_bit(wb, seg->abs_delta);
 
     for (i = 0; i < MAX_SEGMENTS; i++) {
       for (j = 0; j < SEG_LVL_MAX; j++) {
         const int active = segfeature_active(seg, i, j);
-        vpx_wb_write_bit(wb, active);
+        aom_wb_write_bit(wb, active);
         if (active) {
           const int data = get_segdata(seg, i, j);
           const int data_max = vp10_seg_feature_data_max(j);
 
           if (vp10_is_segfeature_signed(j)) {
             encode_unsigned_max(wb, abs(data), data_max);
-            vpx_wb_write_bit(wb, data < 0);
+            aom_wb_write_bit(wb, data < 0);
           } else {
             encode_unsigned_max(wb, data, data_max);
           }
@@ -967,7 +967,7 @@
 }
 
 #if CONFIG_MISC_FIXES
-static void update_seg_probs(VP10_COMP *cpi, vpx_writer *w) {
+static void update_seg_probs(VP10_COMP *cpi, aom_writer *w) {
   VP10_COMMON *cm = &cpi->common;
 
   if (!cpi->common.seg.enabled) return;
@@ -987,18 +987,18 @@
   }
 }
 
-static void write_txfm_mode(TX_MODE mode, struct vpx_write_bit_buffer *wb) {
-  vpx_wb_write_bit(wb, mode == TX_MODE_SELECT);
-  if (mode != TX_MODE_SELECT) vpx_wb_write_literal(wb, mode, 2);
+static void write_txfm_mode(TX_MODE mode, struct aom_write_bit_buffer *wb) {
+  aom_wb_write_bit(wb, mode == TX_MODE_SELECT);
+  if (mode != TX_MODE_SELECT) aom_wb_write_literal(wb, mode, 2);
 }
 #else
-static void write_txfm_mode(TX_MODE mode, struct vpx_writer *wb) {
-  vpx_write_literal(wb, VPXMIN(mode, ALLOW_32X32), 2);
-  if (mode >= ALLOW_32X32) vpx_write_bit(wb, mode == TX_MODE_SELECT);
+static void write_txfm_mode(TX_MODE mode, struct aom_writer *wb) {
+  aom_write_literal(wb, VPXMIN(mode, ALLOW_32X32), 2);
+  if (mode >= ALLOW_32X32) aom_write_bit(wb, mode == TX_MODE_SELECT);
 }
 #endif
 
-static void update_txfm_probs(VP10_COMMON *cm, vpx_writer *w,
+static void update_txfm_probs(VP10_COMMON *cm, aom_writer *w,
                               FRAME_COUNTS *counts) {
   if (cm->tx_mode == TX_MODE_SELECT) {
     int i, j;
@@ -1029,9 +1029,9 @@
 }
 
 static void write_interp_filter(INTERP_FILTER filter,
-                                struct vpx_write_bit_buffer *wb) {
-  vpx_wb_write_bit(wb, filter == SWITCHABLE);
-  if (filter != SWITCHABLE) vpx_wb_write_literal(wb, filter, 2);
+                                struct aom_write_bit_buffer *wb) {
+  aom_wb_write_bit(wb, filter == SWITCHABLE);
+  if (filter != SWITCHABLE) aom_wb_write_literal(wb, filter, 2);
 }
 
 static void fix_interp_filter(VP10_COMMON *cm, FRAME_COUNTS *counts) {
@@ -1058,19 +1058,19 @@
 }
 
 static void write_tile_info(const VP10_COMMON *const cm,
-                            struct vpx_write_bit_buffer *wb) {
+                            struct aom_write_bit_buffer *wb) {
   int min_log2_tile_cols, max_log2_tile_cols, ones;
   vp10_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
 
   // columns
   ones = cm->log2_tile_cols - min_log2_tile_cols;
-  while (ones--) vpx_wb_write_bit(wb, 1);
+  while (ones--) aom_wb_write_bit(wb, 1);
 
-  if (cm->log2_tile_cols < max_log2_tile_cols) vpx_wb_write_bit(wb, 0);
+  if (cm->log2_tile_cols < max_log2_tile_cols) aom_wb_write_bit(wb, 0);
 
   // rows
-  vpx_wb_write_bit(wb, cm->log2_tile_rows != 0);
-  if (cm->log2_tile_rows != 0) vpx_wb_write_bit(wb, cm->log2_tile_rows != 1);
+  aom_wb_write_bit(wb, cm->log2_tile_rows != 0);
+  if (cm->log2_tile_rows != 0) aom_wb_write_bit(wb, cm->log2_tile_rows != 1);
 }
 
 static int get_refresh_mask(VP10_COMP *cpi) {
@@ -1102,7 +1102,7 @@
 static size_t encode_tiles(VP10_COMP *cpi, uint8_t *data_ptr,
                            unsigned int *max_tile_sz) {
   VP10_COMMON *const cm = &cpi->common;
-  vpx_writer residual_bc;
+  aom_writer residual_bc;
   int tile_row, tile_col;
   TOKENEXTRA *tok_end;
   size_t total_size = 0;
@@ -1122,14 +1122,14 @@
                 cpi->tok_count[tile_row][tile_col];
 
       if (tile_col < tile_cols - 1 || tile_row < tile_rows - 1)
-        vpx_start_encode(&residual_bc, data_ptr + total_size + 4);
+        aom_start_encode(&residual_bc, data_ptr + total_size + 4);
       else
-        vpx_start_encode(&residual_bc, data_ptr + total_size);
+        aom_start_encode(&residual_bc, data_ptr + total_size);
 
       write_modes(cpi, &cpi->tile_data[tile_idx].tile_info, &residual_bc, &tok,
                   tok_end);
       assert(tok == tok_end);
-      vpx_stop_encode(&residual_bc);
+      aom_stop_encode(&residual_bc);
       if (tile_col < tile_cols - 1 || tile_row < tile_rows - 1) {
         unsigned int tile_sz;
 
@@ -1150,26 +1150,26 @@
 }
 
 static void write_render_size(const VP10_COMMON *cm,
-                              struct vpx_write_bit_buffer *wb) {
+                              struct aom_write_bit_buffer *wb) {
   const int scaling_active =
       cm->width != cm->render_width || cm->height != cm->render_height;
-  vpx_wb_write_bit(wb, scaling_active);
+  aom_wb_write_bit(wb, scaling_active);
   if (scaling_active) {
-    vpx_wb_write_literal(wb, cm->render_width - 1, 16);
-    vpx_wb_write_literal(wb, cm->render_height - 1, 16);
+    aom_wb_write_literal(wb, cm->render_width - 1, 16);
+    aom_wb_write_literal(wb, cm->render_height - 1, 16);
   }
 }
 
 static void write_frame_size(const VP10_COMMON *cm,
-                             struct vpx_write_bit_buffer *wb) {
-  vpx_wb_write_literal(wb, cm->width - 1, 16);
-  vpx_wb_write_literal(wb, cm->height - 1, 16);
+                             struct aom_write_bit_buffer *wb) {
+  aom_wb_write_literal(wb, cm->width - 1, 16);
+  aom_wb_write_literal(wb, cm->height - 1, 16);
 
   write_render_size(cm, wb);
 }
 
 static void write_frame_size_with_refs(VP10_COMP *cpi,
-                                       struct vpx_write_bit_buffer *wb) {
+                                       struct aom_write_bit_buffer *wb) {
   VP10_COMMON *const cm = &cpi->common;
   int found = 0;
 
@@ -1185,15 +1185,15 @@
                cm->render_height == cfg->render_height;
 #endif
     }
-    vpx_wb_write_bit(wb, found);
+    aom_wb_write_bit(wb, found);
     if (found) {
       break;
     }
   }
 
   if (!found) {
-    vpx_wb_write_literal(wb, cm->width - 1, 16);
-    vpx_wb_write_literal(wb, cm->height - 1, 16);
+    aom_wb_write_literal(wb, cm->width - 1, 16);
+    aom_wb_write_literal(wb, cm->height - 1, 16);
 
 #if CONFIG_MISC_FIXES
     write_render_size(cm, wb);
@@ -1205,84 +1205,84 @@
 #endif
 }
 
-static void write_sync_code(struct vpx_write_bit_buffer *wb) {
-  vpx_wb_write_literal(wb, VP10_SYNC_CODE_0, 8);
-  vpx_wb_write_literal(wb, VP10_SYNC_CODE_1, 8);
-  vpx_wb_write_literal(wb, VP10_SYNC_CODE_2, 8);
+static void write_sync_code(struct aom_write_bit_buffer *wb) {
+  aom_wb_write_literal(wb, VP10_SYNC_CODE_0, 8);
+  aom_wb_write_literal(wb, VP10_SYNC_CODE_1, 8);
+  aom_wb_write_literal(wb, VP10_SYNC_CODE_2, 8);
 }
 
 static void write_profile(BITSTREAM_PROFILE profile,
-                          struct vpx_write_bit_buffer *wb) {
+                          struct aom_write_bit_buffer *wb) {
   switch (profile) {
-    case PROFILE_0: vpx_wb_write_literal(wb, 0, 2); break;
-    case PROFILE_1: vpx_wb_write_literal(wb, 2, 2); break;
-    case PROFILE_2: vpx_wb_write_literal(wb, 1, 2); break;
-    case PROFILE_3: vpx_wb_write_literal(wb, 6, 3); break;
+    case PROFILE_0: aom_wb_write_literal(wb, 0, 2); break;
+    case PROFILE_1: aom_wb_write_literal(wb, 2, 2); break;
+    case PROFILE_2: aom_wb_write_literal(wb, 1, 2); break;
+    case PROFILE_3: aom_wb_write_literal(wb, 6, 3); break;
     default: assert(0);
   }
 }
 
 static void write_bitdepth_colorspace_sampling(
-    VP10_COMMON *const cm, struct vpx_write_bit_buffer *wb) {
+    VP10_COMMON *const cm, struct aom_write_bit_buffer *wb) {
   if (cm->profile >= PROFILE_2) {
     assert(cm->bit_depth > VPX_BITS_8);
-    vpx_wb_write_bit(wb, cm->bit_depth == VPX_BITS_10 ? 0 : 1);
+    aom_wb_write_bit(wb, cm->bit_depth == VPX_BITS_10 ? 0 : 1);
   }
-  vpx_wb_write_literal(wb, cm->color_space, 3);
+  aom_wb_write_literal(wb, cm->color_space, 3);
   if (cm->color_space != VPX_CS_SRGB) {
     // 0: [16, 235] (i.e. xvYCC), 1: [0, 255]
-    vpx_wb_write_bit(wb, cm->color_range);
+    aom_wb_write_bit(wb, cm->color_range);
     if (cm->profile == PROFILE_1 || cm->profile == PROFILE_3) {
       assert(cm->subsampling_x != 1 || cm->subsampling_y != 1);
-      vpx_wb_write_bit(wb, cm->subsampling_x);
-      vpx_wb_write_bit(wb, cm->subsampling_y);
-      vpx_wb_write_bit(wb, 0);  // unused
+      aom_wb_write_bit(wb, cm->subsampling_x);
+      aom_wb_write_bit(wb, cm->subsampling_y);
+      aom_wb_write_bit(wb, 0);  // unused
     } else {
       assert(cm->subsampling_x == 1 && cm->subsampling_y == 1);
     }
   } else {
     assert(cm->profile == PROFILE_1 || cm->profile == PROFILE_3);
-    vpx_wb_write_bit(wb, 0);  // unused
+    aom_wb_write_bit(wb, 0);  // unused
   }
 }
 
 static void write_uncompressed_header(VP10_COMP *cpi,
-                                      struct vpx_write_bit_buffer *wb) {
+                                      struct aom_write_bit_buffer *wb) {
   VP10_COMMON *const cm = &cpi->common;
   MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
 
-  vpx_wb_write_literal(wb, VPX_FRAME_MARKER, 2);
+  aom_wb_write_literal(wb, VPX_FRAME_MARKER, 2);
 
   write_profile(cm->profile, wb);
 
-  vpx_wb_write_bit(wb, 0);  // show_existing_frame
-  vpx_wb_write_bit(wb, cm->frame_type);
-  vpx_wb_write_bit(wb, cm->show_frame);
-  vpx_wb_write_bit(wb, cm->error_resilient_mode);
+  aom_wb_write_bit(wb, 0);  // show_existing_frame
+  aom_wb_write_bit(wb, cm->frame_type);
+  aom_wb_write_bit(wb, cm->show_frame);
+  aom_wb_write_bit(wb, cm->error_resilient_mode);
 
   if (cm->frame_type == KEY_FRAME) {
     write_sync_code(wb);
     write_bitdepth_colorspace_sampling(cm, wb);
     write_frame_size(cm, wb);
   } else {
-    if (!cm->show_frame) vpx_wb_write_bit(wb, cm->intra_only);
+    if (!cm->show_frame) aom_wb_write_bit(wb, cm->intra_only);
 
     if (!cm->error_resilient_mode) {
 #if CONFIG_MISC_FIXES
       if (cm->intra_only) {
-        vpx_wb_write_bit(wb,
+        aom_wb_write_bit(wb,
                          cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL);
       } else {
-        vpx_wb_write_bit(wb,
+        aom_wb_write_bit(wb,
                          cm->reset_frame_context != RESET_FRAME_CONTEXT_NONE);
         if (cm->reset_frame_context != RESET_FRAME_CONTEXT_NONE)
-          vpx_wb_write_bit(wb,
+          aom_wb_write_bit(wb,
                            cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL);
       }
 #else
       static const int reset_frame_context_conv_tbl[3] = { 0, 2, 3 };
 
-      vpx_wb_write_literal(
+      aom_wb_write_literal(
           wb, reset_frame_context_conv_tbl[cm->reset_frame_context], 2);
 #endif
     }
@@ -1299,21 +1299,21 @@
       }
 #endif
 
-      vpx_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
+      aom_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
       write_frame_size(cm, wb);
     } else {
       MV_REFERENCE_FRAME ref_frame;
-      vpx_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
+      aom_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
       for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
         assert(get_ref_frame_map_idx(cpi, ref_frame) != INVALID_IDX);
-        vpx_wb_write_literal(wb, get_ref_frame_map_idx(cpi, ref_frame),
+        aom_wb_write_literal(wb, get_ref_frame_map_idx(cpi, ref_frame),
                              REF_FRAMES_LOG2);
-        vpx_wb_write_bit(wb, cm->ref_frame_sign_bias[ref_frame]);
+        aom_wb_write_bit(wb, cm->ref_frame_sign_bias[ref_frame]);
       }
 
       write_frame_size_with_refs(cpi, wb);
 
-      vpx_wb_write_bit(wb, cm->allow_high_precision_mv);
+      aom_wb_write_bit(wb, cm->allow_high_precision_mv);
 
       fix_interp_filter(cm, cpi->td.counts);
       write_interp_filter(cm->interp_filter, wb);
@@ -1321,16 +1321,16 @@
   }
 
   if (!cm->error_resilient_mode) {
-    vpx_wb_write_bit(wb,
+    aom_wb_write_bit(wb,
                      cm->refresh_frame_context != REFRESH_FRAME_CONTEXT_OFF);
 #if CONFIG_MISC_FIXES
     if (cm->refresh_frame_context != REFRESH_FRAME_CONTEXT_OFF)
 #endif
-      vpx_wb_write_bit(
+      aom_wb_write_bit(
           wb, cm->refresh_frame_context != REFRESH_FRAME_CONTEXT_BACKWARD);
   }
 
-  vpx_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2);
+  aom_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2);
 
   encode_loopfilter(&cm->lf, wb);
 #if CONFIG_CLPF
@@ -1350,8 +1350,8 @@
     const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
     const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
 
-    vpx_wb_write_bit(wb, use_hybrid_pred);
-    if (!use_hybrid_pred) vpx_wb_write_bit(wb, use_compound_pred);
+    aom_wb_write_bit(wb, use_hybrid_pred);
+    if (!use_hybrid_pred) aom_wb_write_bit(wb, use_compound_pred);
   }
 #endif
 
@@ -1362,13 +1362,13 @@
   VP10_COMMON *const cm = &cpi->common;
   FRAME_CONTEXT *const fc = cm->fc;
   FRAME_COUNTS *counts = cpi->td.counts;
-  vpx_writer header_bc;
+  aom_writer header_bc;
   int i;
 #if CONFIG_MISC_FIXES
   int j;
 #endif
 
-  vpx_start_encode(&header_bc, data);
+  aom_start_encode(&header_bc, data);
 
 #if !CONFIG_MISC_FIXES
   if (cpi->td.mb.e_mbd.lossless[0]) {
@@ -1419,9 +1419,9 @@
 #if !CONFIG_MISC_FIXES
       const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
 
-      vpx_write_bit(&header_bc, use_compound_pred);
+      aom_write_bit(&header_bc, use_compound_pred);
       if (use_compound_pred) {
-        vpx_write_bit(&header_bc, use_hybrid_pred);
+        aom_write_bit(&header_bc, use_hybrid_pred);
         if (use_hybrid_pred)
           for (i = 0; i < COMP_INTER_CONTEXTS; i++)
             vp10_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i],
@@ -1464,7 +1464,7 @@
     update_ext_tx_probs(cm, &header_bc);
   }
 
-  vpx_stop_encode(&header_bc);
+  aom_stop_encode(&header_bc);
   assert(header_bc.pos <= 0xffff);
 
   return header_bc.pos;
@@ -1508,8 +1508,8 @@
 void vp10_pack_bitstream(VP10_COMP *const cpi, uint8_t *dest, size_t *size) {
   uint8_t *data = dest;
   size_t first_part_size, uncompressed_hdr_size, data_sz;
-  struct vpx_write_bit_buffer wb = { data, 0 };
-  struct vpx_write_bit_buffer saved_wb;
+  struct aom_write_bit_buffer wb = { data, 0 };
+  struct aom_write_bit_buffer saved_wb;
   unsigned int max_tile;
 #if CONFIG_MISC_FIXES
   VP10_COMMON *const cm = &cpi->common;
@@ -1523,12 +1523,12 @@
   write_uncompressed_header(cpi, &wb);
   saved_wb = wb;
   // don't know in advance first part. size
-  vpx_wb_write_literal(&wb, 0, 16 + have_tiles * 2);
+  aom_wb_write_literal(&wb, 0, 16 + have_tiles * 2);
 
-  uncompressed_hdr_size = vpx_wb_bytes_written(&wb);
+  uncompressed_hdr_size = aom_wb_bytes_written(&wb);
   data += uncompressed_hdr_size;
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   first_part_size = write_compressed_header(cpi, data);
   data += first_part_size;
@@ -1546,7 +1546,7 @@
       mask |= 0xff;
     }
     assert(n_log2_tiles > 0);
-    vpx_wb_write_literal(&saved_wb, mag, 2);
+    aom_wb_write_literal(&saved_wb, mag, 2);
     if (mag < 3)
       data_sz = remux_tiles(data, (int)data_sz, 1 << n_log2_tiles, mag);
   } else {
@@ -1556,7 +1556,7 @@
   data += data_sz;
 
   // TODO(jbb): Figure out what to do if first_part_size > 16 bits.
-  vpx_wb_write_literal(&saved_wb, (int)first_part_size, 16);
+  aom_wb_write_literal(&saved_wb, (int)first_part_size, 16);
 
   *size = data - dest;
 }
diff --git a/av1/encoder/blockiness.c b/av1/encoder/blockiness.c
index e36dc97..36d4410 100644
--- a/av1/encoder/blockiness.c
+++ b/av1/encoder/blockiness.c
@@ -10,13 +10,13 @@
  */
 
 #include "./av1_rtcd.h"
-#include "./vpx_config.h"
-#include "./vpx_dsp_rtcd.h"
+#include "./aom_config.h"
+#include "./aom_dsp_rtcd.h"
 #include "av1/common/common.h"
 #include "av1/common/filter.h"
-#include "aom/vpx_integer.h"
-#include "aom_dsp/vpx_convolve.h"
-#include "aom_dsp/vpx_filter.h"
+#include "aom/aom_integer.h"
+#include "aom_dsp/aom_convolve.h"
+#include "aom_dsp/aom_filter.h"
 #include "aom_ports/mem.h"
 #include "aom_ports/system_state.h"
 
@@ -125,7 +125,7 @@
                            int height) {
   double blockiness = 0;
   int i, j;
-  vpx_clear_system_state();
+  aom_clear_system_state();
   for (i = 0; i < height;
        i += 4, img1 += img1_pitch * 4, img2 += img2_pitch * 4) {
     for (j = 0; j < width; j += 4) {
diff --git a/av1/encoder/context_tree.c b/av1/encoder/context_tree.c
index 00a289e..d89022e 100644
--- a/av1/encoder/context_tree.c
+++ b/av1/encoder/context_tree.c
@@ -23,17 +23,17 @@
   int i, k;
   ctx->num_4x4_blk = num_blk;
 
-  CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, vpx_calloc(num_blk, sizeof(uint8_t)));
+  CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, aom_calloc(num_blk, sizeof(uint8_t)));
   for (i = 0; i < MAX_MB_PLANE; ++i) {
     for (k = 0; k < 3; ++k) {
       CHECK_MEM_ERROR(cm, ctx->coeff[i][k],
-                      vpx_memalign(32, num_pix * sizeof(*ctx->coeff[i][k])));
+                      aom_memalign(32, num_pix * sizeof(*ctx->coeff[i][k])));
       CHECK_MEM_ERROR(cm, ctx->qcoeff[i][k],
-                      vpx_memalign(32, num_pix * sizeof(*ctx->qcoeff[i][k])));
+                      aom_memalign(32, num_pix * sizeof(*ctx->qcoeff[i][k])));
       CHECK_MEM_ERROR(cm, ctx->dqcoeff[i][k],
-                      vpx_memalign(32, num_pix * sizeof(*ctx->dqcoeff[i][k])));
+                      aom_memalign(32, num_pix * sizeof(*ctx->dqcoeff[i][k])));
       CHECK_MEM_ERROR(cm, ctx->eobs[i][k],
-                      vpx_memalign(32, num_blk * sizeof(*ctx->eobs[i][k])));
+                      aom_memalign(32, num_blk * sizeof(*ctx->eobs[i][k])));
       ctx->coeff_pbuf[i][k] = ctx->coeff[i][k];
       ctx->qcoeff_pbuf[i][k] = ctx->qcoeff[i][k];
       ctx->dqcoeff_pbuf[i][k] = ctx->dqcoeff[i][k];
@@ -44,23 +44,23 @@
 
 static void free_mode_context(PICK_MODE_CONTEXT *ctx) {
   int i, k;
-  vpx_free(ctx->zcoeff_blk);
+  aom_free(ctx->zcoeff_blk);
   ctx->zcoeff_blk = 0;
   for (i = 0; i < MAX_MB_PLANE; ++i) {
     for (k = 0; k < 3; ++k) {
-      vpx_free(ctx->coeff[i][k]);
+      aom_free(ctx->coeff[i][k]);
       ctx->coeff[i][k] = 0;
-      vpx_free(ctx->qcoeff[i][k]);
+      aom_free(ctx->qcoeff[i][k]);
       ctx->qcoeff[i][k] = 0;
-      vpx_free(ctx->dqcoeff[i][k]);
+      aom_free(ctx->dqcoeff[i][k]);
       ctx->dqcoeff[i][k] = 0;
-      vpx_free(ctx->eobs[i][k]);
+      aom_free(ctx->eobs[i][k]);
       ctx->eobs[i][k] = 0;
     }
   }
 
   for (i = 0; i < 2; ++i) {
-    vpx_free(ctx->color_index_map[i]);
+    aom_free(ctx->color_index_map[i]);
     ctx->color_index_map[i] = 0;
   }
 }
@@ -102,12 +102,12 @@
   int square_index = 1;
   int nodes;
 
-  vpx_free(td->leaf_tree);
+  aom_free(td->leaf_tree);
   CHECK_MEM_ERROR(cm, td->leaf_tree,
-                  vpx_calloc(leaf_nodes, sizeof(*td->leaf_tree)));
-  vpx_free(td->pc_tree);
+                  aom_calloc(leaf_nodes, sizeof(*td->leaf_tree)));
+  aom_free(td->pc_tree);
   CHECK_MEM_ERROR(cm, td->pc_tree,
-                  vpx_calloc(tree_nodes, sizeof(*td->pc_tree)));
+                  aom_calloc(tree_nodes, sizeof(*td->pc_tree)));
 
   this_pc = &td->pc_tree[0];
   this_leaf = &td->leaf_tree[0];
@@ -151,8 +151,8 @@
   // Sets up all the leaf nodes in the tree.
   for (i = 0; i < tree_nodes; ++i) free_tree_contexts(&td->pc_tree[i]);
 
-  vpx_free(td->pc_tree);
+  aom_free(td->pc_tree);
   td->pc_tree = NULL;
-  vpx_free(td->leaf_tree);
+  aom_free(td->leaf_tree);
   td->leaf_tree = NULL;
 }
diff --git a/av1/encoder/cost.c b/av1/encoder/cost.c
index c1300ae..acf4a47 100644
--- a/av1/encoder/cost.c
+++ b/av1/encoder/cost.c
@@ -38,14 +38,14 @@
   26,   23,   20,   18,   15,   12,   9,    6,    3,    3
 };
 
-static void cost(int *costs, vpx_tree tree, const vpx_prob *probs, int i,
+static void cost(int *costs, aom_tree tree, const aom_prob *probs, int i,
                  int c) {
-  const vpx_prob prob = probs[i / 2];
+  const aom_prob prob = probs[i / 2];
   int b;
 
   for (b = 0; b <= 1; ++b) {
     const int cc = c + vp10_cost_bit(prob, b);
-    const vpx_tree_index ii = tree[i + b];
+    const aom_tree_index ii = tree[i + b];
 
     if (ii <= 0)
       costs[-ii] = cc;
@@ -54,11 +54,11 @@
   }
 }
 
-void vp10_cost_tokens(int *costs, const vpx_prob *probs, vpx_tree tree) {
+void vp10_cost_tokens(int *costs, const aom_prob *probs, aom_tree tree) {
   cost(costs, tree, probs, 0, 0);
 }
 
-void vp10_cost_tokens_skip(int *costs, const vpx_prob *probs, vpx_tree tree) {
+void vp10_cost_tokens_skip(int *costs, const aom_prob *probs, aom_tree tree) {
   assert(tree[0] <= 0 && tree[1] > 0);
 
   costs[-tree[0]] = vp10_cost_bit(probs[0], 0);
diff --git a/av1/encoder/cost.h b/av1/encoder/cost.h
index 83b7a29..be12464 100644
--- a/av1/encoder/cost.h
+++ b/av1/encoder/cost.h
@@ -13,7 +13,7 @@
 #define VP10_ENCODER_COST_H_
 
 #include "aom_dsp/prob.h"
-#include "aom/vpx_integer.h"
+#include "aom/aom_integer.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -31,14 +31,14 @@
 #define vp10_cost_bit(prob, bit) vp10_cost_zero((bit) ? 256 - (prob) : (prob))
 
 static INLINE unsigned int cost_branch256(const unsigned int ct[2],
-                                          vpx_prob p) {
+                                          aom_prob p) {
   return ct[0] * vp10_cost_zero(p) + ct[1] * vp10_cost_one(p);
 }
 
-static INLINE int treed_cost(vpx_tree tree, const vpx_prob *probs, int bits,
+static INLINE int treed_cost(aom_tree tree, const aom_prob *probs, int bits,
                              int len) {
   int cost = 0;
-  vpx_tree_index i = 0;
+  aom_tree_index i = 0;
 
   do {
     const int bit = (bits >> --len) & 1;
@@ -49,8 +49,8 @@
   return cost;
 }
 
-void vp10_cost_tokens(int *costs, const vpx_prob *probs, vpx_tree tree);
-void vp10_cost_tokens_skip(int *costs, const vpx_prob *probs, vpx_tree tree);
+void vp10_cost_tokens(int *costs, const aom_prob *probs, aom_tree tree);
+void vp10_cost_tokens_skip(int *costs, const aom_prob *probs, aom_tree tree);
 
 #ifdef __cplusplus
 }  // extern "C"
diff --git a/av1/encoder/dct.c b/av1/encoder/dct.c
index 3fcc634..30456f8 100644
--- a/av1/encoder/dct.c
+++ b/av1/encoder/dct.c
@@ -13,8 +13,8 @@
 #include <math.h>
 
 #include "./av1_rtcd.h"
-#include "./vpx_config.h"
-#include "./vpx_dsp_rtcd.h"
+#include "./aom_config.h"
+#include "./aom_dsp_rtcd.h"
 
 #include "av1/common/blockd.h"
 #include "av1/common/idct.h"
@@ -991,7 +991,7 @@
 void vp10_fht4x4_c(const int16_t *input, tran_low_t *output, int stride,
                    int tx_type) {
   if (tx_type == DCT_DCT) {
-    vpx_fdct4x4_c(input, output, stride);
+    aom_fdct4x4_c(input, output, stride);
   } else {
     tran_low_t out[4 * 4];
     int i, j;
@@ -1144,7 +1144,7 @@
 void vp10_fht8x8_c(const int16_t *input, tran_low_t *output, int stride,
                    int tx_type) {
   if (tx_type == DCT_DCT) {
-    vpx_fdct8x8_c(input, output, stride);
+    aom_fdct8x8_c(input, output, stride);
   } else {
     tran_low_t out[64];
     int i, j;
@@ -1227,7 +1227,7 @@
 void vp10_fht16x16_c(const int16_t *input, tran_low_t *output, int stride,
                      int tx_type) {
   if (tx_type == DCT_DCT) {
-    vpx_fdct16x16_c(input, output, stride);
+    aom_fdct16x16_c(input, output, stride);
   } else {
     tran_low_t out[256];
     int i, j;
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index d2c01ce..3495262 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -14,12 +14,12 @@
 #include <stdio.h>
 
 #include "./av1_rtcd.h"
-#include "./vpx_dsp_rtcd.h"
-#include "./vpx_config.h"
+#include "./aom_dsp_rtcd.h"
+#include "./aom_config.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
+#include "aom_dsp/aom_dsp_common.h"
 #include "aom_ports/mem.h"
-#include "aom_ports/vpx_timer.h"
+#include "aom_ports/aom_timer.h"
 #include "aom_ports/system_state.h"
 
 #include "av1/common/common.h"
@@ -523,14 +523,14 @@
     if (x8_idx < pixels_wide && y8_idx < pixels_high) {
 #if CONFIG_VPX_HIGHBITDEPTH
       if (highbd_flag & YV12_FLAG_HIGHBITDEPTH) {
-        vpx_highbd_minmax_8x8(s + y8_idx * sp + x8_idx, sp,
+        aom_highbd_minmax_8x8(s + y8_idx * sp + x8_idx, sp,
                               d + y8_idx * dp + x8_idx, dp, &min, &max);
       } else {
-        vpx_minmax_8x8(s + y8_idx * sp + x8_idx, sp, d + y8_idx * dp + x8_idx,
+        aom_minmax_8x8(s + y8_idx * sp + x8_idx, sp, d + y8_idx * dp + x8_idx,
                        dp, &min, &max);
       }
 #else
-      vpx_minmax_8x8(s + y8_idx * sp + x8_idx, sp, d + y8_idx * dp + x8_idx, dp,
+      aom_minmax_8x8(s + y8_idx * sp + x8_idx, sp, d + y8_idx * dp + x8_idx, dp,
                      &min, &max);
 #endif
       if ((max - min) > minmax_max) minmax_max = (max - min);
@@ -558,16 +558,16 @@
       int d_avg = 128;
 #if CONFIG_VPX_HIGHBITDEPTH
       if (highbd_flag & YV12_FLAG_HIGHBITDEPTH) {
-        s_avg = vpx_highbd_avg_4x4(s + y4_idx * sp + x4_idx, sp);
+        s_avg = aom_highbd_avg_4x4(s + y4_idx * sp + x4_idx, sp);
         if (!is_key_frame)
-          d_avg = vpx_highbd_avg_4x4(d + y4_idx * dp + x4_idx, dp);
+          d_avg = aom_highbd_avg_4x4(d + y4_idx * dp + x4_idx, dp);
       } else {
-        s_avg = vpx_avg_4x4(s + y4_idx * sp + x4_idx, sp);
-        if (!is_key_frame) d_avg = vpx_avg_4x4(d + y4_idx * dp + x4_idx, dp);
+        s_avg = aom_avg_4x4(s + y4_idx * sp + x4_idx, sp);
+        if (!is_key_frame) d_avg = aom_avg_4x4(d + y4_idx * dp + x4_idx, dp);
       }
 #else
-      s_avg = vpx_avg_4x4(s + y4_idx * sp + x4_idx, sp);
-      if (!is_key_frame) d_avg = vpx_avg_4x4(d + y4_idx * dp + x4_idx, dp);
+      s_avg = aom_avg_4x4(s + y4_idx * sp + x4_idx, sp);
+      if (!is_key_frame) d_avg = aom_avg_4x4(d + y4_idx * dp + x4_idx, dp);
 #endif
       sum = s_avg - d_avg;
       sse = sum * sum;
@@ -594,16 +594,16 @@
       int d_avg = 128;
 #if CONFIG_VPX_HIGHBITDEPTH
       if (highbd_flag & YV12_FLAG_HIGHBITDEPTH) {
-        s_avg = vpx_highbd_avg_8x8(s + y8_idx * sp + x8_idx, sp);
+        s_avg = aom_highbd_avg_8x8(s + y8_idx * sp + x8_idx, sp);
         if (!is_key_frame)
-          d_avg = vpx_highbd_avg_8x8(d + y8_idx * dp + x8_idx, dp);
+          d_avg = aom_highbd_avg_8x8(d + y8_idx * dp + x8_idx, dp);
       } else {
-        s_avg = vpx_avg_8x8(s + y8_idx * sp + x8_idx, sp);
-        if (!is_key_frame) d_avg = vpx_avg_8x8(d + y8_idx * dp + x8_idx, dp);
+        s_avg = aom_avg_8x8(s + y8_idx * sp + x8_idx, sp);
+        if (!is_key_frame) d_avg = aom_avg_8x8(d + y8_idx * dp + x8_idx, dp);
       }
 #else
-      s_avg = vpx_avg_8x8(s + y8_idx * sp + x8_idx, sp);
-      if (!is_key_frame) d_avg = vpx_avg_8x8(d + y8_idx * dp + x8_idx, dp);
+      s_avg = aom_avg_8x8(s + y8_idx * sp + x8_idx, sp);
+      if (!is_key_frame) d_avg = aom_avg_8x8(d + y8_idx * dp + x8_idx, dp);
 #endif
       sum = s_avg - d_avg;
       sse = sum * sum;
@@ -1042,7 +1042,7 @@
   int segment_qindex;
   VP10_COMMON *const cm = &cpi->common;
   vp10_init_plane_quantizers(cpi, x);
-  vpx_clear_system_state();
+  aom_clear_system_state();
   segment_qindex = vp10_get_qindex(&cm->seg, segment_id, cm->base_qindex);
   return vp10_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q);
 }
@@ -1060,7 +1060,7 @@
   const AQ_MODE aq_mode = cpi->oxcf.aq_mode;
   int i, orig_rdmult;
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   // Use the lower precision, but faster, 32x32 fdct for mode selection.
   x->use_lp32x32fdct = 1;
@@ -2480,8 +2480,8 @@
   int tile_tok = 0;
 
   if (cpi->tile_data == NULL || cpi->allocated_tiles < tile_cols * tile_rows) {
-    if (cpi->tile_data != NULL) vpx_free(cpi->tile_data);
-    CHECK_MEM_ERROR(cm, cpi->tile_data, vpx_malloc(tile_cols * tile_rows *
+    if (cpi->tile_data != NULL) aom_free(cpi->tile_data);
+    CHECK_MEM_ERROR(cm, cpi->tile_data, aom_malloc(tile_cols * tile_rows *
                                                    sizeof(*cpi->tile_data)));
     cpi->allocated_tiles = tile_cols * tile_rows;
 
@@ -2609,8 +2609,8 @@
   vp10_zero(x->skip_txfm);
 
   {
-    struct vpx_usec_timer emr_timer;
-    vpx_usec_timer_start(&emr_timer);
+    struct aom_usec_timer emr_timer;
+    aom_usec_timer_start(&emr_timer);
 
 #if CONFIG_FP_MB_STATS
     if (cpi->use_fp_mb_stats) {
@@ -2625,8 +2625,8 @@
     else
       encode_tiles(cpi);
 
-    vpx_usec_timer_mark(&emr_timer);
-    cpi->time_encode_sb_row += vpx_usec_timer_elapsed(&emr_timer);
+    aom_usec_timer_mark(&emr_timer);
+    cpi->time_encode_sb_row += aom_usec_timer_elapsed(&emr_timer);
   }
 
 #if 0
diff --git a/av1/encoder/encodeframe.h b/av1/encoder/encodeframe.h
index 915e9f2..2b70d73 100644
--- a/av1/encoder/encodeframe.h
+++ b/av1/encoder/encodeframe.h
@@ -12,7 +12,7 @@
 #ifndef VP10_ENCODER_ENCODEFRAME_H_
 #define VP10_ENCODER_ENCODEFRAME_H_
 
-#include "aom/vpx_integer.h"
+#include "aom/aom_integer.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 22c5908..a7d5f50 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -10,11 +10,11 @@
  */
 
 #include "./av1_rtcd.h"
-#include "./vpx_config.h"
-#include "./vpx_dsp_rtcd.h"
+#include "./aom_config.h"
+#include "./aom_dsp_rtcd.h"
 
 #include "aom_dsp/quantize.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
 
 #include "av1/common/idct.h"
@@ -40,13 +40,13 @@
 
 #if CONFIG_VPX_HIGHBITDEPTH
   if (x->e_mbd.cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
-    vpx_highbd_subtract_block(bh, bw, p->src_diff, bw, p->src.buf,
+    aom_highbd_subtract_block(bh, bw, p->src_diff, bw, p->src.buf,
                               p->src.stride, pd->dst.buf, pd->dst.stride,
                               x->e_mbd.bd);
     return;
   }
 #endif  // CONFIG_VPX_HIGHBITDEPTH
-  vpx_subtract_block(bh, bw, p->src_diff, bw, p->src.buf, p->src.stride,
+  aom_subtract_block(bh, bw, p->src_diff, bw, p->src.buf, p->src.stride,
                      pd->dst.buf, pd->dst.stride);
 }
 
@@ -336,18 +336,18 @@
 static INLINE void fdct32x32(int rd_transform, const int16_t *src,
                              tran_low_t *dst, int src_stride) {
   if (rd_transform)
-    vpx_fdct32x32_rd(src, dst, src_stride);
+    aom_fdct32x32_rd(src, dst, src_stride);
   else
-    vpx_fdct32x32(src, dst, src_stride);
+    aom_fdct32x32(src, dst, src_stride);
 }
 
 #if CONFIG_VPX_HIGHBITDEPTH
 static INLINE void highbd_fdct32x32(int rd_transform, const int16_t *src,
                                     tran_low_t *dst, int src_stride) {
   if (rd_transform)
-    vpx_highbd_fdct32x32_rd(src, dst, src_stride);
+    aom_highbd_fdct32x32_rd(src, dst, src_stride);
   else
-    vpx_highbd_fdct32x32(src, dst, src_stride);
+    aom_highbd_fdct32x32(src, dst, src_stride);
 }
 #endif  // CONFIG_VPX_HIGHBITDEPTH
 
@@ -358,7 +358,7 @@
   } else {
     switch (tx_type) {
       case DCT_DCT:
-        vpx_fdct4x4(src_diff, coeff, diff_stride);
+        aom_fdct4x4(src_diff, coeff, diff_stride);
         break;
       case ADST_DCT:
       case DCT_ADST:
@@ -429,7 +429,7 @@
   } else {
     switch (tx_type) {
       case DCT_DCT:
-        vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
+        aom_highbd_fdct4x4(src_diff, coeff, diff_stride);
         break;
       case ADST_DCT:
       case DCT_ADST:
@@ -447,7 +447,7 @@
                                 int diff_stride, TX_TYPE tx_type) {
   switch (tx_type) {
     case DCT_DCT:
-      vpx_highbd_fdct8x8(src_diff, coeff, diff_stride);
+      aom_highbd_fdct8x8(src_diff, coeff, diff_stride);
       break;
     case ADST_DCT:
     case DCT_ADST:
@@ -464,7 +464,7 @@
                                   int diff_stride, TX_TYPE tx_type) {
   switch (tx_type) {
     case DCT_DCT:
-      vpx_highbd_fdct16x16(src_diff, coeff, diff_stride);
+      aom_highbd_fdct16x16(src_diff, coeff, diff_stride);
       break;
     case ADST_DCT:
     case DCT_ADST:
@@ -534,7 +534,7 @@
 #endif
         break;
       case TX_16X16:
-        vpx_highbd_fdct16x16(src_diff, coeff, diff_stride);
+        aom_highbd_fdct16x16(src_diff, coeff, diff_stride);
         vp10_highbd_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp,
                                 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
                                 pd->dequant, eob, scan_order->scan,
@@ -545,7 +545,7 @@
 #endif
         break;
       case TX_8X8:
-        vpx_highbd_fdct8x8(src_diff, coeff, diff_stride);
+        aom_highbd_fdct8x8(src_diff, coeff, diff_stride);
         vp10_highbd_quantize_fp(coeff, 64, x->skip_block, p->zbin, p->round_fp,
                                 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
                                 pd->dequant, eob, scan_order->scan,
@@ -559,7 +559,7 @@
         if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
           vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
         } else {
-          vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
+          aom_highbd_fdct4x4(src_diff, coeff, diff_stride);
         }
         vp10_highbd_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
                                 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
@@ -590,7 +590,7 @@
 #endif
       break;
     case TX_16X16:
-      vpx_fdct16x16(src_diff, coeff, diff_stride);
+      aom_fdct16x16(src_diff, coeff, diff_stride);
       vp10_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp,
                        p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
                        pd->dequant, eob, scan_order->scan,
@@ -614,7 +614,7 @@
       if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
         vp10_fwht4x4(src_diff, coeff, diff_stride);
       } else {
-        vpx_fdct4x4(src_diff, coeff, diff_stride);
+        aom_fdct4x4(src_diff, coeff, diff_stride);
       }
       vp10_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
                        p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
@@ -654,8 +654,8 @@
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
     switch (tx_size) {
       case TX_32X32:
-        vpx_highbd_fdct32x32_1(src_diff, coeff, diff_stride);
-        vpx_highbd_quantize_dc_32x32(coeff, x->skip_block, p->round,
+        aom_highbd_fdct32x32_1(src_diff, coeff, diff_stride);
+        aom_highbd_quantize_dc_32x32(coeff, x->skip_block, p->round,
                                      p->quant_fp[0], qcoeff, dqcoeff,
                                      pd->dequant[0],
 #if !CONFIG_AOM_QM
@@ -665,8 +665,8 @@
 #endif
         break;
       case TX_16X16:
-        vpx_highbd_fdct16x16_1(src_diff, coeff, diff_stride);
-        vpx_highbd_quantize_dc(coeff, 256, x->skip_block, p->round,
+        aom_highbd_fdct16x16_1(src_diff, coeff, diff_stride);
+        aom_highbd_quantize_dc(coeff, 256, x->skip_block, p->round,
                                p->quant_fp[0], qcoeff, dqcoeff, pd->dequant[0],
 #if !CONFIG_AOM_QM
                                eob);
@@ -675,8 +675,8 @@
 #endif
         break;
       case TX_8X8:
-        vpx_highbd_fdct8x8_1(src_diff, coeff, diff_stride);
-        vpx_highbd_quantize_dc(coeff, 64, x->skip_block, p->round,
+        aom_highbd_fdct8x8_1(src_diff, coeff, diff_stride);
+        aom_highbd_quantize_dc(coeff, 64, x->skip_block, p->round,
                                p->quant_fp[0], qcoeff, dqcoeff, pd->dequant[0],
 #if !CONFIG_AOM_QM
                                eob);
@@ -688,9 +688,9 @@
         if (xd->lossless[seg_id]) {
           vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
         } else {
-          vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
+          aom_highbd_fdct4x4(src_diff, coeff, diff_stride);
         }
-        vpx_highbd_quantize_dc(coeff, 16, x->skip_block, p->round,
+        aom_highbd_quantize_dc(coeff, 16, x->skip_block, p->round,
                                p->quant_fp[0], qcoeff, dqcoeff, pd->dequant[0],
 #if !CONFIG_AOM_QM
                                eob);
@@ -707,8 +707,8 @@
 
   switch (tx_size) {
     case TX_32X32:
-      vpx_fdct32x32_1(src_diff, coeff, diff_stride);
-      vpx_quantize_dc_32x32(coeff, x->skip_block, p->round, p->quant_fp[0],
+      aom_fdct32x32_1(src_diff, coeff, diff_stride);
+      aom_quantize_dc_32x32(coeff, x->skip_block, p->round, p->quant_fp[0],
                             qcoeff, dqcoeff, pd->dequant[0],
 #if !CONFIG_AOM_QM
                             eob);
@@ -717,8 +717,8 @@
 #endif
       break;
     case TX_16X16:
-      vpx_fdct16x16_1(src_diff, coeff, diff_stride);
-      vpx_quantize_dc(coeff, 256, x->skip_block, p->round, p->quant_fp[0],
+      aom_fdct16x16_1(src_diff, coeff, diff_stride);
+      aom_quantize_dc(coeff, 256, x->skip_block, p->round, p->quant_fp[0],
                       qcoeff, dqcoeff, pd->dequant[0],
 #if !CONFIG_AOM_QM
                       eob);
@@ -727,8 +727,8 @@
 #endif
       break;
     case TX_8X8:
-      vpx_fdct8x8_1(src_diff, coeff, diff_stride);
-      vpx_quantize_dc(coeff, 64, x->skip_block, p->round, p->quant_fp[0],
+      aom_fdct8x8_1(src_diff, coeff, diff_stride);
+      aom_quantize_dc(coeff, 64, x->skip_block, p->round, p->quant_fp[0],
                       qcoeff, dqcoeff, pd->dequant[0],
 #if !CONFIG_AOM_QM
                       eob);
@@ -740,9 +740,9 @@
       if (xd->lossless[seg_id]) {
         vp10_fwht4x4(src_diff, coeff, diff_stride);
       } else {
-        vpx_fdct4x4(src_diff, coeff, diff_stride);
+        aom_fdct4x4(src_diff, coeff, diff_stride);
       }
-      vpx_quantize_dc(coeff, 16, x->skip_block, p->round, p->quant_fp[0],
+      aom_quantize_dc(coeff, 16, x->skip_block, p->round, p->quant_fp[0],
                       qcoeff, dqcoeff, pd->dequant[0],
 #if !CONFIG_AOM_QM
                       eob);
@@ -784,7 +784,7 @@
       case TX_32X32:
         highbd_fwd_txfm_32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride,
                               tx_type);
-        vpx_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
+        aom_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
                                     p->round, p->quant, p->quant_shift, qcoeff,
                                     dqcoeff, pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -795,7 +795,7 @@
         break;
       case TX_16X16:
         highbd_fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type);
-        vpx_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
+        aom_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
                               p->quant, p->quant_shift, qcoeff, dqcoeff,
                               pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -806,7 +806,7 @@
         break;
       case TX_8X8:
         highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type);
-        vpx_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
+        aom_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
                               p->quant, p->quant_shift, qcoeff, dqcoeff,
                               pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -818,7 +818,7 @@
       case TX_4X4:
         vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
                                  xd->lossless[seg_id]);
-        vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
+        aom_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
                               p->quant, p->quant_shift, qcoeff, dqcoeff,
                               pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -837,7 +837,7 @@
   switch (tx_size) {
     case TX_32X32:
       fwd_txfm_32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride, tx_type);
-      vpx_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
+      aom_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
                            p->quant, p->quant_shift, qcoeff, dqcoeff,
                            pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -848,7 +848,7 @@
       break;
     case TX_16X16:
       fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type);
-      vpx_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant,
+      aom_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant,
                      p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
                      scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -859,7 +859,7 @@
       break;
     case TX_8X8:
       fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type);
-      vpx_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
+      aom_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
                      p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
                      scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -871,7 +871,7 @@
     case TX_4X4:
       vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
                         xd->lossless[seg_id]);
-      vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
+      aom_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
                      p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
                      scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -1123,11 +1123,11 @@
     switch (tx_size) {
       case TX_32X32:
         if (!x->skip_recode) {
-          vpx_highbd_subtract_block(32, 32, src_diff, diff_stride, src,
+          aom_highbd_subtract_block(32, 32, src_diff, diff_stride, src,
                                     src_stride, dst, dst_stride, xd->bd);
           highbd_fwd_txfm_32x32(x->use_lp32x32fdct, src_diff, coeff,
                                 diff_stride, tx_type);
-          vpx_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
+          aom_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
                                       p->round, p->quant, p->quant_shift,
                                       qcoeff, dqcoeff, pd->dequant, eob,
                                       scan_order->scan,
@@ -1143,10 +1143,10 @@
         break;
       case TX_16X16:
         if (!x->skip_recode) {
-          vpx_highbd_subtract_block(16, 16, src_diff, diff_stride, src,
+          aom_highbd_subtract_block(16, 16, src_diff, diff_stride, src,
                                     src_stride, dst, dst_stride, xd->bd);
           highbd_fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type);
-          vpx_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
+          aom_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
                                 p->quant, p->quant_shift, qcoeff, dqcoeff,
                                 pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -1161,10 +1161,10 @@
         break;
       case TX_8X8:
         if (!x->skip_recode) {
-          vpx_highbd_subtract_block(8, 8, src_diff, diff_stride, src,
+          aom_highbd_subtract_block(8, 8, src_diff, diff_stride, src,
                                     src_stride, dst, dst_stride, xd->bd);
           highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type);
-          vpx_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
+          aom_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
                                 p->quant, p->quant_shift, qcoeff, dqcoeff,
                                 pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -1179,11 +1179,11 @@
         break;
       case TX_4X4:
         if (!x->skip_recode) {
-          vpx_highbd_subtract_block(4, 4, src_diff, diff_stride, src,
+          aom_highbd_subtract_block(4, 4, src_diff, diff_stride, src,
                                     src_stride, dst, dst_stride, xd->bd);
           vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
                                    xd->lossless[seg_id]);
-          vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
+          aom_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
                                 p->quant, p->quant_shift, qcoeff, dqcoeff,
                                 pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -1212,11 +1212,11 @@
   switch (tx_size) {
     case TX_32X32:
       if (!x->skip_recode) {
-        vpx_subtract_block(32, 32, src_diff, diff_stride, src, src_stride, dst,
+        aom_subtract_block(32, 32, src_diff, diff_stride, src, src_stride, dst,
                            dst_stride);
         fwd_txfm_32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride,
                        tx_type);
-        vpx_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
+        aom_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
                              p->quant, p->quant_shift, qcoeff, dqcoeff,
                              pd->dequant, eob, scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -1230,10 +1230,10 @@
       break;
     case TX_16X16:
       if (!x->skip_recode) {
-        vpx_subtract_block(16, 16, src_diff, diff_stride, src, src_stride, dst,
+        aom_subtract_block(16, 16, src_diff, diff_stride, src, src_stride, dst,
                            dst_stride);
         fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type);
-        vpx_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant,
+        aom_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant,
                        p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
                        scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -1247,10 +1247,10 @@
       break;
     case TX_8X8:
       if (!x->skip_recode) {
-        vpx_subtract_block(8, 8, src_diff, diff_stride, src, src_stride, dst,
+        aom_subtract_block(8, 8, src_diff, diff_stride, src, src_stride, dst,
                            dst_stride);
         fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type);
-        vpx_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
+        aom_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
                        p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
                        scan_order->scan,
 #if !CONFIG_AOM_QM
@@ -1263,11 +1263,11 @@
       break;
     case TX_4X4:
       if (!x->skip_recode) {
-        vpx_subtract_block(4, 4, src_diff, diff_stride, src, src_stride, dst,
+        aom_subtract_block(4, 4, src_diff, diff_stride, src, src_stride, dst,
                            dst_stride);
         vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
                           xd->lossless[seg_id]);
-        vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
+        aom_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
                        p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
                        scan_order->scan,
 #if !CONFIG_AOM_QM
diff --git a/av1/encoder/encodemb.h b/av1/encoder/encodemb.h
index 3a53119..cd3b677 100644
--- a/av1/encoder/encodemb.h
+++ b/av1/encoder/encodemb.h
@@ -12,7 +12,7 @@
 #ifndef VP10_ENCODER_ENCODEMB_H_
 #define VP10_ENCODER_ENCODEMB_H_
 
-#include "./vpx_config.h"
+#include "./aom_config.h"
 #include "av1/encoder/block.h"
 
 #ifdef __cplusplus
diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c
index 52ca39f..5cf3ad8 100644
--- a/av1/encoder/encodemv.c
+++ b/av1/encoder/encodemv.c
@@ -18,7 +18,7 @@
 #include "av1/encoder/encodemv.h"
 #include "av1/encoder/subexp.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
+#include "aom_dsp/aom_dsp_common.h"
 
 static struct vp10_token mv_joint_encodings[MV_JOINTS];
 static struct vp10_token mv_class_encodings[MV_CLASSES];
@@ -32,7 +32,7 @@
   vp10_tokens_from_tree(mv_fp_encodings, vp10_mv_fp_tree);
 }
 
-static void encode_mv_component(vpx_writer *w, int comp,
+static void encode_mv_component(aom_writer *w, int comp,
                                 const nmv_component *mvcomp, int usehp) {
   int offset;
   const int sign = comp < 0;
@@ -45,7 +45,7 @@
   assert(comp != 0);
 
   // Sign
-  vpx_write(w, sign, mvcomp->sign);
+  aom_write(w, sign, mvcomp->sign);
 
   // Class
   vp10_write_token(w, vp10_mv_class_tree, mvcomp->classes,
@@ -58,7 +58,7 @@
   } else {
     int i;
     const int n = mv_class + CLASS0_BITS - 1;  // number of bits
-    for (i = 0; i < n; ++i) vpx_write(w, (d >> i) & 1, mvcomp->bits[i]);
+    for (i = 0; i < n; ++i) aom_write(w, (d >> i) & 1, mvcomp->bits[i]);
   }
 
   // Fractional bits
@@ -68,7 +68,7 @@
 
   // High precision bit
   if (usehp)
-    vpx_write(w, hp, mv_class == MV_CLASS_0 ? mvcomp->class0_hp : mvcomp->hp);
+    aom_write(w, hp, mv_class == MV_CLASS_0 ? mvcomp->class0_hp : mvcomp->hp);
 }
 
 static void build_nmv_component_cost_table(int *mvcost,
@@ -132,27 +132,27 @@
   }
 }
 
-static void update_mv(vpx_writer *w, const unsigned int ct[2], vpx_prob *cur_p,
-                      vpx_prob upd_p) {
+static void update_mv(aom_writer *w, const unsigned int ct[2], aom_prob *cur_p,
+                      aom_prob upd_p) {
 #if CONFIG_MISC_FIXES
   (void)upd_p;
   vp10_cond_prob_diff_update(w, cur_p, ct);
 #else
-  const vpx_prob new_p = get_binary_prob(ct[0], ct[1]) | 1;
+  const aom_prob new_p = get_binary_prob(ct[0], ct[1]) | 1;
   const int update = cost_branch256(ct, *cur_p) + vp10_cost_zero(upd_p) >
                      cost_branch256(ct, new_p) + vp10_cost_one(upd_p) + 7 * 256;
-  vpx_write(w, update, upd_p);
+  aom_write(w, update, upd_p);
   if (update) {
     *cur_p = new_p;
-    vpx_write_literal(w, new_p >> 1, 7);
+    aom_write_literal(w, new_p >> 1, 7);
   }
 #endif
 }
 
-static void write_mv_update(const vpx_tree_index *tree,
-                            vpx_prob probs[/*n - 1*/],
+static void write_mv_update(const aom_tree_index *tree,
+                            aom_prob probs[/*n - 1*/],
                             const unsigned int counts[/*n - 1*/], int n,
-                            vpx_writer *w) {
+                            aom_writer *w) {
   int i;
   unsigned int branch_ct[32][2];
 
@@ -164,7 +164,7 @@
     update_mv(w, branch_ct[i], &probs[i], MV_UPDATE_PROB);
 }
 
-void vp10_write_nmv_probs(VP10_COMMON *cm, int usehp, vpx_writer *w,
+void vp10_write_nmv_probs(VP10_COMMON *cm, int usehp, aom_writer *w,
                           nmv_context_counts *const counts) {
   int i, j;
   nmv_context *const mvc = &cm->fc->nmvc;
@@ -203,7 +203,7 @@
   }
 }
 
-void vp10_encode_mv(VP10_COMP *cpi, vpx_writer *w, const MV *mv, const MV *ref,
+void vp10_encode_mv(VP10_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref,
                     const nmv_context *mvctx, int usehp) {
   const MV diff = { mv->row - ref->row, mv->col - ref->col };
   const MV_JOINT_TYPE j = vp10_get_mv_joint(&diff);
diff --git a/av1/encoder/encodemv.h b/av1/encoder/encodemv.h
index 8295b74..5b4bf5a 100644
--- a/av1/encoder/encodemv.h
+++ b/av1/encoder/encodemv.h
@@ -20,10 +20,10 @@
 
 void vp10_entropy_mv_init(void);
 
-void vp10_write_nmv_probs(VP10_COMMON *cm, int usehp, vpx_writer *w,
+void vp10_write_nmv_probs(VP10_COMMON *cm, int usehp, aom_writer *w,
                           nmv_context_counts *const counts);
 
-void vp10_encode_mv(VP10_COMP *cpi, vpx_writer *w, const MV *mv, const MV *ref,
+void vp10_encode_mv(VP10_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref,
                     const nmv_context *mvctx, int usehp);
 
 void vp10_build_nmv_cost_table(int *mvjoint, int *mvcost[2],
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 72af6cd..8afb342 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -13,7 +13,7 @@
 #include <stdio.h>
 #include <limits.h>
 
-#include "./vpx_config.h"
+#include "./aom_config.h"
 
 #include "av1/common/alloccommon.h"
 #if CONFIG_CLPF
@@ -49,18 +49,18 @@
 #include "av1/encoder/temporal_filter.h"
 
 #include "./av1_rtcd.h"
-#include "./vpx_dsp_rtcd.h"
-#include "./vpx_scale_rtcd.h"
-#include "aom/internal/vpx_psnr.h"
+#include "./aom_dsp_rtcd.h"
+#include "./aom_scale_rtcd.h"
+#include "aom/internal/aom_psnr.h"
 #if CONFIG_INTERNAL_STATS
 #include "aom_dsp/ssim.h"
 #endif
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_dsp/vpx_filter.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_dsp/aom_filter.h"
 #include "aom_ports/mem.h"
 #include "aom_ports/system_state.h"
-#include "aom_ports/vpx_timer.h"
-#include "aom_scale/vpx_scale.h"
+#include "aom_ports/aom_timer.h"
+#include "aom_scale/aom_scale.h"
 
 #define AM_SEGMENT_ID_INACTIVE 7
 #define AM_SEGMENT_ID_ACTIVE 0
@@ -270,29 +270,29 @@
 }
 
 static int vp10_enc_alloc_mi(VP10_COMMON *cm, int mi_size) {
-  cm->mip = vpx_calloc(mi_size, sizeof(*cm->mip));
+  cm->mip = aom_calloc(mi_size, sizeof(*cm->mip));
   if (!cm->mip) return 1;
-  cm->prev_mip = vpx_calloc(mi_size, sizeof(*cm->prev_mip));
+  cm->prev_mip = aom_calloc(mi_size, sizeof(*cm->prev_mip));
   if (!cm->prev_mip) return 1;
   cm->mi_alloc_size = mi_size;
 
-  cm->mi_grid_base = (MODE_INFO **)vpx_calloc(mi_size, sizeof(MODE_INFO *));
+  cm->mi_grid_base = (MODE_INFO **)aom_calloc(mi_size, sizeof(MODE_INFO *));
   if (!cm->mi_grid_base) return 1;
   cm->prev_mi_grid_base =
-      (MODE_INFO **)vpx_calloc(mi_size, sizeof(MODE_INFO *));
+      (MODE_INFO **)aom_calloc(mi_size, sizeof(MODE_INFO *));
   if (!cm->prev_mi_grid_base) return 1;
 
   return 0;
 }
 
 static void vp10_enc_free_mi(VP10_COMMON *cm) {
-  vpx_free(cm->mip);
+  aom_free(cm->mip);
   cm->mip = NULL;
-  vpx_free(cm->prev_mip);
+  aom_free(cm->prev_mip);
   cm->prev_mip = NULL;
-  vpx_free(cm->mi_grid_base);
+  aom_free(cm->mi_grid_base);
   cm->mi_grid_base = NULL;
-  vpx_free(cm->prev_mi_grid_base);
+  aom_free(cm->prev_mi_grid_base);
   cm->prev_mi_grid_base = NULL;
 }
 
@@ -318,8 +318,8 @@
 
   if (!init_done) {
     av1_rtcd();
-    vpx_dsp_rtcd();
-    vpx_scale_rtcd();
+    aom_dsp_rtcd();
+    aom_scale_rtcd();
     vp10_init_intra_predictors();
     vp10_init_me_luts();
     vp10_rc_init_minq_luts();
@@ -332,60 +332,60 @@
 static void dealloc_compressor_data(VP10_COMP *cpi) {
   VP10_COMMON *const cm = &cpi->common;
 
-  vpx_free(cpi->mbmi_ext_base);
+  aom_free(cpi->mbmi_ext_base);
   cpi->mbmi_ext_base = NULL;
 
-  vpx_free(cpi->tile_data);
+  aom_free(cpi->tile_data);
   cpi->tile_data = NULL;
 
   // Delete sementation map
-  vpx_free(cpi->segmentation_map);
+  aom_free(cpi->segmentation_map);
   cpi->segmentation_map = NULL;
-  vpx_free(cpi->coding_context.last_frame_seg_map_copy);
+  aom_free(cpi->coding_context.last_frame_seg_map_copy);
   cpi->coding_context.last_frame_seg_map_copy = NULL;
 
-  vpx_free(cpi->nmvcosts[0]);
-  vpx_free(cpi->nmvcosts[1]);
+  aom_free(cpi->nmvcosts[0]);
+  aom_free(cpi->nmvcosts[1]);
   cpi->nmvcosts[0] = NULL;
   cpi->nmvcosts[1] = NULL;
 
-  vpx_free(cpi->nmvcosts_hp[0]);
-  vpx_free(cpi->nmvcosts_hp[1]);
+  aom_free(cpi->nmvcosts_hp[0]);
+  aom_free(cpi->nmvcosts_hp[1]);
   cpi->nmvcosts_hp[0] = NULL;
   cpi->nmvcosts_hp[1] = NULL;
 
-  vpx_free(cpi->nmvsadcosts[0]);
-  vpx_free(cpi->nmvsadcosts[1]);
+  aom_free(cpi->nmvsadcosts[0]);
+  aom_free(cpi->nmvsadcosts[1]);
   cpi->nmvsadcosts[0] = NULL;
   cpi->nmvsadcosts[1] = NULL;
 
-  vpx_free(cpi->nmvsadcosts_hp[0]);
-  vpx_free(cpi->nmvsadcosts_hp[1]);
+  aom_free(cpi->nmvsadcosts_hp[0]);
+  aom_free(cpi->nmvsadcosts_hp[1]);
   cpi->nmvsadcosts_hp[0] = NULL;
   cpi->nmvsadcosts_hp[1] = NULL;
 
   vp10_cyclic_refresh_free(cpi->cyclic_refresh);
   cpi->cyclic_refresh = NULL;
 
-  vpx_free(cpi->active_map.map);
+  aom_free(cpi->active_map.map);
   cpi->active_map.map = NULL;
 
   vp10_free_ref_frame_buffers(cm->buffer_pool);
   vp10_free_context_buffers(cm);
 
-  vpx_free_frame_buffer(&cpi->last_frame_uf);
-  vpx_free_frame_buffer(&cpi->scaled_source);
-  vpx_free_frame_buffer(&cpi->scaled_last_source);
-  vpx_free_frame_buffer(&cpi->alt_ref_buffer);
+  aom_free_frame_buffer(&cpi->last_frame_uf);
+  aom_free_frame_buffer(&cpi->scaled_source);
+  aom_free_frame_buffer(&cpi->scaled_last_source);
+  aom_free_frame_buffer(&cpi->alt_ref_buffer);
   vp10_lookahead_destroy(cpi->lookahead);
 
-  vpx_free(cpi->tile_tok[0][0]);
+  aom_free(cpi->tile_tok[0][0]);
   cpi->tile_tok[0][0] = 0;
 
   vp10_free_pc_tree(&cpi->td);
 
   if (cpi->source_diff_var != NULL) {
-    vpx_free(cpi->source_diff_var);
+    aom_free(cpi->source_diff_var);
     cpi->source_diff_var = NULL;
   }
 }
@@ -602,51 +602,51 @@
 #endif
                                          oxcf->lag_in_frames);
   if (!cpi->lookahead)
-    vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
+    aom_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate lag buffers");
 
   // TODO(agrange) Check if ARF is enabled and skip allocation if not.
-  if (vpx_realloc_frame_buffer(&cpi->alt_ref_buffer, oxcf->width, oxcf->height,
+  if (aom_realloc_frame_buffer(&cpi->alt_ref_buffer, oxcf->width, oxcf->height,
                                cm->subsampling_x, cm->subsampling_y,
 #if CONFIG_VPX_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
                                VPX_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
                                NULL, NULL, NULL))
-    vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
+    aom_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate altref buffer");
 }
 
 static void alloc_util_frame_buffers(VP10_COMP *cpi) {
   VP10_COMMON *const cm = &cpi->common;
-  if (vpx_realloc_frame_buffer(&cpi->last_frame_uf, cm->width, cm->height,
+  if (aom_realloc_frame_buffer(&cpi->last_frame_uf, cm->width, cm->height,
                                cm->subsampling_x, cm->subsampling_y,
 #if CONFIG_VPX_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
                                VPX_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
                                NULL, NULL, NULL))
-    vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
+    aom_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate last frame buffer");
 
-  if (vpx_realloc_frame_buffer(&cpi->scaled_source, cm->width, cm->height,
+  if (aom_realloc_frame_buffer(&cpi->scaled_source, cm->width, cm->height,
                                cm->subsampling_x, cm->subsampling_y,
 #if CONFIG_VPX_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
                                VPX_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
                                NULL, NULL, NULL))
-    vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
+    aom_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate scaled source buffer");
 
-  if (vpx_realloc_frame_buffer(&cpi->scaled_last_source, cm->width, cm->height,
+  if (aom_realloc_frame_buffer(&cpi->scaled_last_source, cm->width, cm->height,
                                cm->subsampling_x, cm->subsampling_y,
 #if CONFIG_VPX_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
                                VPX_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
                                NULL, NULL, NULL))
-    vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
+    aom_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate scaled last source buffer");
 }
 
@@ -654,7 +654,7 @@
   VP10_COMMON *cm = &cpi->common;
   int mi_size = cm->mi_cols * cm->mi_rows;
 
-  cpi->mbmi_ext_base = vpx_calloc(mi_size, sizeof(*cpi->mbmi_ext_base));
+  cpi->mbmi_ext_base = aom_calloc(mi_size, sizeof(*cpi->mbmi_ext_base));
   if (!cpi->mbmi_ext_base) return 1;
 
   return 0;
@@ -667,12 +667,12 @@
 
   alloc_context_buffers_ext(cpi);
 
-  vpx_free(cpi->tile_tok[0][0]);
+  aom_free(cpi->tile_tok[0][0]);
 
   {
     unsigned int tokens = get_token_alloc(cm->mb_rows, cm->mb_cols);
     CHECK_MEM_ERROR(cm, cpi->tile_tok[0][0],
-                    vpx_calloc(tokens, sizeof(*cpi->tile_tok[0][0])));
+                    aom_calloc(tokens, sizeof(*cpi->tile_tok[0][0])));
   }
 
   vp10_setup_pc_tree(&cpi->common, &cpi->td);
@@ -867,61 +867,61 @@
   }
 
 /* clang-format off */
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad32x16)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad32x16_avg)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad32x16x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad16x32)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad16x32_avg)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad16x32x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad64x32)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad64x32_avg)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad64x32x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad32x64)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad32x64_avg)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad32x64x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad32x32)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad32x32_avg)
-MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad32x32x3)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad32x32x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad32x32x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad64x64)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad64x64_avg)
-MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad64x64x3)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad64x64x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad64x64x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad16x16)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad16x16_avg)
-MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad16x16x3)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad16x16x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad16x16x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad16x8)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad16x8_avg)
-MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad16x8x3)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad16x8x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad16x8x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad8x16)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad8x16_avg)
-MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad8x16x3)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad8x16x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad8x16x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad8x8)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad8x8_avg)
-MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad8x8x3)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad8x8x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad8x8x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad8x4)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad8x4_avg)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad8x4x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad8x4x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad4x8)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad4x8_avg)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad4x8x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad4x8x4d)
-MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad4x4)
-MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad4x4_avg)
-MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad4x4x3)
-MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad4x4x8)
-MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad4x4x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad32x16)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad32x16_avg)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x16x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad16x32)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad16x32_avg)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x32x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad64x32)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad64x32_avg)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x32x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad32x64)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad32x64_avg)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x64x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad32x32)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad32x32_avg)
+MAKE_BFP_SAD3_WRAPPER(aom_highbd_sad32x32x3)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad32x32x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x32x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad64x64)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad64x64_avg)
+MAKE_BFP_SAD3_WRAPPER(aom_highbd_sad64x64x3)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad64x64x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x64x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad16x16)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad16x16_avg)
+MAKE_BFP_SAD3_WRAPPER(aom_highbd_sad16x16x3)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad16x16x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x16x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad16x8)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad16x8_avg)
+MAKE_BFP_SAD3_WRAPPER(aom_highbd_sad16x8x3)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad16x8x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x8x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad8x16)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad8x16_avg)
+MAKE_BFP_SAD3_WRAPPER(aom_highbd_sad8x16x3)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad8x16x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x16x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad8x8)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad8x8_avg)
+MAKE_BFP_SAD3_WRAPPER(aom_highbd_sad8x8x3)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad8x8x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x8x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad8x4)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad8x4_avg)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad8x4x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x4x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad4x8)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad4x8_avg)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad4x8x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x8x4d)
+MAKE_BFP_SAD_WRAPPER(aom_highbd_sad4x4)
+MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad4x4_avg)
+MAKE_BFP_SAD3_WRAPPER(aom_highbd_sad4x4x3)
+MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad4x4x8)
+MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x4x4d)
 /* clang-format on */
 
 static void highbd_set_var_fns(VP10_COMP *const cpi) {
@@ -929,256 +929,256 @@
   if (cm->use_highbitdepth) {
     switch (cm->bit_depth) {
       case VPX_BITS_8:
-        HIGHBD_BFP(BLOCK_32X16, vpx_highbd_sad32x16_bits8,
-                   vpx_highbd_sad32x16_avg_bits8, vpx_highbd_8_variance32x16,
-                   vpx_highbd_8_sub_pixel_variance32x16,
-                   vpx_highbd_8_sub_pixel_avg_variance32x16, NULL, NULL,
-                   vpx_highbd_sad32x16x4d_bits8)
+        HIGHBD_BFP(BLOCK_32X16, aom_highbd_sad32x16_bits8,
+                   aom_highbd_sad32x16_avg_bits8, aom_highbd_8_variance32x16,
+                   aom_highbd_8_sub_pixel_variance32x16,
+                   aom_highbd_8_sub_pixel_avg_variance32x16, NULL, NULL,
+                   aom_highbd_sad32x16x4d_bits8)
 
-        HIGHBD_BFP(BLOCK_16X32, vpx_highbd_sad16x32_bits8,
-                   vpx_highbd_sad16x32_avg_bits8, vpx_highbd_8_variance16x32,
-                   vpx_highbd_8_sub_pixel_variance16x32,
-                   vpx_highbd_8_sub_pixel_avg_variance16x32, NULL, NULL,
-                   vpx_highbd_sad16x32x4d_bits8)
+        HIGHBD_BFP(BLOCK_16X32, aom_highbd_sad16x32_bits8,
+                   aom_highbd_sad16x32_avg_bits8, aom_highbd_8_variance16x32,
+                   aom_highbd_8_sub_pixel_variance16x32,
+                   aom_highbd_8_sub_pixel_avg_variance16x32, NULL, NULL,
+                   aom_highbd_sad16x32x4d_bits8)
 
-        HIGHBD_BFP(BLOCK_64X32, vpx_highbd_sad64x32_bits8,
-                   vpx_highbd_sad64x32_avg_bits8, vpx_highbd_8_variance64x32,
-                   vpx_highbd_8_sub_pixel_variance64x32,
-                   vpx_highbd_8_sub_pixel_avg_variance64x32, NULL, NULL,
-                   vpx_highbd_sad64x32x4d_bits8)
+        HIGHBD_BFP(BLOCK_64X32, aom_highbd_sad64x32_bits8,
+                   aom_highbd_sad64x32_avg_bits8, aom_highbd_8_variance64x32,
+                   aom_highbd_8_sub_pixel_variance64x32,
+                   aom_highbd_8_sub_pixel_avg_variance64x32, NULL, NULL,
+                   aom_highbd_sad64x32x4d_bits8)
 
-        HIGHBD_BFP(BLOCK_32X64, vpx_highbd_sad32x64_bits8,
-                   vpx_highbd_sad32x64_avg_bits8, vpx_highbd_8_variance32x64,
-                   vpx_highbd_8_sub_pixel_variance32x64,
-                   vpx_highbd_8_sub_pixel_avg_variance32x64, NULL, NULL,
-                   vpx_highbd_sad32x64x4d_bits8)
+        HIGHBD_BFP(BLOCK_32X64, aom_highbd_sad32x64_bits8,
+                   aom_highbd_sad32x64_avg_bits8, aom_highbd_8_variance32x64,
+                   aom_highbd_8_sub_pixel_variance32x64,
+                   aom_highbd_8_sub_pixel_avg_variance32x64, NULL, NULL,
+                   aom_highbd_sad32x64x4d_bits8)
 
-        HIGHBD_BFP(BLOCK_32X32, vpx_highbd_sad32x32_bits8,
-                   vpx_highbd_sad32x32_avg_bits8, vpx_highbd_8_variance32x32,
-                   vpx_highbd_8_sub_pixel_variance32x32,
-                   vpx_highbd_8_sub_pixel_avg_variance32x32,
-                   vpx_highbd_sad32x32x3_bits8, vpx_highbd_sad32x32x8_bits8,
-                   vpx_highbd_sad32x32x4d_bits8)
+        HIGHBD_BFP(BLOCK_32X32, aom_highbd_sad32x32_bits8,
+                   aom_highbd_sad32x32_avg_bits8, aom_highbd_8_variance32x32,
+                   aom_highbd_8_sub_pixel_variance32x32,
+                   aom_highbd_8_sub_pixel_avg_variance32x32,
+                   aom_highbd_sad32x32x3_bits8, aom_highbd_sad32x32x8_bits8,
+                   aom_highbd_sad32x32x4d_bits8)
 
-        HIGHBD_BFP(BLOCK_64X64, vpx_highbd_sad64x64_bits8,
-                   vpx_highbd_sad64x64_avg_bits8, vpx_highbd_8_variance64x64,
-                   vpx_highbd_8_sub_pixel_variance64x64,
-                   vpx_highbd_8_sub_pixel_avg_variance64x64,
-                   vpx_highbd_sad64x64x3_bits8, vpx_highbd_sad64x64x8_bits8,
-                   vpx_highbd_sad64x64x4d_bits8)
+        HIGHBD_BFP(BLOCK_64X64, aom_highbd_sad64x64_bits8,
+                   aom_highbd_sad64x64_avg_bits8, aom_highbd_8_variance64x64,
+                   aom_highbd_8_sub_pixel_variance64x64,
+                   aom_highbd_8_sub_pixel_avg_variance64x64,
+                   aom_highbd_sad64x64x3_bits8, aom_highbd_sad64x64x8_bits8,
+                   aom_highbd_sad64x64x4d_bits8)
 
-        HIGHBD_BFP(BLOCK_16X16, vpx_highbd_sad16x16_bits8,
-                   vpx_highbd_sad16x16_avg_bits8, vpx_highbd_8_variance16x16,
-                   vpx_highbd_8_sub_pixel_variance16x16,
-                   vpx_highbd_8_sub_pixel_avg_variance16x16,
-                   vpx_highbd_sad16x16x3_bits8, vpx_highbd_sad16x16x8_bits8,
-                   vpx_highbd_sad16x16x4d_bits8)
+        HIGHBD_BFP(BLOCK_16X16, aom_highbd_sad16x16_bits8,
+                   aom_highbd_sad16x16_avg_bits8, aom_highbd_8_variance16x16,
+                   aom_highbd_8_sub_pixel_variance16x16,
+                   aom_highbd_8_sub_pixel_avg_variance16x16,
+                   aom_highbd_sad16x16x3_bits8, aom_highbd_sad16x16x8_bits8,
+                   aom_highbd_sad16x16x4d_bits8)
 
         HIGHBD_BFP(
-            BLOCK_16X8, vpx_highbd_sad16x8_bits8, vpx_highbd_sad16x8_avg_bits8,
-            vpx_highbd_8_variance16x8, vpx_highbd_8_sub_pixel_variance16x8,
-            vpx_highbd_8_sub_pixel_avg_variance16x8, vpx_highbd_sad16x8x3_bits8,
-            vpx_highbd_sad16x8x8_bits8, vpx_highbd_sad16x8x4d_bits8)
+            BLOCK_16X8, aom_highbd_sad16x8_bits8, aom_highbd_sad16x8_avg_bits8,
+            aom_highbd_8_variance16x8, aom_highbd_8_sub_pixel_variance16x8,
+            aom_highbd_8_sub_pixel_avg_variance16x8, aom_highbd_sad16x8x3_bits8,
+            aom_highbd_sad16x8x8_bits8, aom_highbd_sad16x8x4d_bits8)
 
         HIGHBD_BFP(
-            BLOCK_8X16, vpx_highbd_sad8x16_bits8, vpx_highbd_sad8x16_avg_bits8,
-            vpx_highbd_8_variance8x16, vpx_highbd_8_sub_pixel_variance8x16,
-            vpx_highbd_8_sub_pixel_avg_variance8x16, vpx_highbd_sad8x16x3_bits8,
-            vpx_highbd_sad8x16x8_bits8, vpx_highbd_sad8x16x4d_bits8)
+            BLOCK_8X16, aom_highbd_sad8x16_bits8, aom_highbd_sad8x16_avg_bits8,
+            aom_highbd_8_variance8x16, aom_highbd_8_sub_pixel_variance8x16,
+            aom_highbd_8_sub_pixel_avg_variance8x16, aom_highbd_sad8x16x3_bits8,
+            aom_highbd_sad8x16x8_bits8, aom_highbd_sad8x16x4d_bits8)
 
         HIGHBD_BFP(
-            BLOCK_8X8, vpx_highbd_sad8x8_bits8, vpx_highbd_sad8x8_avg_bits8,
-            vpx_highbd_8_variance8x8, vpx_highbd_8_sub_pixel_variance8x8,
-            vpx_highbd_8_sub_pixel_avg_variance8x8, vpx_highbd_sad8x8x3_bits8,
-            vpx_highbd_sad8x8x8_bits8, vpx_highbd_sad8x8x4d_bits8)
+            BLOCK_8X8, aom_highbd_sad8x8_bits8, aom_highbd_sad8x8_avg_bits8,
+            aom_highbd_8_variance8x8, aom_highbd_8_sub_pixel_variance8x8,
+            aom_highbd_8_sub_pixel_avg_variance8x8, aom_highbd_sad8x8x3_bits8,
+            aom_highbd_sad8x8x8_bits8, aom_highbd_sad8x8x4d_bits8)
 
-        HIGHBD_BFP(BLOCK_8X4, vpx_highbd_sad8x4_bits8,
-                   vpx_highbd_sad8x4_avg_bits8, vpx_highbd_8_variance8x4,
-                   vpx_highbd_8_sub_pixel_variance8x4,
-                   vpx_highbd_8_sub_pixel_avg_variance8x4, NULL,
-                   vpx_highbd_sad8x4x8_bits8, vpx_highbd_sad8x4x4d_bits8)
+        HIGHBD_BFP(BLOCK_8X4, aom_highbd_sad8x4_bits8,
+                   aom_highbd_sad8x4_avg_bits8, aom_highbd_8_variance8x4,
+                   aom_highbd_8_sub_pixel_variance8x4,
+                   aom_highbd_8_sub_pixel_avg_variance8x4, NULL,
+                   aom_highbd_sad8x4x8_bits8, aom_highbd_sad8x4x4d_bits8)
 
-        HIGHBD_BFP(BLOCK_4X8, vpx_highbd_sad4x8_bits8,
-                   vpx_highbd_sad4x8_avg_bits8, vpx_highbd_8_variance4x8,
-                   vpx_highbd_8_sub_pixel_variance4x8,
-                   vpx_highbd_8_sub_pixel_avg_variance4x8, NULL,
-                   vpx_highbd_sad4x8x8_bits8, vpx_highbd_sad4x8x4d_bits8)
+        HIGHBD_BFP(BLOCK_4X8, aom_highbd_sad4x8_bits8,
+                   aom_highbd_sad4x8_avg_bits8, aom_highbd_8_variance4x8,
+                   aom_highbd_8_sub_pixel_variance4x8,
+                   aom_highbd_8_sub_pixel_avg_variance4x8, NULL,
+                   aom_highbd_sad4x8x8_bits8, aom_highbd_sad4x8x4d_bits8)
 
         HIGHBD_BFP(
-            BLOCK_4X4, vpx_highbd_sad4x4_bits8, vpx_highbd_sad4x4_avg_bits8,
-            vpx_highbd_8_variance4x4, vpx_highbd_8_sub_pixel_variance4x4,
-            vpx_highbd_8_sub_pixel_avg_variance4x4, vpx_highbd_sad4x4x3_bits8,
-            vpx_highbd_sad4x4x8_bits8, vpx_highbd_sad4x4x4d_bits8)
+            BLOCK_4X4, aom_highbd_sad4x4_bits8, aom_highbd_sad4x4_avg_bits8,
+            aom_highbd_8_variance4x4, aom_highbd_8_sub_pixel_variance4x4,
+            aom_highbd_8_sub_pixel_avg_variance4x4, aom_highbd_sad4x4x3_bits8,
+            aom_highbd_sad4x4x8_bits8, aom_highbd_sad4x4x4d_bits8)
         break;
 
       case VPX_BITS_10:
-        HIGHBD_BFP(BLOCK_32X16, vpx_highbd_sad32x16_bits10,
-                   vpx_highbd_sad32x16_avg_bits10, vpx_highbd_10_variance32x16,
-                   vpx_highbd_10_sub_pixel_variance32x16,
-                   vpx_highbd_10_sub_pixel_avg_variance32x16, NULL, NULL,
-                   vpx_highbd_sad32x16x4d_bits10)
+        HIGHBD_BFP(BLOCK_32X16, aom_highbd_sad32x16_bits10,
+                   aom_highbd_sad32x16_avg_bits10, aom_highbd_10_variance32x16,
+                   aom_highbd_10_sub_pixel_variance32x16,
+                   aom_highbd_10_sub_pixel_avg_variance32x16, NULL, NULL,
+                   aom_highbd_sad32x16x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_16X32, vpx_highbd_sad16x32_bits10,
-                   vpx_highbd_sad16x32_avg_bits10, vpx_highbd_10_variance16x32,
-                   vpx_highbd_10_sub_pixel_variance16x32,
-                   vpx_highbd_10_sub_pixel_avg_variance16x32, NULL, NULL,
-                   vpx_highbd_sad16x32x4d_bits10)
+        HIGHBD_BFP(BLOCK_16X32, aom_highbd_sad16x32_bits10,
+                   aom_highbd_sad16x32_avg_bits10, aom_highbd_10_variance16x32,
+                   aom_highbd_10_sub_pixel_variance16x32,
+                   aom_highbd_10_sub_pixel_avg_variance16x32, NULL, NULL,
+                   aom_highbd_sad16x32x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_64X32, vpx_highbd_sad64x32_bits10,
-                   vpx_highbd_sad64x32_avg_bits10, vpx_highbd_10_variance64x32,
-                   vpx_highbd_10_sub_pixel_variance64x32,
-                   vpx_highbd_10_sub_pixel_avg_variance64x32, NULL, NULL,
-                   vpx_highbd_sad64x32x4d_bits10)
+        HIGHBD_BFP(BLOCK_64X32, aom_highbd_sad64x32_bits10,
+                   aom_highbd_sad64x32_avg_bits10, aom_highbd_10_variance64x32,
+                   aom_highbd_10_sub_pixel_variance64x32,
+                   aom_highbd_10_sub_pixel_avg_variance64x32, NULL, NULL,
+                   aom_highbd_sad64x32x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_32X64, vpx_highbd_sad32x64_bits10,
-                   vpx_highbd_sad32x64_avg_bits10, vpx_highbd_10_variance32x64,
-                   vpx_highbd_10_sub_pixel_variance32x64,
-                   vpx_highbd_10_sub_pixel_avg_variance32x64, NULL, NULL,
-                   vpx_highbd_sad32x64x4d_bits10)
+        HIGHBD_BFP(BLOCK_32X64, aom_highbd_sad32x64_bits10,
+                   aom_highbd_sad32x64_avg_bits10, aom_highbd_10_variance32x64,
+                   aom_highbd_10_sub_pixel_variance32x64,
+                   aom_highbd_10_sub_pixel_avg_variance32x64, NULL, NULL,
+                   aom_highbd_sad32x64x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_32X32, vpx_highbd_sad32x32_bits10,
-                   vpx_highbd_sad32x32_avg_bits10, vpx_highbd_10_variance32x32,
-                   vpx_highbd_10_sub_pixel_variance32x32,
-                   vpx_highbd_10_sub_pixel_avg_variance32x32,
-                   vpx_highbd_sad32x32x3_bits10, vpx_highbd_sad32x32x8_bits10,
-                   vpx_highbd_sad32x32x4d_bits10)
+        HIGHBD_BFP(BLOCK_32X32, aom_highbd_sad32x32_bits10,
+                   aom_highbd_sad32x32_avg_bits10, aom_highbd_10_variance32x32,
+                   aom_highbd_10_sub_pixel_variance32x32,
+                   aom_highbd_10_sub_pixel_avg_variance32x32,
+                   aom_highbd_sad32x32x3_bits10, aom_highbd_sad32x32x8_bits10,
+                   aom_highbd_sad32x32x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_64X64, vpx_highbd_sad64x64_bits10,
-                   vpx_highbd_sad64x64_avg_bits10, vpx_highbd_10_variance64x64,
-                   vpx_highbd_10_sub_pixel_variance64x64,
-                   vpx_highbd_10_sub_pixel_avg_variance64x64,
-                   vpx_highbd_sad64x64x3_bits10, vpx_highbd_sad64x64x8_bits10,
-                   vpx_highbd_sad64x64x4d_bits10)
+        HIGHBD_BFP(BLOCK_64X64, aom_highbd_sad64x64_bits10,
+                   aom_highbd_sad64x64_avg_bits10, aom_highbd_10_variance64x64,
+                   aom_highbd_10_sub_pixel_variance64x64,
+                   aom_highbd_10_sub_pixel_avg_variance64x64,
+                   aom_highbd_sad64x64x3_bits10, aom_highbd_sad64x64x8_bits10,
+                   aom_highbd_sad64x64x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_16X16, vpx_highbd_sad16x16_bits10,
-                   vpx_highbd_sad16x16_avg_bits10, vpx_highbd_10_variance16x16,
-                   vpx_highbd_10_sub_pixel_variance16x16,
-                   vpx_highbd_10_sub_pixel_avg_variance16x16,
-                   vpx_highbd_sad16x16x3_bits10, vpx_highbd_sad16x16x8_bits10,
-                   vpx_highbd_sad16x16x4d_bits10)
+        HIGHBD_BFP(BLOCK_16X16, aom_highbd_sad16x16_bits10,
+                   aom_highbd_sad16x16_avg_bits10, aom_highbd_10_variance16x16,
+                   aom_highbd_10_sub_pixel_variance16x16,
+                   aom_highbd_10_sub_pixel_avg_variance16x16,
+                   aom_highbd_sad16x16x3_bits10, aom_highbd_sad16x16x8_bits10,
+                   aom_highbd_sad16x16x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_16X8, vpx_highbd_sad16x8_bits10,
-                   vpx_highbd_sad16x8_avg_bits10, vpx_highbd_10_variance16x8,
-                   vpx_highbd_10_sub_pixel_variance16x8,
-                   vpx_highbd_10_sub_pixel_avg_variance16x8,
-                   vpx_highbd_sad16x8x3_bits10, vpx_highbd_sad16x8x8_bits10,
-                   vpx_highbd_sad16x8x4d_bits10)
+        HIGHBD_BFP(BLOCK_16X8, aom_highbd_sad16x8_bits10,
+                   aom_highbd_sad16x8_avg_bits10, aom_highbd_10_variance16x8,
+                   aom_highbd_10_sub_pixel_variance16x8,
+                   aom_highbd_10_sub_pixel_avg_variance16x8,
+                   aom_highbd_sad16x8x3_bits10, aom_highbd_sad16x8x8_bits10,
+                   aom_highbd_sad16x8x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_8X16, vpx_highbd_sad8x16_bits10,
-                   vpx_highbd_sad8x16_avg_bits10, vpx_highbd_10_variance8x16,
-                   vpx_highbd_10_sub_pixel_variance8x16,
-                   vpx_highbd_10_sub_pixel_avg_variance8x16,
-                   vpx_highbd_sad8x16x3_bits10, vpx_highbd_sad8x16x8_bits10,
-                   vpx_highbd_sad8x16x4d_bits10)
+        HIGHBD_BFP(BLOCK_8X16, aom_highbd_sad8x16_bits10,
+                   aom_highbd_sad8x16_avg_bits10, aom_highbd_10_variance8x16,
+                   aom_highbd_10_sub_pixel_variance8x16,
+                   aom_highbd_10_sub_pixel_avg_variance8x16,
+                   aom_highbd_sad8x16x3_bits10, aom_highbd_sad8x16x8_bits10,
+                   aom_highbd_sad8x16x4d_bits10)
 
         HIGHBD_BFP(
-            BLOCK_8X8, vpx_highbd_sad8x8_bits10, vpx_highbd_sad8x8_avg_bits10,
-            vpx_highbd_10_variance8x8, vpx_highbd_10_sub_pixel_variance8x8,
-            vpx_highbd_10_sub_pixel_avg_variance8x8, vpx_highbd_sad8x8x3_bits10,
-            vpx_highbd_sad8x8x8_bits10, vpx_highbd_sad8x8x4d_bits10)
+            BLOCK_8X8, aom_highbd_sad8x8_bits10, aom_highbd_sad8x8_avg_bits10,
+            aom_highbd_10_variance8x8, aom_highbd_10_sub_pixel_variance8x8,
+            aom_highbd_10_sub_pixel_avg_variance8x8, aom_highbd_sad8x8x3_bits10,
+            aom_highbd_sad8x8x8_bits10, aom_highbd_sad8x8x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_8X4, vpx_highbd_sad8x4_bits10,
-                   vpx_highbd_sad8x4_avg_bits10, vpx_highbd_10_variance8x4,
-                   vpx_highbd_10_sub_pixel_variance8x4,
-                   vpx_highbd_10_sub_pixel_avg_variance8x4, NULL,
-                   vpx_highbd_sad8x4x8_bits10, vpx_highbd_sad8x4x4d_bits10)
+        HIGHBD_BFP(BLOCK_8X4, aom_highbd_sad8x4_bits10,
+                   aom_highbd_sad8x4_avg_bits10, aom_highbd_10_variance8x4,
+                   aom_highbd_10_sub_pixel_variance8x4,
+                   aom_highbd_10_sub_pixel_avg_variance8x4, NULL,
+                   aom_highbd_sad8x4x8_bits10, aom_highbd_sad8x4x4d_bits10)
 
-        HIGHBD_BFP(BLOCK_4X8, vpx_highbd_sad4x8_bits10,
-                   vpx_highbd_sad4x8_avg_bits10, vpx_highbd_10_variance4x8,
-                   vpx_highbd_10_sub_pixel_variance4x8,
-                   vpx_highbd_10_sub_pixel_avg_variance4x8, NULL,
-                   vpx_highbd_sad4x8x8_bits10, vpx_highbd_sad4x8x4d_bits10)
+        HIGHBD_BFP(BLOCK_4X8, aom_highbd_sad4x8_bits10,
+                   aom_highbd_sad4x8_avg_bits10, aom_highbd_10_variance4x8,
+                   aom_highbd_10_sub_pixel_variance4x8,
+                   aom_highbd_10_sub_pixel_avg_variance4x8, NULL,
+                   aom_highbd_sad4x8x8_bits10, aom_highbd_sad4x8x4d_bits10)
 
         HIGHBD_BFP(
-            BLOCK_4X4, vpx_highbd_sad4x4_bits10, vpx_highbd_sad4x4_avg_bits10,
-            vpx_highbd_10_variance4x4, vpx_highbd_10_sub_pixel_variance4x4,
-            vpx_highbd_10_sub_pixel_avg_variance4x4, vpx_highbd_sad4x4x3_bits10,
-            vpx_highbd_sad4x4x8_bits10, vpx_highbd_sad4x4x4d_bits10)
+            BLOCK_4X4, aom_highbd_sad4x4_bits10, aom_highbd_sad4x4_avg_bits10,
+            aom_highbd_10_variance4x4, aom_highbd_10_sub_pixel_variance4x4,
+            aom_highbd_10_sub_pixel_avg_variance4x4, aom_highbd_sad4x4x3_bits10,
+            aom_highbd_sad4x4x8_bits10, aom_highbd_sad4x4x4d_bits10)
         break;
 
       case VPX_BITS_12:
-        HIGHBD_BFP(BLOCK_32X16, vpx_highbd_sad32x16_bits12,
-                   vpx_highbd_sad32x16_avg_bits12, vpx_highbd_12_variance32x16,
-                   vpx_highbd_12_sub_pixel_variance32x16,
-                   vpx_highbd_12_sub_pixel_avg_variance32x16, NULL, NULL,
-                   vpx_highbd_sad32x16x4d_bits12)
+        HIGHBD_BFP(BLOCK_32X16, aom_highbd_sad32x16_bits12,
+                   aom_highbd_sad32x16_avg_bits12, aom_highbd_12_variance32x16,
+                   aom_highbd_12_sub_pixel_variance32x16,
+                   aom_highbd_12_sub_pixel_avg_variance32x16, NULL, NULL,
+                   aom_highbd_sad32x16x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_16X32, vpx_highbd_sad16x32_bits12,
-                   vpx_highbd_sad16x32_avg_bits12, vpx_highbd_12_variance16x32,
-                   vpx_highbd_12_sub_pixel_variance16x32,
-                   vpx_highbd_12_sub_pixel_avg_variance16x32, NULL, NULL,
-                   vpx_highbd_sad16x32x4d_bits12)
+        HIGHBD_BFP(BLOCK_16X32, aom_highbd_sad16x32_bits12,
+                   aom_highbd_sad16x32_avg_bits12, aom_highbd_12_variance16x32,
+                   aom_highbd_12_sub_pixel_variance16x32,
+                   aom_highbd_12_sub_pixel_avg_variance16x32, NULL, NULL,
+                   aom_highbd_sad16x32x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_64X32, vpx_highbd_sad64x32_bits12,
-                   vpx_highbd_sad64x32_avg_bits12, vpx_highbd_12_variance64x32,
-                   vpx_highbd_12_sub_pixel_variance64x32,
-                   vpx_highbd_12_sub_pixel_avg_variance64x32, NULL, NULL,
-                   vpx_highbd_sad64x32x4d_bits12)
+        HIGHBD_BFP(BLOCK_64X32, aom_highbd_sad64x32_bits12,
+                   aom_highbd_sad64x32_avg_bits12, aom_highbd_12_variance64x32,
+                   aom_highbd_12_sub_pixel_variance64x32,
+                   aom_highbd_12_sub_pixel_avg_variance64x32, NULL, NULL,
+                   aom_highbd_sad64x32x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_32X64, vpx_highbd_sad32x64_bits12,
-                   vpx_highbd_sad32x64_avg_bits12, vpx_highbd_12_variance32x64,
-                   vpx_highbd_12_sub_pixel_variance32x64,
-                   vpx_highbd_12_sub_pixel_avg_variance32x64, NULL, NULL,
-                   vpx_highbd_sad32x64x4d_bits12)
+        HIGHBD_BFP(BLOCK_32X64, aom_highbd_sad32x64_bits12,
+                   aom_highbd_sad32x64_avg_bits12, aom_highbd_12_variance32x64,
+                   aom_highbd_12_sub_pixel_variance32x64,
+                   aom_highbd_12_sub_pixel_avg_variance32x64, NULL, NULL,
+                   aom_highbd_sad32x64x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_32X32, vpx_highbd_sad32x32_bits12,
-                   vpx_highbd_sad32x32_avg_bits12, vpx_highbd_12_variance32x32,
-                   vpx_highbd_12_sub_pixel_variance32x32,
-                   vpx_highbd_12_sub_pixel_avg_variance32x32,
-                   vpx_highbd_sad32x32x3_bits12, vpx_highbd_sad32x32x8_bits12,
-                   vpx_highbd_sad32x32x4d_bits12)
+        HIGHBD_BFP(BLOCK_32X32, aom_highbd_sad32x32_bits12,
+                   aom_highbd_sad32x32_avg_bits12, aom_highbd_12_variance32x32,
+                   aom_highbd_12_sub_pixel_variance32x32,
+                   aom_highbd_12_sub_pixel_avg_variance32x32,
+                   aom_highbd_sad32x32x3_bits12, aom_highbd_sad32x32x8_bits12,
+                   aom_highbd_sad32x32x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_64X64, vpx_highbd_sad64x64_bits12,
-                   vpx_highbd_sad64x64_avg_bits12, vpx_highbd_12_variance64x64,
-                   vpx_highbd_12_sub_pixel_variance64x64,
-                   vpx_highbd_12_sub_pixel_avg_variance64x64,
-                   vpx_highbd_sad64x64x3_bits12, vpx_highbd_sad64x64x8_bits12,
-                   vpx_highbd_sad64x64x4d_bits12)
+        HIGHBD_BFP(BLOCK_64X64, aom_highbd_sad64x64_bits12,
+                   aom_highbd_sad64x64_avg_bits12, aom_highbd_12_variance64x64,
+                   aom_highbd_12_sub_pixel_variance64x64,
+                   aom_highbd_12_sub_pixel_avg_variance64x64,
+                   aom_highbd_sad64x64x3_bits12, aom_highbd_sad64x64x8_bits12,
+                   aom_highbd_sad64x64x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_16X16, vpx_highbd_sad16x16_bits12,
-                   vpx_highbd_sad16x16_avg_bits12, vpx_highbd_12_variance16x16,
-                   vpx_highbd_12_sub_pixel_variance16x16,
-                   vpx_highbd_12_sub_pixel_avg_variance16x16,
-                   vpx_highbd_sad16x16x3_bits12, vpx_highbd_sad16x16x8_bits12,
-                   vpx_highbd_sad16x16x4d_bits12)
+        HIGHBD_BFP(BLOCK_16X16, aom_highbd_sad16x16_bits12,
+                   aom_highbd_sad16x16_avg_bits12, aom_highbd_12_variance16x16,
+                   aom_highbd_12_sub_pixel_variance16x16,
+                   aom_highbd_12_sub_pixel_avg_variance16x16,
+                   aom_highbd_sad16x16x3_bits12, aom_highbd_sad16x16x8_bits12,
+                   aom_highbd_sad16x16x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_16X8, vpx_highbd_sad16x8_bits12,
-                   vpx_highbd_sad16x8_avg_bits12, vpx_highbd_12_variance16x8,
-                   vpx_highbd_12_sub_pixel_variance16x8,
-                   vpx_highbd_12_sub_pixel_avg_variance16x8,
-                   vpx_highbd_sad16x8x3_bits12, vpx_highbd_sad16x8x8_bits12,
-                   vpx_highbd_sad16x8x4d_bits12)
+        HIGHBD_BFP(BLOCK_16X8, aom_highbd_sad16x8_bits12,
+                   aom_highbd_sad16x8_avg_bits12, aom_highbd_12_variance16x8,
+                   aom_highbd_12_sub_pixel_variance16x8,
+                   aom_highbd_12_sub_pixel_avg_variance16x8,
+                   aom_highbd_sad16x8x3_bits12, aom_highbd_sad16x8x8_bits12,
+                   aom_highbd_sad16x8x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_8X16, vpx_highbd_sad8x16_bits12,
-                   vpx_highbd_sad8x16_avg_bits12, vpx_highbd_12_variance8x16,
-                   vpx_highbd_12_sub_pixel_variance8x16,
-                   vpx_highbd_12_sub_pixel_avg_variance8x16,
-                   vpx_highbd_sad8x16x3_bits12, vpx_highbd_sad8x16x8_bits12,
-                   vpx_highbd_sad8x16x4d_bits12)
+        HIGHBD_BFP(BLOCK_8X16, aom_highbd_sad8x16_bits12,
+                   aom_highbd_sad8x16_avg_bits12, aom_highbd_12_variance8x16,
+                   aom_highbd_12_sub_pixel_variance8x16,
+                   aom_highbd_12_sub_pixel_avg_variance8x16,
+                   aom_highbd_sad8x16x3_bits12, aom_highbd_sad8x16x8_bits12,
+                   aom_highbd_sad8x16x4d_bits12)
 
         HIGHBD_BFP(
-            BLOCK_8X8, vpx_highbd_sad8x8_bits12, vpx_highbd_sad8x8_avg_bits12,
-            vpx_highbd_12_variance8x8, vpx_highbd_12_sub_pixel_variance8x8,
-            vpx_highbd_12_sub_pixel_avg_variance8x8, vpx_highbd_sad8x8x3_bits12,
-            vpx_highbd_sad8x8x8_bits12, vpx_highbd_sad8x8x4d_bits12)
+            BLOCK_8X8, aom_highbd_sad8x8_bits12, aom_highbd_sad8x8_avg_bits12,
+            aom_highbd_12_variance8x8, aom_highbd_12_sub_pixel_variance8x8,
+            aom_highbd_12_sub_pixel_avg_variance8x8, aom_highbd_sad8x8x3_bits12,
+            aom_highbd_sad8x8x8_bits12, aom_highbd_sad8x8x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_8X4, vpx_highbd_sad8x4_bits12,
-                   vpx_highbd_sad8x4_avg_bits12, vpx_highbd_12_variance8x4,
-                   vpx_highbd_12_sub_pixel_variance8x4,
-                   vpx_highbd_12_sub_pixel_avg_variance8x4, NULL,
-                   vpx_highbd_sad8x4x8_bits12, vpx_highbd_sad8x4x4d_bits12)
+        HIGHBD_BFP(BLOCK_8X4, aom_highbd_sad8x4_bits12,
+                   aom_highbd_sad8x4_avg_bits12, aom_highbd_12_variance8x4,
+                   aom_highbd_12_sub_pixel_variance8x4,
+                   aom_highbd_12_sub_pixel_avg_variance8x4, NULL,
+                   aom_highbd_sad8x4x8_bits12, aom_highbd_sad8x4x4d_bits12)
 
-        HIGHBD_BFP(BLOCK_4X8, vpx_highbd_sad4x8_bits12,
-                   vpx_highbd_sad4x8_avg_bits12, vpx_highbd_12_variance4x8,
-                   vpx_highbd_12_sub_pixel_variance4x8,
-                   vpx_highbd_12_sub_pixel_avg_variance4x8, NULL,
-                   vpx_highbd_sad4x8x8_bits12, vpx_highbd_sad4x8x4d_bits12)
+        HIGHBD_BFP(BLOCK_4X8, aom_highbd_sad4x8_bits12,
+                   aom_highbd_sad4x8_avg_bits12, aom_highbd_12_variance4x8,
+                   aom_highbd_12_sub_pixel_variance4x8,
+                   aom_highbd_12_sub_pixel_avg_variance4x8, NULL,
+                   aom_highbd_sad4x8x8_bits12, aom_highbd_sad4x8x4d_bits12)
 
         HIGHBD_BFP(
-            BLOCK_4X4, vpx_highbd_sad4x4_bits12, vpx_highbd_sad4x4_avg_bits12,
-            vpx_highbd_12_variance4x4, vpx_highbd_12_sub_pixel_variance4x4,
-            vpx_highbd_12_sub_pixel_avg_variance4x4, vpx_highbd_sad4x4x3_bits12,
-            vpx_highbd_sad4x4x8_bits12, vpx_highbd_sad4x4x4d_bits12)
+            BLOCK_4X4, aom_highbd_sad4x4_bits12, aom_highbd_sad4x4_avg_bits12,
+            aom_highbd_12_variance4x4, aom_highbd_12_sub_pixel_variance4x4,
+            aom_highbd_12_sub_pixel_avg_variance4x4, aom_highbd_sad4x4x3_bits12,
+            aom_highbd_sad4x4x8_bits12, aom_highbd_sad4x4x4d_bits12)
         break;
 
       default:
@@ -1194,9 +1194,9 @@
   VP10_COMMON *const cm = &cpi->common;
 
   // Create the encoder segmentation map and set all entries to 0
-  vpx_free(cpi->segmentation_map);
+  aom_free(cpi->segmentation_map);
   CHECK_MEM_ERROR(cm, cpi->segmentation_map,
-                  vpx_calloc(cm->mi_rows * cm->mi_cols, 1));
+                  aom_calloc(cm->mi_rows * cm->mi_cols, 1));
 
   // Create a map used for cyclic background refresh.
   if (cpi->cyclic_refresh) vp10_cyclic_refresh_free(cpi->cyclic_refresh);
@@ -1204,15 +1204,15 @@
                   vp10_cyclic_refresh_alloc(cm->mi_rows, cm->mi_cols));
 
   // Create a map used to mark inactive areas.
-  vpx_free(cpi->active_map.map);
+  aom_free(cpi->active_map.map);
   CHECK_MEM_ERROR(cm, cpi->active_map.map,
-                  vpx_calloc(cm->mi_rows * cm->mi_cols, 1));
+                  aom_calloc(cm->mi_rows * cm->mi_cols, 1));
 
   // And a place holder structure is the coding context
   // for use if we want to save and restore it
-  vpx_free(cpi->coding_context.last_frame_seg_map_copy);
+  aom_free(cpi->coding_context.last_frame_seg_map_copy);
   CHECK_MEM_ERROR(cm, cpi->coding_context.last_frame_seg_map_copy,
-                  vpx_calloc(cm->mi_rows * cm->mi_cols, 1));
+                  aom_calloc(cm->mi_rows * cm->mi_cols, 1));
 }
 
 void vp10_change_config(struct VP10_COMP *cpi, const VP10EncoderConfig *oxcf) {
@@ -1360,7 +1360,7 @@
 VP10_COMP *vp10_create_compressor(VP10EncoderConfig *oxcf,
                                   BufferPool *const pool) {
   unsigned int i;
-  VP10_COMP *volatile const cpi = vpx_memalign(32, sizeof(VP10_COMP));
+  VP10_COMP *volatile const cpi = aom_memalign(32, sizeof(VP10_COMP));
   VP10_COMMON *volatile const cm = cpi != NULL ? &cpi->common : NULL;
 
   if (!cm) return NULL;
@@ -1378,10 +1378,10 @@
   cm->free_mi = vp10_enc_free_mi;
   cm->setup_mi = vp10_enc_setup_mi;
 
-  CHECK_MEM_ERROR(cm, cm->fc, (FRAME_CONTEXT *)vpx_calloc(1, sizeof(*cm->fc)));
+  CHECK_MEM_ERROR(cm, cm->fc, (FRAME_CONTEXT *)aom_calloc(1, sizeof(*cm->fc)));
   CHECK_MEM_ERROR(
       cm, cm->frame_contexts,
-      (FRAME_CONTEXT *)vpx_calloc(FRAME_CONTEXTS, sizeof(*cm->frame_contexts)));
+      (FRAME_CONTEXT *)aom_calloc(FRAME_CONTEXTS, sizeof(*cm->frame_contexts)));
 
   cpi->resize_state = 0;
   cpi->resize_avg_qp = 0;
@@ -1398,27 +1398,27 @@
   realloc_segmentation_maps(cpi);
 
   CHECK_MEM_ERROR(cm, cpi->nmvcosts[0],
-                  vpx_calloc(MV_VALS, sizeof(*cpi->nmvcosts[0])));
+                  aom_calloc(MV_VALS, sizeof(*cpi->nmvcosts[0])));
   CHECK_MEM_ERROR(cm, cpi->nmvcosts[1],
-                  vpx_calloc(MV_VALS, sizeof(*cpi->nmvcosts[1])));
+                  aom_calloc(MV_VALS, sizeof(*cpi->nmvcosts[1])));
   CHECK_MEM_ERROR(cm, cpi->nmvcosts_hp[0],
-                  vpx_calloc(MV_VALS, sizeof(*cpi->nmvcosts_hp[0])));
+                  aom_calloc(MV_VALS, sizeof(*cpi->nmvcosts_hp[0])));
   CHECK_MEM_ERROR(cm, cpi->nmvcosts_hp[1],
-                  vpx_calloc(MV_VALS, sizeof(*cpi->nmvcosts_hp[1])));
+                  aom_calloc(MV_VALS, sizeof(*cpi->nmvcosts_hp[1])));
   CHECK_MEM_ERROR(cm, cpi->nmvsadcosts[0],
-                  vpx_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts[0])));
+                  aom_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts[0])));
   CHECK_MEM_ERROR(cm, cpi->nmvsadcosts[1],
-                  vpx_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts[1])));
+                  aom_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts[1])));
   CHECK_MEM_ERROR(cm, cpi->nmvsadcosts_hp[0],
-                  vpx_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts_hp[0])));
+                  aom_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts_hp[0])));
   CHECK_MEM_ERROR(cm, cpi->nmvsadcosts_hp[1],
-                  vpx_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts_hp[1])));
+                  aom_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts_hp[1])));
 
   for (i = 0; i < (sizeof(cpi->mbgraph_stats) / sizeof(cpi->mbgraph_stats[0]));
        i++) {
     CHECK_MEM_ERROR(
         cm, cpi->mbgraph_stats[i].mb_stats,
-        vpx_calloc(cm->MBs * sizeof(*cpi->mbgraph_stats[i].mb_stats), 1));
+        aom_calloc(cm->MBs * sizeof(*cpi->mbgraph_stats[i].mb_stats), 1));
   }
 
 #if CONFIG_FP_MB_STATS
@@ -1426,7 +1426,7 @@
   if (cpi->use_fp_mb_stats) {
     // a place holder used to store the first pass mb stats in the first pass
     CHECK_MEM_ERROR(cm, cpi->twopass.frame_mb_stats_buf,
-                    vpx_calloc(cm->MBs * sizeof(uint8_t), 1));
+                    aom_calloc(cm->MBs * sizeof(uint8_t), 1));
   } else {
     cpi->twopass.frame_mb_stats_buf = NULL;
   }
@@ -1474,7 +1474,7 @@
   }
 
   if (cpi->b_calculate_consistency) {
-    cpi->ssim_vars = vpx_malloc(sizeof(*cpi->ssim_vars) * 4 *
+    cpi->ssim_vars = aom_malloc(sizeof(*cpi->ssim_vars) * 4 *
                                 cpi->common.mi_rows * cpi->common.mi_cols);
     cpi->worst_consistency = 100.0;
   }
@@ -1540,7 +1540,7 @@
   vp10_set_speed_features_framesize_dependent(cpi);
 
   // Allocate memory to store variances for a frame.
-  CHECK_MEM_ERROR(cm, cpi->source_diff_var, vpx_calloc(cm->MBs, sizeof(diff)));
+  CHECK_MEM_ERROR(cm, cpi->source_diff_var, aom_calloc(cm->MBs, sizeof(diff)));
   cpi->source_var_thresh = 0;
   cpi->frames_till_next_var_check = 0;
 
@@ -1554,57 +1554,57 @@
   cpi->fn_ptr[BT].sdx8f = SDX8F;                                \
   cpi->fn_ptr[BT].sdx4df = SDX4DF;
 
-  BFP(BLOCK_32X16, vpx_sad32x16, vpx_sad32x16_avg, vpx_variance32x16,
-      vpx_sub_pixel_variance32x16, vpx_sub_pixel_avg_variance32x16, NULL, NULL,
-      vpx_sad32x16x4d)
+  BFP(BLOCK_32X16, aom_sad32x16, aom_sad32x16_avg, aom_variance32x16,
+      aom_sub_pixel_variance32x16, aom_sub_pixel_avg_variance32x16, NULL, NULL,
+      aom_sad32x16x4d)
 
-  BFP(BLOCK_16X32, vpx_sad16x32, vpx_sad16x32_avg, vpx_variance16x32,
-      vpx_sub_pixel_variance16x32, vpx_sub_pixel_avg_variance16x32, NULL, NULL,
-      vpx_sad16x32x4d)
+  BFP(BLOCK_16X32, aom_sad16x32, aom_sad16x32_avg, aom_variance16x32,
+      aom_sub_pixel_variance16x32, aom_sub_pixel_avg_variance16x32, NULL, NULL,
+      aom_sad16x32x4d)
 
-  BFP(BLOCK_64X32, vpx_sad64x32, vpx_sad64x32_avg, vpx_variance64x32,
-      vpx_sub_pixel_variance64x32, vpx_sub_pixel_avg_variance64x32, NULL, NULL,
-      vpx_sad64x32x4d)
+  BFP(BLOCK_64X32, aom_sad64x32, aom_sad64x32_avg, aom_variance64x32,
+      aom_sub_pixel_variance64x32, aom_sub_pixel_avg_variance64x32, NULL, NULL,
+      aom_sad64x32x4d)
 
-  BFP(BLOCK_32X64, vpx_sad32x64, vpx_sad32x64_avg, vpx_variance32x64,
-      vpx_sub_pixel_variance32x64, vpx_sub_pixel_avg_variance32x64, NULL, NULL,
-      vpx_sad32x64x4d)
+  BFP(BLOCK_32X64, aom_sad32x64, aom_sad32x64_avg, aom_variance32x64,
+      aom_sub_pixel_variance32x64, aom_sub_pixel_avg_variance32x64, NULL, NULL,
+      aom_sad32x64x4d)
 
-  BFP(BLOCK_32X32, vpx_sad32x32, vpx_sad32x32_avg, vpx_variance32x32,
-      vpx_sub_pixel_variance32x32, vpx_sub_pixel_avg_variance32x32,
-      vpx_sad32x32x3, vpx_sad32x32x8, vpx_sad32x32x4d)
+  BFP(BLOCK_32X32, aom_sad32x32, aom_sad32x32_avg, aom_variance32x32,
+      aom_sub_pixel_variance32x32, aom_sub_pixel_avg_variance32x32,
+      aom_sad32x32x3, aom_sad32x32x8, aom_sad32x32x4d)
 
-  BFP(BLOCK_64X64, vpx_sad64x64, vpx_sad64x64_avg, vpx_variance64x64,
-      vpx_sub_pixel_variance64x64, vpx_sub_pixel_avg_variance64x64,
-      vpx_sad64x64x3, vpx_sad64x64x8, vpx_sad64x64x4d)
+  BFP(BLOCK_64X64, aom_sad64x64, aom_sad64x64_avg, aom_variance64x64,
+      aom_sub_pixel_variance64x64, aom_sub_pixel_avg_variance64x64,
+      aom_sad64x64x3, aom_sad64x64x8, aom_sad64x64x4d)
 
-  BFP(BLOCK_16X16, vpx_sad16x16, vpx_sad16x16_avg, vpx_variance16x16,
-      vpx_sub_pixel_variance16x16, vpx_sub_pixel_avg_variance16x16,
-      vpx_sad16x16x3, vpx_sad16x16x8, vpx_sad16x16x4d)
+  BFP(BLOCK_16X16, aom_sad16x16, aom_sad16x16_avg, aom_variance16x16,
+      aom_sub_pixel_variance16x16, aom_sub_pixel_avg_variance16x16,
+      aom_sad16x16x3, aom_sad16x16x8, aom_sad16x16x4d)
 
-  BFP(BLOCK_16X8, vpx_sad16x8, vpx_sad16x8_avg, vpx_variance16x8,
-      vpx_sub_pixel_variance16x8, vpx_sub_pixel_avg_variance16x8, vpx_sad16x8x3,
-      vpx_sad16x8x8, vpx_sad16x8x4d)
+  BFP(BLOCK_16X8, aom_sad16x8, aom_sad16x8_avg, aom_variance16x8,
+      aom_sub_pixel_variance16x8, aom_sub_pixel_avg_variance16x8, aom_sad16x8x3,
+      aom_sad16x8x8, aom_sad16x8x4d)
 
-  BFP(BLOCK_8X16, vpx_sad8x16, vpx_sad8x16_avg, vpx_variance8x16,
-      vpx_sub_pixel_variance8x16, vpx_sub_pixel_avg_variance8x16, vpx_sad8x16x3,
-      vpx_sad8x16x8, vpx_sad8x16x4d)
+  BFP(BLOCK_8X16, aom_sad8x16, aom_sad8x16_avg, aom_variance8x16,
+      aom_sub_pixel_variance8x16, aom_sub_pixel_avg_variance8x16, aom_sad8x16x3,
+      aom_sad8x16x8, aom_sad8x16x4d)
 
-  BFP(BLOCK_8X8, vpx_sad8x8, vpx_sad8x8_avg, vpx_variance8x8,
-      vpx_sub_pixel_variance8x8, vpx_sub_pixel_avg_variance8x8, vpx_sad8x8x3,
-      vpx_sad8x8x8, vpx_sad8x8x4d)
+  BFP(BLOCK_8X8, aom_sad8x8, aom_sad8x8_avg, aom_variance8x8,
+      aom_sub_pixel_variance8x8, aom_sub_pixel_avg_variance8x8, aom_sad8x8x3,
+      aom_sad8x8x8, aom_sad8x8x4d)
 
-  BFP(BLOCK_8X4, vpx_sad8x4, vpx_sad8x4_avg, vpx_variance8x4,
-      vpx_sub_pixel_variance8x4, vpx_sub_pixel_avg_variance8x4, NULL,
-      vpx_sad8x4x8, vpx_sad8x4x4d)
+  BFP(BLOCK_8X4, aom_sad8x4, aom_sad8x4_avg, aom_variance8x4,
+      aom_sub_pixel_variance8x4, aom_sub_pixel_avg_variance8x4, NULL,
+      aom_sad8x4x8, aom_sad8x4x4d)
 
-  BFP(BLOCK_4X8, vpx_sad4x8, vpx_sad4x8_avg, vpx_variance4x8,
-      vpx_sub_pixel_variance4x8, vpx_sub_pixel_avg_variance4x8, NULL,
-      vpx_sad4x8x8, vpx_sad4x8x4d)
+  BFP(BLOCK_4X8, aom_sad4x8, aom_sad4x8_avg, aom_variance4x8,
+      aom_sub_pixel_variance4x8, aom_sub_pixel_avg_variance4x8, NULL,
+      aom_sad4x8x8, aom_sad4x8x4d)
 
-  BFP(BLOCK_4X4, vpx_sad4x4, vpx_sad4x4_avg, vpx_variance4x4,
-      vpx_sub_pixel_variance4x4, vpx_sub_pixel_avg_variance4x4, vpx_sad4x4x3,
-      vpx_sad4x4x8, vpx_sad4x4x4d)
+  BFP(BLOCK_4X4, aom_sad4x4, aom_sad4x4_avg, aom_variance4x4,
+      aom_sub_pixel_variance4x4, aom_sub_pixel_avg_variance4x4, aom_sad4x4x3,
+      aom_sad4x4x8, aom_sad4x4x4d)
 
 #if CONFIG_VPX_HIGHBITDEPTH
   highbd_set_var_fns(cpi);
@@ -1641,7 +1641,7 @@
   cm = &cpi->common;
   if (cm->current_video_frame > 0) {
 #if CONFIG_INTERNAL_STATS
-    vpx_clear_system_state();
+    aom_clear_system_state();
 
     if (cpi->oxcf.pass != 1) {
       char headings[512] = { 0 };
@@ -1657,9 +1657,9 @@
       const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1);
 
       if (cpi->b_calculate_psnr) {
-        const double total_psnr = vpx_sse_to_psnr(
+        const double total_psnr = aom_sse_to_psnr(
             (double)cpi->total_samples, peak, (double)cpi->total_sq_error);
-        const double totalp_psnr = vpx_sse_to_psnr(
+        const double totalp_psnr = aom_sse_to_psnr(
             (double)cpi->totalp_samples, peak, (double)cpi->totalp_sq_error);
         const double total_ssim =
             100 * pow(cpi->summed_quality / cpi->summed_weights, 8.0);
@@ -1688,7 +1688,7 @@
 
         if (cpi->b_calculate_consistency) {
           double consistency =
-              vpx_sse_to_psnr((double)cpi->totalp_samples, peak,
+              aom_sse_to_psnr((double)cpi->totalp_samples, peak,
                               (double)cpi->total_inconsistency);
 
           SNPRINT(headings, "\tConsist\tWstCons");
@@ -1728,17 +1728,17 @@
     EncWorkerData *const thread_data = &cpi->tile_thr_data[t];
 
     // Deallocate allocated threads.
-    vpx_get_worker_interface()->end(worker);
+    aom_get_worker_interface()->end(worker);
 
     // Deallocate allocated thread data.
     if (t < cpi->num_workers - 1) {
-      vpx_free(thread_data->td->counts);
+      aom_free(thread_data->td->counts);
       vp10_free_pc_tree(thread_data->td);
-      vpx_free(thread_data->td);
+      aom_free(thread_data->td);
     }
   }
-  vpx_free(cpi->tile_thr_data);
-  vpx_free(cpi->workers);
+  aom_free(cpi->tile_thr_data);
+  aom_free(cpi->workers);
 
   if (cpi->num_workers > 1) vp10_loop_filter_dealloc(&cpi->lf_row_sync);
 
@@ -1746,19 +1746,19 @@
 
   for (i = 0; i < sizeof(cpi->mbgraph_stats) / sizeof(cpi->mbgraph_stats[0]);
        ++i) {
-    vpx_free(cpi->mbgraph_stats[i].mb_stats);
+    aom_free(cpi->mbgraph_stats[i].mb_stats);
   }
 
 #if CONFIG_FP_MB_STATS
   if (cpi->use_fp_mb_stats) {
-    vpx_free(cpi->twopass.frame_mb_stats_buf);
+    aom_free(cpi->twopass.frame_mb_stats_buf);
     cpi->twopass.frame_mb_stats_buf = NULL;
   }
 #endif
 
   vp10_remove_common(cm);
   vp10_free_ref_frame_buffers(cm->buffer_pool);
-  vpx_free(cpi);
+  aom_free(cpi);
 
 #ifdef OUTPUT_YUV_SKINMAP
   fclose(yuv_skinmap_file);
@@ -1864,7 +1864,7 @@
     const uint8_t *pa = a;
     const uint8_t *pb = b;
     for (x = 0; x < width / 16; ++x) {
-      vpx_mse16x16(pa, a_stride, pb, b_stride, &sse);
+      aom_mse16x16(pa, a_stride, pb, b_stride, &sse);
       total_sse += sse;
 
       pa += 16;
@@ -1921,7 +1921,7 @@
     const uint8_t *pa = a;
     const uint8_t *pb = b;
     for (x = 0; x < width / 16; ++x) {
-      vpx_highbd_8_mse16x16(pa, a_stride, pb, b_stride, &sse);
+      aom_highbd_8_mse16x16(pa, a_stride, pb, b_stride, &sse);
       total_sse += sse;
       pa += 16;
       pb += 16;
@@ -1975,7 +1975,7 @@
     }
     psnr->sse[1 + i] = sse;
     psnr->samples[1 + i] = samples;
-    psnr->psnr[1 + i] = vpx_sse_to_psnr(samples, peak, (double)sse);
+    psnr->psnr[1 + i] = aom_sse_to_psnr(samples, peak, (double)sse);
 
     total_sse += sse;
     total_samples += samples;
@@ -1984,7 +1984,7 @@
   psnr->sse[0] = total_sse;
   psnr->samples[0] = total_samples;
   psnr->psnr[0] =
-      vpx_sse_to_psnr((double)total_samples, peak, (double)total_sse);
+      aom_sse_to_psnr((double)total_samples, peak, (double)total_sse);
 }
 
 #else   // !CONFIG_VPX_HIGHBITDEPTH
@@ -2011,7 +2011,7 @@
         get_sse(a_planes[i], a_strides[i], b_planes[i], b_strides[i], w, h);
     psnr->sse[1 + i] = sse;
     psnr->samples[1 + i] = samples;
-    psnr->psnr[1 + i] = vpx_sse_to_psnr(samples, peak, (double)sse);
+    psnr->psnr[1 + i] = aom_sse_to_psnr(samples, peak, (double)sse);
 
     total_sse += sse;
     total_samples += samples;
@@ -2020,12 +2020,12 @@
   psnr->sse[0] = total_sse;
   psnr->samples[0] = total_samples;
   psnr->psnr[0] =
-      vpx_sse_to_psnr((double)total_samples, peak, (double)total_sse);
+      aom_sse_to_psnr((double)total_samples, peak, (double)total_sse);
 }
 #endif  // CONFIG_VPX_HIGHBITDEPTH
 
 static void generate_psnr_packet(VP10_COMP *cpi) {
-  struct vpx_codec_cx_pkt pkt;
+  struct aom_codec_cx_pkt pkt;
   int i;
   PSNR_STATS psnr;
 #if CONFIG_VPX_HIGHBITDEPTH
@@ -2041,7 +2041,7 @@
     pkt.data.psnr.psnr[i] = psnr.psnr[i];
   }
   pkt.kind = VPX_CODEC_PSNR_PKT;
-  vpx_codec_pkt_list_add(cpi->output_pkt_list, &pkt);
+  aom_codec_pkt_list_add(cpi->output_pkt_list, &pkt);
 }
 
 int vp10_use_as_reference(VP10_COMP *cpi, int ref_frame_flags) {
@@ -2075,7 +2075,7 @@
                             YV12_BUFFER_CONFIG *sd) {
   YV12_BUFFER_CONFIG *cfg = get_vp10_ref_frame_buffer(cpi, ref_frame_flag);
   if (cfg) {
-    vpx_yv12_copy_frame(cfg, sd);
+    aom_yv12_copy_frame(cfg, sd);
     return 0;
   } else {
     return -1;
@@ -2086,7 +2086,7 @@
                            YV12_BUFFER_CONFIG *sd) {
   YV12_BUFFER_CONFIG *cfg = get_vp10_ref_frame_buffer(cpi, ref_frame_flag);
   if (cfg) {
-    vpx_yv12_copy_frame(sd, cfg);
+    aom_yv12_copy_frame(sd, cfg);
     return 0;
   } else {
     return -1;
@@ -2200,7 +2200,7 @@
 static void scale_and_extend_frame_nonnormative(const YV12_BUFFER_CONFIG *src,
                                                 YV12_BUFFER_CONFIG *dst) {
 #endif  // CONFIG_VPX_HIGHBITDEPTH
-  // TODO(dkovalev): replace YV12_BUFFER_CONFIG with vpx_image_t
+  // TODO(dkovalev): replace YV12_BUFFER_CONFIG with aom_image_t
   int i;
   const uint8_t *const srcs[3] = { src->y_buffer, src->u_buffer,
                                    src->v_buffer };
@@ -2231,7 +2231,7 @@
                       dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]);
 #endif  // CONFIG_VPX_HIGHBITDEPTH
   }
-  vpx_extend_frame_borders(dst);
+  aom_extend_frame_borders(dst);
 }
 
 #if CONFIG_VPX_HIGHBITDEPTH
@@ -2268,18 +2268,18 @@
 
 #if CONFIG_VPX_HIGHBITDEPTH
         if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
-          vpx_highbd_convolve8(src_ptr, src_stride, dst_ptr, dst_stride,
+          aom_highbd_convolve8(src_ptr, src_stride, dst_ptr, dst_stride,
                                kernel[x_q4 & 0xf], 16 * src_w / dst_w,
                                kernel[y_q4 & 0xf], 16 * src_h / dst_h,
                                16 / factor, 16 / factor, bd);
         } else {
-          vpx_convolve8(src_ptr, src_stride, dst_ptr, dst_stride,
+          aom_convolve8(src_ptr, src_stride, dst_ptr, dst_stride,
                         kernel[x_q4 & 0xf], 16 * src_w / dst_w,
                         kernel[y_q4 & 0xf], 16 * src_h / dst_h, 16 / factor,
                         16 / factor);
         }
 #else
-        vpx_convolve8(src_ptr, src_stride, dst_ptr, dst_stride,
+        aom_convolve8(src_ptr, src_stride, dst_ptr, dst_stride,
                       kernel[x_q4 & 0xf], 16 * src_w / dst_w,
                       kernel[y_q4 & 0xf], 16 * src_h / dst_h, 16 / factor,
                       16 / factor);
@@ -2288,7 +2288,7 @@
     }
   }
 
-  vpx_extend_frame_borders(dst);
+  aom_extend_frame_borders(dst);
 }
 
 static int scale_down(VP10_COMP *cpi, int q) {
@@ -2414,16 +2414,16 @@
   if (is_lossless_requested(&cpi->oxcf)) {
     lf->filter_level = 0;
   } else {
-    struct vpx_usec_timer timer;
+    struct aom_usec_timer timer;
 
-    vpx_clear_system_state();
+    aom_clear_system_state();
 
-    vpx_usec_timer_start(&timer);
+    aom_usec_timer_start(&timer);
 
     vp10_pick_filter_level(cpi->Source, cpi, cpi->sf.lpf_pick);
 
-    vpx_usec_timer_mark(&timer);
-    cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer);
+    aom_usec_timer_mark(&timer);
+    cpi->time_pick_lpf += aom_usec_timer_elapsed(&timer);
   }
 
   if (lf->filter_level > 0) {
@@ -2459,7 +2459,7 @@
     if (!hq) {  // Don't try filter if the entire image is nearly losslessly
                 // encoded
 #if CLPF_FILTER_ALL_PLANES
-      vpx_yv12_copy_frame(cm->frame_to_show, &cpi->last_frame_uf);
+      aom_yv12_copy_frame(cm->frame_to_show, &cpi->last_frame_uf);
       before =
           get_sse(cpi->Source->y_buffer, cpi->Source->y_stride,
                   cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
@@ -2481,7 +2481,7 @@
                       cm->frame_to_show->v_buffer, cm->frame_to_show->uv_stride,
                       cpi->Source->uv_crop_width, cpi->Source->uv_crop_height);
 #else
-      vpx_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf);
+      aom_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf);
       before = get_sse(cpi->Source->y_buffer, cpi->Source->y_stride,
                        cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
                        cpi->Source->y_crop_width, cpi->Source->y_crop_height);
@@ -2493,9 +2493,9 @@
       if (before < after) {
 // No improvement, restore original
 #if CLPF_FILTER_ALL_PLANES
-        vpx_yv12_copy_frame(&cpi->last_frame_uf, cm->frame_to_show);
+        aom_yv12_copy_frame(&cpi->last_frame_uf, cm->frame_to_show);
 #else
-        vpx_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
+        aom_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
 #endif
       } else {
         cm->clpf = 1;
@@ -2504,15 +2504,15 @@
   }
 #endif
 
-  vpx_extend_frame_inner_borders(cm->frame_to_show);
+  aom_extend_frame_inner_borders(cm->frame_to_show);
 }
 
 static INLINE void alloc_frame_mvs(const VP10_COMMON *cm, int buffer_idx) {
   RefCntBuffer *const new_fb_ptr = &cm->buffer_pool->frame_bufs[buffer_idx];
   if (new_fb_ptr->mvs == NULL || new_fb_ptr->mi_rows < cm->mi_rows ||
       new_fb_ptr->mi_cols < cm->mi_cols) {
-    vpx_free(new_fb_ptr->mvs);
-    new_fb_ptr->mvs = (MV_REF *)vpx_calloc(cm->mi_rows * cm->mi_cols,
+    aom_free(new_fb_ptr->mvs);
+    new_fb_ptr->mvs = (MV_REF *)aom_calloc(cm->mi_rows * cm->mi_cols,
                                            sizeof(*new_fb_ptr->mvs));
     new_fb_ptr->mi_rows = cm->mi_rows;
     new_fb_ptr->mi_cols = cm->mi_cols;
@@ -2550,7 +2550,7 @@
         new_fb_ptr = &pool->frame_bufs[new_fb];
         if (force_scaling || new_fb_ptr->buf.y_crop_width != cm->width ||
             new_fb_ptr->buf.y_crop_height != cm->height) {
-          vpx_realloc_frame_buffer(
+          aom_realloc_frame_buffer(
               &new_fb_ptr->buf, cm->width, cm->height, cm->subsampling_x,
               cm->subsampling_y, cm->use_highbitdepth, VPX_ENC_BORDER_IN_PIXELS,
               cm->byte_alignment, NULL, NULL, NULL);
@@ -2571,7 +2571,7 @@
         new_fb_ptr = &pool->frame_bufs[new_fb];
         if (force_scaling || new_fb_ptr->buf.y_crop_width != cm->width ||
             new_fb_ptr->buf.y_crop_height != cm->height) {
-          vpx_realloc_frame_buffer(&new_fb_ptr->buf, cm->width, cm->height,
+          aom_realloc_frame_buffer(&new_fb_ptr->buf, cm->width, cm->height,
                                    cm->subsampling_x, cm->subsampling_y,
                                    VPX_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
                                    NULL, NULL, NULL);
@@ -2657,7 +2657,7 @@
   FILE *const f = fopen("tmp.stt", cm->current_video_frame ? "a" : "w");
   int64_t recon_err;
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   recon_err = vp10_get_y_sse(cpi->Source, get_frame_new_buffer(cm));
 
@@ -2833,7 +2833,7 @@
   alloc_frame_mvs(cm, cm->new_fb_idx);
 
   // Reset the frame pointers to the current frame size.
-  vpx_realloc_frame_buffer(get_frame_new_buffer(cm), cm->width, cm->height,
+  aom_realloc_frame_buffer(get_frame_new_buffer(cm), cm->width, cm->height,
                            cm->subsampling_x, cm->subsampling_y,
 #if CONFIG_VPX_HIGHBITDEPTH
                            cm->use_highbitdepth,
@@ -2862,7 +2862,7 @@
                                          buf->y_crop_height, cm->width,
                                          cm->height);
 #endif  // CONFIG_VPX_HIGHBITDEPTH
-      if (vp10_is_scaled(&ref_buf->sf)) vpx_extend_frame_borders(buf);
+      if (vp10_is_scaled(&ref_buf->sf)) aom_extend_frame_borders(buf);
     } else {
       ref_buf->buf = NULL;
     }
@@ -2875,7 +2875,7 @@
   VP10_COMMON *const cm = &cpi->common;
   int q = 0, bottom_index = 0, top_index = 0;  // Dummy variables.
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   set_frame_size(cpi);
 
@@ -2934,7 +2934,7 @@
   // Update the skip mb flag probabilities based on the distribution
   // seen in the last encoder iteration.
   // update_base_skip_probs(cpi);
-  vpx_clear_system_state();
+  aom_clear_system_state();
 }
 
 static void encode_with_recode_loop(VP10_COMP *cpi, size_t *size,
@@ -2954,7 +2954,7 @@
   set_size_independent_vars(cpi);
 
   do {
-    vpx_clear_system_state();
+    aom_clear_system_state();
 
     set_frame_size(cpi);
 
@@ -3017,7 +3017,7 @@
     // seen in the last encoder iteration.
     // update_base_skip_probs(cpi);
 
-    vpx_clear_system_state();
+    aom_clear_system_state();
 
     // Dummy pack of the bitstream using up to date stats to get an
     // accurate estimate of output frame size to determine if we need
@@ -3234,8 +3234,8 @@
   if (cm->mi_cols * MI_SIZE != unscaled->y_width ||
       cm->mi_rows * MI_SIZE != unscaled->y_height) {
     // For 2x2 scaling down.
-    vpx_scale_frame(unscaled, scaled, unscaled->y_buffer, 9, 2, 1, 2, 1, 0);
-    vpx_extend_frame_borders(scaled);
+    aom_scale_frame(unscaled, scaled, unscaled->y_buffer, 9, 2, 1, 2, 1, 0);
+    aom_extend_frame_borders(scaled);
     return scaled;
   } else {
     return unscaled;
@@ -3308,7 +3308,7 @@
   TX_SIZE t;
 
   set_ext_overrides(cpi);
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   // Set the arf sign bias for this frame.
   set_arf_sign_bias(cpi);
@@ -3356,7 +3356,7 @@
     }
   }
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
 #if CONFIG_INTERNAL_STATS
   memset(cpi->mode_chosen_counts, 0,
@@ -3545,7 +3545,7 @@
                            YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
                            int64_t end_time) {
   VP10_COMMON *cm = &cpi->common;
-  struct vpx_usec_timer timer;
+  struct aom_usec_timer timer;
   int res = 0;
   const int subsampling_x = sd->subsampling_x;
   const int subsampling_y = sd->subsampling_y;
@@ -3556,7 +3556,7 @@
   check_initial_width(cpi, subsampling_x, subsampling_y);
 #endif  // CONFIG_VPX_HIGHBITDEPTH
 
-  vpx_usec_timer_start(&timer);
+  aom_usec_timer_start(&timer);
 
   if (vp10_lookahead_push(cpi->lookahead, sd, time_stamp, end_time,
 #if CONFIG_VPX_HIGHBITDEPTH
@@ -3564,18 +3564,18 @@
 #endif  // CONFIG_VPX_HIGHBITDEPTH
                           frame_flags))
     res = -1;
-  vpx_usec_timer_mark(&timer);
-  cpi->time_receive_data += vpx_usec_timer_elapsed(&timer);
+  aom_usec_timer_mark(&timer);
+  cpi->time_receive_data += aom_usec_timer_elapsed(&timer);
 
   if ((cm->profile == PROFILE_0 || cm->profile == PROFILE_2) &&
       (subsampling_x != 1 || subsampling_y != 1)) {
-    vpx_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM,
+    aom_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM,
                        "Non-4:2:0 color format requires profile 1 or 3");
     res = -1;
   }
   if ((cm->profile == PROFILE_1 || cm->profile == PROFILE_3) &&
       (subsampling_x == 1 && subsampling_y == 1)) {
-    vpx_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM,
+    aom_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM,
                        "4:2:0 color format requires profile 0 or 2");
     res = -1;
   }
@@ -3695,14 +3695,14 @@
   VP10_COMMON *const cm = &cpi->common;
   BufferPool *const pool = cm->buffer_pool;
   RATE_CONTROL *const rc = &cpi->rc;
-  struct vpx_usec_timer cmptimer;
+  struct aom_usec_timer cmptimer;
   YV12_BUFFER_CONFIG *force_src_buffer = NULL;
   struct lookahead_entry *last_source = NULL;
   struct lookahead_entry *source = NULL;
   int arf_src_index;
   int i;
 
-  vpx_usec_timer_start(&cmptimer);
+  aom_usec_timer_start(&cmptimer);
 
   vp10_set_high_precision_mv(cpi, ALTREF_HIGH_PRECISION_MV);
 
@@ -3737,7 +3737,7 @@
       if (oxcf->arnr_max_frames > 0) {
         // Produce the filtered ARF frame.
         vp10_temporal_filter(cpi, arf_src_index);
-        vpx_extend_frame_borders(&cpi->alt_ref_buffer);
+        aom_extend_frame_borders(&cpi->alt_ref_buffer);
         force_src_buffer = &cpi->alt_ref_buffer;
       }
 
@@ -3797,7 +3797,7 @@
   }
 
   // Clear down mmx registers
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   // adjust frame rates based on timestamps given
   if (cm->show_frame) {
@@ -3867,8 +3867,8 @@
     cpi->droppable = !frame_is_reference(cpi);
   }
 
-  vpx_usec_timer_mark(&cmptimer);
-  cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer);
+  aom_usec_timer_mark(&cmptimer);
+  cpi->time_compress_data += aom_usec_timer_elapsed(&cmptimer);
 
   if (cpi->b_calculate_psnr && oxcf->pass != 1 && cm->show_frame)
     generate_psnr_packet(cpi);
@@ -3901,17 +3901,17 @@
 
         {
           double frame_ssim2 = 0, weight = 0;
-          vpx_clear_system_state();
+          aom_clear_system_state();
 
 #if CONFIG_VPX_HIGHBITDEPTH
           if (cm->use_highbitdepth) {
             frame_ssim2 =
-                vpx_highbd_calc_ssim(orig, recon, &weight, (int)cm->bit_depth);
+                aom_highbd_calc_ssim(orig, recon, &weight, (int)cm->bit_depth);
           } else {
-            frame_ssim2 = vpx_calc_ssim(orig, recon, &weight);
+            frame_ssim2 = aom_calc_ssim(orig, recon, &weight);
           }
 #else
-          frame_ssim2 = vpx_calc_ssim(orig, recon, &weight);
+          frame_ssim2 = aom_calc_ssim(orig, recon, &weight);
 #endif  // CONFIG_VPX_HIGHBITDEPTH
 
           cpi->worst_ssim = VPXMIN(cpi->worst_ssim, frame_ssim2);
@@ -3951,7 +3951,7 @@
         if (!cm->use_highbitdepth)
 #endif
         {
-          double this_inconsistency = vpx_get_ssim_metrics(
+          double this_inconsistency = aom_get_ssim_metrics(
               cpi->Source->y_buffer, cpi->Source->y_stride,
               cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
               cpi->Source->y_width, cpi->Source->y_height, cpi->ssim_vars,
@@ -3959,7 +3959,7 @@
 
           const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1);
           double consistency =
-              vpx_sse_to_psnr(samples, peak, (double)cpi->total_inconsistency);
+              aom_sse_to_psnr(samples, peak, (double)cpi->total_inconsistency);
           if (consistency > 0.0)
             cpi->worst_consistency =
                 VPXMIN(cpi->worst_consistency, consistency);
@@ -3971,14 +3971,14 @@
         double y, u, v, frame_all;
 #if CONFIG_VPX_HIGHBITDEPTH
         if (cm->use_highbitdepth) {
-          frame_all = vpx_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y,
+          frame_all = aom_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y,
                                             &u, &v, (int)cm->bit_depth);
         } else {
           frame_all =
-              vpx_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v);
+              aom_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v);
         }
 #else
-        frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v);
+        frame_all = aom_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v);
 #endif  // CONFIG_VPX_HIGHBITDEPTH
         adjust_image_stat(y, u, v, frame_all, &cpi->ssimg);
       }
@@ -3988,7 +3988,7 @@
       {
         double y, u, v, frame_all;
         frame_all =
-            vpx_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u, &v);
+            aom_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u, &v);
         adjust_image_stat(y, u, v, frame_all, &cpi->fastssim);
         /* TODO(JBB): add 10/12 bit support */
       }
@@ -3997,14 +3997,14 @@
 #endif
       {
         double y, u, v, frame_all;
-        frame_all = vpx_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v);
+        frame_all = aom_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v);
         adjust_image_stat(y, u, v, frame_all, &cpi->psnrhvs);
       }
     }
   }
 #endif
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
   return 0;
 }
 
@@ -4025,7 +4025,7 @@
     } else {
       ret = -1;
     }
-    vpx_clear_system_state();
+    aom_clear_system_state();
     return ret;
   }
 }
@@ -4107,7 +4107,7 @@
 
 int vp10_get_quantizer(VP10_COMP *cpi) { return cpi->common.base_qindex; }
 
-void vp10_apply_encoding_flags(VP10_COMP *cpi, vpx_enc_frame_flags_t flags) {
+void vp10_apply_encoding_flags(VP10_COMP *cpi, aom_enc_frame_flags_t flags) {
   if (flags &
       (VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF)) {
     int ref = 7;
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 2246ac4..3af900d 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -14,7 +14,7 @@
 
 #include <stdio.h>
 
-#include "./vpx_config.h"
+#include "./aom_config.h"
 #include "aom/vp8cx.h"
 
 #include "av1/common/alloccommon.h"
@@ -39,8 +39,8 @@
 #include "aom_dsp/ssim.h"
 #endif
 #include "aom_dsp/variance.h"
-#include "aom/internal/vpx_codec_internal.h"
-#include "aom_util/vpx_thread.h"
+#include "aom/internal/aom_codec_internal.h"
+#include "aom_util/aom_thread.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,7 +52,7 @@
   int nmvcosts_hp[2][MV_VALS];
 
 #if !CONFIG_MISC_FIXES
-  vpx_prob segment_pred_probs[PREDICTION_PROBS];
+  aom_prob segment_pred_probs[PREDICTION_PROBS];
 #endif
 
   unsigned char *last_frame_seg_map_copy;
@@ -119,7 +119,7 @@
 
 typedef struct VP10EncoderConfig {
   BITSTREAM_PROFILE profile;
-  vpx_bit_depth_t bit_depth;     // Codec bit-depth.
+  aom_bit_depth_t bit_depth;     // Codec bit-depth.
   int width;                     // width of data passed to the compressor
   int height;                    // height of data passed to the compressor
   unsigned int input_bit_depth;  // Input bit depth.
@@ -149,7 +149,7 @@
   // DATARATE CONTROL OPTIONS
 
   // vbr, cbr, constrained quality or constant quality
-  enum vpx_rc_mode rc_mode;
+  enum aom_rc_mode rc_mode;
 
   // buffer targeting aggressiveness
   int under_shoot_pct;
@@ -217,19 +217,19 @@
 
   int max_threads;
 
-  vpx_fixed_buf_t two_pass_stats_in;
-  struct vpx_codec_pkt_list *output_pkt_list;
+  aom_fixed_buf_t two_pass_stats_in;
+  struct aom_codec_pkt_list *output_pkt_list;
 
 #if CONFIG_FP_MB_STATS
-  vpx_fixed_buf_t firstpass_mb_stats_in;
+  aom_fixed_buf_t firstpass_mb_stats_in;
 #endif
 
-  vpx_tune_metric tuning;
-  vpx_tune_content content;
+  aom_tune_metric tuning;
+  aom_tune_content content;
 #if CONFIG_VPX_HIGHBITDEPTH
   int use_highbitdepth;
 #endif
-  vpx_color_space_t color_space;
+  aom_color_space_t color_space;
   int color_range;
   int render_width;
   int render_height;
@@ -346,7 +346,7 @@
 
   int interp_filter_selected[MAX_REF_FRAMES][SWITCHABLE];
 
-  struct vpx_codec_pkt_list *output_pkt_list;
+  struct aom_codec_pkt_list *output_pkt_list;
 
   MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS];
   int mbgraph_n_frames;  // number of frames filled in the above
@@ -378,7 +378,7 @@
   fractional_mv_step_fp *find_fractional_mv_step;
   vp10_full_search_fn_t full_search_sad;
   vp10_diamond_search_fn_t diamond_search_sad;
-  vpx_variance_fn_ptr_t fn_ptr[BLOCK_SIZES];
+  aom_variance_fn_ptr_t fn_ptr[BLOCK_SIZES];
   uint64_t time_receive_data;
   uint64_t time_compress_data;
   uint64_t time_pick_lpf;
@@ -603,7 +603,7 @@
                                            YV12_BUFFER_CONFIG *unscaled,
                                            YV12_BUFFER_CONFIG *scaled);
 
-void vp10_apply_encoding_flags(VP10_COMP *cpi, vpx_enc_frame_flags_t flags);
+void vp10_apply_encoding_flags(VP10_COMP *cpi, aom_enc_frame_flags_t flags);
 
 static INLINE int is_altref_enabled(const VP10_COMP *const cpi) {
   return cpi->oxcf.mode != REALTIME && cpi->oxcf.lag_in_frames > 0 &&
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index c266c87..63956c4 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -12,7 +12,7 @@
 #include "av1/encoder/encodeframe.h"
 #include "av1/encoder/encoder.h"
 #include "av1/encoder/ethread.h"
-#include "aom_dsp/vpx_dsp_common.h"
+#include "aom_dsp/aom_dsp_common.h"
 
 static void accumulate_rd_opt(ThreadData *td, ThreadData *td_t) {
   int i, j, k, l, m, n;
@@ -60,7 +60,7 @@
 void vp10_encode_tiles_mt(VP10_COMP *cpi) {
   VP10_COMMON *const cm = &cpi->common;
   const int tile_cols = 1 << cm->log2_tile_cols;
-  const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
+  const VPxWorkerInterface *const winterface = aom_get_worker_interface();
   const int num_workers = VPXMIN(cpi->oxcf.max_threads, tile_cols);
   int i;
 
@@ -71,10 +71,10 @@
     int allocated_workers = num_workers;
 
     CHECK_MEM_ERROR(cm, cpi->workers,
-                    vpx_malloc(allocated_workers * sizeof(*cpi->workers)));
+                    aom_malloc(allocated_workers * sizeof(*cpi->workers)));
 
     CHECK_MEM_ERROR(cm, cpi->tile_thr_data,
-                    vpx_calloc(allocated_workers, sizeof(*cpi->tile_thr_data)));
+                    aom_calloc(allocated_workers, sizeof(*cpi->tile_thr_data)));
 
     for (i = 0; i < allocated_workers; i++) {
       VPxWorker *const worker = &cpi->workers[i];
@@ -88,7 +88,7 @@
 
         // Allocate thread data.
         CHECK_MEM_ERROR(cm, thread_data->td,
-                        vpx_memalign(32, sizeof(*thread_data->td)));
+                        aom_memalign(32, sizeof(*thread_data->td)));
         vp10_zero(*thread_data->td);
 
         // Set up pc_tree.
@@ -98,11 +98,11 @@
 
         // Allocate frame counters in thread data.
         CHECK_MEM_ERROR(cm, thread_data->td->counts,
-                        vpx_calloc(1, sizeof(*thread_data->td->counts)));
+                        aom_calloc(1, sizeof(*thread_data->td->counts)));
 
         // Create threads
         if (!winterface->reset(worker))
-          vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
+          aom_internal_error(&cm->error, VPX_CODEC_ERROR,
                              "Tile encoder thread creation failed");
       } else {
         // Main thread acts as a worker and uses the thread data in cpi.
diff --git a/av1/encoder/extend.c b/av1/encoder/extend.c
index 8a8c5ca..efb6515 100644
--- a/av1/encoder/extend.c
+++ b/av1/encoder/extend.c
@@ -9,8 +9,8 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
 
 #include "av1/common/common.h"
@@ -73,9 +73,9 @@
   uint16_t *dst_ptr2 = dst + w;
 
   for (i = 0; i < h; i++) {
-    vpx_memset16(dst_ptr1, src_ptr1[0], extend_left);
+    aom_memset16(dst_ptr1, src_ptr1[0], extend_left);
     memcpy(dst_ptr1 + extend_left, src_ptr1, w * sizeof(src_ptr1[0]));
-    vpx_memset16(dst_ptr2, src_ptr2[0], extend_right);
+    aom_memset16(dst_ptr2, src_ptr2[0], extend_right);
     src_ptr1 += src_pitch;
     src_ptr2 += src_pitch;
     dst_ptr1 += dst_pitch;
diff --git a/av1/encoder/extend.h b/av1/encoder/extend.h
index 2dd2b48..ba94a6df 100644
--- a/av1/encoder/extend.h
+++ b/av1/encoder/extend.h
@@ -13,7 +13,7 @@
 #define VP10_ENCODER_EXTEND_H_
 
 #include "aom_scale/yv12config.h"
-#include "aom/vpx_integer.h"
+#include "aom/aom_integer.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 1a7856c..13b888d 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -13,14 +13,14 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "./vpx_dsp_rtcd.h"
-#include "./vpx_scale_rtcd.h"
+#include "./aom_dsp_rtcd.h"
+#include "./aom_scale_rtcd.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
 #include "aom_ports/system_state.h"
-#include "aom_scale/vpx_scale.h"
+#include "aom_scale/aom_scale.h"
 #include "aom_scale/yv12config.h"
 
 #include "av1/common/entropymv.h"
@@ -97,12 +97,12 @@
 }
 
 static void output_stats(FIRSTPASS_STATS *stats,
-                         struct vpx_codec_pkt_list *pktlist) {
-  struct vpx_codec_cx_pkt pkt;
+                         struct aom_codec_pkt_list *pktlist) {
+  struct aom_codec_cx_pkt pkt;
   pkt.kind = VPX_CODEC_STATS_PKT;
   pkt.data.twopass_stats.buf = stats;
   pkt.data.twopass_stats.sz = sizeof(FIRSTPASS_STATS);
-  vpx_codec_pkt_list_add(pktlist, &pkt);
+  aom_codec_pkt_list_add(pktlist, &pkt);
 
 // TEMP debug code
 #if OUTPUT_FPF
@@ -128,12 +128,12 @@
 
 #if CONFIG_FP_MB_STATS
 static void output_fpmb_stats(uint8_t *this_frame_mb_stats, VP10_COMMON *cm,
-                              struct vpx_codec_pkt_list *pktlist) {
-  struct vpx_codec_cx_pkt pkt;
+                              struct aom_codec_pkt_list *pktlist) {
+  struct aom_codec_cx_pkt pkt;
   pkt.kind = VPX_CODEC_FPMB_STATS_PKT;
   pkt.data.firstpass_mb_stats.buf = this_frame_mb_stats;
   pkt.data.firstpass_mb_stats.sz = cm->initial_mbs * sizeof(uint8_t);
-  vpx_codec_pkt_list_add(pktlist, &pkt);
+  aom_codec_pkt_list_add(pktlist, &pkt);
 }
 #endif
 
@@ -278,12 +278,12 @@
   output_stats(&cpi->twopass.total_stats, cpi->output_pkt_list);
 }
 
-static vpx_variance_fn_t get_block_variance_fn(BLOCK_SIZE bsize) {
+static aom_variance_fn_t get_block_variance_fn(BLOCK_SIZE bsize) {
   switch (bsize) {
-    case BLOCK_8X8: return vpx_mse8x8;
-    case BLOCK_16X8: return vpx_mse16x8;
-    case BLOCK_8X16: return vpx_mse8x16;
-    default: return vpx_mse16x16;
+    case BLOCK_8X8: return aom_mse8x8;
+    case BLOCK_16X8: return aom_mse16x8;
+    case BLOCK_8X16: return aom_mse8x16;
+    default: return aom_mse16x16;
   }
 }
 
@@ -291,37 +291,37 @@
                                          const struct buf_2d *src,
                                          const struct buf_2d *ref) {
   unsigned int sse;
-  const vpx_variance_fn_t fn = get_block_variance_fn(bsize);
+  const aom_variance_fn_t fn = get_block_variance_fn(bsize);
   fn(src->buf, src->stride, ref->buf, ref->stride, &sse);
   return sse;
 }
 
 #if CONFIG_VPX_HIGHBITDEPTH
-static vpx_variance_fn_t highbd_get_block_variance_fn(BLOCK_SIZE bsize,
+static aom_variance_fn_t highbd_get_block_variance_fn(BLOCK_SIZE bsize,
                                                       int bd) {
   switch (bd) {
     default:
       switch (bsize) {
-        case BLOCK_8X8: return vpx_highbd_8_mse8x8;
-        case BLOCK_16X8: return vpx_highbd_8_mse16x8;
-        case BLOCK_8X16: return vpx_highbd_8_mse8x16;
-        default: return vpx_highbd_8_mse16x16;
+        case BLOCK_8X8: return aom_highbd_8_mse8x8;
+        case BLOCK_16X8: return aom_highbd_8_mse16x8;
+        case BLOCK_8X16: return aom_highbd_8_mse8x16;
+        default: return aom_highbd_8_mse16x16;
       }
       break;
     case 10:
       switch (bsize) {
-        case BLOCK_8X8: return vpx_highbd_10_mse8x8;
-        case BLOCK_16X8: return vpx_highbd_10_mse16x8;
-        case BLOCK_8X16: return vpx_highbd_10_mse8x16;
-        default: return vpx_highbd_10_mse16x16;
+        case BLOCK_8X8: return aom_highbd_10_mse8x8;
+        case BLOCK_16X8: return aom_highbd_10_mse16x8;
+        case BLOCK_8X16: return aom_highbd_10_mse8x16;
+        default: return aom_highbd_10_mse16x16;
       }
       break;
     case 12:
       switch (bsize) {
-        case BLOCK_8X8: return vpx_highbd_12_mse8x8;
-        case BLOCK_16X8: return vpx_highbd_12_mse16x8;
-        case BLOCK_8X16: return vpx_highbd_12_mse8x16;
-        default: return vpx_highbd_12_mse16x16;
+        case BLOCK_8X8: return aom_highbd_12_mse8x8;
+        case BLOCK_16X8: return aom_highbd_12_mse16x8;
+        case BLOCK_8X16: return aom_highbd_12_mse8x16;
+        default: return aom_highbd_12_mse16x16;
       }
       break;
   }
@@ -332,7 +332,7 @@
                                                 const struct buf_2d *ref,
                                                 int bd) {
   unsigned int sse;
-  const vpx_variance_fn_t fn = highbd_get_block_variance_fn(bsize, bd);
+  const aom_variance_fn_t fn = highbd_get_block_variance_fn(bsize, bd);
   fn(src->buf, src->stride, ref->buf, ref->stride, &sse);
   return sse;
 }
@@ -356,7 +356,7 @@
   MV ref_mv_full = { ref_mv->row >> 3, ref_mv->col >> 3 };
   int num00, tmp_err, n;
   const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
-  vpx_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[bsize];
+  aom_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[bsize];
   const int new_mv_mode_penalty = NEW_MV_MODE_PENALTY;
 
   int step_param = 3;
@@ -420,7 +420,7 @@
   }
 }
 
-static int find_fp_qindex(vpx_bit_depth_t bit_depth) {
+static int find_fp_qindex(aom_bit_depth_t bit_depth) {
   int i;
 
   for (i = 0; i < QINDEX_RANGE; ++i)
@@ -496,7 +496,7 @@
   }
 #endif
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   intra_factor = 0.0;
   brightness_factor = 0.0;
@@ -561,7 +561,7 @@
       const int mb_index = mb_row * cm->mb_cols + mb_col;
 #endif
 
-      vpx_clear_system_state();
+      aom_clear_system_state();
 
       xd->plane[0].dst.buf = new_yv12->y_buffer + recon_yoffset;
       xd->plane[1].dst.buf = new_yv12->u_buffer + recon_uvoffset;
@@ -579,7 +579,7 @@
       xd->mi[0]->mbmi.tx_size =
           use_dc_pred ? (bsize >= BLOCK_16X16 ? TX_16X16 : TX_8X8) : TX_4X4;
       vp10_encode_intra_block_plane(x, bsize, 0);
-      this_error = vpx_get_mb_ss(x->plane[0].src_diff);
+      this_error = aom_get_mb_ss(x->plane[0].src_diff);
 
       // Keep a record of blocks that have almost no intra error residual
       // (i.e. are in effect completely flat and untextured in the intra
@@ -607,7 +607,7 @@
       }
 #endif  // CONFIG_VPX_HIGHBITDEPTH
 
-      vpx_clear_system_state();
+      aom_clear_system_state();
       log_intra = log(this_error + 1.0);
       if (log_intra < 10.0)
         intra_factor += 1.0 + ((10.0 - log_intra) * 0.05);
@@ -774,7 +774,7 @@
 #endif
 
         if (motion_error <= this_error) {
-          vpx_clear_system_state();
+          aom_clear_system_state();
 
           // Keep a count of cases where the inter and intra were very close
           // and very low. This helps with scene cut detection for example in
@@ -908,7 +908,7 @@
     x->plane[2].src.buf +=
         uv_mb_height * x->plane[1].src.stride - uv_mb_height * cm->mb_cols;
 
-    vpx_clear_system_state();
+    aom_clear_system_state();
   }
 
   // Clamp the image start to rows/2. This number of rows is discarded top
@@ -1008,7 +1008,7 @@
     ++twopass->sr_update_lag;
   }
 
-  vpx_extend_frame_borders(new_yv12);
+  aom_extend_frame_borders(new_yv12);
 
   // The frame we just compressed now becomes the last frame.
   ref_cnt_fb(pool->frame_bufs, &cm->ref_frame_map[cpi->lst_fb_idx],
@@ -1042,7 +1042,7 @@
 
 static double calc_correction_factor(double err_per_mb, double err_divisor,
                                      double pt_low, double pt_high, int q,
-                                     vpx_bit_depth_t bit_depth) {
+                                     aom_bit_depth_t bit_depth) {
   const double error_term = err_per_mb / err_divisor;
 
   // Adjustment based on actual quantizer to power term.
@@ -1720,7 +1720,7 @@
     vp10_zero(twopass->gf_group);
   }
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
   vp10_zero(next_frame);
 
   // Load stats for the current frame.
@@ -2381,7 +2381,7 @@
     return;
   }
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   if (cpi->oxcf.rc_mode == VPX_Q) {
     twopass->active_worst_quality = cpi->oxcf.cq_level;
diff --git a/av1/encoder/lookahead.c b/av1/encoder/lookahead.c
index da3d3d5..8206a5e 100644
--- a/av1/encoder/lookahead.c
+++ b/av1/encoder/lookahead.c
@@ -11,7 +11,7 @@
 #include <assert.h>
 #include <stdlib.h>
 
-#include "./vpx_config.h"
+#include "./aom_config.h"
 
 #include "av1/common/common.h"
 
@@ -36,7 +36,7 @@
     if (ctx->buf) {
       unsigned int i;
 
-      for (i = 0; i < ctx->max_sz; i++) vpx_free_frame_buffer(&ctx->buf[i].img);
+      for (i = 0; i < ctx->max_sz; i++) aom_free_frame_buffer(&ctx->buf[i].img);
       free(ctx->buf);
     }
     free(ctx);
@@ -68,7 +68,7 @@
     ctx->buf = calloc(depth, sizeof(*ctx->buf));
     if (!ctx->buf) goto bail;
     for (i = 0; i < depth; i++)
-      if (vpx_alloc_frame_buffer(
+      if (aom_alloc_frame_buffer(
               &ctx->buf[i].img, width, height, subsampling_x, subsampling_y,
 #if CONFIG_VPX_HIGHBITDEPTH
               use_highbitdepth,
@@ -160,14 +160,14 @@
     if (larger_dimensions) {
       YV12_BUFFER_CONFIG new_img;
       memset(&new_img, 0, sizeof(new_img));
-      if (vpx_alloc_frame_buffer(&new_img, width, height, subsampling_x,
+      if (aom_alloc_frame_buffer(&new_img, width, height, subsampling_x,
                                  subsampling_y,
 #if CONFIG_VPX_HIGHBITDEPTH
                                  use_highbitdepth,
 #endif
                                  VPX_ENC_BORDER_IN_PIXELS, 0))
         return 1;
-      vpx_free_frame_buffer(&buf->img);
+      aom_free_frame_buffer(&buf->img);
       buf->img = new_img;
     } else if (new_dimensions) {
       buf->img.y_crop_width = src->y_crop_width;
diff --git a/av1/encoder/lookahead.h b/av1/encoder/lookahead.h
index bfb389c..148809a 100644
--- a/av1/encoder/lookahead.h
+++ b/av1/encoder/lookahead.h
@@ -13,7 +13,7 @@
 #define VP10_ENCODER_LOOKAHEAD_H_
 
 #include "aom_scale/yv12config.h"
-#include "aom/vpx_integer.h"
+#include "aom/aom_integer.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/av1/encoder/mbgraph.c b/av1/encoder/mbgraph.c
index 16eb195..80d2aef 100644
--- a/av1/encoder/mbgraph.c
+++ b/av1/encoder/mbgraph.c
@@ -12,10 +12,10 @@
 #include <limits.h>
 
 #include "./av1_rtcd.h"
-#include "./vpx_dsp_rtcd.h"
+#include "./aom_dsp_rtcd.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/system_state.h"
 #include "av1/encoder/segmentation.h"
 #include "av1/encoder/mcomp.h"
@@ -29,7 +29,7 @@
   MACROBLOCK *const x = &cpi->td.mb;
   MACROBLOCKD *const xd = &x->e_mbd;
   const MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv;
-  const vpx_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
+  const aom_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
 
   const int tmp_col_min = x->mv_col_min;
   const int tmp_col_max = x->mv_col_max;
@@ -74,7 +74,7 @@
   x->mv_row_min = tmp_row_min;
   x->mv_row_max = tmp_row_max;
 
-  return vpx_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
+  return aom_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
                       xd->plane[0].dst.buf, xd->plane[0].dst.stride);
 }
 
@@ -87,7 +87,7 @@
 
   // Try zero MV first
   // FIXME should really use something like near/nearest MV and/or MV prediction
-  err = vpx_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
+  err = aom_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
                      xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride);
   dst_mv->as_int = 0;
 
@@ -123,7 +123,7 @@
 
   // Try zero MV first
   // FIXME should really use something like near/nearest MV and/or MV prediction
-  err = vpx_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
+  err = aom_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
                      xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride);
 
   dst_mv->as_int = 0;
@@ -145,7 +145,7 @@
     vp10_predict_intra_block(xd, 2, 2, TX_16X16, mode, x->plane[0].src.buf,
                              x->plane[0].src.stride, xd->plane[0].dst.buf,
                              xd->plane[0].dst.stride, 0, 0, 0);
-    err = vpx_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
+    err = aom_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
                        xd->plane[0].dst.buf, xd->plane[0].dst.stride);
 
     // find best
@@ -291,7 +291,7 @@
 
   CHECK_MEM_ERROR(
       cm, arf_not_zz,
-      vpx_calloc(cm->mb_rows * cm->mb_cols * sizeof(*arf_not_zz), 1));
+      aom_calloc(cm->mb_rows * cm->mb_cols * sizeof(*arf_not_zz), 1));
 
   // We are not interested in results beyond the alt ref itself.
   if (n_frames > cpi->rc.frames_till_gf_update_due)
@@ -354,7 +354,7 @@
   }
 
   // Free localy allocated storage
-  vpx_free(arf_not_zz);
+  aom_free(arf_not_zz);
 }
 
 void vp10_update_mbgraph_stats(VP10_COMP *cpi) {
@@ -391,7 +391,7 @@
                                cpi->Source);
   }
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   separate_arf_mbs(cpi);
 }
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index b943b9d..a82d151 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -13,11 +13,11 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "./vpx_config.h"
-#include "./vpx_dsp_rtcd.h"
+#include "./aom_config.h"
+#include "./aom_dsp_rtcd.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
 
 #include "av1/common/common.h"
@@ -291,7 +291,7 @@
 
 static unsigned int setup_center_error(
     const MACROBLOCKD *xd, const MV *bestmv, const MV *ref_mv,
-    int error_per_bit, const vpx_variance_fn_ptr_t *vfp,
+    int error_per_bit, const aom_variance_fn_ptr_t *vfp,
     const uint8_t *const src, const int src_stride, const uint8_t *const y,
     int y_stride, const uint8_t *second_pred, int w, int h, int offset,
     int *mvjcost, int *mvcost[2], unsigned int *sse1, int *distortion) {
@@ -300,13 +300,13 @@
   if (second_pred != NULL) {
     if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
       DECLARE_ALIGNED(16, uint16_t, comp_pred16[64 * 64]);
-      vpx_highbd_comp_avg_pred(comp_pred16, second_pred, w, h, y + offset,
+      aom_highbd_comp_avg_pred(comp_pred16, second_pred, w, h, y + offset,
                                y_stride);
       besterr =
           vfp->vf(CONVERT_TO_BYTEPTR(comp_pred16), w, src, src_stride, sse1);
     } else {
       DECLARE_ALIGNED(16, uint8_t, comp_pred[64 * 64]);
-      vpx_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
+      aom_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
       besterr = vfp->vf(comp_pred, w, src, src_stride, sse1);
     }
   } else {
@@ -318,7 +318,7 @@
   (void)xd;
   if (second_pred != NULL) {
     DECLARE_ALIGNED(16, uint8_t, comp_pred[64 * 64]);
-    vpx_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
+    aom_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
     besterr = vfp->vf(comp_pred, w, src, src_stride, sse1);
   } else {
     besterr = vfp->vf(y + offset, y_stride, src, src_stride, sse1);
@@ -355,7 +355,7 @@
 
 int vp10_find_best_sub_pixel_tree_pruned_evenmore(
     const MACROBLOCK *x, MV *bestmv, const MV *ref_mv, int allow_hp,
-    int error_per_bit, const vpx_variance_fn_ptr_t *vfp, int forced_stop,
+    int error_per_bit, const aom_variance_fn_ptr_t *vfp, int forced_stop,
     int iters_per_step, int *cost_list, int *mvjcost, int *mvcost[2],
     int *distortion, unsigned int *sse1, const uint8_t *second_pred, int w,
     int h) {
@@ -424,7 +424,7 @@
 
 int vp10_find_best_sub_pixel_tree_pruned_more(
     const MACROBLOCK *x, MV *bestmv, const MV *ref_mv, int allow_hp,
-    int error_per_bit, const vpx_variance_fn_ptr_t *vfp, int forced_stop,
+    int error_per_bit, const aom_variance_fn_ptr_t *vfp, int forced_stop,
     int iters_per_step, int *cost_list, int *mvjcost, int *mvcost[2],
     int *distortion, unsigned int *sse1, const uint8_t *second_pred, int w,
     int h) {
@@ -488,7 +488,7 @@
 
 int vp10_find_best_sub_pixel_tree_pruned(
     const MACROBLOCK *x, MV *bestmv, const MV *ref_mv, int allow_hp,
-    int error_per_bit, const vpx_variance_fn_ptr_t *vfp, int forced_stop,
+    int error_per_bit, const aom_variance_fn_ptr_t *vfp, int forced_stop,
     int iters_per_step, int *cost_list, int *mvjcost, int *mvcost[2],
     int *distortion, unsigned int *sse1, const uint8_t *second_pred, int w,
     int h) {
@@ -581,7 +581,7 @@
 int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x, MV *bestmv,
                                   const MV *ref_mv, int allow_hp,
                                   int error_per_bit,
-                                  const vpx_variance_fn_ptr_t *vfp,
+                                  const aom_variance_fn_ptr_t *vfp,
                                   int forced_stop, int iters_per_step,
                                   int *cost_list, int *mvjcost, int *mvcost[2],
                                   int *distortion, unsigned int *sse1,
@@ -754,7 +754,7 @@
 // Calculate and return a sad+mvcost list around an integer best pel.
 static INLINE void calc_int_cost_list(const MACROBLOCK *x, const MV *ref_mv,
                                       int sadpb,
-                                      const vpx_variance_fn_ptr_t *fn_ptr,
+                                      const aom_variance_fn_ptr_t *fn_ptr,
                                       const MV *best_mv, int *cost_list) {
   static const MV neighbors[4] = { { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, 0 } };
   const struct buf_2d *const what = &x->plane[0].src;
@@ -803,7 +803,7 @@
 //
 static int vp10_pattern_search(
     const MACROBLOCK *x, MV *ref_mv, int search_param, int sad_per_bit,
-    int do_init_search, int *cost_list, const vpx_variance_fn_ptr_t *vfp,
+    int do_init_search, int *cost_list, const aom_variance_fn_ptr_t *vfp,
     int use_mvcost, const MV *center_mv, MV *best_mv,
     const int num_candidates[MAX_PATTERN_SCALES],
     const MV candidates[MAX_PATTERN_SCALES][MAX_PATTERN_CANDIDATES]) {
@@ -972,7 +972,7 @@
 // use_mvcost option since it is always 1, to save unnecessary branches.
 static int vp10_pattern_search_sad(
     const MACROBLOCK *x, MV *ref_mv, int search_param, int sad_per_bit,
-    int do_init_search, int *cost_list, const vpx_variance_fn_ptr_t *vfp,
+    int do_init_search, int *cost_list, const aom_variance_fn_ptr_t *vfp,
     int use_mvcost, const MV *center_mv, MV *best_mv,
     const int num_candidates[MAX_PATTERN_SCALES],
     const MV candidates[MAX_PATTERN_SCALES][MAX_PATTERN_CANDIDATES]) {
@@ -1247,7 +1247,7 @@
 }
 
 int vp10_get_mvpred_var(const MACROBLOCK *x, const MV *best_mv,
-                        const MV *center_mv, const vpx_variance_fn_ptr_t *vfp,
+                        const MV *center_mv, const aom_variance_fn_ptr_t *vfp,
                         int use_mvcost) {
   const MACROBLOCKD *const xd = &x->e_mbd;
   const struct buf_2d *const what = &x->plane[0].src;
@@ -1264,7 +1264,7 @@
 
 int vp10_get_mvpred_av_var(const MACROBLOCK *x, const MV *best_mv,
                            const MV *center_mv, const uint8_t *second_pred,
-                           const vpx_variance_fn_ptr_t *vfp, int use_mvcost) {
+                           const aom_variance_fn_ptr_t *vfp, int use_mvcost) {
   const MACROBLOCKD *const xd = &x->e_mbd;
   const struct buf_2d *const what = &x->plane[0].src;
   const struct buf_2d *const in_what = &xd->plane[0].pre[0];
@@ -1280,7 +1280,7 @@
 
 int vp10_hex_search(const MACROBLOCK *x, MV *ref_mv, int search_param,
                     int sad_per_bit, int do_init_search, int *cost_list,
-                    const vpx_variance_fn_ptr_t *vfp, int use_mvcost,
+                    const aom_variance_fn_ptr_t *vfp, int use_mvcost,
                     const MV *center_mv, MV *best_mv) {
   // First scale has 8-closest points, the rest have 6 points in hex shape
   // at increasing scales
@@ -1344,7 +1344,7 @@
 
 int vp10_bigdia_search(const MACROBLOCK *x, MV *ref_mv, int search_param,
                        int sad_per_bit, int do_init_search, int *cost_list,
-                       const vpx_variance_fn_ptr_t *vfp, int use_mvcost,
+                       const aom_variance_fn_ptr_t *vfp, int use_mvcost,
                        const MV *center_mv, MV *best_mv) {
   // First scale has 4-closest points, the rest have 8 points in diamond
   // shape at increasing scales
@@ -1443,7 +1443,7 @@
 
 int vp10_square_search(const MACROBLOCK *x, MV *ref_mv, int search_param,
                        int sad_per_bit, int do_init_search, int *cost_list,
-                       const vpx_variance_fn_ptr_t *vfp, int use_mvcost,
+                       const aom_variance_fn_ptr_t *vfp, int use_mvcost,
                        const MV *center_mv, MV *best_mv) {
   // All scales have 8 closest points in square shape
   static const int square_num_candidates[MAX_PATTERN_SCALES] = {
@@ -1549,7 +1549,7 @@
 int vp10_fast_hex_search(const MACROBLOCK *x, MV *ref_mv, int search_param,
                          int sad_per_bit,
                          int do_init_search,  // must be zero for fast_hex
-                         int *cost_list, const vpx_variance_fn_ptr_t *vfp,
+                         int *cost_list, const aom_variance_fn_ptr_t *vfp,
                          int use_mvcost, const MV *center_mv, MV *best_mv) {
   return vp10_hex_search(
       x, ref_mv, VPXMAX(MAX_MVSEARCH_STEPS - 2, search_param), sad_per_bit,
@@ -1558,7 +1558,7 @@
 
 int vp10_fast_dia_search(const MACROBLOCK *x, MV *ref_mv, int search_param,
                          int sad_per_bit, int do_init_search, int *cost_list,
-                         const vpx_variance_fn_ptr_t *vfp, int use_mvcost,
+                         const aom_variance_fn_ptr_t *vfp, int use_mvcost,
                          const MV *center_mv, MV *best_mv) {
   return vp10_bigdia_search(
       x, ref_mv, VPXMAX(MAX_MVSEARCH_STEPS - 2, search_param), sad_per_bit,
@@ -1571,7 +1571,7 @@
 // step size.
 static int exhuastive_mesh_search(const MACROBLOCK *x, MV *ref_mv, MV *best_mv,
                                   int range, int step, int sad_per_bit,
-                                  const vpx_variance_fn_ptr_t *fn_ptr,
+                                  const aom_variance_fn_ptr_t *fn_ptr,
                                   const MV *center_mv) {
   const MACROBLOCKD *const xd = &x->e_mbd;
   const struct buf_2d *const what = &x->plane[0].src;
@@ -1658,7 +1658,7 @@
 int vp10_diamond_search_sad_c(const MACROBLOCK *x,
                               const search_site_config *cfg, MV *ref_mv,
                               MV *best_mv, int search_param, int sad_per_bit,
-                              int *num00, const vpx_variance_fn_ptr_t *fn_ptr,
+                              int *num00, const aom_variance_fn_ptr_t *fn_ptr,
                               const MV *center_mv) {
   int i, j, step;
 
@@ -1803,7 +1803,7 @@
   int center, offset = 0;
   int bw = 4 << bwl;  // redundant variable, to be changed in the experiments.
   for (d = 0; d <= bw; d += 16) {
-    this_sad = vpx_vector_var(&ref[d], src, bwl);
+    this_sad = aom_vector_var(&ref[d], src, bwl);
     if (this_sad < best_sad) {
       best_sad = this_sad;
       offset = d;
@@ -1815,7 +1815,7 @@
     int this_pos = offset + d;
     // check limit
     if (this_pos < 0 || this_pos > bw) continue;
-    this_sad = vpx_vector_var(&ref[this_pos], src, bwl);
+    this_sad = aom_vector_var(&ref[this_pos], src, bwl);
     if (this_sad < best_sad) {
       best_sad = this_sad;
       center = this_pos;
@@ -1827,7 +1827,7 @@
     int this_pos = offset + d;
     // check limit
     if (this_pos < 0 || this_pos > bw) continue;
-    this_sad = vpx_vector_var(&ref[this_pos], src, bwl);
+    this_sad = aom_vector_var(&ref[this_pos], src, bwl);
     if (this_sad < best_sad) {
       best_sad = this_sad;
       center = this_pos;
@@ -1839,7 +1839,7 @@
     int this_pos = offset + d;
     // check limit
     if (this_pos < 0 || this_pos > bw) continue;
-    this_sad = vpx_vector_var(&ref[this_pos], src, bwl);
+    this_sad = aom_vector_var(&ref[this_pos], src, bwl);
     if (this_sad < best_sad) {
       best_sad = this_sad;
       center = this_pos;
@@ -1851,7 +1851,7 @@
     int this_pos = offset + d;
     // check limit
     if (this_pos < 0 || this_pos > bw) continue;
-    this_sad = vpx_vector_var(&ref[this_pos], src, bwl);
+    this_sad = aom_vector_var(&ref[this_pos], src, bwl);
     if (this_sad < best_sad) {
       best_sad = this_sad;
       center = this_pos;
@@ -1918,25 +1918,25 @@
   // Set up prediction 1-D reference set
   ref_buf = xd->plane[0].pre[0].buf - (bw >> 1);
   for (idx = 0; idx < search_width; idx += 16) {
-    vpx_int_pro_row(&hbuf[idx], ref_buf, ref_stride, bh);
+    aom_int_pro_row(&hbuf[idx], ref_buf, ref_stride, bh);
     ref_buf += 16;
   }
 
   ref_buf = xd->plane[0].pre[0].buf - (bh >> 1) * ref_stride;
   for (idx = 0; idx < search_height; ++idx) {
-    vbuf[idx] = vpx_int_pro_col(ref_buf, bw) >> norm_factor;
+    vbuf[idx] = aom_int_pro_col(ref_buf, bw) >> norm_factor;
     ref_buf += ref_stride;
   }
 
   // Set up src 1-D reference set
   for (idx = 0; idx < bw; idx += 16) {
     src_buf = x->plane[0].src.buf + idx;
-    vpx_int_pro_row(&src_hbuf[idx], src_buf, src_stride, bh);
+    aom_int_pro_row(&src_hbuf[idx], src_buf, src_stride, bh);
   }
 
   src_buf = x->plane[0].src.buf;
   for (idx = 0; idx < bh; ++idx) {
-    src_vbuf[idx] = vpx_int_pro_col(src_buf, bw) >> norm_factor;
+    src_vbuf[idx] = aom_int_pro_col(src_buf, bw) >> norm_factor;
     src_buf += src_stride;
   }
 
@@ -2000,7 +2000,7 @@
 int vp10_full_pixel_diamond(const VP10_COMP *cpi, MACROBLOCK *x, MV *mvp_full,
                             int step_param, int sadpb, int further_steps,
                             int do_refine, int *cost_list,
-                            const vpx_variance_fn_ptr_t *fn_ptr,
+                            const aom_variance_fn_ptr_t *fn_ptr,
                             const MV *ref_mv, MV *dst_mv) {
   MV temp_mv;
   int thissme, n, num00 = 0;
@@ -2064,7 +2064,7 @@
 // according to the encode speed profile.
 static int full_pixel_exhaustive(VP10_COMP *cpi, MACROBLOCK *x,
                                  MV *centre_mv_full, int sadpb, int *cost_list,
-                                 const vpx_variance_fn_ptr_t *fn_ptr,
+                                 const aom_variance_fn_ptr_t *fn_ptr,
                                  const MV *ref_mv, MV *dst_mv) {
   const SPEED_FEATURES *const sf = &cpi->sf;
   MV temp_mv = { centre_mv_full->row, centre_mv_full->col };
@@ -2121,7 +2121,7 @@
 
 int vp10_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv,
                            int sad_per_bit, int distance,
-                           const vpx_variance_fn_ptr_t *fn_ptr,
+                           const aom_variance_fn_ptr_t *fn_ptr,
                            const MV *center_mv, MV *best_mv) {
   int r, c;
   const MACROBLOCKD *const xd = &x->e_mbd;
@@ -2156,7 +2156,7 @@
 
 int vp10_full_search_sadx3(const MACROBLOCK *x, const MV *ref_mv,
                            int sad_per_bit, int distance,
-                           const vpx_variance_fn_ptr_t *fn_ptr,
+                           const aom_variance_fn_ptr_t *fn_ptr,
                            const MV *center_mv, MV *best_mv) {
   int r;
   const MACROBLOCKD *const xd = &x->e_mbd;
@@ -2222,7 +2222,7 @@
 
 int vp10_full_search_sadx8(const MACROBLOCK *x, const MV *ref_mv,
                            int sad_per_bit, int distance,
-                           const vpx_variance_fn_ptr_t *fn_ptr,
+                           const aom_variance_fn_ptr_t *fn_ptr,
                            const MV *center_mv, MV *best_mv) {
   int r;
   const MACROBLOCKD *const xd = &x->e_mbd;
@@ -2312,7 +2312,7 @@
 
 int vp10_refining_search_sad(const MACROBLOCK *x, MV *ref_mv, int error_per_bit,
                              int search_range,
-                             const vpx_variance_fn_ptr_t *fn_ptr,
+                             const aom_variance_fn_ptr_t *fn_ptr,
                              const MV *center_mv) {
   const MACROBLOCKD *const xd = &x->e_mbd;
   const MV neighbors[4] = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
@@ -2387,7 +2387,7 @@
 // mode.
 int vp10_refining_search_8p_c(const MACROBLOCK *x, MV *ref_mv,
                               int error_per_bit, int search_range,
-                              const vpx_variance_fn_ptr_t *fn_ptr,
+                              const aom_variance_fn_ptr_t *fn_ptr,
                               const MV *center_mv, const uint8_t *second_pred) {
   const MV neighbors[8] = { { -1, 0 },  { 0, -1 }, { 0, 1 },  { 1, 0 },
                             { -1, -1 }, { 1, -1 }, { -1, 1 }, { 1, 1 } };
@@ -2450,7 +2450,7 @@
                            int var_max, int rd) {
   const SPEED_FEATURES *const sf = &cpi->sf;
   const SEARCH_METHODS method = sf->mv.search_method;
-  vpx_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize];
+  aom_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize];
   int var = 0;
   if (cost_list) {
     cost_list[0] = INT_MAX;
diff --git a/av1/encoder/mcomp.h b/av1/encoder/mcomp.h
index 425fc4e..d603288 100644
--- a/av1/encoder/mcomp.h
+++ b/av1/encoder/mcomp.h
@@ -52,11 +52,11 @@
 
 // Utility to compute variance + MV rate cost for a given MV
 int vp10_get_mvpred_var(const MACROBLOCK *x, const MV *best_mv,
-                        const MV *center_mv, const vpx_variance_fn_ptr_t *vfp,
+                        const MV *center_mv, const aom_variance_fn_ptr_t *vfp,
                         int use_mvcost);
 int vp10_get_mvpred_av_var(const MACROBLOCK *x, const MV *best_mv,
                            const MV *center_mv, const uint8_t *second_pred,
-                           const vpx_variance_fn_ptr_t *vfp, int use_mvcost);
+                           const aom_variance_fn_ptr_t *vfp, int use_mvcost);
 
 struct VP10_COMP;
 struct SPEED_FEATURES;
@@ -65,14 +65,14 @@
 
 int vp10_refining_search_sad(const struct macroblock *x, struct mv *ref_mv,
                              int sad_per_bit, int distance,
-                             const struct vpx_variance_vtable *fn_ptr,
+                             const struct aom_variance_vtable *fn_ptr,
                              const struct mv *center_mv);
 
 // Runs sequence of diamond searches in smaller steps for RD.
 int vp10_full_pixel_diamond(const struct VP10_COMP *cpi, MACROBLOCK *x,
                             MV *mvp_full, int step_param, int sadpb,
                             int further_steps, int do_refine, int *cost_list,
-                            const vpx_variance_fn_ptr_t *fn_ptr,
+                            const aom_variance_fn_ptr_t *fn_ptr,
                             const MV *ref_mv, MV *dst_mv);
 
 // Perform integral projection based motion estimation.
@@ -83,7 +83,7 @@
 typedef int(integer_mv_pattern_search_fn)(const MACROBLOCK *x, MV *ref_mv,
                                           int search_param, int error_per_bit,
                                           int do_init_search, int *cost_list,
-                                          const vpx_variance_fn_ptr_t *vf,
+                                          const aom_variance_fn_ptr_t *vf,
                                           int use_mvcost, const MV *center_mv,
                                           MV *best_mv);
 
@@ -95,7 +95,7 @@
 
 typedef int(fractional_mv_step_fp)(
     const MACROBLOCK *x, MV *bestmv, const MV *ref_mv, int allow_hp,
-    int error_per_bit, const vpx_variance_fn_ptr_t *vfp,
+    int error_per_bit, const aom_variance_fn_ptr_t *vfp,
     int forced_stop,  // 0 - full, 1 - qtr only, 2 - half only
     int iters_per_step, int *cost_list, int *mvjcost, int *mvcost[2],
     int *distortion, unsigned int *sse1, const uint8_t *second_pred, int w,
@@ -108,22 +108,22 @@
 
 typedef int (*vp10_full_search_fn_t)(const MACROBLOCK *x, const MV *ref_mv,
                                      int sad_per_bit, int distance,
-                                     const vpx_variance_fn_ptr_t *fn_ptr,
+                                     const aom_variance_fn_ptr_t *fn_ptr,
                                      const MV *center_mv, MV *best_mv);
 
 typedef int (*vp10_refining_search_fn_t)(const MACROBLOCK *x, MV *ref_mv,
                                          int sad_per_bit, int distance,
-                                         const vpx_variance_fn_ptr_t *fn_ptr,
+                                         const aom_variance_fn_ptr_t *fn_ptr,
                                          const MV *center_mv);
 
 typedef int (*vp10_diamond_search_fn_t)(
     const MACROBLOCK *x, const search_site_config *cfg, MV *ref_mv, MV *best_mv,
     int search_param, int sad_per_bit, int *num00,
-    const vpx_variance_fn_ptr_t *fn_ptr, const MV *center_mv);
+    const aom_variance_fn_ptr_t *fn_ptr, const MV *center_mv);
 
 int vp10_refining_search_8p_c(const MACROBLOCK *x, MV *ref_mv,
                               int error_per_bit, int search_range,
-                              const vpx_variance_fn_ptr_t *fn_ptr,
+                              const aom_variance_fn_ptr_t *fn_ptr,
                               const MV *center_mv, const uint8_t *second_pred);
 
 struct VP10_COMP;
diff --git a/av1/encoder/pickdering.c b/av1/encoder/pickdering.c
index fe3912c..fd9d62d 100644
--- a/av1/encoder/pickdering.c
+++ b/av1/encoder/pickdering.c
@@ -11,12 +11,12 @@
 
 #include <string.h>
 
-#include "./vpx_scale_rtcd.h"
+#include "./aom_scale_rtcd.h"
 #include "av1/common/dering.h"
 #include "av1/common/onyxc_int.h"
 #include "av1/common/reconinter.h"
 #include "av1/encoder/encoder.h"
-#include "aom/vpx_integer.h"
+#include "aom/aom_integer.h"
 
 static double compute_dist(int16_t *x, int xstride, int16_t *y, int ystride,
     int nhb, int nvb, int coeff_shift) {
@@ -55,9 +55,9 @@
   int global_level;
   double best_tot_mse = 1e15;
   int coeff_shift = VPXMAX(cm->bit_depth - 8, 0);
-  src = vpx_malloc(sizeof(*src)*cm->mi_rows*cm->mi_cols*64);
-  ref_coeff = vpx_malloc(sizeof(*ref_coeff)*cm->mi_rows*cm->mi_cols*64);
-  bskip = vpx_malloc(sizeof(*bskip)*cm->mi_rows*cm->mi_cols);
+  src = aom_malloc(sizeof(*src)*cm->mi_rows*cm->mi_cols*64);
+  ref_coeff = aom_malloc(sizeof(*ref_coeff)*cm->mi_rows*cm->mi_cols*64);
+  bskip = aom_malloc(sizeof(*bskip)*cm->mi_rows*cm->mi_cols);
   vp10_setup_dst_planes(xd->plane, frame, 0, 0);
   for (pli = 0; pli < 3; pli++) {
     dec[pli] = xd->plane[pli].subsampling_x;
@@ -92,7 +92,7 @@
   }
   nvsb = (cm->mi_rows + MI_BLOCK_SIZE - 1)/MI_BLOCK_SIZE;
   nhsb = (cm->mi_cols + MI_BLOCK_SIZE - 1)/MI_BLOCK_SIZE;
-  mse = vpx_malloc(nvsb*nhsb*sizeof(*mse));
+  mse = aom_malloc(nvsb*nhsb*sizeof(*mse));
   for (sbr = 0; sbr < nvsb; sbr++) {
     for (sbc = 0; sbc < nhsb; sbc++) {
       int best_mse = 1000000000;
@@ -173,9 +173,9 @@
     if (tot_mse[level] < tot_mse[best_level]) best_level = level;
   }
 #endif
-  vpx_free(src);
-  vpx_free(ref_coeff);
-  vpx_free(bskip);
-  vpx_free(mse);
+  aom_free(src);
+  aom_free(ref_coeff);
+  aom_free(bskip);
+  aom_free(mse);
   return best_level;
 }
diff --git a/av1/encoder/picklpf.c b/av1/encoder/picklpf.c
index ffef764..cf3a08f 100644
--- a/av1/encoder/picklpf.c
+++ b/av1/encoder/picklpf.c
@@ -12,10 +12,10 @@
 #include <assert.h>
 #include <limits.h>
 
-#include "./vpx_scale_rtcd.h"
+#include "./aom_scale_rtcd.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
 
 #include "av1/common/loopfilter.h"
@@ -60,7 +60,7 @@
 #endif  // CONFIG_VPX_HIGHBITDEPTH
 
   // Re-instate the unfiltered frame
-  vpx_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
+  aom_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
 
   return filt_err;
 }
@@ -86,7 +86,7 @@
   memset(ss_err, 0xFF, sizeof(ss_err));
 
   //  Make a copy of the unfiltered / processed recon buffer
-  vpx_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf);
+  aom_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf);
 
   best_err = try_filter_frame(sd, cpi, filt_mid, partial_frame);
   filt_best = filt_mid;
diff --git a/av1/encoder/quantize.c b/av1/encoder/quantize.c
index 098ad33..a0dd2b7 100644
--- a/av1/encoder/quantize.c
+++ b/av1/encoder/quantize.c
@@ -10,8 +10,8 @@
  */
 
 #include <math.h>
-#include "./vpx_dsp_rtcd.h"
-#include "aom_mem/vpx_mem.h"
+#include "./aom_dsp_rtcd.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
 
 #include "av1/common/quant_common.h"
@@ -273,7 +273,7 @@
 
 #if CONFIG_VPX_HIGHBITDEPTH
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
-    vpx_highbd_quantize_b(BLOCK_OFFSET(p->coeff, block), 16, x->skip_block,
+    aom_highbd_quantize_b(BLOCK_OFFSET(p->coeff, block), 16, x->skip_block,
                           p->zbin, p->round, p->quant, p->quant_shift,
                           BLOCK_OFFSET(p->qcoeff, block),
                           BLOCK_OFFSET(pd->dqcoeff, block), pd->dequant,
@@ -286,7 +286,7 @@
     return;
   }
 #endif
-  vpx_quantize_b(BLOCK_OFFSET(p->coeff, block), 16, x->skip_block, p->zbin,
+  aom_quantize_b(BLOCK_OFFSET(p->coeff, block), 16, x->skip_block, p->zbin,
                  p->round, p->quant, p->quant_shift,
                  BLOCK_OFFSET(p->qcoeff, block),
                  BLOCK_OFFSET(pd->dqcoeff, block), pd->dequant, &p->eobs[block],
@@ -308,7 +308,7 @@
   *shift = 1 << (16 - l);
 }
 
-static int get_qzbin_factor(int q, vpx_bit_depth_t bit_depth) {
+static int get_qzbin_factor(int q, aom_bit_depth_t bit_depth) {
   const int quant = vp10_dc_quant(q, 0, bit_depth);
 #if CONFIG_VPX_HIGHBITDEPTH
   switch (bit_depth) {
diff --git a/av1/encoder/quantize.h b/av1/encoder/quantize.h
index 0630638..a3d252f 100644
--- a/av1/encoder/quantize.h
+++ b/av1/encoder/quantize.h
@@ -12,7 +12,7 @@
 #ifndef VP10_ENCODER_QUANTIZE_H_
 #define VP10_ENCODER_QUANTIZE_H_
 
-#include "./vpx_config.h"
+#include "./aom_config.h"
 #include "av1/common/quant_common.h"
 #include "av1/encoder/block.h"
 
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index f0df0d6..bcb5ab8 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -16,8 +16,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
 #include "aom_ports/system_state.h"
 
@@ -101,7 +101,7 @@
 // The formulae were derived from computing a 3rd order polynomial best
 // fit to the original data (after plotting real maxq vs minq (not q index))
 static int get_minq_index(double maxq, double x3, double x2, double x1,
-                          vpx_bit_depth_t bit_depth) {
+                          aom_bit_depth_t bit_depth) {
   int i;
   const double minqtarget = VPXMIN(((x3 * maxq + x2) * maxq + x1) * maxq, maxq);
 
@@ -118,7 +118,7 @@
 
 static void init_minq_luts(int *kf_low_m, int *kf_high_m, int *arfgf_low,
                            int *arfgf_high, int *inter, int *rtc,
-                           vpx_bit_depth_t bit_depth) {
+                           aom_bit_depth_t bit_depth) {
   int i;
   for (i = 0; i < QINDEX_RANGE; i++) {
     const double maxq = vp10_convert_qindex_to_q(i, bit_depth);
@@ -148,7 +148,7 @@
 // These functions use formulaic calculations to make playing with the
 // quantizer tables easier. If necessary they can be replaced by lookup
 // tables if and when things settle down in the experimental bitstream
-double vp10_convert_qindex_to_q(int qindex, vpx_bit_depth_t bit_depth) {
+double vp10_convert_qindex_to_q(int qindex, aom_bit_depth_t bit_depth) {
 // Convert the index to a real Q value (scaled down to match old Q values)
 #if CONFIG_VPX_HIGHBITDEPTH
   switch (bit_depth) {
@@ -165,7 +165,7 @@
 }
 
 int vp10_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex,
-                        double correction_factor, vpx_bit_depth_t bit_depth) {
+                        double correction_factor, aom_bit_depth_t bit_depth) {
   const double q = vp10_convert_qindex_to_q(qindex, bit_depth);
   int enumerator = frame_type == KEY_FRAME ? 2700000 : 1800000;
 
@@ -179,7 +179,7 @@
 
 int vp10_estimate_bits_at_q(FRAME_TYPE frame_type, int q, int mbs,
                             double correction_factor,
-                            vpx_bit_depth_t bit_depth) {
+                            aom_bit_depth_t bit_depth) {
   const int bpm =
       (int)(vp10_rc_bits_per_mb(frame_type, q, correction_factor, bit_depth));
   return VPXMAX(FRAME_OVERHEAD_BITS,
@@ -414,7 +414,7 @@
   if (cpi->rc.is_src_frame_alt_ref) return;
 
   // Clear down mmx registers to allow floating point in what follows
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   // Work out how big we would have expected the frame to be at this Q given
   // the current correction factor.
@@ -532,7 +532,7 @@
 }
 
 static int get_kf_active_quality(const RATE_CONTROL *const rc, int q,
-                                 vpx_bit_depth_t bit_depth) {
+                                 aom_bit_depth_t bit_depth) {
   int *kf_low_motion_minq;
   int *kf_high_motion_minq;
   ASSIGN_MINQ_TABLE(bit_depth, kf_low_motion_minq);
@@ -542,7 +542,7 @@
 }
 
 static int get_gf_active_quality(const RATE_CONTROL *const rc, int q,
-                                 vpx_bit_depth_t bit_depth) {
+                                 aom_bit_depth_t bit_depth) {
   int *arfgf_low_motion_minq;
   int *arfgf_high_motion_minq;
   ASSIGN_MINQ_TABLE(bit_depth, arfgf_low_motion_minq);
@@ -710,7 +710,7 @@
   if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced &&
       !(cm->current_video_frame == 0)) {
     int qdelta = 0;
-    vpx_clear_system_state();
+    aom_clear_system_state();
     qdelta = vp10_compute_qdelta_by_rate(
         &cpi->rc, cm->frame_type, active_worst_quality, 2.0, cm->bit_depth);
     *top_index = active_worst_quality + qdelta;
@@ -864,7 +864,7 @@
 #if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
   {
     int qdelta = 0;
-    vpx_clear_system_state();
+    aom_clear_system_state();
 
     // Limit Q range for the adaptive loop.
     if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced &&
@@ -1049,7 +1049,7 @@
   }
 
 #if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
-  vpx_clear_system_state();
+  aom_clear_system_state();
   // Static forced key frames Q restrictions dealt with elsewhere.
   if (!(frame_is_intra_only(cm)) || !rc->this_key_frame_forced ||
       (cpi->twopass.last_kfgroup_zeromotion_pct < STATIC_MOTION_THRESH)) {
@@ -1470,7 +1470,7 @@
 }
 
 int vp10_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget,
-                        vpx_bit_depth_t bit_depth) {
+                        aom_bit_depth_t bit_depth) {
   int start_index = rc->worst_quality;
   int target_index = rc->worst_quality;
   int i;
@@ -1492,7 +1492,7 @@
 
 int vp10_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type,
                                 int qindex, double rate_target_ratio,
-                                vpx_bit_depth_t bit_depth) {
+                                aom_bit_depth_t bit_depth) {
   int target_index = rc->worst_quality;
   int i;
 
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h
index eaf3b57..410cebf 100644
--- a/av1/encoder/ratectrl.h
+++ b/av1/encoder/ratectrl.h
@@ -12,8 +12,8 @@
 #ifndef VP10_ENCODER_RATECTRL_H_
 #define VP10_ENCODER_RATECTRL_H_
 
-#include "aom/vpx_codec.h"
-#include "aom/vpx_integer.h"
+#include "aom/aom_codec.h"
+#include "aom/aom_integer.h"
 
 #include "av1/common/blockd.h"
 
@@ -153,9 +153,9 @@
 
 int vp10_estimate_bits_at_q(FRAME_TYPE frame_kind, int q, int mbs,
                             double correction_factor,
-                            vpx_bit_depth_t bit_depth);
+                            aom_bit_depth_t bit_depth);
 
-double vp10_convert_qindex_to_q(int qindex, vpx_bit_depth_t bit_depth);
+double vp10_convert_qindex_to_q(int qindex, aom_bit_depth_t bit_depth);
 
 void vp10_rc_init_minq_luts(void);
 
@@ -222,7 +222,7 @@
 
 // Estimates bits per mb for a given qindex and correction factor.
 int vp10_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex,
-                        double correction_factor, vpx_bit_depth_t bit_depth);
+                        double correction_factor, aom_bit_depth_t bit_depth);
 
 // Clamping utilities for bitrate targets for iframes and pframes.
 int vp10_rc_clamp_iframe_target_size(const struct VP10_COMP *const cpi,
@@ -236,13 +236,13 @@
 // Computes a q delta (in "q index" terms) to get from a starting q value
 // to a target q value
 int vp10_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget,
-                        vpx_bit_depth_t bit_depth);
+                        aom_bit_depth_t bit_depth);
 
 // Computes a q delta (in "q index" terms) to get from a starting q value
 // to a value that should equate to the given rate ratio.
 int vp10_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type,
                                 int qindex, double rate_target_ratio,
-                                vpx_bit_depth_t bit_depth);
+                                aom_bit_depth_t bit_depth);
 
 int vp10_frame_type_qdelta(const struct VP10_COMP *cpi, int rf_level, int q);
 
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index fabb6af..0d12f2d 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -15,8 +15,8 @@
 
 #include "./av1_rtcd.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/bitops.h"
 #include "aom_ports/mem.h"
 #include "aom_ports/system_state.h"
@@ -105,7 +105,7 @@
       for (j = 0; j < REF_TYPES; ++j)
         for (k = 0; k < COEF_BANDS; ++k)
           for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
-            vpx_prob probs[ENTROPY_NODES];
+            aom_prob probs[ENTROPY_NODES];
             vp10_model_to_full_probs(p[t][i][j][k][l], probs);
             vp10_cost_tokens((int *)c[t][i][j][k][0][l], probs, vp10_coef_tree);
             vp10_cost_tokens_skip((int *)c[t][i][j][k][1][l], probs,
@@ -127,7 +127,7 @@
 #endif
 
 static void init_me_luts_bd(int *bit16lut, int *bit4lut, int range,
-                            vpx_bit_depth_t bit_depth) {
+                            aom_bit_depth_t bit_depth) {
   int i;
   // Initialize the sad lut tables using a formulaic calculation for now.
   // This is to make it easier to resolve the impact of experimental changes
@@ -182,7 +182,7 @@
   return (int)rdmult;
 }
 
-static int compute_rd_thresh_factor(int qindex, vpx_bit_depth_t bit_depth) {
+static int compute_rd_thresh_factor(int qindex, aom_bit_depth_t bit_depth) {
   double q;
 #if CONFIG_VPX_HIGHBITDEPTH
   switch (bit_depth) {
@@ -264,7 +264,7 @@
   RD_OPT *const rd = &cpi->rd;
   int i;
 
-  vpx_clear_system_state();
+  aom_clear_system_state();
 
   rd->RDDIV = RDDIV_BITS;  // In bits (to multiply D by 128).
   rd->RDMULT = vp10_compute_rd_mult(cpi, cm->base_qindex + cm->y_dc_delta_q);
@@ -620,7 +620,7 @@
 }
 
 int vp10_get_intra_cost_penalty(int qindex, int qdelta,
-                                vpx_bit_depth_t bit_depth) {
+                                aom_bit_depth_t bit_depth) {
   const int q = vp10_dc_quant(qindex, qdelta, bit_depth);
 #if CONFIG_VPX_HIGHBITDEPTH
   switch (bit_depth) {
diff --git a/av1/encoder/rd.h b/av1/encoder/rd.h
index 0a699bc..9d253c3 100644
--- a/av1/encoder/rd.h
+++ b/av1/encoder/rd.h
@@ -186,7 +186,7 @@
                            const struct scale_factors *scale_uv);
 
 int vp10_get_intra_cost_penalty(int qindex, int qdelta,
-                                vpx_bit_depth_t bit_depth);
+                                aom_bit_depth_t bit_depth);
 
 #ifdef __cplusplus
 }  // extern "C"
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index a02c88b..e00717a 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -13,10 +13,10 @@
 #include <math.h>
 
 #include "./av1_rtcd.h"
-#include "./vpx_dsp_rtcd.h"
+#include "./aom_dsp_rtcd.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
 #include "aom_ports/system_state.h"
 
@@ -574,7 +574,7 @@
   TX_TYPE tx_type, best_tx_type = DCT_DCT;
   int r, s;
   int64_t d, psse, this_rd, best_rd = INT64_MAX;
-  vpx_prob skip_prob = vp10_get_skip_prob(cm, xd);
+  aom_prob skip_prob = vp10_get_skip_prob(cm, xd);
   int s0 = vp10_cost_bit(skip_prob, 0);
   int s1 = vp10_cost_bit(skip_prob, 1);
   const int is_inter = is_inter_block(mbmi);
@@ -640,7 +640,7 @@
   VP10_COMMON *const cm = &cpi->common;
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
-  vpx_prob skip_prob = vp10_get_skip_prob(cm, xd);
+  aom_prob skip_prob = vp10_get_skip_prob(cm, xd);
   int r, s;
   int64_t d, sse;
   int64_t rd = INT64_MAX;
@@ -653,7 +653,7 @@
   TX_TYPE tx_type, best_tx_type = DCT_DCT;
   const int is_inter = is_inter_block(mbmi);
 
-  const vpx_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc->tx_probs);
+  const aom_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc->tx_probs);
   assert(skip_prob > 0);
   s0 = vp10_cost_bit(skip_prob, 0);
   s1 = vp10_cost_bit(skip_prob, 1);
@@ -842,7 +842,7 @@
           xd->mi[0]->bmi[block].as_mode = mode;
           vp10_predict_intra_block(xd, 1, 1, TX_4X4, mode, dst, dst_stride, dst,
                                    dst_stride, col + idx, row + idy, 0);
-          vpx_highbd_subtract_block(4, 4, src_diff, 8, src, src_stride, dst,
+          aom_highbd_subtract_block(4, 4, src_diff, 8, src, src_stride, dst,
                                     dst_stride, xd->bd);
           if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
             TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
@@ -937,7 +937,7 @@
         xd->mi[0]->bmi[block].as_mode = mode;
         vp10_predict_intra_block(xd, 1, 1, TX_4X4, mode, dst, dst_stride, dst,
                                  dst_stride, col + idx, row + idy, 0);
-        vpx_subtract_block(4, 4, src_diff, 8, src, src_stride, dst, dst_stride);
+        aom_subtract_block(4, 4, src_diff, 8, src, src_stride, dst, dst_stride);
 
         if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
           TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
@@ -1330,27 +1330,27 @@
 #if CONFIG_VPX_HIGHBITDEPTH
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
     fwd_txm4x4 = xd->lossless[mi->mbmi.segment_id] ? vp10_highbd_fwht4x4
-                                                   : vpx_highbd_fdct4x4;
+                                                   : aom_highbd_fdct4x4;
   } else {
-    fwd_txm4x4 = xd->lossless[mi->mbmi.segment_id] ? vp10_fwht4x4 : vpx_fdct4x4;
+    fwd_txm4x4 = xd->lossless[mi->mbmi.segment_id] ? vp10_fwht4x4 : aom_fdct4x4;
   }
 #else
-  fwd_txm4x4 = xd->lossless[mi->mbmi.segment_id] ? vp10_fwht4x4 : vpx_fdct4x4;
+  fwd_txm4x4 = xd->lossless[mi->mbmi.segment_id] ? vp10_fwht4x4 : aom_fdct4x4;
 #endif  // CONFIG_VPX_HIGHBITDEPTH
 
 #if CONFIG_VPX_HIGHBITDEPTH
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
-    vpx_highbd_subtract_block(
+    aom_highbd_subtract_block(
         height, width,
         vp10_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff), 8, src,
         p->src.stride, dst, pd->dst.stride, xd->bd);
   } else {
-    vpx_subtract_block(height, width, vp10_raster_block_offset_int16(
+    aom_subtract_block(height, width, vp10_raster_block_offset_int16(
                                           BLOCK_8X8, i, p->src_diff),
                        8, src, p->src.stride, dst, pd->dst.stride);
   }
 #else
-  vpx_subtract_block(height, width,
+  aom_subtract_block(height, width,
                      vp10_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff),
                      8, src, p->src.stride, dst, pd->dst.stride);
 #endif  // CONFIG_VPX_HIGHBITDEPTH
@@ -1996,7 +1996,7 @@
                                      const MACROBLOCKD *xd, int segment_id,
                                      unsigned int *ref_costs_single,
                                      unsigned int *ref_costs_comp,
-                                     vpx_prob *comp_mode_p) {
+                                     aom_prob *comp_mode_p) {
   int seg_ref_active =
       segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME);
   if (seg_ref_active) {
@@ -2004,8 +2004,8 @@
     memset(ref_costs_comp, 0, MAX_REF_FRAMES * sizeof(*ref_costs_comp));
     *comp_mode_p = 128;
   } else {
-    vpx_prob intra_inter_p = vp10_get_intra_inter_prob(cm, xd);
-    vpx_prob comp_inter_p = 128;
+    aom_prob intra_inter_p = vp10_get_intra_inter_prob(cm, xd);
+    aom_prob comp_inter_p = 128;
 
     if (cm->reference_mode == REFERENCE_MODE_SELECT) {
       comp_inter_p = vp10_get_reference_mode_prob(cm, xd);
@@ -2017,8 +2017,8 @@
     ref_costs_single[INTRA_FRAME] = vp10_cost_bit(intra_inter_p, 0);
 
     if (cm->reference_mode != COMPOUND_REFERENCE) {
-      vpx_prob ref_single_p1 = vp10_get_pred_prob_single_ref_p1(cm, xd);
-      vpx_prob ref_single_p2 = vp10_get_pred_prob_single_ref_p2(cm, xd);
+      aom_prob ref_single_p1 = vp10_get_pred_prob_single_ref_p1(cm, xd);
+      aom_prob ref_single_p2 = vp10_get_pred_prob_single_ref_p2(cm, xd);
       unsigned int base_cost = vp10_cost_bit(intra_inter_p, 1);
 
       if (cm->reference_mode == REFERENCE_MODE_SELECT)
@@ -2037,7 +2037,7 @@
       ref_costs_single[ALTREF_FRAME] = 512;
     }
     if (cm->reference_mode != SINGLE_REFERENCE) {
-      vpx_prob ref_comp_p = vp10_get_pred_prob_comp_ref_p(cm, xd);
+      aom_prob ref_comp_p = vp10_get_pred_prob_comp_ref_p(cm, xd);
       unsigned int base_cost = vp10_cost_bit(intra_inter_p, 1);
 
       if (cm->reference_mode == REFERENCE_MODE_SELECT)
@@ -2834,7 +2834,7 @@
   int best_mode_skippable = 0;
   int midx, best_mode_index = -1;
   unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES];
-  vpx_prob comp_mode_p;
+  aom_prob comp_mode_p;
   int64_t best_intra_rd = INT64_MAX;
   unsigned int best_pred_sse = UINT_MAX;
   PREDICTION_MODE best_intra_mode = DC_PRED;
@@ -3416,7 +3416,7 @@
   int64_t best_pred_diff[REFERENCE_MODES];
   int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
   unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES];
-  vpx_prob comp_mode_p;
+  aom_prob comp_mode_p;
   INTERP_FILTER best_filter = SWITCHABLE;
   int64_t this_rd = INT64_MAX;
   int rate2 = 0;
@@ -3521,7 +3521,7 @@
   MB_MODE_INFO best_mbmode;
   int ref_index, best_ref_index = 0;
   unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES];
-  vpx_prob comp_mode_p;
+  aom_prob comp_mode_p;
   INTERP_FILTER tmp_best_filter = SWITCHABLE;
   int rate_uv_intra, rate_uv_tokenonly;
   int64_t dist_uv;
diff --git a/av1/encoder/resize.c b/av1/encoder/resize.c
index 623b1ab..18731d6 100644
--- a/av1/encoder/resize.c
+++ b/av1/encoder/resize.c
@@ -17,7 +17,7 @@
 #include <string.h>
 
 #if CONFIG_VPX_HIGHBITDEPTH
-#include "aom_dsp/vpx_dsp_common.h"
+#include "aom_dsp/aom_dsp_common.h"
 #endif  // CONFIG_VPX_HIGHBITDEPTH
 #include "aom_ports/mem.h"
 #include "av1/common/common.h"
diff --git a/av1/encoder/resize.h b/av1/encoder/resize.h
index df514a6..030f4e4 100644
--- a/av1/encoder/resize.h
+++ b/av1/encoder/resize.h
@@ -13,7 +13,7 @@
 #define VP10_ENCODER_RESIZE_H_
 
 #include <stdio.h>
-#include "aom/vpx_integer.h"
+#include "aom/aom_integer.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/av1/encoder/segmentation.c b/av1/encoder/segmentation.c
index 888445a..0c0dcce 100644
--- a/av1/encoder/segmentation.c
+++ b/av1/encoder/segmentation.c
@@ -11,7 +11,7 @@
 
 #include <limits.h>
 
-#include "aom_mem/vpx_mem.h"
+#include "aom_mem/aom_mem.h"
 
 #include "av1/common/pred_common.h"
 #include "av1/common/tile_common.h"
@@ -50,8 +50,8 @@
 
 // Based on set of segment counts calculate a probability tree
 static void calc_segtree_probs(unsigned *segcounts,
-                               vpx_prob *segment_tree_probs,
-                               const vpx_prob *cur_tree_probs) {
+                               aom_prob *segment_tree_probs,
+                               const aom_prob *cur_tree_probs) {
   // Work out probabilities of each segment
   const unsigned cc[4] = { segcounts[0] + segcounts[1],
                            segcounts[2] + segcounts[3],
@@ -83,7 +83,7 @@
 }
 
 // Based on set of segment counts and probabilities calculate a cost estimate
-static int cost_segmap(unsigned *segcounts, vpx_prob *probs) {
+static int cost_segmap(unsigned *segcounts, aom_prob *probs) {
   const int c01 = segcounts[0] + segcounts[1];
   const int c23 = segcounts[2] + segcounts[3];
   const int c45 = segcounts[4] + segcounts[5];
@@ -227,9 +227,9 @@
   unsigned t_unpred_seg_counts[MAX_SEGMENTS] = { 0 };
 #endif
 
-  vpx_prob no_pred_tree[SEG_TREE_PROBS];
-  vpx_prob t_pred_tree[SEG_TREE_PROBS];
-  vpx_prob t_nopred_prob[PREDICTION_PROBS];
+  aom_prob no_pred_tree[SEG_TREE_PROBS];
+  aom_prob t_pred_tree[SEG_TREE_PROBS];
+  aom_prob t_nopred_prob[PREDICTION_PROBS];
 
 #if CONFIG_MISC_FIXES
   (void)xd;
diff --git a/av1/encoder/skin_detection.c b/av1/encoder/skin_detection.c
index c0484f4..b24bdae 100644
--- a/av1/encoder/skin_detection.c
+++ b/av1/encoder/skin_detection.c
@@ -61,10 +61,10 @@
   const int src_uvstride = cpi->Source->uv_stride;
   YV12_BUFFER_CONFIG skinmap;
   memset(&skinmap, 0, sizeof(YV12_BUFFER_CONFIG));
-  if (vpx_alloc_frame_buffer(&skinmap, cm->width, cm->height, cm->subsampling_x,
+  if (aom_alloc_frame_buffer(&skinmap, cm->width, cm->height, cm->subsampling_x,
                              cm->subsampling_y, VPX_ENC_BORDER_IN_PIXELS,
                              cm->byte_alignment)) {
-    vpx_free_frame_buffer(&skinmap);
+    aom_free_frame_buffer(&skinmap);
     return;
   }
   memset(skinmap.buffer_alloc, 128, skinmap.frame_size);
@@ -99,6 +99,6 @@
     src_v += (src_uvstride << 2) - ((cm->mi_cols - 1) << 2);
   }
   vp10_write_yuv_frame_420(&skinmap, yuv_skinmap_file);
-  vpx_free_frame_buffer(&skinmap);
+  aom_free_frame_buffer(&skinmap);
 }
 #endif
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 8fcd902..72e2a95 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -15,7 +15,7 @@
 #include "av1/encoder/speed_features.h"
 #include "av1/encoder/rdopt.h"
 
-#include "aom_dsp/vpx_dsp_common.h"
+#include "aom_dsp/aom_dsp_common.h"
 
 // Mesh search patters for various speed settings
 static MESH_PATTERN best_quality_mesh_pattern[MAX_MESH_STEP] = {
@@ -265,7 +265,7 @@
 }
 
 static void set_rt_speed_feature(VP10_COMP *cpi, SPEED_FEATURES *sf, int speed,
-                                 vpx_tune_content content) {
+                                 aom_tune_content content) {
   VP10_COMMON *const cm = &cpi->common;
   const int is_keyframe = cm->frame_type == KEY_FRAME;
   const int frames_since_key = is_keyframe ? 0 : cpi->rc.frames_since_key;
diff --git a/av1/encoder/subexp.c b/av1/encoder/subexp.c
index 44df62e..d1930a2 100644
--- a/av1/encoder/subexp.c
+++ b/av1/encoder/subexp.c
@@ -83,49 +83,49 @@
   return i;
 }
 
-static int prob_diff_update_cost(vpx_prob newp, vpx_prob oldp) {
+static int prob_diff_update_cost(aom_prob newp, aom_prob oldp) {
   int delp = remap_prob(newp, oldp);
   return update_bits[delp] << VP9_PROB_COST_SHIFT;
 }
 
-static void encode_uniform(vpx_writer *w, int v) {
+static void encode_uniform(aom_writer *w, int v) {
   const int l = 8;
   const int m = (1 << l) - 191 + CONFIG_MISC_FIXES;
   if (v < m) {
-    vpx_write_literal(w, v, l - 1);
+    aom_write_literal(w, v, l - 1);
   } else {
-    vpx_write_literal(w, m + ((v - m) >> 1), l - 1);
-    vpx_write_literal(w, (v - m) & 1, 1);
+    aom_write_literal(w, m + ((v - m) >> 1), l - 1);
+    aom_write_literal(w, (v - m) & 1, 1);
   }
 }
 
-static INLINE int write_bit_gte(vpx_writer *w, int word, int test) {
-  vpx_write_literal(w, word >= test, 1);
+static INLINE int write_bit_gte(aom_writer *w, int word, int test) {
+  aom_write_literal(w, word >= test, 1);
   return word >= test;
 }
 
-static void encode_term_subexp(vpx_writer *w, int word) {
+static void encode_term_subexp(aom_writer *w, int word) {
   if (!write_bit_gte(w, word, 16)) {
-    vpx_write_literal(w, word, 4);
+    aom_write_literal(w, word, 4);
   } else if (!write_bit_gte(w, word, 32)) {
-    vpx_write_literal(w, word - 16, 4);
+    aom_write_literal(w, word - 16, 4);
   } else if (!write_bit_gte(w, word, 64)) {
-    vpx_write_literal(w, word - 32, 5);
+    aom_write_literal(w, word - 32, 5);
   } else {
     encode_uniform(w, word - 64);
   }
 }
 
-void vp10_write_prob_diff_update(vpx_writer *w, vpx_prob newp, vpx_prob oldp) {
+void vp10_write_prob_diff_update(aom_writer *w, aom_prob newp, aom_prob oldp) {
   const int delp = remap_prob(newp, oldp);
   encode_term_subexp(w, delp);
 }
 
-int vp10_prob_diff_update_savings_search(const unsigned int *ct, vpx_prob oldp,
-                                         vpx_prob *bestp, vpx_prob upd) {
+int vp10_prob_diff_update_savings_search(const unsigned int *ct, aom_prob oldp,
+                                         aom_prob *bestp, aom_prob upd) {
   const int old_b = cost_branch256(ct, oldp);
   int bestsavings = 0;
-  vpx_prob newp, bestnewp = oldp;
+  aom_prob newp, bestnewp = oldp;
   const int step = *bestp > oldp ? -1 : 1;
 
   for (newp = *bestp; newp != oldp; newp += step) {
@@ -142,14 +142,14 @@
 }
 
 int vp10_prob_diff_update_savings_search_model(const unsigned int *ct,
-                                               const vpx_prob *oldp,
-                                               vpx_prob *bestp, vpx_prob upd,
+                                               const aom_prob *oldp,
+                                               aom_prob *bestp, aom_prob upd,
                                                int stepsize) {
   int i, old_b, new_b, update_b, savings, bestsavings, step;
   int newp;
-  vpx_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES];
+  aom_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES];
   vp10_model_to_full_probs(oldp, oldplist);
-  memcpy(newplist, oldp, sizeof(vpx_prob) * UNCONSTRAINED_NODES);
+  memcpy(newplist, oldp, sizeof(aom_prob) * UNCONSTRAINED_NODES);
   for (i = UNCONSTRAINED_NODES, old_b = 0; i < ENTROPY_NODES; ++i)
     old_b += cost_branch256(ct + 2 * i, oldplist[i]);
   old_b += cost_branch256(ct + 2 * PIVOT_NODE, oldplist[PIVOT_NODE]);
@@ -197,26 +197,26 @@
   return bestsavings;
 }
 
-void vp10_cond_prob_diff_update(vpx_writer *w, vpx_prob *oldp,
+void vp10_cond_prob_diff_update(aom_writer *w, aom_prob *oldp,
                                 const unsigned int ct[2]) {
-  const vpx_prob upd = DIFF_UPDATE_PROB;
-  vpx_prob newp = get_binary_prob(ct[0], ct[1]);
+  const aom_prob upd = DIFF_UPDATE_PROB;
+  aom_prob newp = get_binary_prob(ct[0], ct[1]);
   const int savings =
       vp10_prob_diff_update_savings_search(ct, *oldp, &newp, upd);
   assert(newp >= 1);
   if (savings > 0) {
-    vpx_write(w, 1, upd);
+    aom_write(w, 1, upd);
     vp10_write_prob_diff_update(w, newp, *oldp);
     *oldp = newp;
   } else {
-    vpx_write(w, 0, upd);
+    aom_write(w, 0, upd);
   }
 }
 
-int vp10_cond_prob_diff_update_savings(vpx_prob *oldp,
+int vp10_cond_prob_diff_update_savings(aom_prob *oldp,
                                        const unsigned int ct[2]) {
-  const vpx_prob upd = DIFF_UPDATE_PROB;
-  vpx_prob newp = get_binary_prob(ct[0], ct[1]);
+  const aom_prob upd = DIFF_UPDATE_PROB;
+  aom_prob newp = get_binary_prob(ct[0], ct[1]);
   const int savings =
       vp10_prob_diff_update_savings_search(ct, *oldp, &newp, upd);
   return savings;
diff --git a/av1/encoder/subexp.h b/av1/encoder/subexp.h
index 257c7fd..9d870f5 100644
--- a/av1/encoder/subexp.h
+++ b/av1/encoder/subexp.h
@@ -18,23 +18,23 @@
 
 #include "aom_dsp/prob.h"
 
-struct vpx_writer;
+struct aom_writer;
 
-void vp10_write_prob_diff_update(struct vpx_writer *w, vpx_prob newp,
-                                 vpx_prob oldp);
+void vp10_write_prob_diff_update(struct aom_writer *w, aom_prob newp,
+                                 aom_prob oldp);
 
-void vp10_cond_prob_diff_update(struct vpx_writer *w, vpx_prob *oldp,
+void vp10_cond_prob_diff_update(struct aom_writer *w, aom_prob *oldp,
                                 const unsigned int ct[2]);
 
-int vp10_prob_diff_update_savings_search(const unsigned int *ct, vpx_prob oldp,
-                                         vpx_prob *bestp, vpx_prob upd);
+int vp10_prob_diff_update_savings_search(const unsigned int *ct, aom_prob oldp,
+                                         aom_prob *bestp, aom_prob upd);
 
 int vp10_prob_diff_update_savings_search_model(const unsigned int *ct,
-                                               const vpx_prob *oldp,
-                                               vpx_prob *bestp, vpx_prob upd,
+                                               const aom_prob *oldp,
+                                               aom_prob *bestp, aom_prob upd,
                                                int stepsize);
 
-int vp10_cond_prob_diff_update_savings(vpx_prob *oldp,
+int vp10_cond_prob_diff_update_savings(aom_prob *oldp,
                                        const unsigned int ct[2]);
 #ifdef __cplusplus
 }  // extern "C"
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index cb21703..cdad633 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -25,11 +25,11 @@
 #include "av1/encoder/ratectrl.h"
 #include "av1/encoder/segmentation.h"
 #include "av1/encoder/temporal_filter.h"
-#include "aom_dsp/vpx_dsp_common.h"
-#include "aom_mem/vpx_mem.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_mem/aom_mem.h"
 #include "aom_ports/mem.h"
-#include "aom_ports/vpx_timer.h"
-#include "aom_scale/vpx_scale.h"
+#include "aom_ports/aom_timer.h"
+#include "aom_scale/aom_scale.h"
 
 static void temporal_filter_predictors_mb_c(
     MACROBLOCKD *xd, uint8_t *y_mb_ptr, uint8_t *u_mb_ptr, uint8_t *v_mb_ptr,
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index f9590f6..21fd17c 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -14,7 +14,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "aom_mem/vpx_mem.h"
+#include "aom_mem/aom_mem.h"
 
 #include "av1/common/entropy.h"
 #include "av1/common/pred_common.h"
@@ -52,7 +52,7 @@
         2;
 
 // Array indices are identical to previously-existing CONTEXT_NODE indices
-const vpx_tree_index vp10_coef_tree[TREE_SIZE(ENTROPY_TOKENS)] = {
+const aom_tree_index vp10_coef_tree[TREE_SIZE(ENTROPY_TOKENS)] = {
   -EOB_TOKEN,
   2,  // 0  = EOB
   -ZERO_TOKEN,
@@ -77,12 +77,12 @@
   -CATEGORY6_TOKEN  // 10 = CAT_FIVE
 };
 
-static const vpx_tree_index cat1[2] = { 0, 0 };
-static const vpx_tree_index cat2[4] = { 2, 2, 0, 0 };
-static const vpx_tree_index cat3[6] = { 2, 2, 4, 4, 0, 0 };
-static const vpx_tree_index cat4[8] = { 2, 2, 4, 4, 6, 6, 0, 0 };
-static const vpx_tree_index cat5[10] = { 2, 2, 4, 4, 6, 6, 8, 8, 0, 0 };
-static const vpx_tree_index cat6[28] = { 2,  2,  4,  4,  6,  6,  8,  8,  10, 10,
+static const aom_tree_index cat1[2] = { 0, 0 };
+static const aom_tree_index cat2[4] = { 2, 2, 0, 0 };
+static const aom_tree_index cat3[6] = { 2, 2, 4, 4, 0, 0 };
+static const aom_tree_index cat4[8] = { 2, 2, 4, 4, 6, 6, 0, 0 };
+static const aom_tree_index cat5[10] = { 2, 2, 4, 4, 6, 6, 8, 8, 0, 0 };
+static const aom_tree_index cat6[28] = { 2,  2,  4,  4,  6,  6,  8,  8,  10, 10,
                                          12, 12, 14, 14, 16, 16, 18, 18, 20, 20,
                                          22, 22, 24, 24, 26, 26, 0,  0 };
 
@@ -257,21 +257,21 @@
 #endif
 
 #if CONFIG_VPX_HIGHBITDEPTH
-static const vpx_tree_index cat1_high10[2] = { 0, 0 };
-static const vpx_tree_index cat2_high10[4] = { 2, 2, 0, 0 };
-static const vpx_tree_index cat3_high10[6] = { 2, 2, 4, 4, 0, 0 };
-static const vpx_tree_index cat4_high10[8] = { 2, 2, 4, 4, 6, 6, 0, 0 };
-static const vpx_tree_index cat5_high10[10] = { 2, 2, 4, 4, 6, 6, 8, 8, 0, 0 };
-static const vpx_tree_index cat6_high10[32] = { 2,  2,  4,  4,  6,  6,  8,  8,
+static const aom_tree_index cat1_high10[2] = { 0, 0 };
+static const aom_tree_index cat2_high10[4] = { 2, 2, 0, 0 };
+static const aom_tree_index cat3_high10[6] = { 2, 2, 4, 4, 0, 0 };
+static const aom_tree_index cat4_high10[8] = { 2, 2, 4, 4, 6, 6, 0, 0 };
+static const aom_tree_index cat5_high10[10] = { 2, 2, 4, 4, 6, 6, 8, 8, 0, 0 };
+static const aom_tree_index cat6_high10[32] = { 2,  2,  4,  4,  6,  6,  8,  8,
                                                 10, 10, 12, 12, 14, 14, 16, 16,
                                                 18, 18, 20, 20, 22, 22, 24, 24,
                                                 26, 26, 28, 28, 30, 30, 0,  0 };
-static const vpx_tree_index cat1_high12[2] = { 0, 0 };
-static const vpx_tree_index cat2_high12[4] = { 2, 2, 0, 0 };
-static const vpx_tree_index cat3_high12[6] = { 2, 2, 4, 4, 0, 0 };
-static const vpx_tree_index cat4_high12[8] = { 2, 2, 4, 4, 6, 6, 0, 0 };
-static const vpx_tree_index cat5_high12[10] = { 2, 2, 4, 4, 6, 6, 8, 8, 0, 0 };
-static const vpx_tree_index cat6_high12[36] = {
+static const aom_tree_index cat1_high12[2] = { 0, 0 };
+static const aom_tree_index cat2_high12[4] = { 2, 2, 0, 0 };
+static const aom_tree_index cat3_high12[6] = { 2, 2, 4, 4, 0, 0 };
+static const aom_tree_index cat4_high12[8] = { 2, 2, 4, 4, 6, 6, 0, 0 };
+static const aom_tree_index cat5_high12[10] = { 2, 2, 4, 4, 6, 6, 8, 8, 0, 0 };
+static const aom_tree_index cat6_high12[36] = {
   2,  2,  4,  4,  6,  6,  8,  8,  10, 10, 12, 12, 14, 14, 16, 16, 18, 18,
   20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 32, 32, 34, 34, 0,  0
 };
@@ -347,7 +347,7 @@
                     blk_row);
 }
 
-static INLINE void add_token(TOKENEXTRA **t, const vpx_prob *context_tree,
+static INLINE void add_token(TOKENEXTRA **t, const aom_prob *context_tree,
                              int32_t extra, uint8_t token,
                              uint8_t skip_eob_node, unsigned int *counts) {
   (*t)->token = token;
@@ -359,7 +359,7 @@
 }
 
 static INLINE void add_token_no_extra(TOKENEXTRA **t,
-                                      const vpx_prob *context_tree,
+                                      const aom_prob *context_tree,
                                       uint8_t token, uint8_t skip_eob_node,
                                       unsigned int *counts) {
   (*t)->token = token;
@@ -400,7 +400,7 @@
   const int ref = is_inter_block(mbmi);
   unsigned int (*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
       td->rd_counts.coef_counts[tx_size][type][ref];
-  vpx_prob (*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
+  aom_prob (*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
       cpi->common.fc->coef_probs[tx_size][type][ref];
   unsigned int (*const eob_branch)[COEFF_CONTEXTS] =
       td->counts->eob_branch[tx_size][type][ref];
diff --git a/av1/encoder/tokenize.h b/av1/encoder/tokenize.h
index f90ec0a..a7a37cb 100644
--- a/av1/encoder/tokenize.h
+++ b/av1/encoder/tokenize.h
@@ -35,14 +35,14 @@
 } TOKENVALUE;
 
 typedef struct {
-  const vpx_prob *context_tree;
+  const aom_prob *context_tree;
   EXTRABIT extra;
   uint8_t token;
   uint8_t skip_eob_node;
 } TOKENEXTRA;
 
-extern const vpx_tree_index vp10_coef_tree[];
-extern const vpx_tree_index vp10_coef_con_tree[];
+extern const aom_tree_index vp10_coef_tree[];
+extern const aom_tree_index vp10_coef_con_tree[];
 extern const struct vp10_token vp10_coef_encodings[];
 
 int vp10_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
diff --git a/av1/encoder/treewriter.c b/av1/encoder/treewriter.c
index d87654f..e1b9887 100644
--- a/av1/encoder/treewriter.c
+++ b/av1/encoder/treewriter.c
@@ -11,13 +11,13 @@
 
 #include "av1/encoder/treewriter.h"
 
-static void tree2tok(struct vp10_token *tokens, const vpx_tree_index *tree,
+static void tree2tok(struct vp10_token *tokens, const aom_tree_index *tree,
                      int i, int v, int l) {
   v += v;
   ++l;
 
   do {
-    const vpx_tree_index j = tree[i++];
+    const aom_tree_index j = tree[i++];
     if (j <= 0) {
       tokens[-j].value = v;
       tokens[-j].len = l;
@@ -28,11 +28,11 @@
 }
 
 void vp10_tokens_from_tree(struct vp10_token *tokens,
-                           const vpx_tree_index *tree) {
+                           const aom_tree_index *tree) {
   tree2tok(tokens, tree, 0, 0, 0);
 }
 
-static unsigned int convert_distribution(unsigned int i, vpx_tree tree,
+static unsigned int convert_distribution(unsigned int i, aom_tree tree,
                                          unsigned int branch_ct[][2],
                                          const unsigned int num_events[]) {
   unsigned int left, right;
@@ -52,7 +52,7 @@
   return left + right;
 }
 
-void vp10_tree_probs_from_distribution(vpx_tree tree,
+void vp10_tree_probs_from_distribution(aom_tree tree,
                                        unsigned int branch_ct[/* n-1 */][2],
                                        const unsigned int num_events[/* n */]) {
   convert_distribution(0, tree, branch_ct, num_events);
diff --git a/av1/encoder/treewriter.h b/av1/encoder/treewriter.h
index f471b7e..306bd4a 100644
--- a/av1/encoder/treewriter.h
+++ b/av1/encoder/treewriter.h
@@ -18,7 +18,7 @@
 extern "C" {
 #endif
 
-void vp10_tree_probs_from_distribution(vpx_tree tree,
+void vp10_tree_probs_from_distribution(aom_tree tree,
                                        unsigned int branch_ct[/* n - 1 */][2],
                                        const unsigned int num_events[/* n */]);
 
@@ -27,20 +27,20 @@
   int len;
 };
 
-void vp10_tokens_from_tree(struct vp10_token *, const vpx_tree_index *);
+void vp10_tokens_from_tree(struct vp10_token *, const aom_tree_index *);
 
-static INLINE void vp10_write_tree(vpx_writer *w, const vpx_tree_index *tree,
-                                   const vpx_prob *probs, int bits, int len,
-                                   vpx_tree_index i) {
+static INLINE void vp10_write_tree(aom_writer *w, const aom_tree_index *tree,
+                                   const aom_prob *probs, int bits, int len,
+                                   aom_tree_index i) {
   do {
     const int bit = (bits >> --len) & 1;
-    vpx_write(w, bit, probs[i >> 1]);
+    aom_write(w, bit, probs[i >> 1]);
     i = tree[i + bit];
   } while (len);
 }
 
-static INLINE void vp10_write_token(vpx_writer *w, const vpx_tree_index *tree,
-                                    const vpx_prob *probs,
+static INLINE void vp10_write_token(aom_writer *w, const aom_tree_index *tree,
+                                    const aom_prob *probs,
                                     const struct vp10_token *token) {
   vp10_write_tree(w, tree, probs, token->value, token->len, 0);
 }
diff --git a/av1/encoder/x86/dct_sse2.c b/av1/encoder/x86/dct_sse2.c
index 69f10b7..54a9d2d 100644
--- a/av1/encoder/x86/dct_sse2.c
+++ b/av1/encoder/x86/dct_sse2.c
@@ -13,7 +13,7 @@
 #include <emmintrin.h>  // SSE2
 
 #include "./av1_rtcd.h"
-#include "./vpx_dsp_rtcd.h"
+#include "./aom_dsp_rtcd.h"
 #include "aom_dsp/txfm_common.h"
 #include "aom_dsp/x86/fwd_txfm_sse2.h"
 #include "aom_dsp/x86/txfm_common_sse2.h"
@@ -157,7 +157,7 @@
   __m128i in[4];
 
   switch (tx_type) {
-    case DCT_DCT: vpx_fdct4x4_sse2(input, output, stride); break;
+    case DCT_DCT: aom_fdct4x4_sse2(input, output, stride); break;
     case ADST_DCT:
       load_buffer_4x4(input, in, stride);
       fadst4_sse2(in);
@@ -1134,7 +1134,7 @@
   __m128i in[8];
 
   switch (tx_type) {
-    case DCT_DCT: vpx_fdct8x8_sse2(input, output, stride); break;
+    case DCT_DCT: aom_fdct8x8_sse2(input, output, stride); break;
     case ADST_DCT:
       load_buffer_8x8(input, in, stride);
       fadst8_sse2(in);
@@ -2017,7 +2017,7 @@
   __m128i in0[16], in1[16];
 
   switch (tx_type) {
-    case DCT_DCT: vpx_fdct16x16_sse2(input, output, stride); break;
+    case DCT_DCT: aom_fdct16x16_sse2(input, output, stride); break;
     case ADST_DCT:
       load_buffer_16x16(input, in0, in1, stride);
       fadst16_sse2(in0, in1);
diff --git a/av1/encoder/x86/error_intrin_avx2.c b/av1/encoder/x86/error_intrin_avx2.c
index 7533557..5f60c3c 100644
--- a/av1/encoder/x86/error_intrin_avx2.c
+++ b/av1/encoder/x86/error_intrin_avx2.c
@@ -12,7 +12,7 @@
 #include <immintrin.h>  // AVX2
 
 #include "./av1_rtcd.h"
-#include "aom/vpx_integer.h"
+#include "aom/aom_integer.h"
 
 int64_t vp10_block_error_avx2(const int16_t *coeff, const int16_t *dqcoeff,
                               intptr_t block_size, int64_t *ssz) {
diff --git a/av1/encoder/x86/quantize_sse2.c b/av1/encoder/x86/quantize_sse2.c
index 7e0c0ec..44b44d0 100644
--- a/av1/encoder/x86/quantize_sse2.c
+++ b/av1/encoder/x86/quantize_sse2.c
@@ -13,7 +13,7 @@
 #include <xmmintrin.h>
 
 #include "./av1_rtcd.h"
-#include "aom/vpx_integer.h"
+#include "aom/aom_integer.h"
 
 void vp10_quantize_fp_sse2(const int16_t* coeff_ptr, intptr_t n_coeffs,
                            int skip_block, const int16_t* zbin_ptr,