mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Remove remaining usages of old intra prediction
This commit is contained in:
parent
ca3ba997aa
commit
23439557e6
|
@ -488,7 +488,6 @@ static int8_t search_intra_rough(encoder_state_t * const state,
|
|||
static int8_t search_intra_rdo(encoder_state_t * const state,
|
||||
int x_px, int y_px, int depth,
|
||||
kvz_pixel *orig, int32_t origstride,
|
||||
kvz_pixel *rec, int16_t recstride,
|
||||
int8_t *intra_preds,
|
||||
int modes_to_check,
|
||||
int8_t modes[35], double costs[35],
|
||||
|
@ -498,31 +497,14 @@ static int8_t search_intra_rdo(encoder_state_t * const state,
|
|||
const int width = LCU_WIDTH >> depth;
|
||||
|
||||
kvz_pixel orig_block[LCU_WIDTH * LCU_WIDTH + 1];
|
||||
int rdo_mode;
|
||||
int pred_mode;
|
||||
|
||||
kvz_pixel rec_filtered_temp[(LCU_WIDTH * 2 + 8) * (LCU_WIDTH * 2 + 8) + 1];
|
||||
kvz_pixel *recf = &rec_filtered_temp[recstride + 1];
|
||||
|
||||
// Generate filtered reference pixels.
|
||||
{
|
||||
int x, y;
|
||||
for (y = -1; y < recstride; y++) {
|
||||
recf[y*recstride - 1] = rec[y*recstride - 1];
|
||||
}
|
||||
for (x = 0; x < recstride; x++) {
|
||||
recf[x - recstride] = rec[x - recstride];
|
||||
}
|
||||
kvz_intra_filter(recf, recstride, width, 0);
|
||||
}
|
||||
|
||||
kvz_pixels_blit(orig, orig_block, width, width, origstride, width);
|
||||
|
||||
// Check that the predicted modes are in the RDO mode list
|
||||
if (modes_to_check < 35) {
|
||||
for (pred_mode = 0; pred_mode < 3; pred_mode++) {
|
||||
for (int pred_mode = 0; pred_mode < 3; pred_mode++) {
|
||||
int mode_found = 0;
|
||||
for (rdo_mode = 0; rdo_mode < modes_to_check; rdo_mode++) {
|
||||
for (int rdo_mode = 0; rdo_mode < modes_to_check; rdo_mode++) {
|
||||
if (intra_preds[pred_mode] == modes[rdo_mode]) {
|
||||
mode_found = 1;
|
||||
break;
|
||||
|
@ -536,42 +518,27 @@ static int8_t search_intra_rdo(encoder_state_t * const state,
|
|||
}
|
||||
}
|
||||
|
||||
for(rdo_mode = 0; rdo_mode < modes_to_check; rdo_mode ++) {
|
||||
for(int rdo_mode = 0; rdo_mode < modes_to_check; rdo_mode ++) {
|
||||
int rdo_bitcost = kvz_luma_mode_bits(state, modes[rdo_mode], intra_preds);
|
||||
costs[rdo_mode] = rdo_bitcost * (int)(state->global->cur_lambda_cost + 0.5);
|
||||
#if 0
|
||||
if (width != 4 && tr_depth == depth) {
|
||||
// This code path has been disabled for now because it increases bdrate
|
||||
// by 1-2 %. Possibly due to not taking chroma into account during luma
|
||||
// mode search. Enabling separate chroma search compensates a little,
|
||||
// but not enough.
|
||||
|
||||
// The idea for this code path is, that it would do the same thing as
|
||||
// the more general search_intra_trdepth, but would only handle cases
|
||||
// where transform split or transform skip don't need to be handled.
|
||||
kvz_intra_get_pred(state->encoder_control, rec, recf, recstride, pred, width, modes[rdo_mode], 0);
|
||||
costs[rdo_mode] += kvz_rdo_cost_intra(state, pred, orig_block, width, modes[rdo_mode], width == 4 ? 1 : 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// Perform transform split search and save mode RD cost for the best one.
|
||||
cu_info_t pred_cu;
|
||||
pred_cu.depth = depth;
|
||||
pred_cu.type = CU_INTRA;
|
||||
pred_cu.part_size = ((depth == MAX_PU_DEPTH) ? SIZE_NxN : SIZE_2Nx2N);
|
||||
pred_cu.intra[0].mode = modes[rdo_mode];
|
||||
pred_cu.intra[1].mode = modes[rdo_mode];
|
||||
pred_cu.intra[2].mode = modes[rdo_mode];
|
||||
pred_cu.intra[3].mode = modes[rdo_mode];
|
||||
pred_cu.intra[0].mode_chroma = modes[rdo_mode];
|
||||
FILL(pred_cu.cbf, 0);
|
||||
// Perform transform split search and save mode RD cost for the best one.
|
||||
cu_info_t pred_cu;
|
||||
pred_cu.depth = depth;
|
||||
pred_cu.type = CU_INTRA;
|
||||
pred_cu.part_size = ((depth == MAX_PU_DEPTH) ? SIZE_NxN : SIZE_2Nx2N);
|
||||
pred_cu.intra[0].mode = modes[rdo_mode];
|
||||
pred_cu.intra[1].mode = modes[rdo_mode];
|
||||
pred_cu.intra[2].mode = modes[rdo_mode];
|
||||
pred_cu.intra[3].mode = modes[rdo_mode];
|
||||
pred_cu.intra[0].mode_chroma = modes[rdo_mode];
|
||||
FILL(pred_cu.cbf, 0);
|
||||
|
||||
// Reset transform split data in lcu.cu for this area.
|
||||
kvz_lcu_set_trdepth(lcu, x_px, y_px, depth, depth);
|
||||
// Reset transform split data in lcu.cu for this area.
|
||||
kvz_lcu_set_trdepth(lcu, x_px, y_px, depth, depth);
|
||||
|
||||
double mode_cost = search_intra_trdepth(state, x_px, y_px, depth, tr_depth, modes[rdo_mode], MAX_INT, &pred_cu, lcu);
|
||||
costs[rdo_mode] += mode_cost;
|
||||
}
|
||||
double mode_cost = search_intra_trdepth(state, x_px, y_px, depth, tr_depth, modes[rdo_mode], MAX_INT, &pred_cu, lcu);
|
||||
costs[rdo_mode] += mode_cost;
|
||||
}
|
||||
|
||||
// The best transform split hierarchy is not saved anywhere, so to get the
|
||||
|
@ -743,7 +710,6 @@ double kvz_search_cu_intra(encoder_state_t * const state,
|
|||
const int x_px, const int y_px,
|
||||
const int depth, lcu_t *lcu)
|
||||
{
|
||||
const videoframe_t * const frame = state->tile->frame;
|
||||
const vector2d_t lcu_px = { x_px & 0x3f, y_px & 0x3f };
|
||||
const vector2d_t lcu_cu = { lcu_px.x >> 3, lcu_px.y >> 3 };
|
||||
const int8_t cu_width = (LCU_WIDTH >> (depth));
|
||||
|
@ -752,9 +718,6 @@ double kvz_search_cu_intra(encoder_state_t * const state,
|
|||
|
||||
cu_info_t *cur_cu = &lcu->cu[cu_index];
|
||||
|
||||
kvz_pixel rec_buffer[(LCU_WIDTH * 2 + 1) * (LCU_WIDTH * 2 + 1)];
|
||||
kvz_pixel *cu_in_rec_buffer = &rec_buffer[cu_width * 2 + 8 + 1];
|
||||
|
||||
kvz_intra_references refs;
|
||||
|
||||
int8_t candidate_modes[3];
|
||||
|
@ -773,13 +736,6 @@ double kvz_search_cu_intra(encoder_state_t * const state,
|
|||
kvz_intra_get_dir_luma_predictor(x_px, y_px, candidate_modes, cur_cu, left_cu, above_cu);
|
||||
|
||||
if (depth > 0) {
|
||||
// Build reconstructed block to use in prediction with extrapolated borders
|
||||
kvz_intra_build_reference_border(state->encoder_control, x_px, y_px, cu_width * 2 + 8,
|
||||
rec_buffer, cu_width * 2 + 8, 0,
|
||||
frame->width,
|
||||
frame->height,
|
||||
lcu);
|
||||
|
||||
const vector2d_t luma_px = { x_px, y_px };
|
||||
const vector2d_t pic_px = { state->tile->frame->width, state->tile->frame->height };
|
||||
kvz_intra_build_reference(log2_width, COLOR_Y, &luma_px, &pic_px, lcu, &refs);
|
||||
|
@ -828,7 +784,6 @@ double kvz_search_cu_intra(encoder_state_t * const state,
|
|||
number_of_modes = search_intra_rdo(state,
|
||||
x_px, y_px, depth,
|
||||
ref_pixels, LCU_WIDTH,
|
||||
cu_in_rec_buffer, cu_width * 2 + 8,
|
||||
candidate_modes,
|
||||
num_modes_to_check,
|
||||
modes, costs, lcu);
|
||||
|
|
Loading…
Reference in a new issue