mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
Change cu_info.intra into an array to support NxN split.
This commit is contained in:
parent
80cd172f75
commit
5083e6db10
|
@ -103,7 +103,7 @@ unsigned render_cu_file(encoder_control *encoder, picture *pic,
|
|||
depth, rgb[0], rgb[1], rgb[2],
|
||||
depth, xCtb, yCtb, (cu->type == CU_INTRA ? 'I' : 'P'),
|
||||
cu->inter.cost, cu->inter.mv[0], cu->inter.mv[1],
|
||||
cu->intra.cost, cu->intra.mode);
|
||||
cu->intra[0].cost, cu->intra[0].mode);
|
||||
|
||||
|
||||
if(depth != MAX_INTER_SEARCH_DEPTH)
|
||||
|
|
|
@ -1183,7 +1183,7 @@ void encode_coding_tree(encoder_control *encoder, uint16_t x_ctb,
|
|||
|
||||
// END for each part
|
||||
} else if (cur_cu->type == CU_INTRA) {
|
||||
uint8_t intra_pred_mode[4] = { cur_cu->intra.mode, -1, -1, -1 }; // TODO: set modes for NxN
|
||||
uint8_t intra_pred_mode[4] = { cur_cu->intra[0].mode, -1, -1, -1 }; // TODO: set modes for NxN
|
||||
uint8_t intra_pred_mode_chroma = 36; // 36 = Chroma derived from luma
|
||||
int8_t intra_preds[3] = { -1, -1, -1};
|
||||
int8_t mpm_preds = -1;
|
||||
|
@ -1426,17 +1426,17 @@ void encode_transform_tree(encoder_control *encoder, int32_t x_cu,int32_t y_cu,
|
|||
{
|
||||
//if multiple scans supported for transform size
|
||||
if (ctx_idx > 3 && ctx_idx < 6) {
|
||||
scan_idx_luma = abs((int32_t) cur_cu->intra.mode - 26) < 5 ? 1 : (abs((int32_t)cur_cu->intra.mode - 10) < 5 ? 2 : 0);
|
||||
scan_idx_luma = abs((int32_t) cur_cu->intra[0].mode - 26) < 5 ? 1 : (abs((int32_t)cur_cu->intra[0].mode - 10) < 5 ? 2 : 0);
|
||||
}
|
||||
// TODO : chroma intra prediction
|
||||
cur_cu->intra.mode_chroma = 36;
|
||||
cur_cu->intra[0].mode_chroma = 36;
|
||||
// Chroma scanmode
|
||||
ctx_idx++;
|
||||
dir_mode = cur_cu->intra.mode_chroma;
|
||||
dir_mode = cur_cu->intra[0].mode_chroma;
|
||||
|
||||
if (dir_mode == 36) {
|
||||
// TODO: support NxN
|
||||
dir_mode = cur_cu->intra.mode;
|
||||
dir_mode = cur_cu->intra[0].mode;
|
||||
}
|
||||
if (ctx_idx > 4 && ctx_idx < 7) { // if multiple scans supported for transform size
|
||||
scan_idx_chroma = abs((int32_t) dir_mode - 26) < 5 ? 1 : (abs((int32_t)dir_mode - 10) < 5 ? 2 : 0);
|
||||
|
@ -1756,7 +1756,7 @@ void encode_transform_coeff(encoder_control *encoder, int32_t x_cu,int32_t y_cu,
|
|||
scan_idx = SCAN_DIAG;
|
||||
} else {
|
||||
// Luma (Intra) scanmode
|
||||
dir_mode = cur_cu->intra.mode;
|
||||
dir_mode = cur_cu->intra[0].mode;
|
||||
|
||||
//if multiple scans supported for transform size
|
||||
if (ctx_idx > 3 && ctx_idx < 6) {
|
||||
|
@ -1774,11 +1774,11 @@ void encode_transform_coeff(encoder_control *encoder, int32_t x_cu,int32_t y_cu,
|
|||
} else {
|
||||
// Chroma scanmode
|
||||
ctx_idx++;
|
||||
dir_mode = cur_cu->intra.mode_chroma;
|
||||
dir_mode = cur_cu->intra[0].mode_chroma;
|
||||
|
||||
if (dir_mode == 36) {
|
||||
// TODO: support NxN
|
||||
dir_mode = cur_cu->intra.mode;
|
||||
dir_mode = cur_cu->intra[0].mode;
|
||||
}
|
||||
|
||||
scan_idx = SCAN_DIAG;
|
||||
|
@ -2143,39 +2143,39 @@ void encode_block_residual(encoder_control *encoder,
|
|||
pixel *rec_shift = &rec[(LCU_WIDTH >> (depth)) * 2 + 8 + 1];
|
||||
pixel *rec_shift_u = &rec[(LCU_WIDTH >> (depth + 1)) * 2 + 8 + 1];
|
||||
|
||||
cur_cu->intra.mode_chroma = 36; // TODO: Chroma intra prediction
|
||||
cur_cu->intra[0].mode_chroma = 36; // TODO: Chroma intra prediction
|
||||
|
||||
intra_build_reference_border(encoder->in.cur_pic, x_ctb, y_ctb,
|
||||
(LCU_WIDTH >> (depth)) * 2 + 8, rec,
|
||||
(LCU_WIDTH >> (depth)) * 2 + 8, 0);
|
||||
cur_cu->intra.mode = (int8_t)intra_prediction(encoder->in.cur_pic->y_data,
|
||||
cur_cu->intra[0].mode = (int8_t)intra_prediction(encoder->in.cur_pic->y_data,
|
||||
encoder->in.width,
|
||||
rec_shift,
|
||||
(LCU_WIDTH >> (depth)) * 2 + 8,
|
||||
x_ctb * (LCU_WIDTH >> (MAX_DEPTH)),
|
||||
y_ctb * (LCU_WIDTH >> (MAX_DEPTH)),
|
||||
width, pred_y, width,
|
||||
&cur_cu->intra.cost);
|
||||
&cur_cu->intra[0].cost);
|
||||
intra_set_block_mode(encoder->in.cur_pic, x_ctb, y_ctb, depth,
|
||||
cur_cu->intra.mode);
|
||||
cur_cu->intra[0].mode);
|
||||
|
||||
// Build reconstructed block to use in prediction with extrapolated borders
|
||||
intra_build_reference_border(encoder->in.cur_pic, x_ctb, y_ctb,
|
||||
(LCU_WIDTH >> (depth)) * 2 + 8, rec, (LCU_WIDTH >> (depth)) * 2 + 8, 0);
|
||||
intra_recon(rec_shift, (LCU_WIDTH >> (depth)) * 2 + 8,
|
||||
x_ctb * (LCU_WIDTH >> (MAX_DEPTH)), y_ctb * (LCU_WIDTH >> (MAX_DEPTH)),
|
||||
width, recbase_y, rec_stride, cur_cu->intra.mode, 0);
|
||||
width, recbase_y, rec_stride, cur_cu->intra[0].mode, 0);
|
||||
|
||||
// Filter DC-prediction
|
||||
if (cur_cu->intra.mode == 1 && width < 32) {
|
||||
if (cur_cu->intra[0].mode == 1 && width < 32) {
|
||||
intra_dc_pred_filtering(rec_shift, (LCU_WIDTH >> (depth)) * 2 + 8, recbase_y,
|
||||
rec_stride, LCU_WIDTH >> depth, LCU_WIDTH >> depth);
|
||||
}
|
||||
|
||||
// TODO : chroma intra prediction
|
||||
if (cur_cu->intra.mode_chroma != 36
|
||||
&& cur_cu->intra.mode_chroma == cur_cu->intra.mode) {
|
||||
cur_cu->intra.mode_chroma = 36;
|
||||
if (cur_cu->intra[0].mode_chroma != 36
|
||||
&& cur_cu->intra[0].mode_chroma == cur_cu->intra[0].mode) {
|
||||
cur_cu->intra[0].mode_chroma = 36;
|
||||
}
|
||||
|
||||
intra_build_reference_border(encoder->in.cur_pic, x_ctb, y_ctb,
|
||||
|
@ -2190,7 +2190,7 @@ void encode_block_residual(encoder_control *encoder,
|
|||
width >> 1,
|
||||
recbase_u,
|
||||
rec_stride >> 1,
|
||||
cur_cu->intra.mode_chroma != 36 ? cur_cu->intra.mode_chroma : cur_cu->intra.mode,
|
||||
cur_cu->intra[0].mode_chroma != 36 ? cur_cu->intra[0].mode_chroma : cur_cu->intra[0].mode,
|
||||
1);
|
||||
intra_build_reference_border(encoder->in.cur_pic, x_ctb, y_ctb,
|
||||
(LCU_WIDTH >> (depth + 1)) * 2 + 8,
|
||||
|
@ -2202,7 +2202,7 @@ void encode_block_residual(encoder_control *encoder,
|
|||
width >> 1,
|
||||
recbase_v,
|
||||
rec_stride >> 1,
|
||||
cur_cu->intra.mode_chroma != 36 ? cur_cu->intra.mode_chroma : cur_cu->intra.mode,
|
||||
cur_cu->intra[0].mode_chroma != 36 ? cur_cu->intra[0].mode_chroma : cur_cu->intra[0].mode,
|
||||
1);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -45,7 +45,7 @@ void intra_set_block_mode(picture *pic,uint32_t x_cu, uint32_t y_cu, uint8_t dep
|
|||
for (x = x_cu; x < x_cu + block_scu_width; x++) {
|
||||
pic->cu_array[MAX_DEPTH][cu_pos + x].depth = depth;
|
||||
pic->cu_array[MAX_DEPTH][cu_pos + x].type = CU_INTRA;
|
||||
pic->cu_array[MAX_DEPTH][cu_pos + x].intra.mode = mode;
|
||||
pic->cu_array[MAX_DEPTH][cu_pos + x].intra[0].mode = mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ int8_t intra_get_block_mode(picture *pic, uint32_t x_cu, uint32_t y_cu, uint8_t
|
|||
int width_in_scu = pic->width_in_lcu<<MAX_DEPTH; //!< width in smallest CU
|
||||
int cu_pos = y_cu * width_in_scu + x_cu;
|
||||
if (pic->cu_array[MAX_DEPTH][cu_pos].type == CU_INTRA) {
|
||||
return pic->cu_array[MAX_DEPTH][cu_pos].intra.mode;
|
||||
return pic->cu_array[MAX_DEPTH][cu_pos].intra[0].mode;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -111,13 +111,13 @@ int8_t intra_get_dir_luma_predictor(picture* pic, uint32_t x_cu, uint32_t y_cu,
|
|||
|
||||
// Left PU predictor
|
||||
if(x_cu && pic->cu_array[MAX_DEPTH][cu_pos - 1].type == CU_INTRA && pic->cu_array[MAX_DEPTH][cu_pos - 1].coded) {
|
||||
left_intra_dir = pic->cu_array[MAX_DEPTH][cu_pos - 1].intra.mode;
|
||||
left_intra_dir = pic->cu_array[MAX_DEPTH][cu_pos - 1].intra[0].mode;
|
||||
}
|
||||
|
||||
// Top PU predictor
|
||||
if(y_cu && ((y_cu * (LCU_WIDTH>>MAX_DEPTH)) % LCU_WIDTH) != 0
|
||||
&& pic->cu_array[MAX_DEPTH][cu_pos - width_in_scu].type == CU_INTRA && pic->cu_array[MAX_DEPTH][cu_pos - width_in_scu].coded) {
|
||||
above_intra_dir = pic->cu_array[MAX_DEPTH][cu_pos - width_in_scu].intra.mode;
|
||||
above_intra_dir = pic->cu_array[MAX_DEPTH][cu_pos - width_in_scu].intra[0].mode;
|
||||
}
|
||||
|
||||
// If the predictions are the same, add new predictions
|
||||
|
|
|
@ -79,7 +79,7 @@ typedef struct
|
|||
int8_t coeff_top_y[MAX_DEPTH+1]; //!< \brief is there coded coeffs Y in top level
|
||||
int8_t coeff_top_u[MAX_DEPTH+1]; //!< \brief is there coded coeffs U in top level
|
||||
int8_t coeff_top_v[MAX_DEPTH+1]; //!< \brief is there coded coeffs V in top level
|
||||
cu_info_intra intra;
|
||||
cu_info_intra intra[4];
|
||||
cu_info_inter inter;
|
||||
} cu_info;
|
||||
|
||||
|
|
10
src/search.c
10
src/search.c
|
@ -391,10 +391,10 @@ void search_intra(encoder_control *encoder, uint16_t x_ctb, uint16_t y_ctb, uint
|
|||
// Build reconstructed block to use in prediction with extrapolated borders
|
||||
search_buildReferenceBorder(encoder->in.cur_pic, x_ctb, y_ctb,
|
||||
(LCU_WIDTH >> (depth)) * 2 + 8, rec, (LCU_WIDTH >> (depth)) * 2 + 8, 0);
|
||||
cur_cu->intra.mode = (uint8_t) intra_prediction(encoder->in.cur_pic->y_data,
|
||||
cur_cu->intra[0].mode = (uint8_t) intra_prediction(encoder->in.cur_pic->y_data,
|
||||
encoder->in.width, recShift, (LCU_WIDTH >> (depth)) * 2 + 8,
|
||||
x_ctb * (LCU_WIDTH >> (MAX_DEPTH)), y_ctb * (LCU_WIDTH >> (MAX_DEPTH)),
|
||||
width, pred, width, &cur_cu->intra.cost);
|
||||
width, pred, width, &cur_cu->intra[0].cost);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,7 +412,7 @@ void search_tree(encoder_control *encoder,
|
|||
picture *cur_pic = encoder->in.cur_pic;
|
||||
cu_info *cur_cu = &cur_pic->cu_array[depth][x_ctb + y_ctb * (encoder->in.width_in_lcu << MAX_DEPTH)];
|
||||
|
||||
cur_cu->intra.cost = 0xffffffff;
|
||||
cur_cu->intra[0].cost = 0xffffffff;
|
||||
cur_cu->inter.cost = 0xffffffff;
|
||||
|
||||
// Force split on border
|
||||
|
@ -462,7 +462,7 @@ uint32_t search_best_mode(encoder_control *encoder,
|
|||
{
|
||||
cu_info *cur_cu = &encoder->in.cur_pic->cu_array[depth]
|
||||
[x_ctb + y_ctb * (encoder->in.width_in_lcu << MAX_DEPTH)];
|
||||
uint32_t best_intra_cost = cur_cu->intra.cost;
|
||||
uint32_t best_intra_cost = cur_cu->intra[0].cost;
|
||||
uint32_t best_inter_cost = cur_cu->inter.cost;
|
||||
uint32_t lambda_cost = (4 * g_lambda_cost[encoder->QP]) << 4; //<<5; //TODO: Correct cost calculation
|
||||
|
||||
|
@ -489,7 +489,7 @@ uint32_t search_best_mode(encoder_control *encoder,
|
|||
return best_inter_cost;
|
||||
} else {
|
||||
intra_set_block_mode(encoder->in.cur_pic, x_ctb, y_ctb, depth,
|
||||
cur_cu->intra.mode);
|
||||
cur_cu->intra[0].mode);
|
||||
return best_intra_cost;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue