mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
[alf] use correct lcu index with wpp and use proper cabac context for alf search
This commit is contained in:
parent
90ed51a6ad
commit
0f8f422ad6
|
@ -1644,7 +1644,8 @@ static void encode_alf_aps(encoder_state_t * const state)
|
||||||
{
|
{
|
||||||
const encoder_control_t * const encoder = state->encoder_control;
|
const encoder_control_t * const encoder = state->encoder_control;
|
||||||
bitstream_t * const stream = &state->stream;
|
bitstream_t * const stream = &state->stream;
|
||||||
if (encoder->cfg.alf_type) // && (state->slice->alf->tile_group_alf_enabled_flag[COMPONENT_Y] || state->slice->alf->tile_group_cc_alf_cb_enabled_flag || state->slice->alf->tile_group_cc_alf_cr_enabled_flag))
|
|
||||||
|
if (encoder->cfg.alf_type && (state->slice->alf->tile_group_alf_enabled_flag[COMPONENT_Y] || state->slice->alf->tile_group_cc_alf_cb_enabled_flag || state->slice->alf->tile_group_cc_alf_cr_enabled_flag))
|
||||||
{
|
{
|
||||||
param_set_map *aps_map = state->tile->frame->alf_param_set_map;
|
param_set_map *aps_map = state->tile->frame->alf_param_set_map;
|
||||||
for (int aps_id = 0; aps_id < ALF_CTB_MAX_NUM_APS; aps_id++)
|
for (int aps_id = 0; aps_id < ALF_CTB_MAX_NUM_APS; aps_id++)
|
||||||
|
|
|
@ -703,7 +703,7 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
|
||||||
WRITE_U(stream, 0, 1, "sps_palette_enabled_flag");
|
WRITE_U(stream, 0, 1, "sps_palette_enabled_flag");
|
||||||
|
|
||||||
if (encoder->cfg.trskip_enable /* || pcSPS->getPLTMode()*/) {
|
if (encoder->cfg.trskip_enable /* || pcSPS->getPLTMode()*/) {
|
||||||
WRITE_UE(stream, MIN_QP_PRIME_TS, "sps_min_qp_prime_ts");
|
WRITE_UE(stream, 0, "sps_internal_bit_depth_minus_input_bit_depth");
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE_U(stream, 0, 1, "sps_ibc_enabled_flag");
|
WRITE_U(stream, 0, 1, "sps_ibc_enabled_flag");
|
||||||
|
|
|
@ -695,7 +695,7 @@ static void encoder_state_worker_encode_lcu_bitstream(void * opaque)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Encode ALF
|
//Encode ALF
|
||||||
kvz_encode_alf_bits(state, lcu->index);
|
kvz_encode_alf_bits(state, lcu->position.y * frame->width_in_lcu + lcu->position.x);
|
||||||
|
|
||||||
//Encode coding tree
|
//Encode coding tree
|
||||||
kvz_encode_coding_tree(state, lcu->position.x * LCU_WIDTH, lcu->position.y * LCU_WIDTH, 0, lcu->coeff);
|
kvz_encode_coding_tree(state, lcu->position.x * LCU_WIDTH, lcu->position.y * LCU_WIDTH, 0, lcu->coeff);
|
||||||
|
@ -1615,12 +1615,17 @@ void kvz_encode_one_frame(encoder_state_t * const state, kvz_picture* frame)
|
||||||
if (state->frame->num == 0) kvz_cabac_bins_verbose = true;
|
if (state->frame->num == 0) kvz_cabac_bins_verbose = true;
|
||||||
else kvz_cabac_bins_verbose = false;
|
else kvz_cabac_bins_verbose = false;
|
||||||
#endif
|
#endif
|
||||||
// Create a separate job for ALF done after everything else, and only then do final bitstream writing (for ALF parameters)
|
|
||||||
if (state->encoder_control->cfg.alf_type && state->encoder_control->cfg.wpp) {
|
|
||||||
state->tqj_alf_process = kvz_threadqueue_job_create(kvz_alf_enc_process_job, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
encoder_state_init_new_frame(state, frame);
|
encoder_state_init_new_frame(state, frame);
|
||||||
|
|
||||||
|
// Create a separate job for ALF done after everything else, and only then do final bitstream writing (for ALF parameters)
|
||||||
|
if (state->encoder_control->cfg.alf_type && state->encoder_control->cfg.wpp) {
|
||||||
|
encoder_state_t* child_state = state;
|
||||||
|
while (child_state->lcu_order == NULL) child_state = &child_state->children[0];
|
||||||
|
state->tqj_alf_process = kvz_threadqueue_job_create(kvz_alf_enc_process_job, child_state);
|
||||||
|
}
|
||||||
|
|
||||||
encoder_state_encode(state);
|
encoder_state_encode(state);
|
||||||
|
|
||||||
threadqueue_job_t *job =
|
threadqueue_job_t *job =
|
||||||
|
|
Loading…
Reference in a new issue