shithub: libvpx

Download patch

ref: 497b6744eae5553f5264b1c2350351a03d4a6351
parent: b63788a116d3f503b11bee4797470bd658109530
parent: 29b9461a5a1d9cdb59ae788e1c24507f82dc12b5
author: James Zern <jzern@google.com>
date: Thu Feb 4 01:25:44 EST 2016

Merge changes from topic 'dead-code'

* changes:
  yv12config.c: remove dead CONFIG_ALPHA code
  vp9_encoder.c: remove unused macro
  vpx_mem.c: remove unused macro
  vp9_svc_layercontext.c: relocate a macro definition
  vp9_encoder.c: protect SNPRINT* macros w/CONFIG check
  vp9_aq_360.c: remove some unused macros
  vp9_diamond_search_sad_avx.c: rename (un)likely macros
  vp9_resize.c: add missing include
  vp9_aq_complexity.c: remove unused macros
  vp9_detokenize.c: remove unused macros

--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -23,14 +23,6 @@
 #define EOB_CONTEXT_NODE            0
 #define ZERO_CONTEXT_NODE           1
 #define ONE_CONTEXT_NODE            2
-#define LOW_VAL_CONTEXT_NODE        0
-#define TWO_CONTEXT_NODE            1
-#define THREE_CONTEXT_NODE          2
-#define HIGH_LOW_CONTEXT_NODE       3
-#define CAT_ONE_CONTEXT_NODE        4
-#define CAT_THREEFOUR_CONTEXT_NODE  5
-#define CAT_THREE_CONTEXT_NODE      6
-#define CAT_FIVE_CONTEXT_NODE       7
 
 #define INCREMENT_COUNT(token)                              \
   do {                                                      \
--- a/vp9/encoder/vp9_aq_360.c
+++ b/vp9/encoder/vp9_aq_360.c
@@ -21,12 +21,6 @@
 #include "vp9/encoder/vp9_rd.h"
 #include "vp9/encoder/vp9_segmentation.h"
 
-#define ENERGY_MIN (-4)
-#define ENERGY_MAX (1)
-#define ENERGY_SPAN (ENERGY_MAX - ENERGY_MIN +  1)
-#define ENERGY_IN_BOUNDS(energy)\
-  assert((energy) >= ENERGY_MIN && (energy) <= ENERGY_MAX)
-
 static const double rate_ratio[MAX_SEGMENTS] =
   {1.0, 0.75, 0.6, 0.5, 0.4, 0.3, 0.25};
 
--- a/vp9/encoder/vp9_aq_complexity.c
+++ b/vp9/encoder/vp9_aq_complexity.c
@@ -35,9 +35,6 @@
     {-3.5, -2.5, -1.5, 100.00, 100.0},
     {-3.0, -2.0, -1.0, 100.00, 100.0} };
 
-#define DEFAULT_COMPLEXITY 64
-
-
 static int get_aq_c_strength(int q_index, vpx_bit_depth_t bit_depth) {
   // Approximate base quatizer (truncated to int)
   const int base_quant = vp9_ac_quant(q_index, 0, bit_depth) / 4;
@@ -107,7 +104,6 @@
 
 #define DEFAULT_LV_THRESH 10.0
 #define MIN_DEFAULT_LV_THRESH 8.0
-#define VAR_STRENGTH_STEP 0.25
 // Select a segment for the current block.
 // The choice of segment for a block depends on the ratio of the projected
 // bits for the block vs a target average and its spatial complexity.
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -62,8 +62,6 @@
 #define AM_SEGMENT_ID_INACTIVE 7
 #define AM_SEGMENT_ID_ACTIVE 0
 
-#define SHARP_FILTER_QTHRESH 0          /* Q threshold for 8-tap sharp filter */
-
 #define ALTREF_HIGH_PRECISION_MV 1      // Whether to use high precision mv
                                          //  for altref computation.
 #define HIGH_PRECISION_MV_QTHRESH 200   // Q threshold for high precision
@@ -1967,11 +1965,14 @@
 
   return cpi;
 }
+
+#if CONFIG_INTERNAL_STATS
 #define SNPRINT(H, T) \
   snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T))
 
 #define SNPRINT2(H, T, V) \
   snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
+#endif  // CONFIG_INTERNAL_STATS
 
 void vp9_remove_compressor(VP9_COMP *cpi) {
   VP9_COMMON *cm;
--- a/vp9/encoder/vp9_resize.c
+++ b/vp9/encoder/vp9_resize.c
@@ -15,6 +15,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "./vpx_config.h"
 #if CONFIG_VP9_HIGHBITDEPTH
 #include "vpx_dsp/vpx_dsp_common.h"
 #endif  // CONFIG_VP9_HIGHBITDEPTH
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -16,7 +16,6 @@
 #include "vp9/encoder/vp9_extend.h"
 #include "vpx_dsp/vpx_dsp_common.h"
 
-#define SMALL_FRAME_FB_IDX 7
 #define SMALL_FRAME_WIDTH  32
 #define SMALL_FRAME_HEIGHT 16
 
@@ -644,6 +643,8 @@
 }
 
 #if CONFIG_SPATIAL_SVC
+#define SMALL_FRAME_FB_IDX 7
+
 int vp9_svc_start_frame(VP9_COMP *const cpi) {
   int width = 0, height = 0;
   LAYER_CONTEXT *lc;
@@ -754,7 +755,8 @@
   return 0;
 }
 
-#endif
+#undef SMALL_FRAME_FB_IDX
+#endif  // CONFIG_SPATIAL_SVC
 
 struct lookahead_entry *vp9_svc_lookahead_pop(VP9_COMP *const cpi,
                                               struct lookahead_ctx *ctx,
--- a/vp9/encoder/x86/vp9_diamond_search_sad_avx.c
+++ b/vp9/encoder/x86/vp9_diamond_search_sad_avx.c
@@ -19,11 +19,11 @@
 #include "vpx_ports/mem.h"
 
 #ifdef __GNUC__
-# define __likely__(v)    __builtin_expect(v, 1)
-# define __unlikely__(v)  __builtin_expect(v, 0)
+# define LIKELY(v)    __builtin_expect(v, 1)
+# define UNLIKELY(v)  __builtin_expect(v, 0)
 #else
-# define __likely__(v)    (v)
-# define __unlikely__(v)  (v)
+# define LIKELY(v)    (v)
+# define UNLIKELY(v)  (v)
 #endif
 
 static INLINE int_mv pack_int_mv(int16_t row, int16_t col) {
@@ -163,7 +163,7 @@
       v_inside_d = _mm_cmpeq_epi32(v_these_mv_clamp_w, v_these_mv_w);
 
       // If none of them are inside, then move on
-      if (__likely__(_mm_test_all_zeros(v_inside_d, v_inside_d))) {
+      if (LIKELY(_mm_test_all_zeros(v_inside_d, v_inside_d))) {
         continue;
       }
 
@@ -269,7 +269,7 @@
         // If the local best value is not saturated, just use it, otherwise
         // find the horizontal minimum again the hard way on 32 bits.
         // This is executed rarely.
-        if (__unlikely__(local_best_sad == 0xffff)) {
+        if (UNLIKELY(local_best_sad == 0xffff)) {
           __m128i v_loval_d, v_hival_d, v_loidx_d, v_hiidx_d, v_sel_d;
 
           v_loval_d = v_sad_d;
@@ -294,7 +294,7 @@
         }
 
         // Update the global minimum if the local minimum is smaller
-        if (__likely__(local_best_sad < best_sad)) {
+        if (LIKELY(local_best_sad < best_sad)) {
           new_bmv = ((const int_mv *)&v_these_mv_w)[local_best_idx];
           new_best_address = ((const uint8_t **)v_blocka)[local_best_idx];
 
@@ -313,7 +313,7 @@
     v_ba_d = _mm_set1_epi32((intptr_t)best_address);
 #endif
 
-    if (__unlikely__(best_address == in_what)) {
+    if (UNLIKELY(best_address == in_what)) {
       (*num00)++;
     }
   }
--- a/vpx_mem/vpx_mem.c
+++ b/vpx_mem/vpx_mem.c
@@ -9,8 +9,6 @@
  */
 
 
-#define __VPX_MEM_C__
-
 #include "vpx_mem.h"
 #include <stdio.h>
 #include <stdlib.h>
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -160,29 +160,12 @@
     const uint64_t uvplane_size = (uv_height + 2 * uv_border_h) *
                                   (uint64_t)uv_stride + byte_alignment;
 
-#if CONFIG_ALPHA
-    const int alpha_width = aligned_width;
-    const int alpha_height = aligned_height;
-    const int alpha_stride = y_stride;
-    const int alpha_border_w = border;
-    const int alpha_border_h = border;
-    const uint64_t alpha_plane_size = (alpha_height + 2 * alpha_border_h) *
-                                      (uint64_t)alpha_stride + byte_alignment;
 #if CONFIG_VP9_HIGHBITDEPTH
-    const uint64_t frame_size = (1 + use_highbitdepth) *
-        (yplane_size + 2 * uvplane_size + alpha_plane_size);
-#else
-    const uint64_t frame_size = yplane_size + 2 * uvplane_size +
-                                alpha_plane_size;
-#endif  // CONFIG_VP9_HIGHBITDEPTH
-#else
-#if CONFIG_VP9_HIGHBITDEPTH
     const uint64_t frame_size =
         (1 + use_highbitdepth) * (yplane_size + 2 * uvplane_size);
 #else
     const uint64_t frame_size = yplane_size + 2 * uvplane_size;
 #endif  // CONFIG_VP9_HIGHBITDEPTH
-#endif  // CONFIG_ALPHA
 
     uint8_t *buf = NULL;
 
@@ -277,14 +260,6 @@
         buf + yplane_size + uvplane_size + (uv_border_h * uv_stride) +
         uv_border_w, vp9_byte_align);
 
-#if CONFIG_ALPHA
-    ybf->alpha_width = alpha_width;
-    ybf->alpha_height = alpha_height;
-    ybf->alpha_stride = alpha_stride;
-    ybf->alpha_buffer = (uint8_t *)yv12_align_addr(
-        buf + yplane_size + 2 * uvplane_size +
-        (alpha_border_h * alpha_stride) + alpha_border_w, vp9_byte_align);
-#endif
     ybf->corrupted = 0; /* assume not corrupted by errors */
     return 0;
   }