diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp
index c29862a1a14abf9afe7025a8ef59a0ce77b77d5f..ddbde068634d7f5e02d56761b527b8598909b372 100644
--- a/source/Lib/CommonLib/InterPrediction.cpp
+++ b/source/Lib/CommonLib/InterPrediction.cpp
@@ -477,7 +477,11 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe
       const bool biocheck1 = !(pps.getUseWP() && slice.getSliceType() == P_SLICE);
       if (biocheck0
         && biocheck1
+#if JVET_P1023_DMVR_BDOF_RP_CONDITION
+        && PU::isBiPredFromDifferentDirEqDistPoc(pu)
+#else
         && PU::isBiPredFromDifferentDir(pu)
+#endif
         && (pu.Y().height >= 8)
         && (pu.Y().width >= 8)
         && ((pu.Y().height * pu.Y().width) >= 128)
@@ -1511,7 +1515,11 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
         const bool biocheck1 = !(pps.getUseWP() && slice.getSliceType() == P_SLICE);
         if (biocheck0
           && biocheck1
+#if JVET_P1023_DMVR_BDOF_RP_CONDITION
+          && PU::isBiPredFromDifferentDirEqDistPoc(pu)
+#else
           && PU::isBiPredFromDifferentDir(pu)
+#endif
           && (pu.Y().height >= 8)
           && (pu.Y().width >= 8)
           && ((pu.Y().height * pu.Y().width) >= 128)
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index eb05bd45545f21f90e627cee0696908e24321be5..a7c013677818e963b29c451fc6909b97df443f8a 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -50,6 +50,8 @@
 #include <assert.h>
 #include <cassert>
 
+#define JVET_P1023_DMVR_BDOF_RP_CONDITION                 1 // JVET_P1023: Reference picture conditions in DMVR and BDOF
+
 #define JVET_P0162_REMOVE_ALF_CTB_FIRST_USE_APS_FLAG      1 // JVET-P0162: Removal of alf_ctb_use_first_aps_flag
 
 #define JVET_P0164_ALF_SYNTAX_SIMP                        1 // JVET-p0164: simplify alf syntax with method2
diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index 237a2c34b4183472ca5d301af7a3b51fcacc315d..5bb5e56dbccfa653f527c66a25c74403fdd316c1 100755
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -3114,6 +3114,7 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP
   PU::spanMotionInfo( pu, mrgCtx );
 }
 
+#if !JVET_P1023_DMVR_BDOF_RP_CONDITION
 bool PU::isBiPredFromDifferentDir( const PredictionUnit& pu )
 {
   if ( pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0 )
@@ -3129,11 +3130,19 @@ bool PU::isBiPredFromDifferentDir( const PredictionUnit& pu )
 
   return false;
 }
+#endif
 
 bool PU::isBiPredFromDifferentDirEqDistPoc(const PredictionUnit& pu)
 {
   if (pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0)
   {
+#if JVET_P1023_DMVR_BDOF_RP_CONDITION
+    if (pu.cu->slice->getRefPic(REF_PIC_LIST_0, pu.refIdx[0])->longTerm
+      || pu.cu->slice->getRefPic(REF_PIC_LIST_1, pu.refIdx[1])->longTerm)
+    {
+      return false;
+    }
+#endif
     const int poc0 = pu.cu->slice->getRefPOC(REF_PIC_LIST_0, pu.refIdx[0]);
     const int poc1 = pu.cu->slice->getRefPOC(REF_PIC_LIST_1, pu.refIdx[1]);
     const int poc = pu.cu->slice->getPOC();
diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h
index bd7a3c7b33d920b164ac63f85d1d18e1f05406e8..f6c6214f4aecc76baa33c6541e8e339cafe9d046 100644
--- a/source/Lib/CommonLib/UnitTools.h
+++ b/source/Lib/CommonLib/UnitTools.h
@@ -165,7 +165,9 @@ namespace PU
     , int mmvdList
   );
   bool getInterMergeSubPuRecurCand(const PredictionUnit &pu, MergeCtx &mrgCtx, const int count);
+#if !JVET_P1023_DMVR_BDOF_RP_CONDITION
   bool isBiPredFromDifferentDir       (const PredictionUnit &pu);
+#endif
   bool isBiPredFromDifferentDirEqDistPoc(const PredictionUnit &pu);
   void restrictBiPredMergeCandsOne    (PredictionUnit &pu);