[x265] share m_mvpIdx[0] as m_mergeIdx

Satoshi Nakagawa nakagawa424 at oki.com
Thu Mar 6 09:35:00 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1394094546 -32400
#      Thu Mar 06 17:29:06 2014 +0900
# Node ID 2b16b4f07ad924accc6ef070696ddc8d931ef285
# Parent  889edfd2c4c33df368481bb161076da1dcdd8295
share m_mvpIdx[0] as m_mergeIdx

diff -r 889edfd2c4c3 -r 2b16b4f07ad9 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Thu Mar 06 00:00:42 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Thu Mar 06 17:29:06 2014 +0900
@@ -71,7 +71,6 @@
     m_height = NULL;
     m_qp = NULL;
     m_bMergeFlags = NULL;
-    m_mergeIndex = NULL;
     m_lumaIntraDir = NULL;
     m_chromaIntraDir = NULL;
     m_interDir = NULL;
@@ -135,7 +134,6 @@
     CHECKED_MALLOC(m_cuTransquantBypass, bool, numPartition);
 
     CHECKED_MALLOC(m_bMergeFlags, bool,  numPartition);
-    CHECKED_MALLOC(m_mergeIndex, UChar, numPartition);
     CHECKED_MALLOC(m_lumaIntraDir, UChar, numPartition);
     CHECKED_MALLOC(m_chromaIntraDir, UChar, numPartition);
     CHECKED_MALLOC(m_interDir, UChar, numPartition);
@@ -149,8 +147,8 @@
     CHECKED_MALLOC(m_cbf[1], UChar, numPartition);
     CHECKED_MALLOC(m_cbf[2], UChar, numPartition);
 
-    CHECKED_MALLOC(m_mvpIdx[0], char, numPartition);
-    CHECKED_MALLOC(m_mvpIdx[1], char, numPartition);
+    CHECKED_MALLOC(m_mvpIdx[0], uint8_t, numPartition * 2);
+    m_mvpIdx[1] = m_mvpIdx[0] + numPartition;
 
     CHECKED_MALLOC(m_trCoeffY, TCoeff, width * height);
     CHECKED_MALLOC(m_trCoeffCb, TCoeff, (width >> m_hChromaShift) * (height >> m_vChromaShift));
@@ -181,7 +179,6 @@
     X265_FREE(m_cbf[2]);
     X265_FREE(m_interDir);
     X265_FREE(m_bMergeFlags);
-    X265_FREE(m_mergeIndex);
     X265_FREE(m_lumaIntraDir);
     X265_FREE(m_chromaIntraDir);
     X265_FREE(m_trIdx);
@@ -196,7 +193,6 @@
     X265_FREE(m_iPCMSampleCb);
     X265_FREE(m_iPCMSampleCr);
     X265_FREE(m_mvpIdx[0]);
-    X265_FREE(m_mvpIdx[1]);
     X265_FREE(m_cuTransquantBypass);
     X265_FREE(m_skipFlag);
     X265_FREE(m_partSizes);
@@ -260,7 +256,6 @@
         memset(m_height,             g_maxCUHeight, numElements * sizeof(*m_height));
         memset(m_qp,                 qp,            numElements * sizeof(*m_qp));
         memset(m_bMergeFlags,        false,         numElements * sizeof(*m_bMergeFlags));
-        memset(m_mergeIndex,         0,             numElements * sizeof(*m_mergeIndex));
         memset(m_lumaIntraDir,       DC_IDX,        numElements * sizeof(*m_lumaIntraDir));
         memset(m_chromaIntraDir,     0,             numElements * sizeof(*m_chromaIntraDir));
         memset(m_interDir,           0,             numElements * sizeof(*m_interDir));
@@ -506,7 +501,6 @@
     memcpy(m_predModes + offset, cu->getPredictionMode(), sizeof(*m_predModes) * numPartition);
     memcpy(m_cuTransquantBypass + offset, cu->getCUTransquantBypass(), sizeof(*m_cuTransquantBypass) * numPartition);
     memcpy(m_bMergeFlags      + offset, cu->getMergeFlag(),         iSizeInBool);
-    memcpy(m_mergeIndex       + offset, cu->getMergeIndex(),        iSizeInUchar);
     memcpy(m_lumaIntraDir     + offset, cu->getLumaIntraDir(),      iSizeInUchar);
     memcpy(m_chromaIntraDir   + offset, cu->getChromaIntraDir(),    iSizeInUchar);
     memcpy(m_interDir         + offset, cu->getInterDir(),          iSizeInUchar);
@@ -575,7 +569,6 @@
     memcpy(rpcCU->getPredictionMode() + m_absIdxInLCU, m_predModes, sizeof(*m_predModes) * m_numPartitions);
     memcpy(rpcCU->getCUTransquantBypass() + m_absIdxInLCU, m_cuTransquantBypass, sizeof(*m_cuTransquantBypass) * m_numPartitions);
     memcpy(rpcCU->getMergeFlag()         + m_absIdxInLCU, m_bMergeFlags,         iSizeInBool);
-    memcpy(rpcCU->getMergeIndex()        + m_absIdxInLCU, m_mergeIndex,       iSizeInUchar);
     memcpy(rpcCU->getLumaIntraDir()      + m_absIdxInLCU, m_lumaIntraDir,     iSizeInUchar);
     memcpy(rpcCU->getChromaIntraDir()    + m_absIdxInLCU, m_chromaIntraDir,   iSizeInUchar);
     memcpy(rpcCU->getInterDir()          + m_absIdxInLCU, m_interDir,         iSizeInUchar);
@@ -663,7 +656,6 @@
     memcpy(cu->getPredictionMode() + partOffset, m_predModes, sizeof(*m_predModes) * qNumPart);
     memcpy(cu->getCUTransquantBypass() + partOffset, m_cuTransquantBypass, sizeof(*m_cuTransquantBypass) * qNumPart);
     memcpy(cu->getMergeFlag()         + partOffset, m_bMergeFlags,      sizeInBool);
-    memcpy(cu->getMergeIndex()        + partOffset, m_mergeIndex,       sizeInUchar);
     memcpy(cu->getLumaIntraDir()      + partOffset, m_lumaIntraDir,     sizeInUchar);
     memcpy(cu->getChromaIntraDir()    + partOffset, m_chromaIntraDir,   sizeInUchar);
     memcpy(cu->getInterDir()          + partOffset, m_interDir,         sizeInUchar);
diff -r 889edfd2c4c3 -r 2b16b4f07ad9 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Thu Mar 06 00:00:42 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h	Thu Mar 06 17:29:06 2014 +0900
@@ -144,11 +144,10 @@
     // -------------------------------------------------------------------------------------------------------------------
 
     bool*         m_bMergeFlags;      ///< array of merge flags
-    UChar*        m_mergeIndex;       ///< array of merge candidate indices
     UChar*        m_lumaIntraDir;     ///< array of intra directions (luma)
     UChar*        m_chromaIntraDir;   ///< array of intra directions (chroma)
     UChar*        m_interDir;         ///< array of inter directions
-    char*         m_mvpIdx[2];        ///< array of motion vector predictor candidates
+    uint8_t*      m_mvpIdx[2];        ///< array of motion vector predictor candidates or merge candidate indices [0]
     bool*         m_iPCMFlags;        ///< array of intra_pcm flags
 
     // -------------------------------------------------------------------------------------------------------------------
@@ -328,11 +327,11 @@
 
     void          setMergeFlag(uint32_t idx, bool bMergeFlag) { m_bMergeFlags[idx] = bMergeFlag; }
 
-    UChar*        getMergeIndex()                   { return m_mergeIndex; }
+    uint8_t*      getMergeIndex()                   { return m_mvpIdx[0]; }
 
-    UChar         getMergeIndex(uint32_t idx)           { return m_mergeIndex[idx]; }
+    uint8_t       getMergeIndex(uint32_t idx)           { return m_mvpIdx[0][idx]; }
 
-    void          setMergeIndex(uint32_t idx, uint32_t mergeIndex) { m_mergeIndex[idx] = (UChar)mergeIndex; }
+    void          setMergeIndex(uint32_t idx, int mergeIndex) { m_mvpIdx[0][idx] = (uint8_t)mergeIndex; }
 
     template<typename T>
     void          setSubPart(T bParameter, T* pbBaseLCU, uint32_t cuAddr, uint32_t cuDepth, uint32_t puIdx);
@@ -379,11 +378,11 @@
     void          fillMvpCand(uint32_t partIdx, uint32_t partAddr, int picList, int refIdx, AMVPInfo* info);
     bool          isDiffMER(int xN, int yN, int xP, int yP);
     void          getPartPosition(uint32_t partIdx, int& xP, int& yP, int& nPSW, int& nPSH);
-    void          setMVPIdx(int picList, uint32_t idx, int mvpIdx) { m_mvpIdx[picList][idx] = (char)mvpIdx; }
+    void          setMVPIdx(int picList, uint32_t idx, int mvpIdx) { m_mvpIdx[picList][idx] = (uint8_t)mvpIdx; }
 
-    int           getMVPIdx(int picList, uint32_t idx)             { return m_mvpIdx[picList][idx]; }
+    uint8_t       getMVPIdx(int picList, uint32_t idx)             { return m_mvpIdx[picList][idx]; }
 
-    char*         getMVPIdx(int picList)                       { return m_mvpIdx[picList]; }
+    uint8_t*      getMVPIdx(int picList)                       { return m_mvpIdx[picList]; }
 
     void          clipMv(MV& outMV);
 


More information about the x265-devel mailing list