Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1323)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1324)
@@ -1284,4 +1284,5 @@
   ("SearchRange,-sr",                                 m_iSearchRange,                                      96, "Motion search range")
   ("BipredSearchRange",                               m_bipredSearchRange,                                  4, "Motion search range for bipred refinement")
+  ("ClipForBiPredMEEnabled",                          m_bClipForBiPredMeEnabled,                        false, "Enables clipping in the Bi-Pred ME. It is disabled to reduce encoder run-time")
   ("HadamardME",                                      m_bUseHADME,                                       true, "Hadamard ME for fractional-pel")
   ("ASR",                                             m_bUseASR,                                        false, "Adaptive motion search range")
Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 1323)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 1324)
@@ -276,4 +276,5 @@
   Int       m_iSearchRange;                                   ///< ME search range
   Int       m_bipredSearchRange;                              ///< ME search range for bipred refinement
+  Bool      m_bClipForBiPredMeEnabled;                        ///< Enables clipping for Bi-Pred ME.
   Bool      m_bUseFastEnc;                                    ///< flag for using fast encoder setting
   Bool      m_bUseEarlyCU;                                    ///< flag for using Early CU setting
Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1323)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1324)
@@ -409,4 +409,5 @@
     m_acTEncTop[layer].setSearchRange                                      ( m_iSearchRange );
     m_acTEncTop[layer].setBipredSearchRange                                ( m_bipredSearchRange );
+    m_acTEncTop[layer].setClipForBiPredMeEnabled                           ( m_bClipForBiPredMeEnabled );
 
     //====== Quality control ========
@@ -845,4 +846,5 @@
   m_cTEncTop.setSearchRange                                       ( m_iSearchRange );
   m_cTEncTop.setBipredSearchRange                                 ( m_bipredSearchRange );
+  m_cTEncTop.setClipForBiPredMeEnabled                            ( m_bClipForBiPredMeEnabled );
 
   //====== Quality control ========
Index: /branches/SHM-dev/source/Lib/TLibCommon/TComYuv.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComYuv.cpp	(revision 1323)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComYuv.cpp	(revision 1324)
@@ -410,8 +410,7 @@
                               const UInt uiPartIdx,
                               const UInt uiWidth,
-                              const UInt uiHeight
-#if !DISABLING_CLIP_FOR_BIPREDME
-                              ,const Int bitDepths[MAX_NUM_CHANNEL_TYPE]
-#endif
+                              const UInt uiHeight,
+                              const Int bitDepths[MAX_NUM_CHANNEL_TYPE],
+                              const Bool bClipToBitDepths
                               )
 {
@@ -419,8 +418,4 @@
   {
     const ComponentID compID=ComponentID(comp);
-#if !DISABLING_CLIP_FOR_BIPREDME
-    const Int clipBd=bitDepths[toChannelType(compID)];
-#endif
-
     const Pel* pSrc  = pcYuvSrc->getAddr(compID, uiPartIdx);
     Pel* pDst  = getAddr(compID, uiPartIdx);
@@ -430,17 +425,28 @@
     const Int iWidth  = uiWidth >>getComponentScaleX(compID);
     const Int iHeight = uiHeight>>getComponentScaleY(compID);
-
-    for ( Int y = iHeight-1; y >= 0; y-- )
-    {
-      for ( Int x = iWidth-1; x >= 0; x-- )
-      {
-#if DISABLING_CLIP_FOR_BIPREDME
-        pDst[x ] = (2 * pDst[x]) - pSrc[x];
-#else
-        pDst[x ] = ClipBD((2 * pDst[x]) - pSrc[x], clipBd);
-#endif
-      }
-      pSrc += iSrcStride;
-      pDst += iDstStride;
+    if (bClipToBitDepths)
+    {
+      const Int clipBd=bitDepths[toChannelType(compID)];
+      for ( Int y = iHeight-1; y >= 0; y-- )
+      {
+        for ( Int x = iWidth-1; x >= 0; x-- )
+        {
+          pDst[x ] = ClipBD((2 * pDst[x]) - pSrc[x], clipBd);
+        }
+        pSrc += iSrcStride;
+        pDst += iDstStride;
+      }
+    }
+    else
+    {
+      for ( Int y = iHeight-1; y >= 0; y-- )
+      {
+        for ( Int x = iWidth-1; x >= 0; x-- )
+        {
+          pDst[x ] = (2 * pDst[x]) - pSrc[x];
+        }
+        pSrc += iSrcStride;
+        pDst += iDstStride;
+      }
     }
   }
Index: /branches/SHM-dev/source/Lib/TLibCommon/TComYuv.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComYuv.h	(revision 1323)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComYuv.h	(revision 1324)
@@ -140,7 +140,5 @@
 
   Void         removeHighFreq             ( const TComYuv* pcYuvSrc, const UInt uiPartIdx, const UInt uiWidth, const UInt uiHeight
-#if !DISABLING_CLIP_FOR_BIPREDME
-                                          , const Int bitDepths[MAX_NUM_CHANNEL_TYPE]
-#endif
+                                          , const Int bitDepths[MAX_NUM_CHANNEL_TYPE], const Bool bClipToBitDepths
                                           );
 
Index: /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 1323)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 1324)
@@ -208,6 +208,4 @@
 #define SBH_THRESHOLD                                     4  ///< I0156: value of the fixed SBH controlling threshold
 
-#define DISABLING_CLIP_FOR_BIPREDME                       1  ///< Ticket #175
-
 #define C1FLAG_NUMBER                                     8 // maximum number of largerThan1 flag coded in one chunk :  16 in HM5
 #define C2FLAG_NUMBER                                     1 // maximum number of largerThan2 flag coded in one chunk:  16 in HM5
Index: /branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 1323)
+++ /branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 1324)
@@ -172,4 +172,5 @@
   Int       m_iSearchRange;                     //  0:Full frame
   Int       m_bipredSearchRange;
+  Bool      m_bClipForBiPredMeEnabled;
 
   //====== Quality control ========
@@ -544,4 +545,5 @@
   Void      setSearchRange                  ( Int   i )      { m_iSearchRange = i; }
   Void      setBipredSearchRange            ( Int   i )      { m_bipredSearchRange = i; }
+  Void      setClipForBiPredMeEnabled       ( Bool  b )      { m_bClipForBiPredMeEnabled = b; }
 
   //====== Quality control ========
@@ -606,6 +608,7 @@
   //==== Motion search ========
   Bool      getDisableIntraPUsInInterSlices () const { return m_bDisableIntraPUsInInterSlices; }
-  Int       getFastSearch                   ()      { return  m_iFastSearch; }
-  Int       getSearchRange                  ()      { return  m_iSearchRange; }
+  Int       getFastSearch                   () const { return m_iFastSearch; }
+  Int       getSearchRange                  () const { return m_iSearchRange; }
+  Bool      getClipForBiPredMeEnabled       () const { return m_bClipForBiPredMeEnabled; }
 
   //==== Quality control ========
Index: /branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1323)
+++ /branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1324)
@@ -3892,9 +3892,5 @@
     pcYuvOrg->copyPartToPartYuv( pcYuv, uiPartAddr, iRoiWidth, iRoiHeight );
 
-    pcYuv->removeHighFreq( pcYuvOther, uiPartAddr, iRoiWidth, iRoiHeight
-#if !DISABLING_CLIP_FOR_BIPREDME
-                          , pcCU->getSlice()->getSPS()->getBitDepths().recon
-#endif
-                          );
+    pcYuv->removeHighFreq( pcYuvOther, uiPartAddr, iRoiWidth, iRoiHeight, pcCU->getSlice()->getSPS()->getBitDepths().recon, m_pcEncCfg->getClipForBiPredMeEnabled() );
 
     fWeight = 0.5;
