From 39302b0328adc83df79500fabf1fe00edd1f751a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arttu=20Yl=C3=A4-Outinen?= Date: Mon, 31 Aug 2015 13:01:24 +0300 Subject: [PATCH] Refactor inter_clear_cu_unused. Replaces duplicated code with a for loop. --- src/inter.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/inter.c b/src/inter.c index cd26486f..46c34968 100644 --- a/src/inter.c +++ b/src/inter.c @@ -395,15 +395,12 @@ void kvz_inter_recon_lcu_bipred(const encoder_state_t * const state, const kvz_p * \param cu coding unit to clear */ static void inter_clear_cu_unused(cu_info_t* cu) { - if(!(cu->inter.mv_dir & 1)) { - cu->inter.mv[0][0] = 0; - cu->inter.mv[0][1] = 0; - cu->inter.mv_ref[0] = 255; - } - if(!(cu->inter.mv_dir & 2)) { - cu->inter.mv[1][0] = 0; - cu->inter.mv[1][1] = 0; - cu->inter.mv_ref[1] = 255; + for (unsigned i = 0; i < 2; ++i) { + if (cu->inter.mv_dir & (1 << i)) continue; + + cu->inter.mv[i][0] = 0; + cu->inter.mv[i][1] = 0; + cu->inter.mv_ref[i] = 255; } }