diff --git a/test/vp9_subtract_test.cc b/test/vp9_subtract_test.cc index 24767957f54ebe453b73e03a8df66f015abc6cde..a66a450f00027fd74f0a2e1b1f3476c8ca01414f 100644 --- a/test/vp9_subtract_test.cc +++ b/test/vp9_subtract_test.cc @@ -39,7 +39,7 @@ TEST_P(VP9SubtractBlockTest, SimpleSubtract) { ACMRandom rnd(ACMRandom::DeterministicSeed()); // FIXME(rbultje) split in its own file - for (BLOCK_SIZE_TYPE bsize = BLOCK_4X4; bsize < BLOCK_SIZE_TYPES; + for (BLOCK_SIZE_TYPE bsize = BLOCK_4X4; bsize < BLOCK_SIZES; bsize = static_cast<BLOCK_SIZE_TYPE>(static_cast<int>(bsize) + 1)) { const int block_width = 4 << b_width_log2(bsize); const int block_height = 4 << b_height_log2(bsize); diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 703821dfd89d964e6997e37656975e1b0228aeb9..0ffdb62557d761c182d8a3640e49137deebd6994 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -313,8 +313,8 @@ static INLINE int partition_plane_context(MACROBLOCKD *xd, static BLOCK_SIZE_TYPE get_subsize(BLOCK_SIZE_TYPE bsize, PARTITION_TYPE partition) { - BLOCK_SIZE_TYPE subsize = subsize_lookup[partition][bsize]; - assert(subsize != BLOCK_SIZE_TYPES); + const BLOCK_SIZE_TYPE subsize = subsize_lookup[partition][bsize]; + assert(subsize < BLOCK_SIZES); return subsize; } @@ -396,7 +396,7 @@ static BLOCK_SIZE_TYPE get_plane_block_size(BLOCK_SIZE_TYPE bsize, struct macroblockd_plane *pd) { BLOCK_SIZE_TYPE bs = ss_size_lookup[bsize] [pd->subsampling_x][pd->subsampling_y]; - assert(bs < BLOCK_SIZE_TYPES); + assert(bs < BLOCK_SIZES); return bs; } diff --git a/vp9/common/vp9_common_data.c b/vp9/common/vp9_common_data.c index 399391a9f4a5e4f0fcde8016d31a7d72753cfee4..310a6677b44b25eaf61a0d8b3aead66864c04748 100644 --- a/vp9/common/vp9_common_data.c +++ b/vp9/common/vp9_common_data.c @@ -13,33 +13,33 @@ #include "vp9/common/vp9_common_data.h" // Log 2 conversion lookup tables for block width and height -const int b_width_log2_lookup[BLOCK_SIZE_TYPES] = +const int b_width_log2_lookup[BLOCK_SIZES] = {0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}; -const int b_height_log2_lookup[BLOCK_SIZE_TYPES] = +const int b_height_log2_lookup[BLOCK_SIZES] = {0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4}; -const int num_4x4_blocks_wide_lookup[BLOCK_SIZE_TYPES] = +const int num_4x4_blocks_wide_lookup[BLOCK_SIZES] = {1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16}; -const int num_4x4_blocks_high_lookup[BLOCK_SIZE_TYPES] = +const int num_4x4_blocks_high_lookup[BLOCK_SIZES] = {1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16}; // Log 2 conversion lookup tables for modeinfo width and height -const int mi_width_log2_lookup[BLOCK_SIZE_TYPES] = +const int mi_width_log2_lookup[BLOCK_SIZES] = {0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3}; -const int num_8x8_blocks_wide_lookup[BLOCK_SIZE_TYPES] = +const int num_8x8_blocks_wide_lookup[BLOCK_SIZES] = {1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8}; -const int mi_height_log2_lookup[BLOCK_SIZE_TYPES] = +const int mi_height_log2_lookup[BLOCK_SIZES] = {0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3}; -const int num_8x8_blocks_high_lookup[BLOCK_SIZE_TYPES] = +const int num_8x8_blocks_high_lookup[BLOCK_SIZES] = {1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8}; // MIN(3, MIN(b_width_log2(bsize), b_height_log2(bsize))) -const int size_group_lookup[BLOCK_SIZE_TYPES] = +const int size_group_lookup[BLOCK_SIZES] = {0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3}; -const int num_pels_log2_lookup[BLOCK_SIZE_TYPES] = +const int num_pels_log2_lookup[BLOCK_SIZES] = {4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12}; -const PARTITION_TYPE partition_lookup[][BLOCK_SIZE_TYPES] = { +const PARTITION_TYPE partition_lookup[][BLOCK_SIZES] = { { // 4X4 // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64 PARTITION_NONE, PARTITION_INVALID, PARTITION_INVALID, @@ -74,7 +74,7 @@ const PARTITION_TYPE partition_lookup[][BLOCK_SIZE_TYPES] = { } }; -const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZE_TYPES] = { +const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = { { // PARTITION_NONE BLOCK_4X4, BLOCK_4X8, BLOCK_8X4, BLOCK_8X8, BLOCK_8X16, BLOCK_16X8, @@ -102,20 +102,20 @@ const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZE_TYPES] = { } }; -const TX_SIZE max_txsize_lookup[BLOCK_SIZE_TYPES] = { +const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = { TX_4X4, TX_4X4, TX_4X4, TX_8X8, TX_8X8, TX_8X8, TX_16X16, TX_16X16, TX_16X16, TX_32X32, TX_32X32, TX_32X32, TX_32X32 }; -const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZE_TYPES] = { +const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES] = { TX_4X4, TX_4X4, TX_4X4, TX_4X4, TX_4X4, TX_4X4, TX_8X8, TX_8X8, TX_8X8, TX_16X16, TX_16X16, TX_16X16, TX_32X32 }; -const BLOCK_SIZE_TYPE ss_size_lookup[BLOCK_SIZE_TYPES][2][2] = { +const BLOCK_SIZE_TYPE ss_size_lookup[BLOCK_SIZES][2][2] = { // ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1 // ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1 {{BLOCK_4X4, BLOCK_INVALID}, {BLOCK_INVALID, BLOCK_INVALID}}, diff --git a/vp9/common/vp9_common_data.h b/vp9/common/vp9_common_data.h index cfa4cd5bed0592abdcd2cc930e58e525cf5ac98a..808b9ed5d2acabcbd4960bbdec3e62c11da8464e 100644 --- a/vp9/common/vp9_common_data.h +++ b/vp9/common/vp9_common_data.h @@ -13,20 +13,20 @@ #include "vp9/common/vp9_enums.h" -extern const int b_width_log2_lookup[BLOCK_SIZE_TYPES]; -extern const int b_height_log2_lookup[BLOCK_SIZE_TYPES]; -extern const int mi_width_log2_lookup[BLOCK_SIZE_TYPES]; -extern const int mi_height_log2_lookup[BLOCK_SIZE_TYPES]; -extern const int num_8x8_blocks_wide_lookup[BLOCK_SIZE_TYPES]; -extern const int num_8x8_blocks_high_lookup[BLOCK_SIZE_TYPES]; -extern const int num_4x4_blocks_high_lookup[BLOCK_SIZE_TYPES]; -extern const int num_4x4_blocks_wide_lookup[BLOCK_SIZE_TYPES]; -extern const int size_group_lookup[BLOCK_SIZE_TYPES]; -extern const int num_pels_log2_lookup[BLOCK_SIZE_TYPES]; -extern const PARTITION_TYPE partition_lookup[][BLOCK_SIZE_TYPES]; -extern const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZE_TYPES]; -extern const TX_SIZE max_txsize_lookup[BLOCK_SIZE_TYPES]; -extern const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZE_TYPES]; -extern const BLOCK_SIZE_TYPE ss_size_lookup[BLOCK_SIZE_TYPES][2][2]; +extern const int b_width_log2_lookup[BLOCK_SIZES]; +extern const int b_height_log2_lookup[BLOCK_SIZES]; +extern const int mi_width_log2_lookup[BLOCK_SIZES]; +extern const int mi_height_log2_lookup[BLOCK_SIZES]; +extern const int num_8x8_blocks_wide_lookup[BLOCK_SIZES]; +extern const int num_8x8_blocks_high_lookup[BLOCK_SIZES]; +extern const int num_4x4_blocks_high_lookup[BLOCK_SIZES]; +extern const int num_4x4_blocks_wide_lookup[BLOCK_SIZES]; +extern const int size_group_lookup[BLOCK_SIZES]; +extern const int num_pels_log2_lookup[BLOCK_SIZES]; +extern const PARTITION_TYPE partition_lookup[][BLOCK_SIZES]; +extern const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES]; +extern const TX_SIZE max_txsize_lookup[BLOCK_SIZES]; +extern const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES]; +extern const BLOCK_SIZE_TYPE ss_size_lookup[BLOCK_SIZES][2][2]; #endif // VP9_COMMON_VP9_COMMON_DATA_H diff --git a/vp9/common/vp9_enums.h b/vp9/common/vp9_enums.h index 9d0dfa56d75807471ab9245f43137eb30671a5e9..435460e89a2530e6be606c0c9bfb3c14bfce3288 100644 --- a/vp9/common/vp9_enums.h +++ b/vp9/common/vp9_enums.h @@ -35,8 +35,8 @@ typedef enum BLOCK_SIZE_TYPE { BLOCK_32X64, BLOCK_64X32, BLOCK_64X64, - BLOCK_SIZE_TYPES, - BLOCK_INVALID = BLOCK_SIZE_TYPES + BLOCK_SIZES, + BLOCK_INVALID = BLOCK_SIZES } BLOCK_SIZE_TYPE; typedef enum PARTITION_TYPE { diff --git a/vp9/common/vp9_mvref_common.c b/vp9/common/vp9_mvref_common.c index 2399080134474d8c451e592d91908c3ab98b8f2e..f6bb0f1265ace600844a2d7d5e10f31954452419 100644 --- a/vp9/common/vp9_mvref_common.c +++ b/vp9/common/vp9_mvref_common.c @@ -70,7 +70,7 @@ static const int counter_to_context[19] = { BOTH_INTRA // 18 }; -static const MV mv_ref_blocks[BLOCK_SIZE_TYPES][MVREF_NEIGHBOURS] = { +static const MV mv_ref_blocks[BLOCK_SIZES][MVREF_NEIGHBOURS] = { // 4X4 {{-1, 0}, {0, -1}, {-1, -1}, {-2, 0}, {0, -2}, {-2, -1}, {-1, -2}, {-2, -2}}, // 4X8 diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 4324134b263b8fa087f7d0bfd477c53aa840348b..2e855c86281e58e51de19d8dbe6c601b7195ed68 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1457,11 +1457,11 @@ static void rd_use_partition(VP9_COMP *cpi, MODE_INFO *m, TOKENEXTRA **tp, *dist = chosen_dist; } -static BLOCK_SIZE_TYPE min_partition_size[BLOCK_SIZE_TYPES] = +static const BLOCK_SIZE_TYPE min_partition_size[BLOCK_SIZES] = { BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, BLOCK_4X4, BLOCK_8X8, BLOCK_8X8, BLOCK_8X8, BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, BLOCK_16X16 }; -static BLOCK_SIZE_TYPE max_partition_size[BLOCK_SIZE_TYPES] = +static const BLOCK_SIZE_TYPE max_partition_size[BLOCK_SIZES] = { BLOCK_8X8, BLOCK_16X16, BLOCK_16X16, BLOCK_16X16, BLOCK_32X32, BLOCK_32X32, BLOCK_32X32, BLOCK_64X64, BLOCK_64X64, BLOCK_64X64, BLOCK_64X64, BLOCK_64X64, BLOCK_64X64 }; diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 0b3b4dca8fdbbc8729a4a7eeed96b88341dccbbd..47664bf123e5f6e5b8c6f66b6a735270857968ac 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -772,7 +772,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->use_avoid_tested_higherror = 1; sf->adaptive_rd_thresh = 1; if (speed == 1) { - sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES; + sf->comp_inter_joint_search_thresh = BLOCK_SIZES; sf->less_rectangular_check = 1; sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME || cpi->common.intra_only || @@ -804,7 +804,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->adjust_thresholds_by_speed = 1; sf->less_rectangular_check = 1; sf->use_square_partition_only = 1; - sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES; + sf->comp_inter_joint_search_thresh = BLOCK_SIZES; sf->use_lastframe_partitioning = 1; sf->adjust_partitioning_from_last_frame = 1; sf->last_partitioning_redo_frequency = 3; @@ -834,7 +834,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->use_fast_lpf_pick = 1; } if (speed == 3) { - sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES; + sf->comp_inter_joint_search_thresh = BLOCK_SIZES; sf->partition_by_variance = 1; sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME || cpi->common.intra_only || @@ -856,7 +856,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->subpel_iters_per_step = 1; } if (speed == 4) { - sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES; + sf->comp_inter_joint_search_thresh = BLOCK_SIZES; sf->use_one_partition_size_always = 1; sf->always_this_block_size = BLOCK_16X16; sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME || diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index b568990bc86b1b71f1f16ddc836f538dc4afa28f..e5b3eb78e5229b75725bf524f7ad4c8657837437 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -374,9 +374,9 @@ typedef struct VP9_COMP { int set_ref_frame_mask; int rd_thresh_mult[MAX_MODES]; - int rd_baseline_thresh[BLOCK_SIZE_TYPES][MAX_MODES]; - int rd_threshes[BLOCK_SIZE_TYPES][MAX_MODES]; - int rd_thresh_freq_fact[BLOCK_SIZE_TYPES][MAX_MODES]; + int rd_baseline_thresh[BLOCK_SIZES][MAX_MODES]; + int rd_threshes[BLOCK_SIZES][MAX_MODES]; + int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; int64_t rd_comp_pred_diff[NB_PREDICTION_TYPES]; // FIXME(rbultje) int64_t? @@ -540,7 +540,7 @@ typedef struct VP9_COMP { vp9_full_search_fn_t full_search_sad; vp9_refining_search_fn_t refining_search_sad; vp9_diamond_search_fn_t diamond_search_sad; - vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZE_TYPES]; + vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; uint64_t time_receive_data; uint64_t time_compress_data; uint64_t time_pick_lpf; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 27499447b1c622f1fb97084049e669267081ae87..7321a2f8702c37f844b1eee72c2ba51873a94d15 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -102,7 +102,7 @@ const MODE_DEFINITION vp9_mode_order[MAX_MODES] = { // certain modes are assumed to be based on 8x8 blocks. // This table is used to correct for blocks size. // The factors here are << 2 (2 = x0.5, 32 = x8 etc). -static int rd_thresh_block_size_factor[BLOCK_SIZE_TYPES] = +static int rd_thresh_block_size_factor[BLOCK_SIZES] = {2, 3, 3, 4, 6, 6, 8, 12, 12, 16, 24, 24, 32}; #define BASE_RD_THRESH_FREQ_FACT 16 @@ -199,7 +199,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) { cpi->RDDIV = 1; cpi->RDMULT /= 100; - for (bsize = 0; bsize < BLOCK_SIZE_TYPES; ++bsize) { + for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) { for (i = 0; i < MAX_MODES; ++i) { // Threshold here seem unecessarily harsh but fine given actual // range of values used for cpi->sf.thresh_mult[] @@ -224,7 +224,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) { } else { cpi->RDDIV = 100; - for (bsize = 0; bsize < BLOCK_SIZE_TYPES; ++bsize) { + for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) { for (i = 0; i < MAX_MODES; i++) { // Threshold here seem unecessarily harsh but fine given actual // range of values used for cpi->sf.thresh_mult[] @@ -3506,7 +3506,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, // Disable intra modes other than DC_PRED for blocks with low variance // Threshold for intra skipping based on source variance // TODO(debargha): Specialize the threshold for super block sizes - static const int skip_intra_var_thresh[BLOCK_SIZE_TYPES] = { + static const int skip_intra_var_thresh[BLOCK_SIZES] = { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, }; if ((cpi->sf.mode_search_skip_flags & FLAG_SKIP_INTRA_LOWVAR) &&