Remove chroma mode "36".

- It's an unnecessary chore to handle this special case everywhere (it means
  chroma_mode == intra_mode). Better just to use the actual mode.
This commit is contained in:
Ari Koivula 2014-05-14 15:00:27 +03:00
parent ed87df34ae
commit f0e990905e
4 changed files with 10 additions and 14 deletions

View file

@ -2698,7 +2698,7 @@ void encode_coding_tree(encoder_state * const encoder_state,
uint8_t intra_pred_mode[4] = {
cur_cu->intra[0].mode, cur_cu->intra[1].mode,
cur_cu->intra[2].mode, cur_cu->intra[3].mode };
uint8_t intra_pred_mode_chroma = 36; // 36 = Chroma derived from luma
uint8_t intra_pred_mode_chroma = cur_cu->intra[0].mode_chroma;
int8_t intra_preds[4][3] = {{-1, -1, -1},{-1, -1, -1},{-1, -1, -1},{-1, -1, -1}};
int8_t mpm_preds[4] = {-1, -1, -1, -1};
int i, j;
@ -2776,7 +2776,7 @@ void encode_coding_tree(encoder_state * const encoder_state,
unsigned pred_mode = 5;
unsigned chroma_pred_modes[4] = {0, 26, 10, 1};
if (intra_pred_mode_chroma == 36) {
if (intra_pred_mode_chroma == intra_pred_mode[0]) {
pred_mode = 4;
} else if (intra_pred_mode_chroma == 34) {
// Angular 34 mode is possible only if intra pred mode is one of the
@ -2791,6 +2791,10 @@ void encode_coding_tree(encoder_state * const encoder_state,
}
}
// pred_mode == 5 mean intra_pred_mode_chroma is something that can't
// be coded.
assert(pred_mode != 5);
/**
* Table 9-35 - Binarization for intra_chroma_pred_mode
* intra_chroma_pred_mode bin_string
@ -2992,11 +2996,6 @@ static void encode_transform_unit(encoder_state * const encoder_state,
ctx_idx++;
dir_mode = cur_cu->intra[0].mode_chroma;
if (dir_mode == 36) {
// TODO: support NxN
dir_mode = cur_cu->intra[0].mode;
}
scan_idx = SCAN_DIAG;
if (ctx_idx > 4 && ctx_idx < 7) { // if multiple scans supported for transform size

View file

@ -853,8 +853,6 @@ void intra_recon_lcu(encoder_state * const encoder_state, int x, int y, int dept
int i = PU_INDEX(x >> 2, y >> 2);
cur_cu->intra[0].mode_chroma = 36; // TODO: Chroma intra prediction
// Reconstruct chroma.
if (!(x & 4 || y & 4)) {
pixel *rec_shift_c = &rec[width_c * 2 + 8 + 1];
@ -866,7 +864,7 @@ void intra_recon_lcu(encoder_state * const encoder_state, int x, int y, int dept
width_c,
recbase_u,
rec_stride >> 1,
cur_cu->intra[0].mode_chroma != 36 ? cur_cu->intra[0].mode_chroma : cur_cu->intra[0].mode,
cur_cu->intra[0].mode_chroma,
1);
intra_build_reference_border(encoder, x, y,(int16_t)width_c * 2 + 8, rec, (int16_t)width_c * 2 + 8, 2,
@ -877,7 +875,7 @@ void intra_recon_lcu(encoder_state * const encoder_state, int x, int y, int dept
width_c,
recbase_v,
rec_stride >> 1,
cur_cu->intra[0].mode_chroma != 36 ? cur_cu->intra[0].mode_chroma : cur_cu->intra[0].mode,
cur_cu->intra[0].mode_chroma,
2);
}

View file

@ -718,6 +718,8 @@ static int search_cu_intra(encoder_state * const encoder_state,
cur_cu->intra[pu_index].mode = (int8_t)mode;
cur_cu->intra[pu_index].cost = cost;
cur_cu->intra[pu_index].bitcost = bitcost;
cur_cu->intra[0].mode = cur_cu->intra[pu_index].mode;
}
return cur_cu->intra[PU_INDEX(x_px >> 2, y_px >> 2)].cost;

View file

@ -1146,9 +1146,6 @@ void quantize_lcu_chroma_residual(encoder_state * const encoder_state, int32_t x
int chroma_depth = (depth == MAX_PU_DEPTH ? depth - 1 : depth);
int chroma_width = LCU_WIDTH_C >> chroma_depth;
if (cur_cu->intra[0].mode_chroma == 36) {
cur_cu->intra[0].mode_chroma = cur_cu->intra[0].mode;
}
scan_idx_chroma = get_scan_order(cur_cu->type, cur_cu->intra[0].mode_chroma, depth);
if (quantize_residual(encoder_state, cur_cu, chroma_width, COLOR_U, scan_idx_chroma, tr_skip, LCU_WIDTH_C, LCU_WIDTH_C, base_u, recbase_u, recbase_u, orig_coeff_u)) {
cbf_set(&cur_cu->cbf.u, depth);