<div style="font-family: -apple-system, system-ui; font-size: 14px; color: rgb(0, 0, 0);"><span style="line-height: 1.6;">From a7bffa5e6575b454cfa50f6465e6d2b72e3b1bdf Mon Sep 17 00:00:00 2001<br  />
From: Mr-Z-2697 <74594146+Mr-Z-2697@users.noreply.github.com><br  />
Date: Sat, 28 Dec 2024 15:26:16 +0800<br  />
Subject: [PATCH] CUTree: Improve the accuracy of frame duration calculate<br  />
<br  />
This loop has no practical use.<br  />
The precision problem with IEEE 754 binary formats will cause slight inaccuracy, and inconsistency when compiled with different compilers and options (Machine-Dependent Options).<br  />
Fixes https://bitbucket.org/multicoreware/x265_git/issues/957/different-metrics-with-avx-versions<br  />
---<br  />
 source/encoder/slicetype.cpp | 5 +----<br  />
 1 file changed, 1 insertion(+), 4 deletions(-)<br  />
<br  />
diff --git a/source/encoder/slicetype.cpp b/source/encoder/slicetype.cpp<br  />
index e94a7eb9c..e6b831349 100644<br  />
--- a/source/encoder/slicetype.cpp<br  />
+++ b/source/encoder/slicetype.cpp<br  />
@@ -3546,11 +3546,8 @@ void Lookahead::cuTree(Lowres **frames, int numframes, bool bIntra)<br  />
     int bframes = 0;<br  />
 <br  />
     x265_emms();<br  />
-    double totalDuration = 0.0;<br  />
-    for (int j = 0; j <= numframes; j++)<br  />
-        totalDuration += (double)m_param->fpsDenom / m_param->fpsNum;<br  />
 <br  />
-    double averageDuration = totalDuration / (numframes + 1);<br  />
+    double averageDuration = (double)m_param->fpsDenom / m_param->fpsNum;<br  />
 <br  />
     int i = numframes;<br  />
 <br  />
-- <br  />
2.49.0.windows.1</span></div>