[cleanup] remove some warnings

This commit is contained in:
Marko Viitanen 2021-07-23 20:46:55 +03:00
parent 5e1636dcb9
commit 99a2b0384d
9 changed files with 60 additions and 81 deletions

View file

@ -633,7 +633,6 @@ static void encoder_state_worker_encode_lcu_search(void * opaque)
} }
lcu->coeff = calloc(1, sizeof(lcu_coeff_t)); lcu->coeff = calloc(1, sizeof(lcu_coeff_t));
state->coeff = lcu->coeff;
//This part doesn't write to bitstream, it's only search, deblock and sao //This part doesn't write to bitstream, it's only search, deblock and sao
kvz_search_lcu(state, lcu->position_px.x, lcu->position_px.y, state->tile->hor_buf_search, state->tile->ver_buf_search, lcu->coeff); kvz_search_lcu(state, lcu->position_px.x, lcu->position_px.y, state->tile->hor_buf_search, state->tile->ver_buf_search, lcu->coeff);
@ -682,8 +681,6 @@ static void encoder_state_worker_encode_lcu_bitstream(void * opaque)
videoframe_t* const frame = state->tile->frame; videoframe_t* const frame = state->tile->frame;
encoder_state_config_slice_t *slice = state->slice; encoder_state_config_slice_t *slice = state->slice;
state->coeff = lcu->coeff;
//Now write data to bitstream (required to have a correct CABAC state) //Now write data to bitstream (required to have a correct CABAC state)
const uint64_t existing_bits = kvz_bitstream_tell(&state->stream); const uint64_t existing_bits = kvz_bitstream_tell(&state->stream);
@ -701,7 +698,6 @@ static void encoder_state_worker_encode_lcu_bitstream(void * opaque)
// Coeffs are not needed anymore. // Coeffs are not needed anymore.
free(lcu->coeff); free(lcu->coeff);
lcu->coeff = NULL; lcu->coeff = NULL;
state->coeff = NULL;
bool end_of_slice_segment_flag; bool end_of_slice_segment_flag;
if (state->encoder_control->cfg.slices & KVZ_SLICES_WPP) { if (state->encoder_control->cfg.slices & KVZ_SLICES_WPP) {

View file

@ -338,11 +338,6 @@ typedef struct encoder_state_t {
*/ */
int8_t last_qp; int8_t last_qp;
/**
* \brief Coeffs for the LCU.
*/
lcu_coeff_t *coeff;
//Jobs to wait for //Jobs to wait for
threadqueue_job_t * tqj_recon_done; //Reconstruction is done threadqueue_job_t * tqj_recon_done; //Reconstruction is done
threadqueue_job_t * tqj_bitstream_written; //Bitstream is written threadqueue_job_t * tqj_bitstream_written; //Bitstream is written

View file

@ -15,58 +15,58 @@ typedef struct {
// 0 to MAX_FAST_COEFF_COST_QP // 0 to MAX_FAST_COEFF_COST_QP
static const float default_fast_coeff_cost_wts[][4] = { static const float default_fast_coeff_cost_wts[][4] = {
// Just extend it by stretching the first actual values.. // Just extend it by stretching the first actual values..
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
// up to here // up to here
{0.164240, 4.161530, 3.509033, 6.928047}, {0.164240f, 4.161530f, 3.509033f, 6.928047f},
{0.162844, 4.055940, 3.564467, 6.861493}, {0.162844f, 4.055940f, 3.564467f, 6.861493f},
{0.128729, 4.311973, 3.942837, 6.935403}, {0.128729f, 4.311973f, 3.942837f, 6.935403f},
{0.110956, 4.433190, 3.945753, 6.877697}, {0.110956f, 4.433190f, 3.945753f, 6.877697f},
{0.095026, 4.483547, 4.194173, 6.781540}, {0.095026f, 4.483547f, 4.194173f, 6.781540f},
{0.075046, 4.633703, 4.084193, 6.698600}, {0.075046f, 4.633703f, 4.084193f, 6.698600f},
{0.052426, 4.967223, 4.027210, 6.549197}, {0.052426f, 4.967223f, 4.027210f, 6.549197f},
{0.040219, 5.141820, 3.982650, 6.461557}, {0.040219f, 5.141820f, 3.982650f, 6.461557f},
{0.035090, 5.192493, 3.830950, 6.418477}, {0.035090f, 5.192493f, 3.830950f, 6.418477f},
{0.029845, 5.211647, 3.815457, 6.345440}, {0.029845f, 5.211647f, 3.815457f, 6.345440f},
{0.023522, 5.322213, 3.816537, 6.360677}, {0.023522f, 5.322213f, 3.816537f, 6.360677f},
{0.021305, 5.225923, 3.842700, 6.325787}, {0.021305f, 5.225923f, 3.842700f, 6.325787f},
{0.015878, 5.183090, 3.956003, 6.329680}, {0.015878f, 5.183090f, 3.956003f, 6.329680f},
{0.010430, 5.099230, 4.176803, 6.305400}, {0.010430f, 5.099230f, 4.176803f, 6.305400f},
{0.008433, 5.030257, 4.237587, 6.270133}, {0.008433f, 5.030257f, 4.237587f, 6.270133f},
{0.006500, 4.969247, 4.339397, 6.217827}, {0.006500f, 4.969247f, 4.339397f, 6.217827f},
{0.004929, 4.923500, 4.442413, 6.183523}, {0.004929f, 4.923500f, 4.442413f, 6.183523f},
{0.003715, 4.915583, 4.429090, 6.125320}, {0.003715f, 4.915583f, 4.429090f, 6.125320f},
{0.003089, 4.883907, 4.562790, 6.156447}, {0.003089f, 4.883907f, 4.562790f, 6.156447f},
{0.002466, 4.881063, 4.629883, 6.142643}, {0.002466f, 4.881063f, 4.629883f, 6.142643f},
{0.002169, 4.882493, 4.646313, 6.127663}, {0.002169f, 4.882493f, 4.646313f, 6.127663f},
{0.002546, 4.793337, 4.837413, 6.199270}, {0.002546f, 4.793337f, 4.837413f, 6.199270f},
{0.001314, 4.808853, 4.828337, 6.243437}, {0.001314f, 4.808853f, 4.828337f, 6.243437f},
{0.001154, 4.862603, 4.846883, 6.205523}, {0.001154f, 4.862603f, 4.846883f, 6.205523f},
{0.000984, 4.866403, 4.859330, 6.240893}, {0.000984f, 4.866403f, 4.859330f, 6.240893f},
{0.000813, 4.856633, 4.924527, 6.293413}, {0.000813f, 4.856633f, 4.924527f, 6.293413f},
{0.001112, 4.789260, 5.009880, 6.433540}, {0.001112f, 4.789260f, 5.009880f, 6.433540f},
{0.000552, 4.760747, 5.090447, 6.599380}, {0.000552f, 4.760747f, 5.090447f, 6.599380f},
{0.000391, 4.961447, 5.111033, 6.756370}, {0.000391f, 4.961447f, 5.111033f, 6.756370f},
{0.000332, 4.980953, 5.138127, 6.867420}, {0.000332f, 4.980953f, 5.138127f, 6.867420f},
{0.000201, 5.181957, 4.740160, 6.460997}, {0.000201f, 5.181957f, 4.740160f, 6.460997f},
{0.000240, 5.185390, 4.874840, 6.819093}, {0.000240f, 5.185390f, 4.874840f, 6.819093f},
{0.000130, 5.270350, 4.734213, 6.826240}, {0.000130f, 5.270350f, 4.734213f, 6.826240f},
{0.000104, 5.371937, 4.595087, 6.659253}, {0.000104f, 5.371937f, 4.595087f, 6.659253f},
{0.000083, 5.362000, 4.617470, 6.837770}, {0.000083f, 5.362000f, 4.617470f, 6.837770f},
{0.000069, 5.285997, 4.754993, 7.159043}, {0.000069f, 5.285997f, 4.754993f, 7.159043f},
{0.000049, 5.488470, 4.396107, 6.727357}, {0.000049f, 5.488470f, 4.396107f, 6.727357f},
{0.000058, 4.958940, 4.580460, 6.477740}, {0.000058f, 4.958940f, 4.580460f, 6.477740f},
{0.000028, 5.521253, 4.440493, 7.205017}, {0.000028f, 5.521253f, 4.440493f, 7.205017f},
{0.000000, 0.000000, 0.000000, 0.000000}, {0.000000f, 0.000000f, 0.000000f, 0.000000f},
{0.000019, 5.811260, 4.399110, 7.336310}, {0.000019f, 5.811260f, 4.399110f, 7.336310f},
}; };
typedef struct encoder_state_t encoder_state_t; typedef struct encoder_state_t encoder_state_t;

View file

@ -262,7 +262,7 @@ enum kvz_file_format
// Map from input format to chroma format. // Map from input format to chroma format.
#define KVZ_FORMAT2CSP(format) ((enum kvz_chroma_format)"\0\1\2\3"[format]) #define KVZ_FORMAT2CSP(format) ((enum kvz_chroma_format)format)
/** /**
* \brief GoP picture configuration. * \brief GoP picture configuration.

View file

@ -1078,8 +1078,6 @@ int kvz_ts_rdoq(encoder_state_t* const state, coeff_t* src_coeff, coeff_t* dest_
double block_uncoded_cost = 0; double block_uncoded_cost = 0;
uint32_t cg_num = width * height >> 4; uint32_t cg_num = width * height >> 4;
const int32_t shift = 4 >> 1;
const uint32_t num_blk_side = width >> shift;
int32_t qp_scaled = kvz_get_scaled_qp(type, state->qp, (encoder->bitdepth - 8) * 6, encoder->qp_map[0]); int32_t qp_scaled = kvz_get_scaled_qp(type, state->qp, (encoder->bitdepth - 8) * 6, encoder->qp_map[0]);
qp_scaled = MAX(qp_scaled, 4 + 6 * MIN_QP_PRIME_TS); qp_scaled = MAX(qp_scaled, 4 + 6 * MIN_QP_PRIME_TS);
@ -1102,8 +1100,6 @@ int kvz_ts_rdoq(encoder_state_t* const state, coeff_t* src_coeff, coeff_t* dest_
default: assert(0 && "There should be 1, 4, 16 or 64 coefficient groups"); default: assert(0 && "There should be 1, 4, 16 or 64 coefficient groups");
} }
int bdpcm = 0;
const bool needs_sqrt2_scale = false; // from VTM: should always be false - transform-skipped blocks don't require sqrt(2) compensation. const bool needs_sqrt2_scale = false; // from VTM: should always be false - transform-skipped blocks don't require sqrt(2) compensation.
const int q_bits = QUANT_SHIFT + qp_scaled / 6 + (needs_sqrt2_scale ? -1 : 0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits const int q_bits = QUANT_SHIFT + qp_scaled / 6 + (needs_sqrt2_scale ? -1 : 0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits
const int32_t quant_coeff = kvz_g_quant_scales[qp_scaled % 6]; const int32_t quant_coeff = kvz_g_quant_scales[qp_scaled % 6];
@ -1151,7 +1147,7 @@ int kvz_ts_rdoq(encoder_state_t* const state, coeff_t* src_coeff, coeff_t* dest_
for (int scan_pos_in_sb = 0; scan_pos_in_sb <= sbSizeM1; scan_pos_in_sb++) for (int scan_pos_in_sb = 0; scan_pos_in_sb <= sbSizeM1; scan_pos_in_sb++)
{ {
scan_pos = sbId << log2_cg_size + scan_pos_in_sb; scan_pos = (sbId << log2_cg_size) + scan_pos_in_sb;
int last_pos_coded = sbSizeM1; int last_pos_coded = sbSizeM1;
uint32_t blkpos = scan[scan_pos]; uint32_t blkpos = scan[scan_pos];
uint32_t pos_y = blkpos >> log2_block_size; uint32_t pos_y = blkpos >> log2_block_size;
@ -1269,7 +1265,7 @@ int kvz_ts_rdoq(encoder_state_t* const state, coeff_t* src_coeff, coeff_t* dest_
rem_reg_bins += rd_stats.num_sbb_ctx_bins; // skip sub-block rem_reg_bins += rd_stats.num_sbb_ctx_bins; // skip sub-block
for (int scanPosInSB = 0; scanPosInSB <= sbSizeM1; scanPosInSB++) for (int scanPosInSB = 0; scanPosInSB <= sbSizeM1; scanPosInSB++)
{ {
scan_pos = sbId << log2_cg_size + scanPosInSB; scan_pos = (sbId << log2_cg_size) + scanPosInSB;
uint32_t blkPos = scan[scan_pos]; uint32_t blkPos = scan[scan_pos];
if (dest_coeff[blkPos]) if (dest_coeff[blkPos])
@ -1353,8 +1349,6 @@ void kvz_rdoq(encoder_state_t * const state, coeff_t *coef, coeff_t *dest_coeff,
int32_t temp_diag = -1; int32_t temp_diag = -1;
int32_t temp_sum = -1; int32_t temp_sum = -1;
int32_t base_level;
const uint32_t *scan = kvz_g_sig_last_scan[ scan_mode ][ log2_block_size - 1 ]; const uint32_t *scan = kvz_g_sig_last_scan[ scan_mode ][ log2_block_size - 1 ];
int32_t cg_last_scanpos = -1; int32_t cg_last_scanpos = -1;

View file

@ -2057,9 +2057,9 @@ void kvz_search_cu_smp(encoder_state_t * const state,
*inter_cost += cost; *inter_cost += cost;
*inter_bitcost += bitcost; *inter_bitcost += bitcost;
for (int y = y_pu; y < y_pu + height_pu; y += SCU_WIDTH) { for (int y_tmp = y_pu; y_tmp < y_pu + height_pu; y_tmp += SCU_WIDTH) {
for (int x = x_pu; x < x_pu + width_pu; x += SCU_WIDTH) { for (int x_tmp = x_pu; x_tmp < x_pu + width_pu; x_tmp += SCU_WIDTH) {
cu_info_t *scu = LCU_GET_CU_AT_PX(lcu, x, y); cu_info_t *scu = LCU_GET_CU_AT_PX(lcu, x_tmp, y_tmp);
scu->type = CU_INTER; scu->type = CU_INTER;
scu->inter = cur_pu->inter; scu->inter = cur_pu->inter;
} }

View file

@ -67,8 +67,6 @@ void kvz_encode_coeff_nxn_generic(encoder_state_t * const state,
const uint32_t *scan = const uint32_t *scan =
kvz_g_sig_last_scan[scan_mode][log2_block_size - 1]; kvz_g_sig_last_scan[scan_mode][log2_block_size - 1];
const uint32_t *scan_cg = g_sig_last_scan_cg[log2_block_size - 1][scan_mode]; const uint32_t *scan_cg = g_sig_last_scan_cg[log2_block_size - 1][scan_mode];
const uint32_t clipped_log2_size = log2_block_size > 4 ? 4 : log2_block_size;
const uint32_t num_blk_side = width >> log2_cg_size;
// Init base contexts according to block type // Init base contexts according to block type
@ -147,7 +145,6 @@ void kvz_encode_coeff_nxn_generic(encoder_state_t * const state,
if (sig_coeffgroup_flag[cg_blk_pos]) { if (sig_coeffgroup_flag[cg_blk_pos]) {
uint32_t next_pass = 0;
int32_t min_sub_pos = i << log2_cg_size; // LOG2_SCAN_SET_SIZE; int32_t min_sub_pos = i << log2_cg_size; // LOG2_SCAN_SET_SIZE;
int32_t first_sig_pos = (i == scan_cg_last) ? scan_pos_last : (min_sub_pos + (1 << log2_cg_size) - 1); int32_t first_sig_pos = (i == scan_cg_last) ? scan_pos_last : (min_sub_pos + (1 << log2_cg_size) - 1);
int32_t next_sig_pos = first_sig_pos; int32_t next_sig_pos = first_sig_pos;

View file

@ -122,7 +122,6 @@ static void kvz_angular_pred_generic(
// Temporary buffer for modes 11-25. // Temporary buffer for modes 11-25.
// It only needs to be big enough to hold indices from -width to width-1. // It only needs to be big enough to hold indices from -width to width-1.
kvz_pixel tmp_ref[2 * 128] = { 0 };
kvz_pixel temp_main[2 * 128] = { 0 }; kvz_pixel temp_main[2 * 128] = { 0 };
kvz_pixel temp_side[2 * 128] = { 0 }; kvz_pixel temp_side[2 * 128] = { 0 };
const int_fast32_t width = 1 << log2_width; const int_fast32_t width = 1 << log2_width;
@ -202,7 +201,6 @@ static void kvz_angular_pred_generic(
temp_side[i] = (vertical_mode ? in_ref_left[i] : in_ref_above[i]); temp_side[i] = (vertical_mode ? in_ref_left[i] : in_ref_above[i]);
} }
const int log2_ratio = 0;
const int s = 0; const int s = 0;
const int max_index = (0 << s) + 2; const int max_index = (0 << s) + 2;
const int ref_length = width << 1; const int ref_length = width << 1;
@ -389,7 +387,6 @@ static void kvz_intra_pred_planar_generic(
const int_fast8_t width = 1 << log2_width; const int_fast8_t width = 1 << log2_width;
const kvz_pixel top_right = ref_top[width + 1]; const kvz_pixel top_right = ref_top[width + 1];
const kvz_pixel bottom_left = ref_left[width + 1]; const kvz_pixel bottom_left = ref_left[width + 1];
const uint32_t offset = 1 <<(log2_width+ log2_width);
#if 0 #if 0
// Unoptimized version for reference. // Unoptimized version for reference.

View file

@ -40,8 +40,8 @@
static int16_t * dct_bufs[NUM_TESTS] = { 0 }; // SIMD aligned pointers. static int16_t * dct_bufs[NUM_TESTS] = { 0 }; // SIMD aligned pointers.
static int16_t * dct_actual_bufs[NUM_TESTS] = { 0 }; // pointers returned by malloc. static int16_t * dct_actual_bufs[NUM_TESTS] = { 0 }; // pointers returned by malloc.
static int16_t dct_result[NUM_TRANSFORM][NUM_SIZES][LCU_WIDTH*LCU_WIDTH] = { { 0 } }; static int16_t dct_result[NUM_TRANSFORM][NUM_SIZES][LCU_WIDTH*LCU_WIDTH] = { { { 0 } } };
static int16_t idct_result[NUM_TRANSFORM][NUM_SIZES][LCU_WIDTH*LCU_WIDTH] = { { 0 } }; static int16_t idct_result[NUM_TRANSFORM][NUM_SIZES][LCU_WIDTH*LCU_WIDTH] = { { { 0 } } };
static struct test_env_t { static struct test_env_t {
int log_width; // for selecting dim from bufs int log_width; // for selecting dim from bufs