Commit cd167c4e authored by Sebastien Alaiwan's avatar Sebastien Alaiwan Committed by sebastien alaiwan
Browse files

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
parent ffbe8533
......@@ -643,10 +643,8 @@ typedef struct macroblockd {
#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];
......
......@@ -367,9 +367,7 @@ static int av1_pvq_decode_helper(MACROBLOCKD *xd, tran_low_t *ref_coeff,
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 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
}
#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 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
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);
......
......@@ -238,12 +238,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
*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 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
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 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
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 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
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 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
#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
......
......@@ -184,11 +184,7 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
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 av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
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 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(MACROBLOCK *x, tran_low_t *const coeff,
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
......
......@@ -1994,9 +1994,7 @@ void av1_change_config(struct AV1_COMP *cpi, const AV1EncoderConfig *oxcf) {
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment