[x265-commits] [x265] search: dump and share the best motion statistics for int...

Gopu Govindaswamy gopu at multicorewareinc.com
Tue Nov 4 19:47:57 CET 2014


details:   http://hg.videolan.org/x265/rev/d5f6133b99d4
branches:  
changeset: 8778:d5f6133b99d4
user:      Gopu Govindaswamy <gopu at multicorewareinc.com>
date:      Tue Nov 04 10:51:50 2014 +0530
description:
search: dump and share the best motion statistics for inter(P&B) slices
Subject: [x265] motion: remove unused sa8d pointer and bufSA8D method

details:   http://hg.videolan.org/x265/rev/59a08101dfc6
branches:  
changeset: 8779:59a08101dfc6
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 04 00:09:50 2014 -0600
description:
motion: remove unused sa8d pointer and bufSA8D method
Subject: [x265] frame: rename m_reconPicYuv -> m_reconPic, m_origPicYuv -> m_fencPic

details:   http://hg.videolan.org/x265/rev/67bf055c13d5
branches:  
changeset: 8780:67bf055c13d5
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 04 11:46:11 2014 -0600
description:
frame: rename m_reconPicYuv -> m_reconPic, m_origPicYuv -> m_fencPic

the fooPicYuv names were potentially confusing, preferred names:
PicYuv* fooPic;
Yuv*    fooYuv;
Subject: [x265] api: add void to functions that take no parameters for -Wstrict-prototypes

details:   http://hg.videolan.org/x265/rev/0d44fcb269a6
branches:  
changeset: 8781:0d44fcb269a6
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 04 12:41:57 2014 -0600
description:
api: add void to functions that take no parameters for -Wstrict-prototypes

diffstat:

 source/common/cudata.h              |    1 +
 source/common/deblock.cpp           |    4 +-
 source/common/frame.cpp             |   38 ++++++------
 source/common/frame.h               |    4 +-
 source/common/framedata.h           |    2 +-
 source/common/predict.cpp           |   40 ++++++------
 source/encoder/analysis.cpp         |   74 +++++++++++++++++++++---
 source/encoder/analysis.h           |    1 +
 source/encoder/api.cpp              |    2 +-
 source/encoder/dpb.cpp              |    6 +-
 source/encoder/encoder.cpp          |   37 +++++++-----
 source/encoder/frameencoder.cpp     |    8 +-
 source/encoder/framefilter.cpp      |   24 ++++----
 source/encoder/motion.cpp           |    1 -
 source/encoder/motion.h             |    3 -
 source/encoder/ratecontrol.cpp      |   14 ++--
 source/encoder/sao.cpp              |   26 ++++----
 source/encoder/search.cpp           |  108 ++++++++++++++++++++++++++++-------
 source/encoder/search.h             |    1 +
 source/encoder/slicetype.cpp        |    4 +-
 source/encoder/weightPrediction.cpp |    8 +-
 source/x265.cpp                     |    6 +-
 source/x265.h                       |    5 +-
 23 files changed, 268 insertions(+), 149 deletions(-)

diffs (truncated from 1177 to 300 lines):

diff -r a8ec469d7fb1 -r 0d44fcb269a6 source/common/cudata.h
--- a/source/common/cudata.h	Mon Nov 03 14:32:14 2014 -0600
+++ b/source/common/cudata.h	Tue Nov 04 12:41:57 2014 -0600
@@ -46,6 +46,7 @@ enum PartSize
     SIZE_2NxnD, // asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2)
     SIZE_nLx2N, // asymmetric motion partition, ( N/2)x2N + (3N/2)x2N
     SIZE_nRx2N, // asymmetric motion partition, (3N/2)x2N + ( N/2)x2N
+    NUM_SIZES,
     SIZE_NONE = 15
 };
 
diff -r a8ec469d7fb1 -r 0d44fcb269a6 source/common/deblock.cpp
--- a/source/common/deblock.cpp	Mon Nov 03 14:32:14 2014 -0600
+++ b/source/common/deblock.cpp	Tue Nov 04 12:41:57 2014 -0600
@@ -444,7 +444,7 @@ static inline void pelFilterChroma(pixel
 
 void Deblock::edgeFilterLuma(CUData* cu, uint32_t absPartIdx, uint32_t depth, int32_t dir, int32_t edge, const uint8_t blockingStrength[])
 {
-    PicYuv* reconYuv = cu->m_encData->m_reconPicYuv;
+    PicYuv* reconYuv = cu->m_encData->m_reconPic;
     pixel* src = reconYuv->getLumaAddr(cu->m_cuAddr, absPartIdx);
 
     intptr_t stride = reconYuv->m_stride;
@@ -559,7 +559,7 @@ void Deblock::edgeFilterChroma(CUData* c
                 : ((g_zscanToPelY[absPartIdx] + edge * UNIT_SIZE) >> cu->m_vChromaShift)) % DEBLOCK_SMALLEST_BLOCK == 0,
                "invalid edge\n");
 
-    PicYuv* reconPic = cu->m_encData->m_reconPicYuv;
+    PicYuv* reconPic = cu->m_encData->m_reconPic;
     intptr_t stride = reconPic->m_strideC;
     intptr_t srcOffset = reconPic->getChromaAddrOffset(cu->m_cuAddr, absPartIdx);
 
diff -r a8ec469d7fb1 -r 0d44fcb269a6 source/common/frame.cpp
--- a/source/common/frame.cpp	Mon Nov 03 14:32:14 2014 -0600
+++ b/source/common/frame.cpp	Tue Nov 04 12:41:57 2014 -0600
@@ -34,7 +34,7 @@ Frame::Frame()
     m_reconRowCount.set(0);
     m_countRefEncoders = 0;
     m_encData = NULL;
-    m_reconPicYuv = NULL;
+    m_reconPic = NULL;
     m_next = NULL;
     m_prev = NULL;
     memset(&m_lowres, 0, sizeof(m_lowres));
@@ -42,26 +42,26 @@ Frame::Frame()
 
 bool Frame::create(x265_param *param)
 {
-    m_origPicYuv = new PicYuv;
+    m_fencPic = new PicYuv;
 
-    return m_origPicYuv->create(param->sourceWidth, param->sourceHeight, param->internalCsp) &&
-           m_lowres.create(m_origPicYuv, param->bframes, !!param->rc.aqMode);
+    return m_fencPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp) &&
+           m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode);
 }
 
 bool Frame::allocEncodeData(x265_param *param, const SPS& sps)
 {
     m_encData = new FrameData;
-    m_reconPicYuv = new PicYuv;
-    m_encData->m_reconPicYuv = m_reconPicYuv;
-    bool ok = m_encData->create(param, sps) && m_reconPicYuv->create(param->sourceWidth, param->sourceHeight, param->internalCsp);
+    m_reconPic = new PicYuv;
+    m_encData->m_reconPic = m_reconPic;
+    bool ok = m_encData->create(param, sps) && m_reconPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp);
     if (ok)
     {
         /* initialize right border of m_reconpicYuv as SAO may read beyond the
          * end of the picture accessing uninitialized pixels */
         int maxHeight = sps.numCuInHeight * g_maxCUSize;
-        memset(m_reconPicYuv->m_picOrg[0], 0, m_reconPicYuv->m_stride * maxHeight);
-        memset(m_reconPicYuv->m_picOrg[1], 0, m_reconPicYuv->m_strideC * (maxHeight >> m_reconPicYuv->m_vChromaShift));
-        memset(m_reconPicYuv->m_picOrg[2], 0, m_reconPicYuv->m_strideC * (maxHeight >> m_reconPicYuv->m_vChromaShift));
+        memset(m_reconPic->m_picOrg[0], 0, m_reconPic->m_stride * maxHeight);
+        memset(m_reconPic->m_picOrg[1], 0, m_reconPic->m_strideC * (maxHeight >> m_reconPic->m_vChromaShift));
+        memset(m_reconPic->m_picOrg[2], 0, m_reconPic->m_strideC * (maxHeight >> m_reconPic->m_vChromaShift));
     }
     return ok;
 }
@@ -70,7 +70,7 @@ bool Frame::allocEncodeData(x265_param *
 void Frame::reinit(const SPS& sps)
 {
     m_bChromaExtended = false;
-    m_reconPicYuv = m_encData->m_reconPicYuv;
+    m_reconPic = m_encData->m_reconPic;
     m_encData->reinit(sps);
 }
 
@@ -83,18 +83,18 @@ void Frame::destroy()
         m_encData = NULL;
     }
 
-    if (m_origPicYuv)
+    if (m_fencPic)
     {
-        m_origPicYuv->destroy();
-        delete m_origPicYuv;
-        m_origPicYuv = NULL;
+        m_fencPic->destroy();
+        delete m_fencPic;
+        m_fencPic = NULL;
     }
 
-    if (m_reconPicYuv)
+    if (m_reconPic)
     {
-        m_reconPicYuv->destroy();
-        delete m_reconPicYuv;
-        m_reconPicYuv = NULL;
+        m_reconPic->destroy();
+        delete m_reconPic;
+        m_reconPic = NULL;
     }
 
     m_lowres.destroy();
diff -r a8ec469d7fb1 -r 0d44fcb269a6 source/common/frame.h
--- a/source/common/frame.h	Mon Nov 03 14:32:14 2014 -0600
+++ b/source/common/frame.h	Tue Nov 04 12:41:57 2014 -0600
@@ -44,10 +44,10 @@ public:
     /* These two items will be NULL until the Frame begins to be encoded, at which point
      * it will be assigned a FrameData instance, which comes with a reconstructed image PicYuv */
     FrameData*        m_encData;
-    PicYuv*           m_reconPicYuv;
+    PicYuv*           m_reconPic;
 
     /* Data associated with x265_picture */
-    PicYuv*           m_origPicYuv;
+    PicYuv*           m_fencPic;
     int               m_poc;
     int64_t           m_pts;                // user provided presentation time stamp
     int64_t           m_reorderedPts;
diff -r a8ec469d7fb1 -r 0d44fcb269a6 source/common/framedata.h
--- a/source/common/framedata.h	Mon Nov 03 14:32:14 2014 -0600
+++ b/source/common/framedata.h	Tue Nov 04 12:41:57 2014 -0600
@@ -49,7 +49,7 @@ public:
     x265_param*    m_param;
 
     FrameData*     m_freeListNext;
-    PicYuv*        m_reconPicYuv;
+    PicYuv*        m_reconPic;
     bool           m_bHasReferences;   /* used during DPB/RPS updates */
     int            m_frameEncoderID;   /* the ID of the FrameEncoder encoding this frame */
 
diff -r a8ec469d7fb1 -r 0d44fcb269a6 source/common/predict.cpp
--- a/source/common/predict.cpp	Mon Nov 03 14:32:14 2014 -0600
+++ b/source/common/predict.cpp	Tue Nov 04 12:41:57 2014 -0600
@@ -187,18 +187,18 @@ void Predict::motionCompensation(Yuv& pr
             ShortYuv& shortYuv = m_predShortYuv[0];
 
             if (bLuma)
-                predInterLumaShort(shortYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
+                predInterLumaShort(shortYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
             if (bChroma)
-                predInterChromaShort(shortYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
+                predInterChromaShort(shortYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
 
             addWeightUni(predYuv, shortYuv, wv0, bLuma, bChroma);
         }
         else
         {
             if (bLuma)
-                predInterLumaPixel(predYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
+                predInterLumaPixel(predYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
             if (bChroma)
-                predInterChromaPixel(predYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
+                predInterChromaPixel(predYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
         }
     }
     else
@@ -253,13 +253,13 @@ void Predict::motionCompensation(Yuv& pr
 
             if (bLuma)
             {
-                predInterLumaShort(m_predShortYuv[0], *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
-                predInterLumaShort(m_predShortYuv[1], *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPicYuv, m_clippedMv[1]);
+                predInterLumaShort(m_predShortYuv[0], *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
+                predInterLumaShort(m_predShortYuv[1], *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPic, m_clippedMv[1]);
             }
             if (bChroma)
             {
-                predInterChromaShort(m_predShortYuv[0], *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
-                predInterChromaShort(m_predShortYuv[1], *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPicYuv, m_clippedMv[1]);
+                predInterChromaShort(m_predShortYuv[0], *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
+                predInterChromaShort(m_predShortYuv[1], *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPic, m_clippedMv[1]);
             }
 
             if (pwp0 && pwp1 && (pwp0->bPresentFlag || pwp1->bPresentFlag))
@@ -277,18 +277,18 @@ void Predict::motionCompensation(Yuv& pr
                 ShortYuv& shortYuv = m_predShortYuv[0];
 
                 if (bLuma)
-                    predInterLumaShort(shortYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
+                    predInterLumaShort(shortYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
                 if (bChroma)
-                    predInterChromaShort(shortYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
+                    predInterChromaShort(shortYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
 
                 addWeightUni(predYuv, shortYuv, wv0, bLuma, bChroma);
             }
             else
             {
                 if (bLuma)
-                    predInterLumaPixel(predYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
+                    predInterLumaPixel(predYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
                 if (bChroma)
-                    predInterChromaPixel(predYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPicYuv, m_clippedMv[0]);
+                    predInterChromaPixel(predYuv, *m_predSlice->m_refPicList[0][m_refIdx0]->m_reconPic, m_clippedMv[0]);
             }
         }
         else
@@ -302,18 +302,18 @@ void Predict::motionCompensation(Yuv& pr
                 ShortYuv& shortYuv = m_predShortYuv[0];
 
                 if (bLuma)
-                    predInterLumaShort(shortYuv, *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPicYuv, m_clippedMv[1]);
+                    predInterLumaShort(shortYuv, *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPic, m_clippedMv[1]);
                 if (bChroma)
-                    predInterChromaShort(shortYuv, *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPicYuv, m_clippedMv[1]);
+                    predInterChromaShort(shortYuv, *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPic, m_clippedMv[1]);
 
                 addWeightUni(predYuv, shortYuv, wv0, bLuma, bChroma);
             }
             else
             {
                 if (bLuma)
-                    predInterLumaPixel(predYuv, *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPicYuv, m_clippedMv[1]);
+                    predInterLumaPixel(predYuv, *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPic, m_clippedMv[1]);
                 if (bChroma)
-                    predInterChromaPixel(predYuv, *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPicYuv, m_clippedMv[1]);
+                    predInterChromaPixel(predYuv, *m_predSlice->m_refPicList[1][m_refIdx1]->m_reconPic, m_clippedMv[1]);
             }
         }
     }
@@ -668,8 +668,8 @@ void Predict::initAdiPattern(const CUDat
     int tuSize = intraNeighbors.tuSize;
     int tuSize2 = tuSize << 1;
 
-    pixel* adiOrigin = cu.m_encData->m_reconPicYuv->getLumaAddr(cu.m_cuAddr, cuGeom.encodeIdx + absPartIdx);
-    intptr_t picStride = cu.m_encData->m_reconPicYuv->m_stride;
+    pixel* adiOrigin = cu.m_encData->m_reconPic->getLumaAddr(cu.m_cuAddr, cuGeom.encodeIdx + absPartIdx);
+    intptr_t picStride = cu.m_encData->m_reconPic->m_stride;
 
     fillReferenceSamples(adiOrigin, picStride, adiBuf, intraNeighbors);
 
@@ -744,8 +744,8 @@ void Predict::initAdiPatternChroma(const
     initIntraNeighbors(cu, absPartIdx, partDepth, false, &intraNeighbors);
     uint32_t tuSize = intraNeighbors.tuSize;
 
-    const pixel* adiOrigin = cu.m_encData->m_reconPicYuv->getChromaAddr(chromaId, cu.m_cuAddr, cuGeom.encodeIdx + absPartIdx);
-    intptr_t picStride = cu.m_encData->m_reconPicYuv->m_strideC;
+    const pixel* adiOrigin = cu.m_encData->m_reconPic->getChromaAddr(chromaId, cu.m_cuAddr, cuGeom.encodeIdx + absPartIdx);
+    intptr_t picStride = cu.m_encData->m_reconPic->m_strideC;
     pixel* adiRef = getAdiChromaBuf(chromaId, tuSize);
 
     fillReferenceSamples(adiOrigin, picStride, adiRef, intraNeighbors);
diff -r a8ec469d7fb1 -r 0d44fcb269a6 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Mon Nov 03 14:32:14 2014 -0600
+++ b/source/encoder/analysis.cpp	Tue Nov 04 12:41:57 2014 -0600
@@ -124,7 +124,7 @@ Mode& Analysis::compressCTU(CUData& ctu,
     invalidateContexts(0);
     m_quant.setQPforQuant(ctu);
     m_rqt[0].cur.load(initialContext);
-    m_modeDepth[0].fencYuv.copyFromPicYuv(*m_frame->m_origPicYuv, ctu.m_cuAddr, 0);
+    m_modeDepth[0].fencYuv.copyFromPicYuv(*m_frame->m_fencPic, ctu.m_cuAddr, 0);
 
     uint32_t numPartition = ctu.m_numPartitions;
     if (m_slice->m_sliceType == I_SLICE)
@@ -149,11 +149,14 @@ Mode& Analysis::compressCTU(CUData& ctu,
     }
     else
     {
+        if (m_param->analysisMode)
+            m_interAnalysisData = m_frame->m_interData + (ctu.m_cuAddr * (CUGeom::MAX_GEOMS * NUM_SIZES));
+
         if (!m_param->rdLevel)
         {
             /* In RD Level 0/1, copy source pixels into the reconstructed block so
              * they are available for intra predictions */
-            m_modeDepth[0].fencYuv.copyToPicYuv(*m_frame->m_reconPicYuv, ctu.m_cuAddr, 0);
+            m_modeDepth[0].fencYuv.copyToPicYuv(*m_frame->m_reconPic, ctu.m_cuAddr, 0);
             
             compressInterCU_rd0_4(ctu, cuGeom);
 
@@ -300,7 +303,7 @@ void Analysis::compressIntraCU(const CUD
     /* Copy best data to encData CTU and recon */
     md.bestMode->cu.copyToPic(depth);
     if (md.bestMode != &md.pred[PRED_SPLIT])
-        md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPicYuv, parentCTU.m_cuAddr, cuGeom.encodeIdx);
+        md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPic, parentCTU.m_cuAddr, cuGeom.encodeIdx);
 }
 
 bool Analysis::findJob(int threadId)
@@ -349,7 +352,7 @@ void Analysis::parallelME(int threadId, 
         slave->m_slice = m_slice;
         slave->m_frame = m_frame;
 
-        PicYuv* fencPic = m_frame->m_origPicYuv;
+        PicYuv* fencPic = m_frame->m_fencPic;
         pixel* pu = fencPic->getLumaAddr(m_curInterMode->cu.m_cuAddr, m_curGeom->encodeIdx + m_puAbsPartIdx);


More information about the x265-commits mailing list