Fix qsort inconsistency at inter_modes_info_sort()

This patch fixes the in-built qsort function inconsistency
between linux and windows by fixing the compare function
at inter_modes_info_sort(). This resolves the bitstream
mismatch between linux and windows platforms.

BUG=aomedia:2928

Change-Id: If772bb4746434e34c35a2b6ac48b213b859c77b8
(cherry picked from commit d607d33195ba54dc2dcf3cb264292b9e2ace1cf0)
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index fc1e9ce..9f36f89 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -485,7 +485,14 @@
 
 static int compare_rd_idx_pair(const void *a, const void *b) {
   if (((RdIdxPair *)a)->rd == ((RdIdxPair *)b)->rd) {
-    return 0;
+    // To avoid inconsistency in qsort() ordering when two elements are equal,
+    // using idx as tie breaker. Refer aomedia:2928
+    if (((RdIdxPair *)a)->idx == ((RdIdxPair *)b)->idx)
+      return 0;
+    else if (((RdIdxPair *)a)->idx > ((RdIdxPair *)b)->idx)
+      return 1;
+    else
+      return -1;
   } else if (((const RdIdxPair *)a)->rd > ((const RdIdxPair *)b)->rd) {
     return 1;
   } else {