mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 20:54:07 +00:00
Simplify two ifs in encode_coeff_nxn-avx2
This commit is contained in:
parent
37a2a8bac8
commit
9a5a6fdbc7
|
@ -308,19 +308,15 @@ void kvz_encode_coeff_nxn_avx2(encoder_state_t * const state,
|
||||||
CABAC_BIN(cabac, symbol, "coeff_abs_level_greater2_flag");
|
CABAC_BIN(cabac, symbol, "coeff_abs_level_greater2_flag");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (be_valid && sign_hidden) {
|
int32_t shiftamt = (be_valid && sign_hidden) ? 1 : 0;
|
||||||
coeff_signs = coeff_signs >> 1;
|
int32_t nnz = num_non_zero - shiftamt;
|
||||||
if (!cabac->only_count)
|
coeff_signs >>= shiftamt;
|
||||||
|
if (!cabac->only_count) {
|
||||||
if (encoder->cfg.crypto_features & KVZ_CRYPTO_TRANSF_COEFF_SIGNS) {
|
if (encoder->cfg.crypto_features & KVZ_CRYPTO_TRANSF_COEFF_SIGNS) {
|
||||||
coeff_signs = coeff_signs ^ kvz_crypto_get_key(state->crypto_hdl, num_non_zero-1);
|
coeff_signs ^= kvz_crypto_get_key(state->crypto_hdl, nnz);
|
||||||
}
|
}
|
||||||
CABAC_BINS_EP(cabac, coeff_signs , (num_non_zero - 1), "coeff_sign_flag");
|
|
||||||
} else {
|
|
||||||
if (!cabac->only_count)
|
|
||||||
if (encoder->cfg.crypto_features & KVZ_CRYPTO_TRANSF_COEFF_SIGNS)
|
|
||||||
coeff_signs = coeff_signs ^ kvz_crypto_get_key(state->crypto_hdl, num_non_zero);
|
|
||||||
CABAC_BINS_EP(cabac, coeff_signs, num_non_zero, "coeff_sign_flag");
|
|
||||||
}
|
}
|
||||||
|
CABAC_BINS_EP(cabac, coeff_signs, nnz, "coeff_sign_flag");
|
||||||
|
|
||||||
if (c1 == 0 || num_non_zero > C1FLAG_NUMBER) {
|
if (c1 == 0 || num_non_zero > C1FLAG_NUMBER) {
|
||||||
first_coeff2 = 1;
|
first_coeff2 = 1;
|
||||||
|
@ -329,13 +325,11 @@ void kvz_encode_coeff_nxn_avx2(encoder_state_t * const state,
|
||||||
int32_t base_level = (idx < C1FLAG_NUMBER) ? (2 + first_coeff2) : 1;
|
int32_t base_level = (idx < C1FLAG_NUMBER) ? (2 + first_coeff2) : 1;
|
||||||
|
|
||||||
if (abs_coeff[idx] >= base_level) {
|
if (abs_coeff[idx] >= base_level) {
|
||||||
if (!cabac->only_count) {
|
if (!cabac->only_count && (encoder->cfg.crypto_features & KVZ_CRYPTO_TRANSF_COEFFS)) {
|
||||||
if (encoder->cfg.crypto_features & KVZ_CRYPTO_TRANSF_COEFFS)
|
|
||||||
kvz_cabac_write_coeff_remain_encry(state, cabac, abs_coeff[idx] - base_level, go_rice_param, base_level);
|
kvz_cabac_write_coeff_remain_encry(state, cabac, abs_coeff[idx] - base_level, go_rice_param, base_level);
|
||||||
else
|
} else {
|
||||||
kvz_cabac_write_coeff_remain(cabac, abs_coeff[idx] - base_level, go_rice_param);
|
|
||||||
} else
|
|
||||||
kvz_cabac_write_coeff_remain(cabac, abs_coeff[idx] - base_level, go_rice_param);
|
kvz_cabac_write_coeff_remain(cabac, abs_coeff[idx] - base_level, go_rice_param);
|
||||||
|
}
|
||||||
|
|
||||||
if (abs_coeff[idx] > 3 * (1 << go_rice_param)) {
|
if (abs_coeff[idx] > 3 * (1 << go_rice_param)) {
|
||||||
go_rice_param = MIN(go_rice_param + 1, 4);
|
go_rice_param = MIN(go_rice_param + 1, 4);
|
||||||
|
|
Loading…
Reference in a new issue