Index: trunk/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 20)
+++ trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 21)
@@ -787,4 +787,7 @@
 #endif
 
+#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV
+  xConfirmPara( REF_IDX_ME_AROUND_ZEROMV && REF_IDX_ME_ZEROMV, "REF_IDX_ME_AROUND_ZEROMV and REF_IDX_ME_ZEROMV cannot be enabled simultaneously");
+#endif
   // max CU width and height should be power of 2
   UInt ui = m_uiMaxCUWidth;
@@ -1309,4 +1312,5 @@
   printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled);
   printf("REF_IDX_ME_AROUND_ZEROMV:%d ", REF_IDX_ME_AROUND_ZEROMV);
+  printf("REF_IDX_ME_ZEROMV: %d", REF_IDX_ME_ZEROMV);
 #else
   printf("INTRA_BL:%d ", INTRA_BL);
Index: trunk/source/Lib/TLibCommon/TComPic.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComPic.cpp	(revision 20)
+++ trunk/source/Lib/TLibCommon/TComPic.cpp	(revision 21)
@@ -68,5 +68,5 @@
 , m_bSpatialEnhLayer( false )
 , m_pcFullPelBaseRec( NULL )
-#if REF_IDX_ME_AROUND_ZEROMV || ENCODER_FAST_MODE
+#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE
 , m_bIsILR                                (false)
 #endif
Index: trunk/source/Lib/TLibCommon/TComPic.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComPic.h	(revision 20)
+++ trunk/source/Lib/TLibCommon/TComPic.h	(revision 21)
@@ -88,5 +88,5 @@
   Bool                  m_bSpatialEnhLayer;       // whether current layer is a spatial enhancement layer,
   TComPicYuv*           m_pcFullPelBaseRec;    // upsampled base layer recontruction for difference domain inter prediction
-#if REF_IDX_ME_AROUND_ZEROMV || ENCODER_FAST_MODE
+#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE
   Bool                  m_bIsILR;                 //  Is ILR picture
 #endif
@@ -118,5 +118,5 @@
   TComPicYuv*   getFullPelBaseRec   ()  { return  m_pcFullPelBaseRec;  }
 #endif
-#if REF_IDX_ME_AROUND_ZEROMV || ENCODER_FAST_MODE
+#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE
   Void          setIsILR( Bool bIsILR)      {m_bIsILR = bIsILR;}
   Bool          getIsILR()                  {return m_bIsILR;}
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 20)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 21)
@@ -58,4 +58,5 @@
 #if REF_IDX_FRAMEWORK
 #define REF_IDX_ME_AROUND_ZEROMV         0      ///< added ME around zero MV for inter-layer reference picture
+#define REF_IDX_ME_ZEROMV                1      ///< L0051: use zero motion for inter-layer reference picture (without fractional ME)
 #define ENCODER_FAST_MODE                1      ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1.
 #else
Index: trunk/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 20)
+++ trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 21)
@@ -164,4 +164,7 @@
         m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
 #endif
+#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV
+        m_cIlpPic[j]->setIsILR(true);
+#endif
         for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCUsInFrame(); i++)
         {
Index: trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 20)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 21)
@@ -4470,4 +4470,5 @@
   setWpScalingDistParam( pcCU, iRefIdxPred, eRefPicList );
   //  Do integer search
+#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV
 #if REF_IDX_ME_AROUND_ZEROMV
   if( pcCU->getSlice()->getRefPic(eRefPicList, iRefIdxPred )->getIsILR())  //ILR reference pic
@@ -4487,4 +4488,21 @@
     }
   }
+#endif
+#if REF_IDX_ME_ZEROMV
+  if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getIsILR())  //ILR reference pic 
+    rcMv.setZero();  //use Mv(0, 0) for integer ME 
+  else  //non ILR reference pic
+  {
+    if ( !m_iFastSearch || bBi ) 
+    { 
+      xPatternSearch      ( pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); 
+    } 
+    else 
+    { 
+      rcMv = *pcMvPred; 
+      xPatternSearchFast  ( pcCU, pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); 
+    }
+  }
+#endif
 #else
   if ( !m_iFastSearch || bBi )
@@ -4503,7 +4521,14 @@
   
   {
+#if REF_IDX_ME_ZEROMV
+    if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getIsILR())  //ILR reference pic
+      xPatternSearchFracDIFMv0( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost, bBi );
+    else    //non ILR reference pic
+      xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost, bBi );
+#else
     xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost
                           ,bBi
                           );
+#endif
   }
   
@@ -4887,4 +4912,27 @@
 }
 
+#if REF_IDX_ME_ZEROMV
+Void TEncSearch::xPatternSearchFracDIFMv0(TComDataCU* pcCU,
+                                          TComPattern* pcPatternKey,
+                                          Pel* piRefY,
+                                          Int iRefStride,
+                                          TComMv* pcMvInt,
+                                          TComMv& rcMvHalf,
+                                          TComMv& rcMvQter,
+                                          UInt& ruiCost,
+                                          Bool biPred
+                                          )
+{
+  assert(pcMvInt->getHor() == 0 && pcMvInt->getVer() == 0);
+  Int         iOffset    = pcMvInt->getHor() + pcMvInt->getVer() * iRefStride;
+  m_pcRdCost->setDistParam( pcPatternKey, piRefY + iOffset, iRefStride, 1, m_cDistParam, m_pcEncCfg->getUseHADME() );
+  m_pcRdCost->setCostScale ( 2 );
+  setDistParamComp(0);
+  ruiCost = m_cDistParam.DistFunc( &m_cDistParam );  //SATD
+  ruiCost += m_pcRdCost->getCost( pcMvInt->getHor(), pcMvInt->getVer() );  //SATD rdCost
+  rcMvHalf.setZero();
+  rcMvQter.setZero();
+}
+#endif
 /** encode residual and calculate rate-distortion for a CU block
  * \param pcCU
Index: trunk/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 20)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 21)
@@ -471,4 +471,15 @@
 #endif
   
+#if REF_IDX_ME_ZEROMV
+  Void xPatternSearchFracDIFMv0  ( TComDataCU*   pcCU,
+                                   TComPattern*  pcPatternKey,
+                                   Pel*          piRefY,
+                                   Int           iRefStride,
+                                   TComMv*       pcMvInt,
+                                   TComMv&       rcMvHalf,
+                                   TComMv&       rcMvQter,
+                                   UInt&         ruiCost,
+                                   Bool          biPred );
+#endif
   Void xExtDIFUpSamplingH( TComPattern* pcPattern, Bool biPred  );
   Void xExtDIFUpSamplingQ( TComPattern* pcPatternKey, TComMv halfPelRef, Bool biPred );
Index: trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 20)
+++ trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 21)
@@ -394,5 +394,5 @@
         m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
 #endif
-#if REF_IDX_ME_AROUND_ZEROMV || ENCODER_FAST_MODE
+#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE
         m_cIlpPic[j]->setIsILR(true);
 #endif
