[x265] [PATCH] CUTree: Improve the accuracy of frame duration calculate

Richard ccc7922 at foxmail.com
Mon Apr 14 08:42:44 UTC 2025


From a7bffa5e6575b454cfa50f6465e6d2b72e3b1bdf Mon Sep 17 00:00:00 2001
 From: Mr-Z-2697 <74594146+Mr-Z-2697 at users.noreply.github.com>
 Date: Sat, 28 Dec 2024 15:26:16 +0800
 Subject: [PATCH] CUTree: Improve the accuracy of frame duration calculate
 
 This loop has no practical use.
 The precision problem with IEEE 754 binary formats will cause slight inaccuracy, and inconsistency when compiled with different compilers and options (Machine-Dependent Options).
 Fixes https://bitbucket.org/multicoreware/x265_git/issues/957/different-metrics-with-avx-versions
 ---
  source/encoder/slicetype.cpp | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
 
 diff --git a/source/encoder/slicetype.cpp b/source/encoder/slicetype.cpp
 index e94a7eb9c..e6b831349 100644
 --- a/source/encoder/slicetype.cpp
 +++ b/source/encoder/slicetype.cpp
 @@ -3546,11 +3546,8 @@ void Lookahead::cuTree(Lowres **frames, int numframes, bool bIntra)
      int bframes = 0;
  
      x265_emms();
 -    double totalDuration = 0.0;
 -    for (int j = 0; j <= numframes; j++)
 -        totalDuration += (double)m_param->fpsDenom / m_param->fpsNum;
  
 -    double averageDuration = totalDuration / (numframes + 1);
 +    double averageDuration = (double)m_param->fpsDenom / m_param->fpsNum;
  
      int i = numframes;
  
 -- 
 2.49.0.windows.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250414/9e9b2024/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-CUTree-Improve-the-accuracy-of-frame-duration-calcul.patch
Type: application/octet-stream
Size: 1294 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250414/9e9b2024/attachment.obj>


More information about the x265-devel mailing list