From 951a845f086232c5114b11244c183065edeab87d Mon Sep 17 00:00:00 2001 From: Joose Sainio Date: Thu, 16 Dec 2021 11:48:59 +0200 Subject: [PATCH] Remove consts and fix wrong types --- src/rdo.c | 5 ++--- src/sao.c | 14 +++++++------- src/search_intra.c | 12 ++++++------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/rdo.c b/src/rdo.c index fc0b2198..04b9aca9 100644 --- a/src/rdo.c +++ b/src/rdo.c @@ -271,8 +271,7 @@ static INLINE uint32_t get_coeff_cabac_cost( scan_mode, 0); if(cabac_copy.update) { - - memcpy(&state->search_cabac, &cabac_copy, sizeof(cabac_copy)); + memcpy((cabac_data_t *)&state->search_cabac, &cabac_copy, sizeof(cabac_copy)); } return (bits_left - cabac_copy.bits_left) + ((cabac_copy.num_buffered_bytes - num_buffered_bytes) << 3); } @@ -1036,7 +1035,7 @@ double kvz_calc_mvd_cost_cabac(const encoder_state_t * state, inter_merge_cand_t merge_cand[MRG_MAX_NUM_CANDS], int16_t num_cand, int32_t ref_idx, - uint32_t *bitcost) + double* bitcost) { cabac_data_t state_cabac_copy; cabac_data_t* cabac; diff --git a/src/sao.c b/src/sao.c index 179f4311..b7d76e64 100644 --- a/src/sao.c +++ b/src/sao.c @@ -53,7 +53,7 @@ static double sao_mode_bits_none(const encoder_state_t * const state, sao_info_t { double mode_bits = 0.0; cabac_data_t * cabac = (cabac_data_t*)&state->search_cabac; - const cabac_ctx_t *ctx = NULL; + cabac_ctx_t *ctx = NULL; // FL coded merges. if (sao_left != NULL) { ctx = &(cabac->ctx.sao_merge_flag_model); @@ -74,8 +74,8 @@ static double sao_mode_bits_none(const encoder_state_t * const state, sao_info_t static double sao_mode_bits_merge(const encoder_state_t * const state, int8_t merge_cand) { double mode_bits = 0.0; - cabac_data_t * const cabac = (cabac_data_t*)&state->search_cabac; - const cabac_ctx_t *ctx = NULL; + cabac_data_t * cabac = (cabac_data_t*)&state->search_cabac; + cabac_ctx_t *ctx = NULL; // FL coded merges. ctx = &(cabac->ctx.sao_merge_flag_model); @@ -91,8 +91,8 @@ static double sao_mode_bits_edge(const encoder_state_t * const state, sao_info_t *sao_top, sao_info_t *sao_left, unsigned buf_cnt) { double mode_bits = 0.0; - cabac_data_t * const cabac = (cabac_data_t*)&state->search_cabac; - const cabac_ctx_t *ctx = NULL; + cabac_data_t * cabac = (cabac_data_t*)&state->search_cabac; + cabac_ctx_t *ctx = NULL; // FL coded merges. if (sao_left != NULL) { ctx = &(cabac->ctx.sao_merge_flag_model); @@ -132,8 +132,8 @@ static double sao_mode_bits_band(const encoder_state_t * const state, sao_info_t *sao_top, sao_info_t *sao_left, unsigned buf_cnt) { double mode_bits = 0.0; - cabac_data_t * const cabac = (cabac_data_t*)&state->search_cabac; - const cabac_ctx_t *ctx = NULL; + cabac_data_t * cabac = (cabac_data_t*)&state->search_cabac; + cabac_ctx_t *ctx = NULL; // FL coded merges. if (sao_left != NULL) { ctx = &(cabac->ctx.sao_merge_flag_model); diff --git a/src/search_intra.c b/src/search_intra.c index e29f29a3..2986f67f 100644 --- a/src/search_intra.c +++ b/src/search_intra.c @@ -269,7 +269,7 @@ static double search_intra_trdepth(encoder_state_t * const state, // Add bits for split_transform_flag = 1, because transform depth search bypasses // the normal recursion in the cost functions. if (depth >= 1 && depth <= 3) { - const cabac_ctx_t *ctx = &(state->search_cabac.ctx.trans_subdiv_model[5 - (6 - depth)]); + cabac_ctx_t *ctx = &(state->search_cabac.ctx.trans_subdiv_model[5 - (6 - depth)]); CABAC_FBITS_UPDATE(&state->search_cabac, ctx, 1, tr_split_bit, "tr_split"); *bit_cost += tr_split_bit; } @@ -283,7 +283,7 @@ static double search_intra_trdepth(encoder_state_t * const state, if (state->encoder_control->chroma_format != KVZ_CSP_400) { const uint8_t tr_depth = depth - pred_cu->depth; - const cabac_ctx_t *ctx = &(state->search_cabac.ctx.qt_cbf_model_chroma[tr_depth]); + cabac_ctx_t *ctx = &(state->search_cabac.ctx.qt_cbf_model_chroma[tr_depth]); if (tr_depth == 0 || cbf_is_set(pred_cu->cbf, depth - 1, COLOR_U)) { CABAC_FBITS_UPDATE(&state->search_cabac, ctx, cbf_is_set(pred_cu->cbf, depth, COLOR_U), cbf_bits, "cbf_cb"); } @@ -647,9 +647,9 @@ static int8_t search_intra_rdo(encoder_state_t * const state, } -double kvz_luma_mode_bits(encoder_state_t *state, int8_t luma_mode, const int8_t *intra_preds) +double kvz_luma_mode_bits(const encoder_state_t *state, int8_t luma_mode, const int8_t *intra_preds) { - cabac_data_t* cabac = &state->search_cabac; + cabac_data_t* cabac = (cabac_data_t *)&state->search_cabac; double mode_bits = 0; bool mode_in_preds = false; @@ -659,7 +659,7 @@ double kvz_luma_mode_bits(encoder_state_t *state, int8_t luma_mode, const int8_t } } - const cabac_ctx_t *ctx = &(cabac->ctx.intra_mode_model); + cabac_ctx_t *ctx = &(cabac->ctx.intra_mode_model); CABAC_FBITS_UPDATE(cabac, ctx, mode_in_preds, mode_bits, "prev_intra_luma_pred_flag_search"); if (state->search_cabac.update) { if(mode_in_preds) { @@ -688,7 +688,7 @@ double kvz_luma_mode_bits(encoder_state_t *state, int8_t luma_mode, const int8_t double kvz_chroma_mode_bits(const encoder_state_t *state, int8_t chroma_mode, int8_t luma_mode) { cabac_data_t* cabac = (cabac_data_t*)&state->search_cabac; - const cabac_ctx_t *ctx = &(cabac->ctx.chroma_pred_model[0]); + cabac_ctx_t *ctx = &(cabac->ctx.chroma_pred_model[0]); double mode_bits = 0; CABAC_FBITS_UPDATE(cabac, ctx, chroma_mode != luma_mode, mode_bits, "intra_chroma_pred_mode");