Disable filters, trskip and signhide in lossless.

When lossless coding is used, deblock and SAO are skipped, transform
skip flag is not written and sign hiding is not used.
This commit is contained in:
Arttu Ylä-Outinen 2016-05-30 20:26:13 +09:00
parent 97451ec401
commit 06b82bf888
4 changed files with 14 additions and 6 deletions

View file

@ -397,18 +397,22 @@ encoder_control_t* kvz_encoder_control_init(const kvz_config *const cfg) {
encoder->in.video_format = FORMAT_420; encoder->in.video_format = FORMAT_420;
// deblocking filter // deblocking filter
encoder->deblock_enable = (int8_t) encoder->cfg->deblock_enable; encoder->deblock_enable = (int8_t) (encoder->cfg->deblock_enable &&
!encoder->cfg->lossless);
encoder->beta_offset_div2 = (int8_t) encoder->cfg->deblock_beta; encoder->beta_offset_div2 = (int8_t) encoder->cfg->deblock_beta;
encoder->tc_offset_div2 = (int8_t) encoder->cfg->deblock_tc; encoder->tc_offset_div2 = (int8_t) encoder->cfg->deblock_tc;
// SAO // SAO
encoder->sao_enable = (int8_t) encoder->cfg->sao_enable; encoder->sao_enable = (int8_t) (encoder->cfg->sao_enable &&
!encoder->cfg->lossless);
// RDO // RDO
encoder->rdoq_enable = (int8_t) encoder->cfg->rdoq_enable; encoder->rdoq_enable = (int8_t) encoder->cfg->rdoq_enable;
encoder->rdo = (int8_t) encoder->cfg->rdo; encoder->rdo = (int8_t) encoder->cfg->rdo;
encoder->sign_hiding = encoder->cfg->signhide_enable; encoder->sign_hiding = (encoder->cfg->signhide_enable &&
!encoder->cfg->lossless);
encoder->full_intra_search = (int8_t) encoder->cfg->full_intra_search; encoder->full_intra_search = (int8_t) encoder->cfg->full_intra_search;
// TR SKIP // TR SKIP
encoder->trskip_enable = (int8_t) encoder->cfg->trskip_enable; encoder->trskip_enable = (int8_t) (encoder->cfg->trskip_enable &&
!encoder->cfg->lossless);
encoder->tr_depth_intra = (int8_t) encoder->cfg->tr_depth_intra; encoder->tr_depth_intra = (int8_t) encoder->cfg->tr_depth_intra;
// MOTION ESTIMATION // MOTION ESTIMATION
encoder->fme_level = (int8_t) encoder->cfg->fme_level; encoder->fme_level = (int8_t) encoder->cfg->fme_level;

View file

@ -1906,8 +1906,8 @@ void kvz_encode_coeff_nxn(encoder_state_t * const state, coeff_t *coeff, uint8_t
} }
if (num_non_zero > 0) { if (num_non_zero > 0) {
int8_t sign_hidden = (last_nz_pos_in_cg - first_nz_pos_in_cg >= bool sign_hidden = last_nz_pos_in_cg - first_nz_pos_in_cg >= 4 /* SBH_THRESHOLD */
4 /*SBH_THRESHOLD*/) ? 1 : 0; && !encoder->cfg->lossless;
uint32_t ctx_set = (i > 0 && type == 0) ? 2 : 0; uint32_t ctx_set = (i > 0 && type == 0) ? 2 : 0;
cabac_ctx_t *base_ctx_mod; cabac_ctx_t *base_ctx_mod;
int32_t num_c1_flag, first_c2_flag_idx, idx, first_coeff2; int32_t num_c1_flag, first_c2_flag_idx, idx, first_coeff2;

View file

@ -684,6 +684,8 @@ static void filter_deblock_lcu_rightmost(encoder_state_t * const state,
*/ */
void kvz_filter_deblock_lcu(encoder_state_t * const state, int x_px, int y_px) void kvz_filter_deblock_lcu(encoder_state_t * const state, int x_px, int y_px)
{ {
assert(!state->encoder_control->cfg->lossless);
filter_deblock_lcu_inside(state, x_px, y_px, EDGE_VER); filter_deblock_lcu_inside(state, x_px, y_px, EDGE_VER);
if (x_px > 0) { if (x_px > 0) {
filter_deblock_lcu_rightmost(state, x_px, y_px); filter_deblock_lcu_rightmost(state, x_px, y_px);

View file

@ -741,6 +741,8 @@ static void sao_search_luma(const encoder_state_t * const state, const videofram
void kvz_sao_search_lcu(const encoder_state_t* const state, int lcu_x, int lcu_y) void kvz_sao_search_lcu(const encoder_state_t* const state, int lcu_x, int lcu_y)
{ {
assert(!state->encoder_control->cfg->lossless);
videoframe_t* const frame = state->tile->frame; videoframe_t* const frame = state->tile->frame;
const int stride = frame->width_in_lcu; const int stride = frame->width_in_lcu;
int32_t merge_cost_luma[3] = { INT32_MAX }; int32_t merge_cost_luma[3] = { INT32_MAX };