[x265] [PATCH 1 of 4] Used cached MotionReference pointers in Prediction

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Thu Aug 1 14:23:34 CEST 2013


# HG changeset patch
# User Shazeb N Khan
# Date 1375352595 -19800
#      Thu Aug 01 15:53:15 2013 +0530
# Node ID c48788bcc946082f9bacc731c29085717b969c8b
# Parent  6a66dfc449bc0de03db82a590210b911d6787394
Used cached MotionReference pointers in Prediction

diff -r 6a66dfc449bc -r c48788bcc946 source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Thu Aug 01 11:33:03 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Thu Aug 01 15:53:15 2013 +0530
@@ -318,7 +318,8 @@
     MV mv = cu->getCUMvField(picList)->getMv(partAddr);
     cu->clipMv(mv);
 
-    xPredInterLumaBlk(cu, cu->getSlice()->getRefPic(picList, refIdx)->getPicYuvRec(), partAddr, &mv, width, height, outPredYuv);
+    xPredInterLumaBlk(cu, cu->getSlice()->m_mref[picList][refIdx], partAddr, &mv, width, height, outPredYuv);
+
     xPredInterChromaBlk(cu, cu->getSlice()->getRefPic(picList, refIdx)->getPicYuvRec(), partAddr, &mv, width, height, outPredYuv);
 }
 
@@ -437,11 +438,10 @@
  * \param dstPic   Pointer to destination picture
  * \param bi       Flag indicating whether bipred is used
  */
-Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, MV *mv, Int width, Int height, TComYuv *dstPic)
+Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, x265::MotionReference *ref, UInt partAddr, MV *mv, Int width, Int height, TComYuv *dstPic)
 {
     //assert(bi == false);
-
-    Int refStride = refPic->getStride();
+    Int refStride = ref->m_lumaStride;
     Int refOffset = (mv->x >> 2) + (mv->y >> 2) * refStride;
 
     Int dstStride = dstPic->getStride();
@@ -449,9 +449,10 @@
 
     Int xFrac = mv->x & 0x3;
     Int yFrac = mv->y & 0x3;
-
-    Pel* src = refPic->getLumaFilterBlock(yFrac, xFrac, cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
-    Int srcStride = refPic->getStride();
+    TComPicYuv* pic = cu->getSlice()->getPic()->getPicYuvOrg();
+    Int blkOffset = pic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) - pic->getLumaAddr();
+    Pel* src = ref->m_lumaPlane[xFrac][yFrac] + blkOffset + refOffset;
+    Int srcStride = refStride;
 
     x265::primitives.blockcpy_pp(width, height, dst, dstStride, src, srcStride);
 }
diff -r 6a66dfc449bc -r c48788bcc946 source/Lib/TLibCommon/TComPrediction.h
--- a/source/Lib/TLibCommon/TComPrediction.h	Thu Aug 01 11:33:03 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.h	Thu Aug 01 15:53:15 2013 +0530
@@ -45,6 +45,7 @@
 #include "TComTrQuant.h"
 #include "TComWeightPrediction.h"
 #include "TShortYUV.h"
+#include "reference.h"
 
 //! \ingroup TLibCommon
 //! \{
@@ -80,7 +81,7 @@
     // motion compensation functions
     Void xPredInterUni(TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList picList, TComYuv* outPredYuv);
     Void xPredInterUni(TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList picList, TShortYUV* outPredYuv);
-    Void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, x265::MV *mv, Int width, Int height, TComYuv *dstPic);
+    Void xPredInterLumaBlk(TComDataCU *cu, x265::MotionReference *refPic, UInt partAddr, x265::MV *mv, Int width, Int height, TComYuv *dstPic);
     Void xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, x265::MV *mv, Int width, Int height, TShortYUV *dstPic);
     Void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, x265::MV *mv, Int width, Int height, TComYuv *dstPic);
     Void xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, x265::MV *mv, Int width, Int height, TShortYUV *dstPic);
diff -r 6a66dfc449bc -r c48788bcc946 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Aug 01 11:33:03 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Aug 01 15:53:15 2013 +0530
@@ -3271,16 +3271,16 @@
     cu->clipMv(mvCand);
 
     // prediction pattern
-    TComPicYuv* frefYuv = cu->getSlice()->getRefPic(picList, refIfx)->getPicYuvRec();
+    MotionReference* ref = cu->getSlice()->m_mref[picList][refIfx];
     if (cu->getSlice()->getPPS()->getUseWP() && cu->getSlice()->getSliceType() == P_SLICE)
     {
         TShortYUV *mbYuv = &m_predShortYuv[0];
-        xPredInterLumaBlk(cu, frefYuv, partAddr, &mvCand, sizex, sizey, mbYuv);
+        xPredInterLumaBlk(cu, cu->getSlice()->getRefPic(picList, refIfx)->getPicYuvRec(), partAddr, &mvCand, sizex, sizey, mbYuv);
         xWeightedPredictionUni(cu, mbYuv, partAddr, sizex, sizey, picList, templateCand, refIfx);
     }
     else
     {
-        xPredInterLumaBlk(cu, frefYuv, partAddr, &mvCand, sizex, sizey, templateCand);
+        xPredInterLumaBlk(cu, ref, partAddr, &mvCand, sizex, sizey, templateCand);
     }
 
     // calc distortion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265-1.patch
Type: text/x-patch
Size: 4754 bytes
Desc: not available
URL: <http://mailman.videolan.org/private/x265-devel/attachments/20130801/ee1662b1/attachment.bin>


More information about the x265-devel mailing list