shithub: libvpx

Download patch

ref: 209c6cbf8f8ffcd0a43a9deaad0516aca8d59a9f
parent: db60c02c9e0524b87915cc22f01c2f89c2df6f0b
author: Dmitry Kovalev <dkovalev@google.com>
date: Fri Sep 27 10:11:13 EDT 2013

Removing vp9_get_coef_neighbors_handle function.

Change-Id: I6be72c8b048d1ccc7ef43764cf84c32360098970

--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -569,31 +569,6 @@
                       vp9_default_scan_32x32_neighbors);
 }
 
-const int16_t *vp9_get_coef_neighbors_handle(const int16_t *scan) {
-  if (scan == vp9_default_scan_4x4) {
-    return vp9_default_scan_4x4_neighbors;
-  } else if (scan == vp9_row_scan_4x4) {
-    return vp9_row_scan_4x4_neighbors;
-  } else if (scan == vp9_col_scan_4x4) {
-    return vp9_col_scan_4x4_neighbors;
-  } else if (scan == vp9_default_scan_8x8) {
-    return vp9_default_scan_8x8_neighbors;
-  } else if (scan == vp9_row_scan_8x8) {
-    return vp9_row_scan_8x8_neighbors;
-  } else if (scan == vp9_col_scan_8x8) {
-    return vp9_col_scan_8x8_neighbors;
-  } else if (scan == vp9_default_scan_16x16) {
-    return vp9_default_scan_16x16_neighbors;
-  } else if (scan == vp9_row_scan_16x16) {
-    return vp9_row_scan_16x16_neighbors;
-  } else if (scan == vp9_col_scan_16x16) {
-    return vp9_col_scan_16x16_neighbors;
-  } else {
-    assert(scan == vp9_default_scan_32x32);
-    return vp9_default_scan_32x32_neighbors;
-  }
-}
-
 void vp9_coef_tree_initialize() {
   vp9_init_neighbors();
   init_bit_trees();
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -190,9 +190,6 @@
           token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1;
 }
 
-const int16_t *vp9_get_coef_neighbors_handle(const int16_t *scan);
-
-
 // 128 lists of probabilities are stored for the following ONE node probs:
 // 1, 3, 5, 7, ..., 253, 255
 // In between probabilities are interpolated linearly
@@ -367,22 +364,24 @@
 static void get_scan_and_band(const MACROBLOCKD *xd, TX_SIZE tx_size,
                               PLANE_TYPE type, int block_idx,
                               const int16_t **scan,
+                              const int16_t **scan_nb,
                               const uint8_t **band_translate) {
   switch (tx_size) {
     case TX_4X4:
-      *scan = get_scan_4x4(get_tx_type_4x4(type, xd, block_idx));
+      get_scan_nb_4x4(get_tx_type_4x4(type, xd, block_idx), scan, scan_nb);
       *band_translate = vp9_coefband_trans_4x4;
       break;
     case TX_8X8:
-      *scan = get_scan_8x8(get_tx_type_8x8(type, xd));
+      get_scan_nb_8x8(get_tx_type_8x8(type, xd), scan, scan_nb);
       *band_translate = vp9_coefband_trans_8x8plus;
       break;
     case TX_16X16:
-      *scan = get_scan_16x16(get_tx_type_16x16(type, xd));
+      get_scan_nb_16x16(get_tx_type_16x16(type, xd), scan, scan_nb);
       *band_translate = vp9_coefband_trans_8x8plus;
       break;
     case TX_32X32:
       *scan = vp9_default_scan_32x32;
+      *scan_nb = vp9_default_scan_32x32_neighbors;
       *band_translate = vp9_coefband_trans_8x8plus;
       break;
     default:
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -106,8 +106,7 @@
   const uint8_t *band_translate;
   uint8_t token_cache[1024];
   int pt = get_entropy_context(tx_size, A, L);
-  get_scan_and_band(xd, tx_size, type, block_idx, &scan, &band_translate);
-  nb = vp9_get_coef_neighbors_handle(scan);
+  get_scan_and_band(xd, tx_size, type, block_idx, &scan, &nb, &band_translate);
 
   while (1) {
     int val;
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -172,7 +172,7 @@
   assert((!type && !plane) || (type && plane));
   dqcoeff_ptr = BLOCK_OFFSET(pd->dqcoeff, block);
   qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block);
-  get_scan_and_band(xd, tx_size, type, ib, &scan, &band_translate);
+  get_scan_and_band(xd, tx_size, type, ib, &scan, &nb, &band_translate);
   assert(eob <= default_eob);
 
   /* Now set up a Viterbi trellis to evaluate alternative roundings. */
@@ -191,7 +191,6 @@
   for (i = 0; i < eob; i++)
     token_cache[scan[i]] = vp9_pt_energy_class[vp9_dct_value_tokens_ptr[
         qcoeff_ptr[scan[i]]].token];
-  nb = vp9_get_coef_neighbors_handle(scan);
 
   for (i = eob; i-- > i0;) {
     int base_bits, d2, dx;
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1097,6 +1097,7 @@
       for (idx = 0; idx < num_4x4_blocks_wide; ++idx) {
         int64_t ssz;
         const int16_t *scan;
+        const int16_t *nb;
         uint8_t *src = src_init + idx * 4 + idy * 4 * src_stride;
         uint8_t *dst = dst_init + idx * 4 + idy * 4 * dst_stride;
 
@@ -1122,10 +1123,10 @@
           x->quantize_b_4x4(x, block, tx_type, 16);
         }
 
-        scan = get_scan_4x4(get_tx_type_4x4(PLANE_TYPE_Y_WITH_DC, xd, block));
+        get_scan_nb_4x4(get_tx_type_4x4(PLANE_TYPE_Y_WITH_DC, xd, block),
+                        &scan, &nb);
         ratey += cost_coeffs(x, 0, block,
-                             tempa + idx, templ + idy, TX_4X4, scan,
-                             vp9_get_coef_neighbors_handle(scan));
+                             tempa + idx, templ + idy, TX_4X4, scan, nb);
         distortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, block),
                                       16, &ssz) >> 2;
         if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd)
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -137,8 +137,7 @@
 
   pt = get_entropy_context(tx_size, pd->above_context + aoff,
                                     pd->left_context + loff);
-  get_scan_and_band(xd, tx_size, type, block, &scan, &band_translate);
-  nb = vp9_get_coef_neighbors_handle(scan);
+  get_scan_and_band(xd, tx_size, type, block, &scan, &nb, &band_translate);
   c = 0;
   do {
     const int band = get_coef_band(band_translate, c);