Index: /trunk/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 117)
+++ /trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 118)
@@ -243,5 +243,5 @@
   UInt          m_uiPartInfo[OL_PART_BUF_SIZE][2];
   UInt          m_uiPartNum;
-  Bool          b_dumpPartInfo;
+  Bool          m_dumpPartInfo;
 #endif 
   
@@ -610,6 +610,6 @@
   Void        updatePartInfo(UInt uiSymbol, UInt uiDepth) { m_uiPartInfo[m_uiPartNum][0] = uiSymbol; m_uiPartInfo[m_uiPartNum][1] = uiDepth;};
   UInt*       readPartInfo()                              { return (UInt*)m_uiPartInfo;};
-  Void        setPartDumpFlag(Bool flag)                  { b_dumpPartInfo = flag; };
-  Bool        getPartDumpFlag()                           { return b_dumpPartInfo; };
+  Void        setPartDumpFlag(Bool flag)                  { m_dumpPartInfo = flag; };
+  Bool        getPartDumpFlag()                           { return m_dumpPartInfo; };
 #endif
   
Index: /trunk/source/Lib/TLibCommon/TComYuv.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComYuv.cpp	(revision 117)
+++ /trunk/source/Lib/TLibCommon/TComYuv.cpp	(revision 118)
@@ -711,19 +711,20 @@
   getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset);
 
-  for ( y = uiPartSize-1; y >= iYOffset; y-- )
-  {
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
+#if FIX_LG_RESTRICTEDRESPRED_M24766
+  for ( y = 0; y < iYOffset; y++ )
+  {
+    if(iPUResiPredShift[0] >= 0)
+    {
+      for ( x = 0; x < iXOffset; x++ )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[0]);
+      }
+    }
+
+    if(iPUResiPredShift[1] >= 0)
+    {
+      for ( x = iXOffset; x < uiPartSize; x++ )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[1]);
       }
     }
@@ -733,19 +734,19 @@
   }
 
-  for ( y = iYOffset-1; y >= 0; y-- )
-  {
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+  for ( y = iYOffset; y < uiPartSize; y++ )
+  {
+    if(iPUResiPredShift[2] >= 0)
+    {
+      for ( x = 0; x < iXOffset; x++ )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
+      }
+    }
+
+    if(iPUResiPredShift[3] >= 0)
+    {
+      for ( x = iXOffset; x < uiPartSize; x++ )
       {
         pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
       }
     }
@@ -754,5 +755,49 @@
     pDst  += iDstStride;
   }
-
+#else
+  for ( y = uiPartSize-1; y >= iYOffset; y-- )
+  {
+    if(iPUResiPredShift[3] >= 0)
+    {
+      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
+      }
+    }
+
+    if(iPUResiPredShift[2] >= 0)
+    {
+      for ( x = iXOffset-1; x >= 0; x-- )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
+      }
+    }
+    pSrc0 += iSrc0Stride;
+    pSrc1 += iSrc1Stride;
+    pDst  += iDstStride;
+  }
+
+  for ( y = iYOffset-1; y >= 0; y-- )
+  {
+    if(iPUResiPredShift[1] >= 0)
+    {
+      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
+      }
+    }
+
+    if(iPUResiPredShift[0] >= 0)
+    {
+      for ( x = iXOffset-1; x >= 0; x-- )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
+      }
+    }
+    pSrc0 += iSrc0Stride;
+    pSrc1 += iSrc1Stride;
+    pDst  += iDstStride;
+  }
+#endif
 #else
   for ( y = uiPartSize-1; y >= 0; y-- )
@@ -792,21 +837,22 @@
   getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset);
 
-  for ( y = uiPartSize-1; y >= iYOffset; y-- )
-  {
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
+#if FIX_LG_RESTRICTEDRESPRED_M24766
+  for ( y = 0; y < iYOffset; y++ )
+  {
+    if(iPUResiPredShift[0] >= 0)
+    {
+      for ( x = 0; x < iXOffset; x++ )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
+      }
+    }
+
+    if(iPUResiPredShift[1] >= 0)
+    {
+      for ( x = iXOffset; x < uiPartSize; x++ )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
       }
     }
@@ -819,21 +865,21 @@
   }
 
-  for ( y = iYOffset-1; y >= 0; y-- )
-  {
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
-      }
-    }
-
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
+  for ( y = iYOffset; y < uiPartSize; y++ )
+  {
+    if(iPUResiPredShift[2] >= 0)
+    {
+      for ( x = 0; x < iXOffset; x++ )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
+      }
+    }
+
+    if(iPUResiPredShift[3] >= 0)
+    {
+      for ( x = iXOffset; x < uiPartSize; x++ )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
       }
     }
@@ -845,4 +891,59 @@
     pDstV  += iDstStride;
   }
+#else
+  for ( y = uiPartSize-1; y >= iYOffset; y-- )
+  {
+    if(iPUResiPredShift[3] >= 0)
+    {
+      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
+      }
+    }
+
+    if(iPUResiPredShift[2] >= 0)
+    {
+      for ( x = iXOffset-1; x >= 0; x-- )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
+      }
+    }
+    pSrcU0 += iSrc0Stride;
+    pSrcU1 += iSrc1Stride;
+    pSrcV0 += iSrc0Stride;
+    pSrcV1 += iSrc1Stride;
+    pDstU  += iDstStride;
+    pDstV  += iDstStride;
+  }
+
+  for ( y = iYOffset-1; y >= 0; y-- )
+  {
+    if(iPUResiPredShift[1] >= 0)
+    {
+      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
+      }
+    }
+
+    if(iPUResiPredShift[0] >= 0)
+    {
+      for ( x = iXOffset-1; x >= 0; x-- )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
+      }
+    }
+    pSrcU0 += iSrc0Stride;
+    pSrcU1 += iSrc1Stride;
+    pSrcV0 += iSrc0Stride;
+    pSrcV1 += iSrc1Stride;
+    pDstU  += iDstStride;
+    pDstV  += iDstStride;
+  }
+#endif
 #else
   for ( y = uiPartSize-1; y >= 0; y-- )
Index: /trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TypeDef.h	(revision 117)
+++ /trunk/source/Lib/TLibCommon/TypeDef.h	(revision 118)
@@ -48,4 +48,6 @@
 #define FIX_VIRT_DESTRUCTOR               1
 
+#define FIX_LG_RESTRICTEDRESPRED_M24766   1
+
 
 #define LGE_EDGE_INTRA                    1   // JCT2-A0070
