make av1_get_mv_joint() branchless
This would introduce minor speedup to av1_diamond_search_sad_c().
Profiling one-pass encoding of speed-3 with 1080p park_run,
the percentage of av1_diamond_search_sad_c() drops from 5.6% to 5.33%.
Change-Id: I0b01f57d2369229de7d43cc0f65965f0c4f1bc36
diff --git a/av1/encoder/encodemv.h b/av1/encoder/encodemv.h
index ebd4d2c..c049035 100644
--- a/av1/encoder/encodemv.h
+++ b/av1/encoder/encodemv.h
@@ -44,11 +44,11 @@
int is_integer);
static INLINE MV_JOINT_TYPE av1_get_mv_joint(const MV *mv) {
- if (mv->row == 0) {
- return mv->col == 0 ? MV_JOINT_ZERO : MV_JOINT_HNZVZ;
- } else {
- return mv->col == 0 ? MV_JOINT_HZVNZ : MV_JOINT_HNZVNZ;
- }
+ // row: Z col: Z | MV_JOINT_ZERO (0)
+ // row: Z col: NZ | MV_JOINT_HNZVZ (1)
+ // row: NZ col: Z | MV_JOINT_HZVNZ (2)
+ // row: NZ col: NZ | MV_JOINT_HNZVNZ (3)
+ return (!!mv->col) | ((!!mv->row) << 1);
}
#ifdef __cplusplus