File: fix_hanging_tests_i386.patch

package info (click to toggle)
kvazaar 2.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,976 kB
  • sloc: ansic: 35,253; sh: 4,870; python: 362; makefile: 324; cpp: 166; awk: 10
file content (36 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 2f9a21423a1ef666c93f15e2068bcde979d20f7e Mon Sep 17 00:00:00 2001
From: Marko Viitanen <fador@iki.fi>
Date: Wed, 14 Aug 2024 12:47:57 +0300
Subject: [PATCH] Add an offset to double comparison in mv_cost to fix problems
 on some platforms

---
 src/search_inter.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/search_inter.c b/src/search_inter.c
index 9e624532..f8f876a3 100644
--- a/src/search_inter.c
+++ b/src/search_inter.c
@@ -220,8 +220,9 @@ static bool check_mv_cost(inter_search_info_t *info,
       info->height,
       info->optimized_sad
   );
-
-  if (cost >= *best_cost) return false;
+  // On some platforms comparing two doubles give weird results, so add an offset
+#define KVZ_TEMP_DOUBLE_PRECISION 0.001
+  if (cost + KVZ_TEMP_DOUBLE_PRECISION >= *best_cost) return false;
 
   cost += info->mvd_cost_func(
       info->state,
@@ -233,7 +234,8 @@ static bool check_mv_cost(inter_search_info_t *info,
       &bitcost
   );
 
-  if (cost >= *best_cost) return false;
+  if (cost + KVZ_TEMP_DOUBLE_PRECISION >= *best_cost) return false;
+#undef KVZ_TEMP_DOUBLE_PRECISION
 
   // Set to motion vector in quarter pixel precision.
   best_mv->x = x * 4;