mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
Move 4x4 chroma tu info to bottom right cu when intra is split into 4x4
This commit is contained in:
parent
b413aa5c43
commit
0381d7d779
|
@ -352,8 +352,8 @@ void kvz_encode_last_significant_xy(cabac_data_t * const cabac,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void encode_chroma_tu(encoder_state_t* const state, int x, int y, int depth, const uint8_t width_c, const cu_info_t* cur_pu, int8_t* scan_idx, lcu_coeff_t* coeff, uint8_t joint_chroma) {
|
static void encode_chroma_tu(encoder_state_t* const state, int x, int y, int depth, const uint8_t width_c, const cu_info_t* cur_pu, int8_t* scan_idx, lcu_coeff_t* coeff, uint8_t joint_chroma) {
|
||||||
int x_local = (x >> 1) % LCU_WIDTH_C;
|
int x_local = ((x & ~7) >> 1) % LCU_WIDTH_C;
|
||||||
int y_local = (y >> 1) % LCU_WIDTH_C;
|
int y_local = ((y & ~7) >> 1) % LCU_WIDTH_C;
|
||||||
cabac_data_t* const cabac = &state->cabac;
|
cabac_data_t* const cabac = &state->cabac;
|
||||||
*scan_idx = kvz_get_scan_order(cur_pu->type, cur_pu->intra.mode_chroma, depth);
|
*scan_idx = kvz_get_scan_order(cur_pu->type, cur_pu->intra.mode_chroma, depth);
|
||||||
if(!joint_chroma){
|
if(!joint_chroma){
|
||||||
|
@ -367,7 +367,7 @@ static void encode_chroma_tu(encoder_state_t* const state, int x, int y, int dep
|
||||||
// TODO: transform skip for chroma blocks
|
// TODO: transform skip for chroma blocks
|
||||||
CABAC_BIN(cabac, 0, "transform_skip_flag");
|
CABAC_BIN(cabac, 0, "transform_skip_flag");
|
||||||
}
|
}
|
||||||
kvz_encode_coeff_nxn(state, &state->cabac, coeff_u, width_c, 1, *scan_idx, NULL, false);
|
kvz_encode_coeff_nxn(state, &state->cabac, coeff_u, width_c, COLOR_U, *scan_idx, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cbf_is_set(cur_pu->cbf, depth, COLOR_V)) {
|
if (cbf_is_set(cur_pu->cbf, depth, COLOR_V)) {
|
||||||
|
@ -375,7 +375,7 @@ static void encode_chroma_tu(encoder_state_t* const state, int x, int y, int dep
|
||||||
cabac->cur_ctx = &cabac->ctx.transform_skip_model_chroma;
|
cabac->cur_ctx = &cabac->ctx.transform_skip_model_chroma;
|
||||||
CABAC_BIN(cabac, 0, "transform_skip_flag");
|
CABAC_BIN(cabac, 0, "transform_skip_flag");
|
||||||
}
|
}
|
||||||
kvz_encode_coeff_nxn(state, &state->cabac, coeff_v, width_c, 2, *scan_idx, NULL, false);
|
kvz_encode_coeff_nxn(state, &state->cabac, coeff_v, width_c, COLOR_V, *scan_idx, NULL, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -384,7 +384,7 @@ static void encode_chroma_tu(encoder_state_t* const state, int x, int y, int dep
|
||||||
cabac->cur_ctx = &cabac->ctx.transform_skip_model_chroma;
|
cabac->cur_ctx = &cabac->ctx.transform_skip_model_chroma;
|
||||||
CABAC_BIN(cabac, 0, "transform_skip_flag");
|
CABAC_BIN(cabac, 0, "transform_skip_flag");
|
||||||
}
|
}
|
||||||
kvz_encode_coeff_nxn(state, &state->cabac, coeff_uv, width_c, 2, *scan_idx, NULL, false);
|
kvz_encode_coeff_nxn(state, &state->cabac, coeff_uv, width_c, COLOR_V, *scan_idx, NULL, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,8 +444,6 @@ static void encode_transform_unit(encoder_state_t * const state,
|
||||||
} else {
|
} else {
|
||||||
// Time to to code the chroma transform blocks. Move to the top-left
|
// Time to to code the chroma transform blocks. Move to the top-left
|
||||||
// corner of the block.
|
// corner of the block.
|
||||||
x -= 4;
|
|
||||||
y -= 4;
|
|
||||||
cur_pu = kvz_cu_array_at_const((const cu_array_t *)frame->cu_array, x, y);
|
cur_pu = kvz_cu_array_at_const((const cu_array_t *)frame->cu_array, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,7 +483,7 @@ static void encode_transform_coeff(encoder_state_t * const state,
|
||||||
// containing CU.
|
// containing CU.
|
||||||
const int x_cu = 8 * (x / 8);
|
const int x_cu = 8 * (x / 8);
|
||||||
const int y_cu = 8 * (y / 8);
|
const int y_cu = 8 * (y / 8);
|
||||||
const cu_info_t *cur_cu = kvz_cu_array_at_const(frame->cu_array, x_cu, y_cu);
|
const cu_info_t *cur_cu = kvz_cu_array_at_const(frame->cu_array, x, y);
|
||||||
|
|
||||||
// NxN signifies implicit transform split at the first transform level.
|
// NxN signifies implicit transform split at the first transform level.
|
||||||
// There is a similar implicit split for inter, but it is only used when
|
// There is a similar implicit split for inter, but it is only used when
|
||||||
|
|
|
@ -1534,6 +1534,11 @@ void kvz_intra_recon_cu(
|
||||||
}
|
}
|
||||||
const int8_t mode_luma = search_data->pred_cu.intra.mode;
|
const int8_t mode_luma = search_data->pred_cu.intra.mode;
|
||||||
const int8_t mode_chroma= search_data->pred_cu.intra.mode_chroma;
|
const int8_t mode_chroma= search_data->pred_cu.intra.mode_chroma;
|
||||||
|
|
||||||
|
if(mode_chroma != -1 && mode_luma == -1) {
|
||||||
|
x &= ~7;
|
||||||
|
y &= ~7;
|
||||||
|
}
|
||||||
|
|
||||||
if (mode_luma != -1 && mode_chroma != -1) {
|
if (mode_luma != -1 && mode_chroma != -1) {
|
||||||
if (search_data->pred_cu.intra.mip_flag) {
|
if (search_data->pred_cu.intra.mip_flag) {
|
||||||
|
|
22
src/search.c
22
src/search.c
|
@ -608,7 +608,7 @@ void kvz_select_jccr_mode(
|
||||||
{
|
{
|
||||||
const vector2d_t lcu_px = { (SUB_SCU(x_px) & ~7) / 2, (SUB_SCU(y_px) & ~7) / 2 };
|
const vector2d_t lcu_px = { (SUB_SCU(x_px) & ~7) / 2, (SUB_SCU(y_px) & ~7) / 2 };
|
||||||
const int width = (depth < MAX_DEPTH) ? LCU_WIDTH >> (depth + 1) : LCU_WIDTH >> depth;
|
const int width = (depth < MAX_DEPTH) ? LCU_WIDTH >> (depth + 1) : LCU_WIDTH >> depth;
|
||||||
if (pred_cu == NULL) pred_cu = LCU_GET_CU_AT_PX(lcu, lcu_px.x * 2, lcu_px.y * 2);
|
if (pred_cu == NULL) pred_cu = LCU_GET_CU_AT_PX(lcu, SUB_SCU(x_px), SUB_SCU(y_px));
|
||||||
assert(pred_cu->depth == pred_cu->tr_depth && "jccr does not support transform splitting");
|
assert(pred_cu->depth == pred_cu->tr_depth && "jccr does not support transform splitting");
|
||||||
if (cost_out == NULL && pred_cu->joint_cb_cr == 0) {
|
if (cost_out == NULL && pred_cu->joint_cb_cr == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -650,23 +650,23 @@ void kvz_select_jccr_mode(
|
||||||
cbf_mask = pred_cu->joint_cb_cr - 1;
|
cbf_mask = pred_cu->joint_cb_cr - 1;
|
||||||
CABAC_FBITS_UPDATE(cabac, &(cabac->ctx.joint_cb_cr[cbf_mask]), 1, joint_cbcr_tr_tree_bits, "jccr_flag");
|
CABAC_FBITS_UPDATE(cabac, &(cabac->ctx.joint_cb_cr[cbf_mask]), 1, joint_cbcr_tr_tree_bits, "jccr_flag");
|
||||||
}
|
}
|
||||||
int ssd = 0;
|
unsigned ssd = 0;
|
||||||
int joint_ssd = 0;
|
unsigned joint_ssd = 0;
|
||||||
if (!state->encoder_control->cfg.lossless) {
|
if (!state->encoder_control->cfg.lossless) {
|
||||||
int index = lcu_px.y * LCU_WIDTH_C + lcu_px.x;
|
const int index = lcu_px.y * LCU_WIDTH_C + lcu_px.x;
|
||||||
int ssd_u = kvz_pixels_calc_ssd(&lcu->ref.u[index], &lcu->rec.u[index],
|
const unsigned ssd_u = kvz_pixels_calc_ssd(&lcu->ref.u[index], &lcu->rec.u[index],
|
||||||
LCU_WIDTH_C, LCU_WIDTH_C,
|
LCU_WIDTH_C, LCU_WIDTH_C,
|
||||||
width);
|
width);
|
||||||
int ssd_v = kvz_pixels_calc_ssd(&lcu->ref.v[index], &lcu->rec.v[index],
|
const unsigned ssd_v = kvz_pixels_calc_ssd(&lcu->ref.v[index], &lcu->rec.v[index],
|
||||||
LCU_WIDTH_C, LCU_WIDTH_C,
|
LCU_WIDTH_C, LCU_WIDTH_C,
|
||||||
width);
|
width);
|
||||||
ssd = ssd_u + ssd_v;
|
ssd = ssd_u + ssd_v;
|
||||||
|
|
||||||
if (pred_cu->joint_cb_cr) {
|
if (pred_cu->joint_cb_cr) {
|
||||||
int ssd_u_joint = kvz_pixels_calc_ssd(&lcu->ref.u[index], &lcu->rec.joint_u[index],
|
const unsigned ssd_u_joint = kvz_pixels_calc_ssd(&lcu->ref.u[index], &lcu->rec.joint_u[index],
|
||||||
LCU_WIDTH_C, LCU_WIDTH_C,
|
LCU_WIDTH_C, LCU_WIDTH_C,
|
||||||
width);
|
width);
|
||||||
int ssd_v_joint = kvz_pixels_calc_ssd(&lcu->ref.v[index], &lcu->rec.joint_v[index],
|
const unsigned ssd_v_joint = kvz_pixels_calc_ssd(&lcu->ref.v[index], &lcu->rec.joint_v[index],
|
||||||
LCU_WIDTH_C, LCU_WIDTH_C,
|
LCU_WIDTH_C, LCU_WIDTH_C,
|
||||||
width);
|
width);
|
||||||
joint_ssd = ssd_u_joint + ssd_v_joint;
|
joint_ssd = ssd_u_joint + ssd_v_joint;
|
||||||
|
@ -1009,13 +1009,13 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
||||||
}
|
}
|
||||||
intra_search.pred_cu.intra.mode = -1; // skip luma
|
intra_search.pred_cu.intra.mode = -1; // skip luma
|
||||||
kvz_intra_recon_cu(state,
|
kvz_intra_recon_cu(state,
|
||||||
x & ~7, y & ~7, // TODO: as does this
|
x, y, // TODO: as does this
|
||||||
depth, &intra_search,
|
depth, &intra_search,
|
||||||
NULL,
|
NULL,
|
||||||
lcu);
|
lcu);
|
||||||
if(depth != 0 && state->encoder_control->cfg.jccr && ctrl->cfg.rdo < 3) {
|
if(depth != 0 && state->encoder_control->cfg.jccr && ctrl->cfg.rdo < 3) {
|
||||||
kvz_select_jccr_mode(state,
|
kvz_select_jccr_mode(state,
|
||||||
x & ~7, y & ~7,
|
x, y,
|
||||||
depth,
|
depth,
|
||||||
NULL,
|
NULL,
|
||||||
lcu,
|
lcu,
|
||||||
|
@ -1074,7 +1074,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
||||||
false);
|
false);
|
||||||
if (cur_cu->depth == cur_cu->tr_depth && state->encoder_control->cfg.jccr && cur_cu->joint_cb_cr) {
|
if (cur_cu->depth == cur_cu->tr_depth && state->encoder_control->cfg.jccr && cur_cu->joint_cb_cr) {
|
||||||
kvz_select_jccr_mode(state,
|
kvz_select_jccr_mode(state,
|
||||||
x & ~7, y & ~7,
|
x, y,
|
||||||
depth,
|
depth,
|
||||||
NULL,
|
NULL,
|
||||||
lcu,
|
lcu,
|
||||||
|
|
|
@ -367,7 +367,7 @@ static double search_intra_trdepth(
|
||||||
pred_cu->intra.mode_chroma = chroma_mode;
|
pred_cu->intra.mode_chroma = chroma_mode;
|
||||||
pred_cu->joint_cb_cr= 4; // TODO: Maybe check the jccr mode here also but holy shit is the interface of search_intra_rdo bad currently
|
pred_cu->joint_cb_cr= 4; // TODO: Maybe check the jccr mode here also but holy shit is the interface of search_intra_rdo bad currently
|
||||||
kvz_intra_recon_cu(state,
|
kvz_intra_recon_cu(state,
|
||||||
x_px & ~7, y_px & ~7,
|
x_px, y_px,
|
||||||
depth, search_data,
|
depth, search_data,
|
||||||
pred_cu,
|
pred_cu,
|
||||||
lcu);
|
lcu);
|
||||||
|
|
Loading…
Reference in a new issue