mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-12-04 13:54:05 +00:00
[mrl] Fix issues transmitting multi ref idx during search. Change multi ref idx type to uint.
This commit is contained in:
parent
54505e0250
commit
3a81a389c3
|
@ -856,7 +856,7 @@ static void encode_intra_coding_unit(encoder_state_t * const state,
|
||||||
bool allow_isp = enough_samples;
|
bool allow_isp = enough_samples;
|
||||||
|
|
||||||
// Code MRL related bits
|
// Code MRL related bits
|
||||||
int multi_ref_idx = cur_cu->intra.multi_ref_idx;
|
int multi_ref_idx = cur_cu->type == CU_INTRA ? cur_cu->intra.multi_ref_idx : 0;
|
||||||
bool enable_mrl = state->encoder_control->cfg.mrl;
|
bool enable_mrl = state->encoder_control->cfg.mrl;
|
||||||
|
|
||||||
if (cur_cu->type == CU_INTRA && (y % LCU_WIDTH) != 0 && !cur_cu->bdpcmMode && enable_mrl) {
|
if (cur_cu->type == CU_INTRA && (y % LCU_WIDTH) != 0 && !cur_cu->bdpcmMode && enable_mrl) {
|
||||||
|
|
15
src/intra.c
15
src/intra.c
|
@ -967,7 +967,7 @@ void kvz_intra_build_reference(
|
||||||
kvz_intra_references *const refs,
|
kvz_intra_references *const refs,
|
||||||
bool entropy_sync,
|
bool entropy_sync,
|
||||||
kvz_pixel *extra_ref_lines,
|
kvz_pixel *extra_ref_lines,
|
||||||
int8_t multi_ref_idx)
|
uint8_t multi_ref_idx)
|
||||||
{
|
{
|
||||||
assert(!(extra_ref_lines == NULL && multi_ref_idx != 0) && "Trying to use MRL with NULL extra references.");
|
assert(!(extra_ref_lines == NULL && multi_ref_idx != 0) && "Trying to use MRL with NULL extra references.");
|
||||||
|
|
||||||
|
@ -1012,7 +1012,7 @@ static void intra_recon_tb_leaf(
|
||||||
int x_scu = SUB_SCU(x);
|
int x_scu = SUB_SCU(x);
|
||||||
int y_scu = SUB_SCU(y);
|
int y_scu = SUB_SCU(y);
|
||||||
const vector2d_t lcu_px = {x_scu >> shift, y_scu >> shift };
|
const vector2d_t lcu_px = {x_scu >> shift, y_scu >> shift };
|
||||||
uint8_t multi_ref_index = multi_ref_idx;
|
uint8_t multi_ref_index = color == COLOR_Y ? multi_ref_idx : 0;
|
||||||
|
|
||||||
kvz_intra_references refs;
|
kvz_intra_references refs;
|
||||||
// Extra reference lines for use with MRL. Extra lines needed only for left edge.
|
// Extra reference lines for use with MRL. Extra lines needed only for left edge.
|
||||||
|
@ -1097,6 +1097,7 @@ void kvz_intra_recon_cu(
|
||||||
int8_t mode_chroma,
|
int8_t mode_chroma,
|
||||||
cu_info_t *cur_cu,
|
cu_info_t *cur_cu,
|
||||||
cclm_parameters_t *cclm_params,
|
cclm_parameters_t *cclm_params,
|
||||||
|
uint8_t multi_ref_idx,
|
||||||
lcu_t *lcu)
|
lcu_t *lcu)
|
||||||
{
|
{
|
||||||
const vector2d_t lcu_px = { SUB_SCU(x), SUB_SCU(y) };
|
const vector2d_t lcu_px = { SUB_SCU(x), SUB_SCU(y) };
|
||||||
|
@ -1104,7 +1105,7 @@ void kvz_intra_recon_cu(
|
||||||
if (cur_cu == NULL) {
|
if (cur_cu == NULL) {
|
||||||
cur_cu = LCU_GET_CU_AT_PX(lcu, lcu_px.x, lcu_px.y);
|
cur_cu = LCU_GET_CU_AT_PX(lcu, lcu_px.x, lcu_px.y);
|
||||||
}
|
}
|
||||||
uint8_t multi_ref_index = cur_cu->intra.multi_ref_idx;
|
uint8_t multi_ref_index = multi_ref_idx;
|
||||||
|
|
||||||
// Reset CBFs because CBFs might have been set
|
// Reset CBFs because CBFs might have been set
|
||||||
// for depth earlier
|
// for depth earlier
|
||||||
|
@ -1122,10 +1123,10 @@ void kvz_intra_recon_cu(
|
||||||
const int32_t x2 = x + offset;
|
const int32_t x2 = x + offset;
|
||||||
const int32_t y2 = y + offset;
|
const int32_t y2 = y + offset;
|
||||||
|
|
||||||
kvz_intra_recon_cu(state, x, y, depth + 1, mode_luma, mode_chroma, NULL, NULL, lcu);
|
kvz_intra_recon_cu(state, x, y, depth + 1, mode_luma, mode_chroma, NULL, NULL, multi_ref_index, lcu);
|
||||||
kvz_intra_recon_cu(state, x2, y, depth + 1, mode_luma, mode_chroma, NULL, NULL, lcu);
|
kvz_intra_recon_cu(state, x2, y, depth + 1, mode_luma, mode_chroma, NULL, NULL, multi_ref_index, lcu);
|
||||||
kvz_intra_recon_cu(state, x, y2, depth + 1, mode_luma, mode_chroma, NULL, NULL, lcu);
|
kvz_intra_recon_cu(state, x, y2, depth + 1, mode_luma, mode_chroma, NULL, NULL, multi_ref_index, lcu);
|
||||||
kvz_intra_recon_cu(state, x2, y2, depth + 1, mode_luma, mode_chroma, NULL, NULL, lcu);
|
kvz_intra_recon_cu(state, x2, y2, depth + 1, mode_luma, mode_chroma, NULL, NULL, multi_ref_index, lcu);
|
||||||
|
|
||||||
// Propagate coded block flags from child CUs to parent CU.
|
// Propagate coded block flags from child CUs to parent CU.
|
||||||
uint16_t child_cbfs[3] = {
|
uint16_t child_cbfs[3] = {
|
||||||
|
|
|
@ -99,7 +99,7 @@ void kvz_intra_build_reference(
|
||||||
kvz_intra_references *const refs,
|
kvz_intra_references *const refs,
|
||||||
bool entropy_sync,
|
bool entropy_sync,
|
||||||
kvz_pixel *extra_refs,
|
kvz_pixel *extra_refs,
|
||||||
int8_t multi_ref_idx);
|
uint8_t multi_ref_idx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Generate intra predictions.
|
* \brief Generate intra predictions.
|
||||||
|
@ -129,6 +129,7 @@ void kvz_intra_recon_cu(
|
||||||
int8_t mode_chroma,
|
int8_t mode_chroma,
|
||||||
cu_info_t *cur_cu,
|
cu_info_t *cur_cu,
|
||||||
cclm_parameters_t* cclm_params,
|
cclm_parameters_t* cclm_params,
|
||||||
|
uint8_t multi_ref_idx,
|
||||||
lcu_t *lcu);
|
lcu_t *lcu);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -724,7 +724,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
||||||
int8_t intra_mode;
|
int8_t intra_mode;
|
||||||
int8_t intra_trafo;
|
int8_t intra_trafo;
|
||||||
double intra_cost;
|
double intra_cost;
|
||||||
int8_t multi_ref_index = 0;
|
uint8_t multi_ref_index = 0;
|
||||||
kvz_search_cu_intra(state, x, y, depth, lcu,
|
kvz_search_cu_intra(state, x, y, depth, lcu,
|
||||||
&intra_mode, &intra_trafo, &intra_cost, &multi_ref_index);
|
&intra_mode, &intra_trafo, &intra_cost, &multi_ref_index);
|
||||||
if (intra_cost < cost) {
|
if (intra_cost < cost) {
|
||||||
|
@ -749,7 +749,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
||||||
x, y,
|
x, y,
|
||||||
depth,
|
depth,
|
||||||
cur_cu->intra.mode, -1, // skip chroma
|
cur_cu->intra.mode, -1, // skip chroma
|
||||||
NULL, NULL, lcu);
|
NULL, NULL, cur_cu->intra.multi_ref_idx, lcu);
|
||||||
|
|
||||||
downsample_cclm_rec(
|
downsample_cclm_rec(
|
||||||
state, x, y, cu_width / 2, cu_width / 2, lcu->rec.y, lcu->left_ref.y[64]
|
state, x, y, cu_width / 2, cu_width / 2, lcu->rec.y, lcu->left_ref.y[64]
|
||||||
|
@ -771,7 +771,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
||||||
x & ~7, y & ~7, // TODO: as does this
|
x & ~7, y & ~7, // TODO: as does this
|
||||||
depth,
|
depth,
|
||||||
-1, cur_cu->intra.mode_chroma, // skip luma
|
-1, cur_cu->intra.mode_chroma, // skip luma
|
||||||
NULL, cclm_params, lcu);
|
NULL, cclm_params, 0, lcu);
|
||||||
}
|
}
|
||||||
} else if (cur_cu->type == CU_INTER) {
|
} else if (cur_cu->type == CU_INTER) {
|
||||||
|
|
||||||
|
@ -931,7 +931,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
||||||
x, y,
|
x, y,
|
||||||
depth,
|
depth,
|
||||||
cur_cu->intra.mode, mode_chroma,
|
cur_cu->intra.mode, mode_chroma,
|
||||||
NULL,NULL, lcu);
|
NULL,NULL, 0, lcu);
|
||||||
|
|
||||||
cost += kvz_cu_rd_cost_luma(state, x_local, y_local, depth, cur_cu, lcu);
|
cost += kvz_cu_rd_cost_luma(state, x_local, y_local, depth, cur_cu, lcu);
|
||||||
if (has_chroma) {
|
if (has_chroma) {
|
||||||
|
|
|
@ -333,7 +333,7 @@ static double search_intra_trdepth(encoder_state_t * const state,
|
||||||
x_px, y_px,
|
x_px, y_px,
|
||||||
depth,
|
depth,
|
||||||
intra_mode, -1,
|
intra_mode, -1,
|
||||||
pred_cu, cclm_params, lcu);
|
pred_cu, cclm_params, pred_cu->intra.multi_ref_idx, lcu);
|
||||||
|
|
||||||
// TODO: Not sure if this should be 0 or 1 but at least seems to work with 1
|
// TODO: Not sure if this should be 0 or 1 but at least seems to work with 1
|
||||||
if (pred_cu->tr_idx > 1)
|
if (pred_cu->tr_idx > 1)
|
||||||
|
@ -361,7 +361,7 @@ static double search_intra_trdepth(encoder_state_t * const state,
|
||||||
x_px, y_px,
|
x_px, y_px,
|
||||||
depth,
|
depth,
|
||||||
-1, chroma_mode,
|
-1, chroma_mode,
|
||||||
pred_cu, cclm_params, lcu);
|
pred_cu, cclm_params, 0, lcu);
|
||||||
best_rd_cost += kvz_cu_rd_cost_chroma(state, lcu_px.x, lcu_px.y, depth, pred_cu, lcu);
|
best_rd_cost += kvz_cu_rd_cost_chroma(state, lcu_px.x, lcu_px.y, depth, pred_cu, lcu);
|
||||||
}
|
}
|
||||||
pred_cu->tr_skip = best_tr_idx == MTS_SKIP;
|
pred_cu->tr_skip = best_tr_idx == MTS_SKIP;
|
||||||
|
@ -716,7 +716,7 @@ static int8_t search_intra_rdo(encoder_state_t * const state,
|
||||||
int modes_to_check,
|
int modes_to_check,
|
||||||
int8_t modes[67], int8_t trafo[67], double costs[67],
|
int8_t modes[67], int8_t trafo[67], double costs[67],
|
||||||
lcu_t *lcu,
|
lcu_t *lcu,
|
||||||
int8_t multi_ref_idx)
|
uint8_t multi_ref_idx)
|
||||||
{
|
{
|
||||||
const int tr_depth = CLIP(1, MAX_PU_DEPTH, depth + state->encoder_control->cfg.tr_depth_intra);
|
const int tr_depth = CLIP(1, MAX_PU_DEPTH, depth + state->encoder_control->cfg.tr_depth_intra);
|
||||||
const int width = LCU_WIDTH >> depth;
|
const int width = LCU_WIDTH >> depth;
|
||||||
|
@ -901,7 +901,7 @@ int8_t kvz_search_intra_chroma_rdo(encoder_state_t * const state,
|
||||||
x_px, y_px,
|
x_px, y_px,
|
||||||
depth,
|
depth,
|
||||||
-1, chroma.mode, // skip luma
|
-1, chroma.mode, // skip luma
|
||||||
NULL, NULL, lcu);
|
NULL, NULL, 0, lcu);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -934,8 +934,7 @@ int8_t kvz_search_intra_chroma_rdo(encoder_state_t * const state,
|
||||||
x_px, y_px,
|
x_px, y_px,
|
||||||
depth,
|
depth,
|
||||||
-1, chroma.mode, // skip luma
|
-1, chroma.mode, // skip luma
|
||||||
NULL, cclm_params, lcu
|
NULL, cclm_params, 0, lcu);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
chroma.cost = kvz_cu_rd_cost_chroma(state, lcu_px.x, lcu_px.y, depth, tr_cu, lcu);
|
chroma.cost = kvz_cu_rd_cost_chroma(state, lcu_px.x, lcu_px.y, depth, tr_cu, lcu);
|
||||||
|
|
||||||
|
@ -1025,7 +1024,7 @@ void kvz_search_cu_intra(encoder_state_t * const state,
|
||||||
int8_t *mode_out,
|
int8_t *mode_out,
|
||||||
int8_t *trafo_out,
|
int8_t *trafo_out,
|
||||||
double *cost_out,
|
double *cost_out,
|
||||||
int8_t *multi_ref_idx_out)
|
uint8_t *multi_ref_idx_out)
|
||||||
{
|
{
|
||||||
const vector2d_t lcu_px = { SUB_SCU(x_px), SUB_SCU(y_px) };
|
const vector2d_t lcu_px = { SUB_SCU(x_px), SUB_SCU(y_px) };
|
||||||
const int8_t cu_width = LCU_WIDTH >> depth;
|
const int8_t cu_width = LCU_WIDTH >> depth;
|
||||||
|
|
|
@ -60,6 +60,6 @@ void kvz_search_cu_intra(encoder_state_t * const state,
|
||||||
int8_t *mode_out,
|
int8_t *mode_out,
|
||||||
int8_t *trafo_out,
|
int8_t *trafo_out,
|
||||||
double *cost_out,
|
double *cost_out,
|
||||||
int8_t *multi_ref_idx_out);
|
uint8_t *multi_ref_idx_out);
|
||||||
|
|
||||||
#endif // SEARCH_INTRA_H_
|
#endif // SEARCH_INTRA_H_
|
||||||
|
|
Loading…
Reference in a new issue