mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Enable RDOQ and sign hiding
This commit is contained in:
parent
7098a94a6f
commit
79c36f6aeb
|
@ -638,7 +638,7 @@ void kvz_rdoq_sign_hiding(
|
|||
* coding engines using probability models like CABAC
|
||||
* From HM 12.0
|
||||
*/
|
||||
/*
|
||||
|
||||
// ToDo: implement new RDOQ
|
||||
void kvz_rdoq(encoder_state_t * const state, coeff_t *coef, coeff_t *dest_coeff, int32_t width,
|
||||
int32_t height, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth)
|
||||
|
@ -699,7 +699,7 @@ void kvz_rdoq(encoder_state_t * const state, coeff_t *coef, coeff_t *dest_coeff,
|
|||
default: assert(0 && "There should be 1, 4, 16 or 64 coefficient groups");
|
||||
}
|
||||
|
||||
cabac_ctx_t *base_coeff_group_ctx = &(cabac->ctx.cu_sig_coeff_group_model[type]);
|
||||
cabac_ctx_t *base_coeff_group_ctx = &(cabac->ctx.sig_coeff_group_model[type]);
|
||||
cabac_ctx_t *baseCtx = (type == 0) ? &(cabac->ctx.cu_sig_model_luma[0][0]) : &(cabac->ctx.cu_sig_model_chroma[0][0]);
|
||||
|
||||
struct {
|
||||
|
@ -974,7 +974,7 @@ void kvz_rdoq(encoder_state_t * const state, coeff_t *coef, coeff_t *dest_coeff,
|
|||
kvz_rdoq_sign_hiding(state, qp_scaled, scan, &sh_rates, best_last_idx_p1, coef, dest_coeff);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Calculate cost of actual motion vectors using CABAC coding
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
extern const uint32_t kvz_g_go_rice_range[5];
|
||||
extern const uint32_t kvz_g_go_rice_prefix_len[5];
|
||||
|
||||
/*void kvz_rdoq(encoder_state_t *state, coeff_t *coef, coeff_t *dest_coeff, int32_t width,
|
||||
int32_t height, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth);*/
|
||||
void kvz_rdoq(encoder_state_t *state, coeff_t *coef, coeff_t *dest_coeff, int32_t width,
|
||||
int32_t height, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth);
|
||||
|
||||
uint32_t kvz_get_coeff_cost(const encoder_state_t * const state,
|
||||
const coeff_t *coeff,
|
||||
|
|
|
@ -658,7 +658,7 @@ int kvz_quantize_residual_avx2(encoder_state_t *const state,
|
|||
}
|
||||
|
||||
// Quantize coeffs. (coeff -> coeff_out)
|
||||
/*
|
||||
|
||||
if (state->encoder_control->cfg.rdoq_enable &&
|
||||
(width > 4 || !state->encoder_control->cfg.rdoq_skip))
|
||||
{
|
||||
|
@ -666,7 +666,7 @@ int kvz_quantize_residual_avx2(encoder_state_t *const state,
|
|||
tr_depth += (cur_cu->part_size == SIZE_NxN ? 1 : 0);
|
||||
kvz_rdoq(state, coeff, coeff_out, width, width, (color == COLOR_Y ? 0 : 2),
|
||||
scan_order, cur_cu->type, tr_depth);
|
||||
} else*/ {
|
||||
} else {
|
||||
kvz_quant(state, coeff, coeff_out, width, width, (color == COLOR_Y ? 0 : 2),
|
||||
scan_order, cur_cu->type);
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ void kvz_quant_generic(const encoder_state_t * const state, coeff_t *coef, coeff
|
|||
int32_t height, int8_t type, int8_t scan_idx, int8_t block_type)
|
||||
{
|
||||
const encoder_control_t * const encoder = state->encoder_control;
|
||||
//const uint32_t log2_block_size = kvz_g_convert_to_bit[width] + 2;
|
||||
//const uint32_t * const scan = kvz_g_sig_last_scan[scan_idx][log2_block_size - 1];
|
||||
const uint32_t log2_block_size = kvz_g_convert_to_bit[width] + 2;
|
||||
const uint32_t * const scan = kvz_g_sig_last_scan[scan_idx][log2_block_size - 1];
|
||||
|
||||
int32_t qp_scaled = kvz_get_scaled_qp(type, state->qp, (encoder->bitdepth - 8) * 6);
|
||||
const uint32_t log2_tr_size = kvz_g_convert_to_bit[width] + 2;
|
||||
|
@ -48,7 +48,7 @@ void kvz_quant_generic(const encoder_state_t * const state, coeff_t *coef, coeff
|
|||
const int32_t transform_shift = MAX_TR_DYNAMIC_RANGE - encoder->bitdepth - log2_tr_size; //!< Represents scaling through forward transform
|
||||
const int32_t q_bits = QUANT_SHIFT + qp_scaled / 6 + transform_shift;
|
||||
const int32_t add = ((state->frame->slicetype == KVZ_SLICE_I) ? 171 : 85) << (q_bits - 9);
|
||||
//const int32_t q_bits8 = q_bits - 8;
|
||||
const int32_t q_bits8 = q_bits - 8;
|
||||
|
||||
uint32_t ac_sum = 0;
|
||||
|
||||
|
@ -67,8 +67,8 @@ void kvz_quant_generic(const encoder_state_t * const state, coeff_t *coef, coeff
|
|||
q_coef[n] = (coeff_t)(CLIP(-32768, 32767, level));
|
||||
|
||||
}
|
||||
/*
|
||||
// Signhiding disabled in VVC
|
||||
|
||||
// Signhiding
|
||||
if (!encoder->cfg.signhide_enable || ac_sum < 2) return;
|
||||
|
||||
int32_t delta_u[LCU_WIDTH*LCU_WIDTH >> 2];
|
||||
|
@ -165,7 +165,6 @@ void kvz_quant_generic(const encoder_state_t * const state, coeff_t *coef, coeff
|
|||
#undef SCAN_SET_SIZE
|
||||
#undef LOG2_SCAN_SET_SIZE
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,7 +219,7 @@ int kvz_quantize_residual_generic(encoder_state_t *const state,
|
|||
}
|
||||
|
||||
// Quantize coeffs. (coeff -> coeff_out)
|
||||
/*
|
||||
|
||||
if (state->encoder_control->cfg.rdoq_enable &&
|
||||
(width > 4 || !state->encoder_control->cfg.rdoq_skip))
|
||||
{
|
||||
|
@ -228,7 +227,7 @@ int kvz_quantize_residual_generic(encoder_state_t *const state,
|
|||
tr_depth += (cur_cu->part_size == SIZE_NxN ? 1 : 0);
|
||||
kvz_rdoq(state, coeff, coeff_out, width, width, (color == COLOR_Y ? 0 : 2),
|
||||
scan_order, cur_cu->type, tr_depth);
|
||||
} else*/ {
|
||||
} else {
|
||||
|
||||
kvz_quant(state, coeff, coeff_out, width, width, (color == COLOR_Y ? 0 : 2),
|
||||
scan_order, cur_cu->type);
|
||||
|
|
Loading…
Reference in a new issue