From 8ec0159159b99d0e89486730e2f1d8b29bad3467 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:41:17 -0800 Subject: [PATCH 01/10] vp9_detokenize.c: remove unused macros LOW_VAL_CONTEXT_NODE TWO_CONTEXT_NODE THREE_CONTEXT_NODE HIGH_LOW_CONTEXT_NODE CAT_ONE_CONTEXT_NODE CAT_THREEFOUR_CONTEXT_NODE CAT_THREE_CONTEXT_NODE CAT_FIVE_CONTEXT_NODE unused since: adaec4d Speeding up decode_coeffs(). Change-Id: Id07d2b0b76ff0ee6ef40d1b7a8e085e5e9e4aa8d --- vp9/decoder/vp9_detokenize.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c index dbcf2becc..dcc75b9d2 100644 --- 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 { \ From 59b560acef8bff4c50d66a553f24a3ff7f2e1b30 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:42:07 -0800 Subject: [PATCH 02/10] vp9_aq_complexity.c: remove unused macros DEFAULT_COMPLEXITY VAR_STRENGTH_STEP unused since first commit Change-Id: I4a47544098caf0d72e571633b7776146be88237c --- vp9/encoder/vp9_aq_complexity.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vp9/encoder/vp9_aq_complexity.c b/vp9/encoder/vp9_aq_complexity.c index e5973220e..2d979ec70 100644 --- a/vp9/encoder/vp9_aq_complexity.c +++ b/vp9/encoder/vp9_aq_complexity.c @@ -35,9 +35,6 @@ static const double aq_c_var_thresholds[AQ_C_STRENGTHS][AQ_C_SEGMENTS] = {-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 @@ void vp9_setup_in_frame_q_adj(VP9_COMP *cpi) { #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. From 8a515c16fdfd9ab3c1ebf9d842ad0722663e9e20 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:43:33 -0800 Subject: [PATCH 03/10] vp9_resize.c: add missing include Change-Id: I429e3c80216102ed0a85ce348ecac0bf1e1e28eb --- vp9/encoder/vp9_resize.c | 1 + 1 file changed, 1 insertion(+) diff --git a/vp9/encoder/vp9_resize.c b/vp9/encoder/vp9_resize.c index 59c747852..f4d0db4d5 100644 --- a/vp9/encoder/vp9_resize.c +++ b/vp9/encoder/vp9_resize.c @@ -15,6 +15,7 @@ #include #include +#include "./vpx_config.h" #if CONFIG_VP9_HIGHBITDEPTH #include "vpx_dsp/vpx_dsp_common.h" #endif // CONFIG_VP9_HIGHBITDEPTH From 8647792975b68797fc98d0e1bca20380e06e22e5 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:44:02 -0800 Subject: [PATCH 04/10] vp9_diamond_search_sad_avx.c: rename (un)likely macros avoid using '__' this is a reserved namespace for the compiler Change-Id: I7d2be4dba2bdddc6f1010a16ad9e59a2e211b064 --- vp9/encoder/x86/vp9_diamond_search_sad_avx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vp9/encoder/x86/vp9_diamond_search_sad_avx.c b/vp9/encoder/x86/vp9_diamond_search_sad_avx.c index 2ed3f1a8b..f6fe7a4eb 100644 --- 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) { @@ -162,7 +162,7 @@ int vp9_diamond_search_sad_avx(const MACROBLOCK *x, 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; } @@ -268,7 +268,7 @@ int vp9_diamond_search_sad_avx(const MACROBLOCK *x, // 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; @@ -293,7 +293,7 @@ int vp9_diamond_search_sad_avx(const MACROBLOCK *x, } // 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]; @@ -312,7 +312,7 @@ int vp9_diamond_search_sad_avx(const MACROBLOCK *x, v_ba_d = _mm_set1_epi32((intptr_t)best_address); #endif - if (__unlikely__(best_address == in_what)) { + if (UNLIKELY(best_address == in_what)) { (*num00)++; } } From d78ebb82f54333634fb6a40fad057da3536c4d07 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:46:44 -0800 Subject: [PATCH 05/10] vp9_aq_360.c: remove some unused macros ENERGY_MIN ENERGY_MAX ENERGY_SPAN ENERGY_IN_BOUNDS unused since first commit Change-Id: I5507d36487aaee3e64f7a5fba582791ef9a533b0 --- vp9/encoder/vp9_aq_360.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/vp9/encoder/vp9_aq_360.c b/vp9/encoder/vp9_aq_360.c index 7f937344d..f8c187cc5 100644 --- 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}; From d6c66d46916c4dfc1da31694409326bf35d82ee0 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:50:42 -0800 Subject: [PATCH 06/10] vp9_encoder.c: protect SNPRINT* macros w/CONFIG check these are only used with CONFIG_INTERNAL_STATS Change-Id: Ibbcefbdc1db79d93f75e5865289f9960a8c2358a --- vp9/encoder/vp9_encoder.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 1d081fdd4..047d28d6e 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -1967,11 +1967,14 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, 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; From c9e057a9a0d49ff878895272ba1f072ad64b0157 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:51:25 -0800 Subject: [PATCH 07/10] vp9_svc_layercontext.c: relocate a macro definition move SMALL_FRAME_FB_IDX closer to its first use. this is only used with CONFIG_SPATIAL_SVC. Change-Id: Ibf2b3e59a3aab2be2c3b3f89b4380ebe272e0ed6 --- vp9/encoder/vp9_svc_layercontext.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c index e0236aa6e..9724df4cd 100644 --- 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 @@ int vp9_one_pass_cbr_svc_start_layer(VP9_COMP *const cpi) { } #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 @@ int vp9_svc_start_frame(VP9_COMP *const cpi) { 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, From 77d3775941008e9ad53e9a5b96e82ca88e9564f4 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:56:04 -0800 Subject: [PATCH 08/10] vpx_mem.c: remove unused macro __VPX_MEM_C__ unused since: f58011a vpx_mem: remove vpx_memset Change-Id: I820c972c4165275ddf21c1687748409818a7f2af --- vpx_mem/vpx_mem.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/vpx_mem/vpx_mem.c b/vpx_mem/vpx_mem.c index b98fe83c0..b261fc0da 100644 --- 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 #include From fc110235addbd6724ec5736d9d1c1b795ceaef14 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 17:56:50 -0800 Subject: [PATCH 09/10] vp9_encoder.c: remove unused macro SHARP_FILTER_QTHRESH unused since: 5373119 Merging in the Switchable interp experiment Change-Id: I9ccc1883828babffd1886810b59aa16aca4766bf --- vp9/encoder/vp9_encoder.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 047d28d6e..53c6dd698 100644 --- 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 From 29b9461a5a1d9cdb59ae788e1c24507f82dc12b5 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 2 Feb 2016 18:06:05 -0800 Subject: [PATCH 10/10] yv12config.c: remove dead CONFIG_ALPHA code the rest was removed with: 5926e7c Remove unfinished VP9 alpha channel. Change-Id: I0c1d92765e5334e1380ad027b069b401e4ae9b8f --- vpx_scale/generic/yv12config.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c index e1ee46eb7..e8fee528e 100644 --- a/vpx_scale/generic/yv12config.c +++ b/vpx_scale/generic/yv12config.c @@ -160,29 +160,12 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, 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 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, 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; }