Fix intra mode writing

This commit is contained in:
Marko Viitanen 2018-09-12 10:34:58 +03:00
parent d4ed0ee3ad
commit 4aad2fa383

View file

@ -1072,8 +1072,12 @@ static void encode_intra_coding_unit(encoder_state_t * const state,
CABAC_BIN_EP(cabac, (mpm_preds[j] == 1 ? 0 : 1), "mpm_idx"); CABAC_BIN_EP(cabac, (mpm_preds[j] == 1 ? 0 : 1), "mpm_idx");
} }
} else { } else {
static const uint8_t intra_mode_33_to_65_angle[36] =
// H D V
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, DM
{ 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68 };
// Signal the actual prediction mode. // Signal the actual prediction mode.
int32_t tmp_pred = intra_pred_mode[j]; int32_t tmp_pred = intra_mode_33_to_65_angle[intra_pred_mode[j]];
// Sort prediction list from lowest to highest. // Sort prediction list from lowest to highest.
if (intra_preds[j][0] > intra_preds[j][1]) SWAP(intra_preds[j][0], intra_preds[j][1], int8_t); if (intra_preds[j][0] > intra_preds[j][1]) SWAP(intra_preds[j][0], intra_preds[j][1], int8_t);
@ -1084,13 +1088,10 @@ static void encode_intra_coding_unit(encoder_state_t * const state,
// prediction list, as it has been already signaled that it's not one // prediction list, as it has been already signaled that it's not one
// of the prediction modes. // of the prediction modes.
for (int i = 2; i >= 0; i--) { for (int i = 2; i >= 0; i--) {
tmp_pred = (tmp_pred > intra_preds[j][i] ? tmp_pred - 1 : tmp_pred); tmp_pred = (tmp_pred > intra_mode_33_to_65_angle[intra_preds[j][i]] ? tmp_pred - 1 : tmp_pred);
} }
static const uint8_t intra_mode_33_to_65_angle[36] =
// H D V CABAC_BINS_EP(cabac, tmp_pred, 6, "rem_intra_luma_pred_mode");
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, DM
{ 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68 };
CABAC_BINS_EP(cabac, intra_mode_33_to_65_angle[tmp_pred], 6, "rem_intra_luma_pred_mode");
} }
} }