Commit e4984ffc authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

Simplify flow of control

Avoid switch warning regarding fallthrough, add consts.

Change-Id: Ie3a03e60420d962941abc4e144648f29401916b9
parent d4e87160
...@@ -3819,9 +3819,7 @@ static void write_global_motion_params(const WarpedMotionParams *params, ...@@ -3819,9 +3819,7 @@ static void write_global_motion_params(const WarpedMotionParams *params,
const WarpedMotionParams *ref_params, const WarpedMotionParams *ref_params,
struct aom_write_bit_buffer *wb, struct aom_write_bit_buffer *wb,
int allow_hp) { int allow_hp) {
TransformationType type = params->wmtype; const TransformationType type = params->wmtype;
int trans_bits;
int trans_prec_diff;
aom_wb_write_bit(wb, type != IDENTITY); aom_wb_write_bit(wb, type != IDENTITY);
if (type != IDENTITY) { if (type != IDENTITY) {
...@@ -3833,48 +3831,45 @@ static void write_global_motion_params(const WarpedMotionParams *params, ...@@ -3833,48 +3831,45 @@ static void write_global_motion_params(const WarpedMotionParams *params,
#endif // GLOBAL_TRANS_TYPES > 4 #endif // GLOBAL_TRANS_TYPES > 4
} }
switch (type) { if (type >= ROTZOOM) {
case AFFINE: aom_wb_write_signed_primitive_refsubexpfin(
case ROTZOOM: wb, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
aom_wb_write_signed_primitive_refsubexpfin( (ref_params->wmmat[2] >> GM_ALPHA_PREC_DIFF) -
wb, GM_ALPHA_MAX + 1, SUBEXPFIN_K, (1 << GM_ALPHA_PREC_BITS),
(ref_params->wmmat[2] >> GM_ALPHA_PREC_DIFF) - (params->wmmat[2] >> GM_ALPHA_PREC_DIFF) - (1 << GM_ALPHA_PREC_BITS));
(1 << GM_ALPHA_PREC_BITS), aom_wb_write_signed_primitive_refsubexpfin(
(params->wmmat[2] >> GM_ALPHA_PREC_DIFF) - (1 << GM_ALPHA_PREC_BITS)); wb, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
aom_wb_write_signed_primitive_refsubexpfin( (ref_params->wmmat[3] >> GM_ALPHA_PREC_DIFF),
wb, GM_ALPHA_MAX + 1, SUBEXPFIN_K, (params->wmmat[3] >> GM_ALPHA_PREC_DIFF));
(ref_params->wmmat[3] >> GM_ALPHA_PREC_DIFF), }
(params->wmmat[3] >> GM_ALPHA_PREC_DIFF));
if (type >= AFFINE) { if (type >= AFFINE) {
aom_wb_write_signed_primitive_refsubexpfin( aom_wb_write_signed_primitive_refsubexpfin(
wb, GM_ALPHA_MAX + 1, SUBEXPFIN_K, wb, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
(ref_params->wmmat[4] >> GM_ALPHA_PREC_DIFF), (ref_params->wmmat[4] >> GM_ALPHA_PREC_DIFF),
(params->wmmat[4] >> GM_ALPHA_PREC_DIFF)); (params->wmmat[4] >> GM_ALPHA_PREC_DIFF));
aom_wb_write_signed_primitive_refsubexpfin( aom_wb_write_signed_primitive_refsubexpfin(
wb, GM_ALPHA_MAX + 1, SUBEXPFIN_K, wb, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
(ref_params->wmmat[5] >> GM_ALPHA_PREC_DIFF) - (ref_params->wmmat[5] >> GM_ALPHA_PREC_DIFF) -
(1 << GM_ALPHA_PREC_BITS), (1 << GM_ALPHA_PREC_BITS),
(params->wmmat[5] >> GM_ALPHA_PREC_DIFF) - (params->wmmat[5] >> GM_ALPHA_PREC_DIFF) - (1 << GM_ALPHA_PREC_BITS));
(1 << GM_ALPHA_PREC_BITS)); }
}
// fallthrough intended if (type >= TRANSLATION) {
case TRANSLATION: const int trans_bits = (type == TRANSLATION)
trans_bits = (type == TRANSLATION) ? GM_ABS_TRANS_ONLY_BITS - !allow_hp ? GM_ABS_TRANS_ONLY_BITS - !allow_hp
: GM_ABS_TRANS_BITS; : GM_ABS_TRANS_BITS;
trans_prec_diff = (type == TRANSLATION) const int trans_prec_diff = (type == TRANSLATION)
? GM_TRANS_ONLY_PREC_DIFF + !allow_hp ? GM_TRANS_ONLY_PREC_DIFF + !allow_hp
: GM_TRANS_PREC_DIFF; : GM_TRANS_PREC_DIFF;
aom_wb_write_signed_primitive_refsubexpfin( aom_wb_write_signed_primitive_refsubexpfin(
wb, (1 << trans_bits) + 1, SUBEXPFIN_K, wb, (1 << trans_bits) + 1, SUBEXPFIN_K,
(ref_params->wmmat[0] >> trans_prec_diff), (ref_params->wmmat[0] >> trans_prec_diff),
(params->wmmat[0] >> trans_prec_diff)); (params->wmmat[0] >> trans_prec_diff));
aom_wb_write_signed_primitive_refsubexpfin( aom_wb_write_signed_primitive_refsubexpfin(
wb, (1 << trans_bits) + 1, SUBEXPFIN_K, wb, (1 << trans_bits) + 1, SUBEXPFIN_K,
(ref_params->wmmat[1] >> trans_prec_diff), (ref_params->wmmat[1] >> trans_prec_diff),
(params->wmmat[1] >> trans_prec_diff)); (params->wmmat[1] >> trans_prec_diff));
break;
case IDENTITY: break;
default: assert(0);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment