From 302e60b33f7c4fd14e14d3d455255b74b1d2ff05 Mon Sep 17 00:00:00 2001
From: Yin Zhao <yin.zhao@huawei.com>
Date: Fri, 23 Aug 2019 20:07:51 +0800
Subject: [PATCH] fix the case that all coding modes of a CU do not get coding
 results

---
 source/Lib/EncoderLib/EncCu.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index da4f21f51..b5c64147a 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -995,6 +995,14 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
   }
 
 #endif
+  if( tempCS->cost == MAX_DOUBLE && bestCS->cost == MAX_DOUBLE )
+  {
+    //although some coding modes were planned to be tried in RDO, no coding mode actually finished encoding due to early termination
+    //thus tempCS->cost and bestCS->cost are both MAX_DOUBLE; in this case, skip the following process for normal case
+    m_modeCtrl->finishCULevel( partitioner );
+    return;
+  }
+
   // set context states
   m_CABACEstimator->getCtx() = m_CurrCtx->best;
 
-- 
GitLab