Remove some special cases for CONFIG_HIGHBITDEPTH
This also avoids having 'bit_depth'/'bd' members whose presence
is decided by the preprocessor.
The goal is to simplify statements accessing the bitdepth value.
(instead of forcing them to also rely on the preprocessor to query
the member presence through #if CONFIG_HIGHBIDEPTH).
Change-Id: I68b822bbaa2b1c67bde81cb4f3f8b9988b798b0d
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 1d88fc6..bf2374d 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -643,10 +643,8 @@
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *tile_ctx;
#endif
-#if CONFIG_HIGHBITDEPTH
/* Bit depth: 8, 10, 12 */
int bd;
-#endif
int qindex[MAX_SEGMENTS];
int lossless[MAX_SEGMENTS];
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 0d4f344..1c6501a 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -367,9 +367,7 @@
od_coeff ref_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX];
od_coeff out_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX];
-#if CONFIG_HIGHBITDEPTH
hbd_downshift = xd->bd - 8;
-#endif // CONFIG_HIGHBITDEPTH
od_raster_to_coding_order(ref_coeff_pvq, blk_size, tx_type, ref_coeff,
blk_size);
@@ -4293,9 +4291,7 @@
}
#endif
-#if CONFIG_HIGHBITDEPTH
get_frame_new_buffer(cm)->bit_depth = cm->bit_depth;
-#endif
get_frame_new_buffer(cm)->color_space = cm->color_space;
get_frame_new_buffer(cm)->color_range = cm->color_range;
get_frame_new_buffer(cm)->render_width = cm->render_width;
@@ -4361,9 +4357,7 @@
decode_restoration_mode(cm, rb);
#endif // CONFIG_LOOP_RESTORATION
setup_quantization(cm, rb);
-#if CONFIG_HIGHBITDEPTH
xd->bd = (int)cm->bit_depth;
-#endif
#if CONFIG_Q_ADAPT_PROBS
av1_default_coef_probs(cm);
diff --git a/av1/decoder/detokenize.c b/av1/decoder/detokenize.c
index 494f168..60ceb4b 100644
--- a/av1/decoder/detokenize.c
+++ b/av1/decoder/detokenize.c
@@ -238,12 +238,7 @@
*max_scan_line = AOMMAX(*max_scan_line, scan[c]);
token_cache[scan[c]] = av1_pt_energy_class[token];
- val = token_to_value(r, token, tx_size,
-#if CONFIG_HIGHBITDEPTH
- xd->bd);
-#else
- 8);
-#endif // CONFIG_HIGHBITDEPTH
+ val = token_to_value(r, token, tx_size, xd->bd);
#if CONFIG_NEW_QUANT
v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val);
@@ -258,11 +253,7 @@
v = aom_read_bit(r, ACCT_STR) ? -v : v;
#if CONFIG_COEFFICIENT_RANGE_CHECKING
-#if CONFIG_HIGHBITDEPTH
check_range(v, xd->bd);
-#else
- check_range(v, 8);
-#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_COEFFICIENT_RANGE_CHECKING
dqcoeff[scan[c]] = v;
@@ -311,12 +302,7 @@
aom_read_symbol(r, *cdf, CATEGORY6_TOKEN - ONE_TOKEN + 1, ACCT_STR);
INCREMENT_COUNT(ONE_TOKEN + (token > ONE_TOKEN));
assert(token != ZERO_TOKEN);
- val = token_to_value(r, token, tx_size,
-#if CONFIG_HIGHBITDEPTH
- xd->bd);
-#else
- 8);
-#endif // CONFIG_HIGHBITDEPTH
+ val = token_to_value(r, token, tx_size, xd->bd);
#else // CONFIG_EC_MULTISYMBOL
if (!aom_read(r, prob[ONE_CONTEXT_NODE], ACCT_STR)) {
INCREMENT_COUNT(ONE_TOKEN);
@@ -327,12 +313,7 @@
token = aom_read_tree(r, av1_coef_con_tree,
av1_pareto8_full[prob[PIVOT_NODE] - 1], ACCT_STR);
assert(token != ZERO_TOKEN && token != ONE_TOKEN);
- val = token_to_value(r, token, tx_size,
-#if CONFIG_HIGHBITDEPTH
- xd->bd);
-#else
- 8);
-#endif // CONFIG_HIGHBITDEPTH
+ val = token_to_value(r, token, tx_size, xd->bd);
}
#endif // CONFIG_EC_MULTISYMBOL
#if CONFIG_NEW_QUANT
@@ -347,12 +328,8 @@
#endif // CONFIG_NEW_QUANT
#if CONFIG_COEFFICIENT_RANGE_CHECKING
-#if CONFIG_HIGHBITDEPTH
dqcoeff[scan[c]] =
- highbd_check_range((aom_read_bit(r, ACCT_STR) ? -v : v), xd->bd);
-#else
- dqcoeff[scan[c]] = check_range(aom_read_bit(r, ACCT_STR) ? -v : v, 8);
-#endif // CONFIG_HIGHBITDEPTH
+ check_range((aom_read_bit(r, ACCT_STR) ? -v : v), xd->bd);
#else
dqcoeff[scan[c]] = aom_read_bit(r, ACCT_STR) ? -v : v;
#endif // CONFIG_COEFFICIENT_RANGE_CHECKING
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index c450244..f8903a1 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -184,11 +184,7 @@
int64_t rd_cost0, rd_cost1;
int16_t t0, t1;
int i, final_eob;
-#if CONFIG_HIGHBITDEPTH
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, xd->bd);
-#else
- const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, 8);
-#endif
unsigned int(*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
mb->token_costs[txsize_sqr_map[tx_size]][plane_type][ref];
const int default_eob = tx_size_2d[tx_size];
@@ -549,11 +545,7 @@
int best, band = (eob < default_eob) ? band_translate[eob]
: band_translate[eob - 1];
int pt, i, final_eob;
-#if CONFIG_HIGHBITDEPTH
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, xd->bd);
-#else
- const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, 8);
-#endif
unsigned int(*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
mb->token_costs[txsize_sqr_map[tx_size]][plane_type][ref];
const uint16_t *band_counts = &band_count_table[tx_size][band];
@@ -1545,9 +1537,7 @@
DECLARE_ALIGNED(16, int32_t, ref_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
DECLARE_ALIGNED(16, int32_t, out_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
-#if CONFIG_HIGHBITDEPTH
hbd_downshift = x->e_mbd.bd - 8;
-#endif
assert(OD_COEFF_SHIFT >= 4);
// DC quantizer for PVQ
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index c623bdc..2110d47 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -1994,9 +1994,7 @@
assert(cm->bit_depth > AOM_BITS_8);
cpi->oxcf = *oxcf;
-#if CONFIG_HIGHBITDEPTH
cpi->td.mb.e_mbd.bd = (int)cm->bit_depth;
-#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_GLOBAL_MOTION
cpi->td.mb.e_mbd.global_motion = cm->global_motion;
#endif // CONFIG_GLOBAL_MOTION