Index: /branches/SHM-dev/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp	(revision 1398)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp	(revision 1399)
@@ -588,5 +588,5 @@
   const ComponentID compIdx    = pcDtParam->compIdx;
   assert(compIdx<MAX_NUM_COMPONENT);
-  const WPScalingParam  wpCur    = pcDtParam->wpCur[compIdx];
+  const WPScalingParam &wpCur  = pcDtParam->wpCur[compIdx];
 
   Distortion uiSum = 0;
Index: /branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp	(revision 1398)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp	(revision 1399)
@@ -55,4 +55,15 @@
 }
 
+static inline Pel noWeightUnidir( Pel P0, Int round, Int shift, Int offset, Int clipBD)
+{
+  return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ) + offset, clipBD );
+}
+
+static inline Pel noWeightOffsetUnidir( Pel P0, Int round, Int shift, Int clipBD)
+{
+  return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ), clipBD );
+}
+
+
 // ====================================================================================================================
 // Class definition
@@ -154,5 +165,4 @@
     const Int  shiftNum    = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD));
     const Int  shift       = wp0[compID].shift + shiftNum;
-    const Int  round       = (shift > 0) ? (1<<(shift-1)) : 0;
     const UInt iSrc0Stride = pcYuvSrc0->getStride(compID);
     const UInt iDstStride  = pcYuvDst->getStride(compID);
@@ -162,20 +172,68 @@
     const Int  iWidth      = uiWidth>>csx;
 
-    for (Int y = iHeight-1; y >= 0; y-- )
-    {
-      Int x = iWidth-1;
-      for ( ; x >= 3; )
+    if (w0 != 1 << wp0[compID].shift)
+    {
+      const Int  round       = (shift > 0) ? (1<<(shift-1)) : 0;
+      for (Int y = iHeight-1; y >= 0; y-- )
       {
-        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
-        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
-        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
-        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
+        Int x = iWidth-1;
+        for ( ; x >= 3; )
+        {
+          pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
+          pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
+          pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
+          pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
+        }
+        for( ; x >= 0; x--)
+        {
+          pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD);
+        }
+        pSrc0 += iSrc0Stride;
+        pDst  += iDstStride;
       }
-      for( ; x >= 0; x--)
+    }
+    else
+    {
+      const Int  round       = (shiftNum > 0) ? (1<<(shiftNum-1)) : 0;
+      if (offset == 0)
       {
-        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD);
+        for (Int y = iHeight-1; y >= 0; y-- )
+        {
+          Int x = iWidth-1;
+          for ( ; x >= 3; )
+          {
+            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
+            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
+            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
+            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
+          }
+          for( ; x >= 0; x--)
+          {
+            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD);
+          }
+          pSrc0 += iSrc0Stride;
+          pDst  += iDstStride;
+        }
       }
-      pSrc0 += iSrc0Stride;
-      pDst  += iDstStride;
+      else
+      {
+        for (Int y = iHeight-1; y >= 0; y-- )
+        {
+          Int x = iWidth-1;
+          for ( ; x >= 3; )
+          {
+            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
+            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
+            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
+            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
+          }
+          for( ; x >= 0; x--)
+          {
+            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD);
+          }
+          pSrc0 += iSrc0Stride;
+          pDst  += iDstStride;
+        }
+      }
     }
   }
@@ -197,8 +255,8 @@
         TComSlice *const pcSlice  = pcCU->getSlice();
   const Bool             wpBiPred = pcCU->getSlice()->getPPS()->getWPBiPred();
-  const Bool             bBiDir   = (iRefIdx0>=0 && iRefIdx1>=0);
-  const Bool             bUniDir  = !bBiDir;
-
-  if ( bUniDir || wpBiPred )
+  const Bool             bBiPred  = (iRefIdx0>=0 && iRefIdx1>=0);
+  const Bool             bUniPred = !bBiPred;
+
+  if ( bUniPred || wpBiPred )
   { // explicit --------------------
     if ( iRefIdx0 >= 0 )
@@ -228,6 +286,6 @@
   const Bool bUseHighPrecisionPredictionWeighting = pcSlice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag();
 
-  if ( bBiDir )
-  { // Bi-Dir case
+  if ( bBiPred )
+  { // Bi-predictive case
     for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
     {
@@ -252,5 +310,5 @@
   }
   else
-  {  // Unidir
+  {  // UniPred
     WPScalingParam *const pwp = (iRefIdx0>=0) ? wp0 : wp1 ;
 
