mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Fix warnings/errors
This commit is contained in:
parent
b093248ca7
commit
88c01b6d32
38
src/intra.c
38
src/intra.c
|
@ -83,9 +83,9 @@ static const uint8_t num_ref_pixels_left[16][16] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void static mip_predict(
|
static void mip_predict(
|
||||||
const encoder_state_t* const state,
|
const encoder_state_t* const state,
|
||||||
kvz_intra_references* const refs,
|
const kvz_intra_references* const refs,
|
||||||
const uint16_t pred_block_width,
|
const uint16_t pred_block_width,
|
||||||
const uint16_t pred_block_height,
|
const uint16_t pred_block_height,
|
||||||
kvz_pixel* dst,
|
kvz_pixel* dst,
|
||||||
|
@ -479,7 +479,7 @@ static void linear_transform_cclm(const cclm_parameters_t* cclm_params, kvz_pixe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void kvz_predict_cclm(
|
void predict_cclm(
|
||||||
encoder_state_t const* const state,
|
encoder_state_t const* const state,
|
||||||
const color_t color,
|
const color_t color,
|
||||||
const int8_t width,
|
const int8_t width,
|
||||||
|
@ -488,7 +488,7 @@ void kvz_predict_cclm(
|
||||||
const int16_t y0,
|
const int16_t y0,
|
||||||
const int16_t stride,
|
const int16_t stride,
|
||||||
const int8_t mode,
|
const int8_t mode,
|
||||||
lcu_t* const lcu,
|
const lcu_t* const lcu,
|
||||||
kvz_intra_references* chroma_ref,
|
kvz_intra_references* chroma_ref,
|
||||||
kvz_pixel* dst,
|
kvz_pixel* dst,
|
||||||
cclm_parameters_t* cclm_params
|
cclm_parameters_t* cclm_params
|
||||||
|
@ -508,7 +508,7 @@ void kvz_predict_cclm(
|
||||||
int available_left_below = 0;
|
int available_left_below = 0;
|
||||||
|
|
||||||
|
|
||||||
kvz_pixel *y_rec = lcu->rec.y + x_scu + y_scu * LCU_WIDTH;
|
const kvz_pixel *y_rec = lcu->rec.y + x_scu + y_scu * LCU_WIDTH;
|
||||||
const int stride2 = (((state->tile->frame->width + 7) & ~7) + FRAME_PADDING_LUMA);
|
const int stride2 = (((state->tile->frame->width + 7) & ~7) + FRAME_PADDING_LUMA);
|
||||||
|
|
||||||
// Essentially what this does is that it uses 6-tap filtering to downsample
|
// Essentially what this does is that it uses 6-tap filtering to downsample
|
||||||
|
@ -520,7 +520,7 @@ void kvz_predict_cclm(
|
||||||
if (y0) {
|
if (y0) {
|
||||||
for (; available_above_right < width / 2; available_above_right++) {
|
for (; available_above_right < width / 2; available_above_right++) {
|
||||||
int x_extension = x_scu + width * 2 + 4 * available_above_right;
|
int x_extension = x_scu + width * 2 + 4 * available_above_right;
|
||||||
cu_info_t* pu = LCU_GET_CU_AT_PX(lcu, x_extension, y_scu - 4);
|
const cu_info_t* pu = LCU_GET_CU_AT_PX(lcu, x_extension, y_scu - 4);
|
||||||
if (x_extension >= LCU_WIDTH || pu->type == CU_NOTSET) break;
|
if (x_extension >= LCU_WIDTH || pu->type == CU_NOTSET) break;
|
||||||
}
|
}
|
||||||
if(y_scu == 0) {
|
if(y_scu == 0) {
|
||||||
|
@ -545,7 +545,7 @@ void kvz_predict_cclm(
|
||||||
if(x0) {
|
if(x0) {
|
||||||
for (; available_left_below < height / 2; available_left_below++) {
|
for (; available_left_below < height / 2; available_left_below++) {
|
||||||
int y_extension = y_scu + height * 2 + 4 * available_left_below;
|
int y_extension = y_scu + height * 2 + 4 * available_left_below;
|
||||||
cu_info_t* pu = LCU_GET_CU_AT_PX(lcu, x_scu - 4, y_extension);
|
const cu_info_t* pu = LCU_GET_CU_AT_PX(lcu, x_scu - 4, y_extension);
|
||||||
if (y_extension >= LCU_WIDTH || pu->type == CU_NOTSET) break;
|
if (y_extension >= LCU_WIDTH || pu->type == CU_NOTSET) break;
|
||||||
if(x_scu == 32 && y_scu == 0 && pu->depth == 0) break;
|
if(x_scu == 32 && y_scu == 0 && pu->depth == 0) break;
|
||||||
}
|
}
|
||||||
|
@ -742,9 +742,9 @@ void kvz_mip_pred_upsampling_1D(int* const dst, const int* const src, const int*
|
||||||
|
|
||||||
/** \brief Matrix weighted intra prediction.
|
/** \brief Matrix weighted intra prediction.
|
||||||
*/
|
*/
|
||||||
void static mip_predict(
|
static void mip_predict(
|
||||||
const encoder_state_t* const state,
|
const encoder_state_t* const state,
|
||||||
kvz_intra_references* const refs,
|
const kvz_intra_references* const refs,
|
||||||
const uint16_t pred_block_width,
|
const uint16_t pred_block_width,
|
||||||
const uint16_t pred_block_height,
|
const uint16_t pred_block_height,
|
||||||
kvz_pixel* dst,
|
kvz_pixel* dst,
|
||||||
|
@ -892,7 +892,7 @@ void static mip_predict(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void static intra_predict_regular(
|
static void intra_predict_regular(
|
||||||
const encoder_state_t* const state,
|
const encoder_state_t* const state,
|
||||||
kvz_intra_references *refs,
|
kvz_intra_references *refs,
|
||||||
int_fast8_t log2_width,
|
int_fast8_t log2_width,
|
||||||
|
@ -1369,15 +1369,14 @@ void kvz_intra_build_reference(
|
||||||
|
|
||||||
void kvz_intra_predict(
|
void kvz_intra_predict(
|
||||||
const encoder_state_t* const state,
|
const encoder_state_t* const state,
|
||||||
const kvz_intra_references* const refs,
|
kvz_intra_references* const refs,
|
||||||
const cu_loc_t* const cu_loc,
|
const cu_loc_t* const cu_loc,
|
||||||
const color_t color,
|
const color_t color,
|
||||||
kvz_pixel* dst,
|
kvz_pixel* dst,
|
||||||
intra_search_data_t* data,
|
const intra_search_data_t* data,
|
||||||
const lcu_t* lcu
|
const lcu_t* lcu
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const kvz_config* cfg = &state->encoder_control->cfg;
|
|
||||||
const int stride = (((state->tile->frame->width + 7) & ~7) + FRAME_PADDING_LUMA);
|
const int stride = (((state->tile->frame->width + 7) & ~7) + FRAME_PADDING_LUMA);
|
||||||
// TODO: what is this used for?
|
// TODO: what is this used for?
|
||||||
// const bool filter_boundary = color == COLOR_Y && !(cfg->lossless && cfg->implicit_rdpcm);
|
// const bool filter_boundary = color == COLOR_Y && !(cfg->lossless && cfg->implicit_rdpcm);
|
||||||
|
@ -1407,8 +1406,9 @@ void kvz_intra_predict(
|
||||||
else {
|
else {
|
||||||
kvz_pixels_blit(&state->tile->frame->cclm_luma_rec[x / 2 + (y * stride) / 4], dst, width, width, stride / 2, width);
|
kvz_pixels_blit(&state->tile->frame->cclm_luma_rec[x / 2 + (y * stride) / 4], dst, width, width, stride / 2, width);
|
||||||
if (data->pred_cu.depth != data->pred_cu.tr_depth || data->cclm_parameters[color == COLOR_U ? 0 : 1].b <= 0) {
|
if (data->pred_cu.depth != data->pred_cu.tr_depth || data->cclm_parameters[color == COLOR_U ? 0 : 1].b <= 0) {
|
||||||
kvz_predict_cclm(
|
predict_cclm(
|
||||||
state, color, width, width, x, y, stride, intra_mode, lcu, refs, dst, &data->cclm_parameters[color == COLOR_U ? 0 : 1]);
|
state, color, width, width, x, y, stride, intra_mode, lcu, refs, dst,
|
||||||
|
(cclm_parameters_t*)&data->cclm_parameters[color == COLOR_U ? 0 : 1]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linear_transform_cclm(&data->cclm_parameters[color == COLOR_U ? 0 : 1], dst, dst, width, width);
|
linear_transform_cclm(&data->cclm_parameters[color == COLOR_U ? 0 : 1], dst, dst, width, width);
|
||||||
|
@ -1418,7 +1418,7 @@ void kvz_intra_predict(
|
||||||
|
|
||||||
|
|
||||||
static void intra_recon_tb_leaf(
|
static void intra_recon_tb_leaf(
|
||||||
const encoder_state_t* const state,
|
encoder_state_t* const state,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int depth,
|
int depth,
|
||||||
|
@ -1472,8 +1472,8 @@ static void intra_recon_tb_leaf(
|
||||||
|
|
||||||
cu_loc_t loc = {
|
cu_loc_t loc = {
|
||||||
x, y,
|
x, y,
|
||||||
width, width,
|
width, height,
|
||||||
width, width,
|
width, height,
|
||||||
};
|
};
|
||||||
|
|
||||||
kvz_intra_predict(state, &refs, &loc, color, pred, search_data, lcu);
|
kvz_intra_predict(state, &refs, &loc, color, pred, search_data, lcu);
|
||||||
|
@ -1518,7 +1518,7 @@ static void intra_recon_tb_leaf(
|
||||||
* \param lcu containing LCU
|
* \param lcu containing LCU
|
||||||
*/
|
*/
|
||||||
void kvz_intra_recon_cu(
|
void kvz_intra_recon_cu(
|
||||||
const encoder_state_t* const state,
|
encoder_state_t* const state,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int depth,
|
int depth,
|
||||||
|
|
25
src/intra.h
25
src/intra.h
|
@ -127,15 +127,16 @@ void kvz_intra_build_reference(
|
||||||
*/
|
*/
|
||||||
void kvz_intra_predict(
|
void kvz_intra_predict(
|
||||||
const encoder_state_t* const state,
|
const encoder_state_t* const state,
|
||||||
const kvz_intra_references* const refs,
|
kvz_intra_references* const refs,
|
||||||
const cu_loc_t* const cu_loc,
|
const cu_loc_t* const cu_loc,
|
||||||
const color_t color,
|
const color_t color,
|
||||||
kvz_pixel* dst,
|
kvz_pixel* dst,
|
||||||
intra_search_data_t* data,
|
const intra_search_data_t* data,
|
||||||
const lcu_t* lcu);
|
const lcu_t* lcu
|
||||||
|
);
|
||||||
|
|
||||||
void kvz_intra_recon_cu(
|
void kvz_intra_recon_cu(
|
||||||
const encoder_state_t* const state,
|
encoder_state_t* const state,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int depth,
|
int depth,
|
||||||
|
@ -143,20 +144,4 @@ void kvz_intra_recon_cu(
|
||||||
cu_info_t *cur_cu,
|
cu_info_t *cur_cu,
|
||||||
lcu_t *lcu);
|
lcu_t *lcu);
|
||||||
|
|
||||||
|
|
||||||
void kvz_predict_cclm(
|
|
||||||
encoder_state_t const* const state,
|
|
||||||
const color_t color,
|
|
||||||
const int8_t width,
|
|
||||||
const int8_t height,
|
|
||||||
const int16_t x0,
|
|
||||||
const int16_t y0,
|
|
||||||
const int16_t stride,
|
|
||||||
const int8_t mode,
|
|
||||||
lcu_t* const lcu,
|
|
||||||
kvz_intra_references* chroma_ref,
|
|
||||||
kvz_pixel* dst,
|
|
||||||
cclm_parameters_t* cclm_params
|
|
||||||
);
|
|
||||||
|
|
||||||
int kvz_get_mip_flag_context(int x, int y, int width, int height, const lcu_t* lcu, cu_array_t* const cu_a);
|
int kvz_get_mip_flag_context(int x, int y, int width, int height, const lcu_t* lcu, cu_array_t* const cu_a);
|
||||||
|
|
|
@ -1201,12 +1201,14 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
||||||
kvz_lcu_fill_trdepth(lcu, x, y, depth, cur_cu->tr_depth);
|
kvz_lcu_fill_trdepth(lcu, x, y, depth, cur_cu->tr_depth);
|
||||||
lcu_fill_cu_info(lcu, x_local, y_local, cu_width, cu_width, cur_cu);
|
lcu_fill_cu_info(lcu, x_local, y_local, cu_width, cu_width, cur_cu);
|
||||||
|
|
||||||
const bool has_chroma = state->encoder_control->chroma_format != KVZ_CSP_400;
|
intra_search_data_t proxy;
|
||||||
const int8_t mode_chroma = has_chroma ? cur_cu->intra.mode_chroma : -1;
|
FILL(proxy, 0);
|
||||||
|
proxy.pred_cu = *cur_cu;
|
||||||
|
|
||||||
kvz_intra_recon_cu(state,
|
kvz_intra_recon_cu(state,
|
||||||
x, y,
|
x, y,
|
||||||
depth, NULL,
|
depth,
|
||||||
|
&proxy,
|
||||||
NULL,
|
NULL,
|
||||||
lcu);
|
lcu);
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ static void get_cost_dual(encoder_state_t * const state,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double static INLINE rough_cost_prediction_mode(const encoder_state_t* const state,
|
static INLINE double rough_cost_prediction_mode(encoder_state_t* const state,
|
||||||
kvz_intra_references* const references,
|
kvz_intra_references* const references,
|
||||||
const cu_loc_t* const cu_loc,
|
const cu_loc_t* const cu_loc,
|
||||||
kvz_pixel *ref_pixels,
|
kvz_pixel *ref_pixels,
|
||||||
|
@ -188,6 +188,7 @@ double static INLINE rough_cost_prediction_mode(const encoder_state_t* const sta
|
||||||
kvz_intra_predict(state, references, cu_loc, color, pred, data, lcu);
|
kvz_intra_predict(state, references, cu_loc, color, pred, data, lcu);
|
||||||
|
|
||||||
double cost = get_cost(state, pred, ref_pixels, satd_func, sad_func, width);
|
double cost = get_cost(state, pred, ref_pixels, satd_func, sad_func, width);
|
||||||
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -596,8 +597,8 @@ static int8_t search_intra_rough(
|
||||||
int8_t modes[KVZ_NUM_INTRA_MODES];
|
int8_t modes[KVZ_NUM_INTRA_MODES];
|
||||||
double costs[KVZ_NUM_INTRA_MODES];
|
double costs[KVZ_NUM_INTRA_MODES];
|
||||||
|
|
||||||
const kvz_config *cfg = &state->encoder_control->cfg;
|
// const kvz_config *cfg = &state->encoder_control->cfg;
|
||||||
const bool filter_boundary = !(cfg->lossless && cfg->implicit_rdpcm);
|
// const bool filter_boundary = !(cfg->lossless && cfg->implicit_rdpcm);
|
||||||
|
|
||||||
// Temporary block arrays
|
// Temporary block arrays
|
||||||
kvz_pixel _preds[PARALLEL_BLKS * 32 * 32 + SIMD_ALIGNMENT];
|
kvz_pixel _preds[PARALLEL_BLKS * 32 * 32 + SIMD_ALIGNMENT];
|
||||||
|
@ -821,7 +822,7 @@ static int8_t search_intra_rdo(
|
||||||
|
|
||||||
// Update order according to new costs
|
// Update order according to new costs
|
||||||
double best_cost = MAX_INT;
|
double best_cost = MAX_INT;
|
||||||
int best_mode;
|
int best_mode = 0;
|
||||||
for (int mode = 0; mode < modes_to_check; mode++) {
|
for (int mode = 0; mode < modes_to_check; mode++) {
|
||||||
if(search_data[mode].cost < best_cost) {
|
if(search_data[mode].cost < best_cost) {
|
||||||
best_cost = search_data[mode].cost;
|
best_cost = search_data[mode].cost;
|
||||||
|
@ -905,9 +906,6 @@ int8_t kvz_search_intra_chroma_rdo(
|
||||||
|
|
||||||
|
|
||||||
if (reconstruct_chroma) {
|
if (reconstruct_chroma) {
|
||||||
|
|
||||||
int c_width = MAX(32 >> (depth), 4);
|
|
||||||
|
|
||||||
kvz_intra_build_reference(MAX(LOG2_LCU_WIDTH - depth - 1, 2), COLOR_U, &luma_px, &pic_px, lcu, &refs[0], state->encoder_control->cfg.wpp, NULL, 0);
|
kvz_intra_build_reference(MAX(LOG2_LCU_WIDTH - depth - 1, 2), COLOR_U, &luma_px, &pic_px, lcu, &refs[0], state->encoder_control->cfg.wpp, NULL, 0);
|
||||||
kvz_intra_build_reference(MAX(LOG2_LCU_WIDTH - depth - 1, 2), COLOR_V, &luma_px, &pic_px, lcu, &refs[1], state->encoder_control->cfg.wpp, NULL, 0);
|
kvz_intra_build_reference(MAX(LOG2_LCU_WIDTH - depth - 1, 2), COLOR_V, &luma_px, &pic_px, lcu, &refs[1], state->encoder_control->cfg.wpp, NULL, 0);
|
||||||
|
|
||||||
|
@ -924,7 +922,6 @@ int8_t kvz_search_intra_chroma_rdo(
|
||||||
lcu);
|
lcu);
|
||||||
}
|
}
|
||||||
|
|
||||||
double bits = 0;
|
|
||||||
if(tr_cu->depth != tr_cu->tr_depth || !state->encoder_control->cfg.jccr) {
|
if(tr_cu->depth != tr_cu->tr_depth || !state->encoder_control->cfg.jccr) {
|
||||||
chroma_data[i].cost = kvz_cu_rd_cost_chroma(state, lcu_px.x, lcu_px.y, depth, tr_cu, lcu);
|
chroma_data[i].cost = kvz_cu_rd_cost_chroma(state, lcu_px.x, lcu_px.y, depth, tr_cu, lcu);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1119,13 +1116,20 @@ void kvz_search_cu_intra(
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
number_of_modes += num_mip_modes;
|
||||||
|
|
||||||
|
int num_mrl_modes = 0;
|
||||||
uint8_t lines = 1;
|
uint8_t lines = 1;
|
||||||
// Find modes with multiple reference lines if in use. Do not use if CU in first row.
|
// Find modes with multiple reference lines if in use. Do not use if CU in first row.
|
||||||
if (state->encoder_control->cfg.mrl && (y_px % LCU_WIDTH) != 0) {
|
if (state->encoder_control->cfg.mrl && (y_px % LCU_WIDTH) != 0) {
|
||||||
lines = MAX_REF_LINE_IDX;
|
lines = MAX_REF_LINE_IDX;
|
||||||
}
|
}
|
||||||
|
for(int line = 1; line < lines; ++line) {
|
||||||
|
for(int i = 1; i < INTRA_MPM_COUNT; i++) {
|
||||||
|
num_mrl_modes++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
number_of_modes += num_mrl_modes;
|
||||||
|
|
||||||
// Set transform depth to current depth, meaning no transform splits.
|
// Set transform depth to current depth, meaning no transform splits.
|
||||||
kvz_lcu_fill_trdepth(lcu, x_px, y_px, depth, depth);
|
kvz_lcu_fill_trdepth(lcu, x_px, y_px, depth, depth);
|
||||||
|
|
Loading…
Reference in a new issue