From 6147d36eef92709dec64583b77c9de09e5ad2d0f Mon Sep 17 00:00:00 2001
From: Ryoji HASHIMOTO <ryoji.hashimoto.te@renesas.com>
Date: Thu, 29 Nov 2018 11:34:31 +0900
Subject: [PATCH] fix for ticket_#121 (JVET-J0090 related)

set cache disable in following cases
- on processing CPR
- before processing BIO vertical filter
---
 source/Lib/CommonLib/InterPrediction.cpp | 5 ++++-
 source/Lib/CommonLib/InterPrediction.h   | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp
index 959ba16d65..0997fbbca3 100644
--- a/source/Lib/CommonLib/InterPrediction.cpp
+++ b/source/Lib/CommonLib/InterPrediction.cpp
@@ -630,6 +630,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio
   if (isCPR)
   {
     xFrac = yFrac = 0;
+    JVET_J0090_SET_CACHE_ENABLE( false );
   }
 #endif
   xFrac <<= VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE - iAddPrecShift;
@@ -702,8 +703,8 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio
 #else
     m_if.filterVer(compID, (Pel*) tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf, dstBuf.stride, width, height,                   yFrac, false, rndRes, chFmt, clpRng);
 #endif
-    JVET_J0090_SET_CACHE_ENABLE( true );
   }
+  JVET_J0090_SET_CACHE_ENABLE( true );
 #if JVET_L0256_BIO
   if (bioApplied && compID == COMPONENT_Y)
   {
@@ -1084,7 +1085,9 @@ void InterPrediction::bioSampleExtendBilinearFilter(Pel const* src, int srcStrid
       tmpBuf.stride = width;
 
       m_if.filterHor(COMPONENT_Y, pSrc - ((vFilterSize >> 1) - 1) * srcStride, srcStride, tmpBuf.buf, tmpBuf.stride, widthTmp, heightTmp + vFilterSize - 1, fracX, false, fmt, clpRng, 1);
+      JVET_J0090_SET_CACHE_ENABLE( false );
       m_if.filterVer(COMPONENT_Y, tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, pDst, dstStride, widthTmp, heightTmp, fracY, false, isLast, fmt, clpRng, 1);
+      JVET_J0090_SET_CACHE_ENABLE( true );
     }
   }
 }
diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h
index 4edb247a2a..c799405d3d 100644
--- a/source/Lib/CommonLib/InterPrediction.h
+++ b/source/Lib/CommonLib/InterPrediction.h
@@ -155,6 +155,9 @@ protected:
 #if JVET_L0293_CPR
   void xChromaMC(PredictionUnit &pu, PelUnitBuf& pcYuvPred);
 #endif
+#if JVET_J0090_MEMORY_BANDWITH_MEASURE
+  CacheModel      *m_cacheModel;
+#endif
 public:
   InterPrediction();
   virtual ~InterPrediction();
-- 
GitLab