From 35634b5596744ad906c7aaf29f695981b253c9ec Mon Sep 17 00:00:00 2001 From: Wassim Hamidouche Date: Tue, 7 Jun 2016 18:12:42 +0200 Subject: [PATCH] correct MV sign encryption --- src/encoderstate.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/encoderstate.c b/src/encoderstate.c index b82ec8a7..9a216bc8 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -1205,22 +1205,20 @@ static void encode_inter_prediction_unit(encoder_state_t * const state, if (mvd_hor_abs > 1) { kvz_cabac_write_ep_ex_golomb(state, cabac, mvd_hor_abs-2, 1); } - uint8_t mvd_hor_sign = (mvd_hor>0)?0:1; -#if !EncryptMVDiffSign + uint32_t mvd_hor_sign = (mvd_hor>0)?0:1; if(!state->cabac.only_count) if (state->encoder_control->cfg->crypto_features & KVZ_CRYPTO_MV_SIGNS) - mvd_hor_sign = mvd_hor^ff_get_key(&state->tile->dbs_g, 1); -#endif + mvd_hor_sign = mvd_hor_sign^ff_get_key(&state->tile->dbs_g, 1); CABAC_BIN_EP(cabac, mvd_hor_sign, "mvd_sign_flag_hor"); } if (ver_abs_gr0) { if (mvd_ver_abs > 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->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"); } }