correct MV sign encryption

This commit is contained in:
Wassim Hamidouche 2016-06-07 18:12:42 +02:00 committed by Ari Koivula
parent 15abdc6e81
commit 35634b5596

View file

@ -1205,22 +1205,20 @@ static void encode_inter_prediction_unit(encoder_state_t * const state,
if (mvd_hor_abs > 1) { if (mvd_hor_abs > 1) {
kvz_cabac_write_ep_ex_golomb(state, cabac, mvd_hor_abs-2, 1); kvz_cabac_write_ep_ex_golomb(state, cabac, mvd_hor_abs-2, 1);
} }
uint8_t mvd_hor_sign = (mvd_hor>0)?0:1; uint32_t mvd_hor_sign = (mvd_hor>0)?0:1;
#if !EncryptMVDiffSign
if(!state->cabac.only_count) if(!state->cabac.only_count)
if (state->encoder_control->cfg->crypto_features & KVZ_CRYPTO_MV_SIGNS) if (state->encoder_control->cfg->crypto_features & KVZ_CRYPTO_MV_SIGNS)
mvd_hor_sign = mvd_hor^ff_get_key(&state->tile->dbs_g, 1); mvd_hor_sign = mvd_hor_sign^ff_get_key(&state->tile->dbs_g, 1);
#endif
CABAC_BIN_EP(cabac, mvd_hor_sign, "mvd_sign_flag_hor"); CABAC_BIN_EP(cabac, mvd_hor_sign, "mvd_sign_flag_hor");
} }
if (ver_abs_gr0) { if (ver_abs_gr0) {
if (mvd_ver_abs > 1) { if (mvd_ver_abs > 1) {
kvz_cabac_write_ep_ex_golomb(state, cabac, mvd_ver_abs-2, 1); kvz_cabac_write_ep_ex_golomb(state, cabac, mvd_ver_abs-2, 1);
} }
uint8_t mvd_ver_sign = (mvd_ver>0)?0:1; uint32_t mvd_ver_sign = (mvd_ver>0)?0:1;
if(!state->cabac.only_count) if(!state->cabac.only_count)
if (state->encoder_control->cfg->crypto_features & KVZ_CRYPTO_MV_SIGNS) if (state->encoder_control->cfg->crypto_features & KVZ_CRYPTO_MV_SIGNS)
mvd_ver_sign = mvd_ver^ff_get_key(&state->tile->dbs_g, 1); mvd_ver_sign = mvd_ver_sign^ff_get_key(&state->tile->dbs_g, 1);
CABAC_BIN_EP(cabac, mvd_ver_sign, "mvd_sign_flag_ver"); CABAC_BIN_EP(cabac, mvd_ver_sign, "mvd_sign_flag_ver");
} }
} }