[x265] cleanup CUData::m_skipFlag

Deepthi Nandakumar deepthi at multicorewareinc.com
Mon Nov 3 09:21:38 CET 2014


On Mon, Nov 3, 2014 at 1:35 PM, Satoshi Nakagawa <nakagawa424 at oki.com>
wrote:

> # HG changeset patch
> # User Satoshi Nakagawa <nakagawa424 at oki.com>
> # Date 1415001734 -32400
> #      Mon Nov 03 17:02:14 2014 +0900
> # Node ID ef411645295a51cf276e7830d9a98ffe50d85f63
> # Parent  eebb372eec893efc50e66806fcc19b1c1bd89683
> cleanup CUData::m_skipFlag
>
> diff -r eebb372eec89 -r ef411645295a source/common/cudata.cpp
> --- a/source/common/cudata.cpp  Fri Oct 31 16:29:20 2014 -0500
> +++ b/source/common/cudata.cpp  Mon Nov 03 17:02:14 2014 +0900
> @@ -230,13 +230,12 @@
>      m_qp          = (char*)charBuf; charBuf += m_numPartitions;
>      m_log2CUSize         = charBuf; charBuf += m_numPartitions;
>      m_partSize           = charBuf; charBuf += m_numPartitions;
> -    m_predMode           = charBuf; charBuf += m_numPartitions;
>      m_lumaIntraDir       = charBuf; charBuf += m_numPartitions;
>      m_tqBypass           = charBuf; charBuf += m_numPartitions;
>      m_refIdx[0]   = (char*)charBuf; charBuf += m_numPartitions;
>      m_refIdx[1]   = (char*)charBuf; charBuf += m_numPartitions;
>      m_cuDepth            = charBuf; charBuf += m_numPartitions;
> -    m_skipFlag           = charBuf; charBuf += m_numPartitions; /* the
> order up to here is important in initCTU() and initSubCU() */
> +    m_predMode           = charBuf; charBuf += m_numPartitions; /* the
> order up to here is important in initCTU() and initSubCU() */
>      m_mergeFlag          = charBuf; charBuf += m_numPartitions;
>      m_interDir           = charBuf; charBuf += m_numPartitions;
>      m_mvpIdx[0]          = charBuf; charBuf += m_numPartitions;
> @@ -279,7 +278,6 @@
>      m_partSet((uint8_t*)m_qp, (uint8_t)qp);
>      m_partSet(m_log2CUSize,   (uint8_t)g_maxLog2CUSize);
>      m_partSet(m_partSize,     (uint8_t)SIZE_NONE);
> -    m_partSet(m_predMode,     (uint8_t)MODE_NONE);
>      m_partSet(m_lumaIntraDir, (uint8_t)DC_IDX);
>      m_partSet(m_tqBypass,
>  (uint8_t)frame.m_encData->m_param->bLossless);
>      if (m_slice->m_sliceType != I_SLICE)
> @@ -291,7 +289,7 @@
>      X265_CHECK(!(frame.m_encData->m_param->bLossless &&
> !m_slice->m_pps->bTransquantBypassEnabled), "lossless enabled without
> TQbypass in PPS\n");
>
>      /* initialize the remaining CU data in one memset */
> -    memset(m_cuDepth, 0, (BytesPerPartition - 8) * m_numPartitions);
> +    memset(m_cuDepth, 0, (BytesPerPartition - 7) * m_numPartitions);
>
>      uint32_t widthInCU = m_slice->m_sps->numCuInWidth;
>      m_cuLeft = (m_cuAddr % widthInCU) ? m_encData->getPicCTU(m_cuAddr -
> 1) : NULL;
> @@ -319,7 +317,6 @@
>      m_partSet((uint8_t*)m_qp, (uint8_t)ctu.m_qp[0]);
>      m_partSet(m_log2CUSize,   (uint8_t)cuGeom.log2CUSize);
>      m_partSet(m_partSize,     (uint8_t)SIZE_NONE);
> -    m_partSet(m_predMode,     (uint8_t)MODE_NONE);
>      m_partSet(m_lumaIntraDir, (uint8_t)DC_IDX);
>      m_partSet(m_tqBypass,     (uint8_t)m_encData->m_param->bLossless);
>      m_partSet((uint8_t*)m_refIdx[0], (uint8_t)REF_NOT_VALID);
> @@ -327,7 +324,7 @@
>      m_partSet(m_cuDepth,      (uint8_t)cuGeom.depth);
>
>      /* initialize the remaining CU data in one memset */
> -    memset(m_skipFlag, 0, (BytesPerPartition - 9) * m_numPartitions);
> +    memset(m_predMode, 0, (BytesPerPartition - 8) * m_numPartitions);
>  }
>
>  /* Copy the results of a sub-part (split) CU to the parent CU */
> @@ -340,13 +337,12 @@
>      m_subPartCopy((uint8_t*)m_qp + offset, (uint8_t*)subCU.m_qp);
>      m_subPartCopy(m_log2CUSize + offset, subCU.m_log2CUSize);
>      m_subPartCopy(m_partSize + offset, subCU.m_partSize);
> -    m_subPartCopy(m_predMode + offset, subCU.m_predMode);
>      m_subPartCopy(m_lumaIntraDir + offset, subCU.m_lumaIntraDir);
>      m_subPartCopy(m_tqBypass + offset, subCU.m_tqBypass);
>      m_subPartCopy((uint8_t*)m_refIdx[0] + offset,
> (uint8_t*)subCU.m_refIdx[0]);
>      m_subPartCopy((uint8_t*)m_refIdx[1] + offset,
> (uint8_t*)subCU.m_refIdx[1]);
>      m_subPartCopy(m_cuDepth + offset, subCU.m_cuDepth);
> -    m_subPartCopy(m_skipFlag + offset, subCU.m_skipFlag);
> +    m_subPartCopy(m_predMode + offset, subCU.m_predMode);
>      m_subPartCopy(m_mergeFlag + offset, subCU.m_mergeFlag);
>      m_subPartCopy(m_interDir + offset, subCU.m_interDir);
>      m_subPartCopy(m_mvpIdx[0] + offset, subCU.m_mvpIdx[0]);
> @@ -410,7 +406,7 @@
>      m_partSet(m_tqBypass, true);
>
>      /* clear residual coding flags */
> -    m_partSet(m_skipFlag, 0);
> +    m_partSet(m_predMode, cu.m_predMode[0] & (MODE_INTRA | MODE_INTER));
>      m_partSet(m_tuDepth, 0);
>      m_partSet(m_transformSkip[0], 0);
>      m_partSet(m_transformSkip[1], 0);
> @@ -428,13 +424,12 @@
>      m_partCopy((uint8_t*)ctu.m_qp + m_absIdxInCTU, (uint8_t*)m_qp);
>      m_partCopy(ctu.m_log2CUSize + m_absIdxInCTU, m_log2CUSize);
>      m_partCopy(ctu.m_partSize + m_absIdxInCTU, m_partSize);
> -    m_partCopy(ctu.m_predMode + m_absIdxInCTU, m_predMode);
>      m_partCopy(ctu.m_lumaIntraDir + m_absIdxInCTU, m_lumaIntraDir);
>      m_partCopy(ctu.m_tqBypass + m_absIdxInCTU, m_tqBypass);
>      m_partCopy((uint8_t*)ctu.m_refIdx[0] + m_absIdxInCTU,
> (uint8_t*)m_refIdx[0]);
>      m_partCopy((uint8_t*)ctu.m_refIdx[1] + m_absIdxInCTU,
> (uint8_t*)m_refIdx[1]);
>      m_partCopy(ctu.m_cuDepth + m_absIdxInCTU, m_cuDepth);
> -    m_partCopy(ctu.m_skipFlag + m_absIdxInCTU, m_skipFlag);
> +    m_partCopy(ctu.m_predMode + m_absIdxInCTU, m_predMode);
>      m_partCopy(ctu.m_mergeFlag + m_absIdxInCTU, m_mergeFlag);
>      m_partCopy(ctu.m_interDir + m_absIdxInCTU, m_interDir);
>      m_partCopy(ctu.m_mvpIdx[0] + m_absIdxInCTU, m_mvpIdx[0]);
> @@ -478,7 +473,6 @@
>      m_partCopy((uint8_t*)m_qp, (uint8_t*)ctu.m_qp + m_absIdxInCTU);
>      m_partCopy(m_log2CUSize,   ctu.m_log2CUSize + m_absIdxInCTU);
>      m_partCopy(m_partSize,     ctu.m_partSize + m_absIdxInCTU);
> -    m_partCopy(m_predMode,     ctu.m_predMode + m_absIdxInCTU);
>      m_partCopy(m_lumaIntraDir, ctu.m_lumaIntraDir + m_absIdxInCTU);
>      m_partCopy(m_tqBypass,     ctu.m_tqBypass + m_absIdxInCTU);
>      m_partCopy((uint8_t*)m_refIdx[0], (uint8_t*)ctu.m_refIdx[0] +
> m_absIdxInCTU);
> @@ -496,7 +490,7 @@
>      memcpy(m_mvd[1], ctu.m_mvd[1] + m_absIdxInCTU, m_numPartitions *
> sizeof(MV));
>
>      /* clear residual coding flags */
> -    m_partSet(m_skipFlag, 0);
> +    m_partSet(m_predMode, ctu.m_predMode[m_absIdxInCTU] & (MODE_INTRA |
> MODE_INTER));
>      m_partSet(m_tuDepth, 0);
>      m_partSet(m_transformSkip[0], 0);
>      m_partSet(m_transformSkip[1], 0);
> @@ -515,7 +509,7 @@
>      m_partCopy(ctu.m_transformSkip[0] + m_absIdxInCTU,
> m_transformSkip[0]);
>      m_partCopy(ctu.m_transformSkip[1] + m_absIdxInCTU,
> m_transformSkip[1]);
>      m_partCopy(ctu.m_transformSkip[2] + m_absIdxInCTU,
> m_transformSkip[2]);
> -    m_partCopy(ctu.m_skipFlag + m_absIdxInCTU, m_skipFlag);
> +    m_partCopy(ctu.m_predMode + m_absIdxInCTU, m_predMode);
>      m_partCopy(ctu.m_tuDepth + m_absIdxInCTU, m_tuDepth);
>      m_partCopy(ctu.m_cbf[0] + m_absIdxInCTU, m_cbf[0]);
>      m_partCopy(ctu.m_cbf[1] + m_absIdxInCTU, m_cbf[1]);
> @@ -1441,7 +1435,7 @@
>      bool isAvailableA1 = cuLeft &&
>          cuLeft->isDiffMER(xP - 1, yP + nPSH - 1, xP, yP) &&
>          !(puIdx == 1 && (curPS == SIZE_Nx2N || curPS == SIZE_nLx2N ||
> curPS == SIZE_nRx2N)) &&
> -        !cuLeft->isIntra(leftPartIdx);
> +        cuLeft->isInter(leftPartIdx);
>      if (isAvailableA1)
>      {
>          // get Inter Dir
> @@ -1465,7 +1459,7 @@
>      bool isAvailableB1 = cuAbove &&
>          cuAbove->isDiffMER(xP + nPSW - 1, yP - 1, xP, yP) &&
>          !(puIdx == 1 && (curPS == SIZE_2NxN || curPS == SIZE_2NxnU ||
> curPS == SIZE_2NxnD)) &&
> -        !cuAbove->isIntra(abovePartIdx);
> +        cuAbove->isInter(abovePartIdx);
>      if (isAvailableB1 && (!isAvailableA1 ||
> !cuLeft->hasEqualMotion(leftPartIdx, *cuAbove, abovePartIdx)))
>      {
>          // get Inter Dir
> @@ -1486,7 +1480,7 @@
>      const CUData* cuAboveRight = getPUAboveRight(aboveRightPartIdx,
> partIdxRT);
>      bool isAvailableB0 = cuAboveRight &&
>          cuAboveRight->isDiffMER(xP + nPSW, yP - 1, xP, yP) &&
> -        !cuAboveRight->isIntra(aboveRightPartIdx);
> +        cuAboveRight->isInter(aboveRightPartIdx);
>      if (isAvailableB0 && (!isAvailableB1 ||
> !cuAbove->hasEqualMotion(abovePartIdx, *cuAboveRight, aboveRightPartIdx)))
>      {
>          // get Inter Dir
> @@ -1507,7 +1501,7 @@
>      const CUData* cuLeftBottom = this->getPUBelowLeft(leftBottomPartIdx,
> partIdxLB);
>      bool isAvailableA0 = cuLeftBottom &&
>          cuLeftBottom->isDiffMER(xP - 1, yP + nPSH, xP, yP) &&
> -        !cuLeftBottom->isIntra(leftBottomPartIdx);
> +        cuLeftBottom->isInter(leftBottomPartIdx);
>      if (isAvailableA0 && (!isAvailableA1 ||
> !cuLeft->hasEqualMotion(leftPartIdx, *cuLeftBottom, leftBottomPartIdx)))
>      {
>          // get Inter Dir
> @@ -1530,7 +1524,7 @@
>          const CUData* cuAboveLeft = getPUAboveLeft(aboveLeftPartIdx,
> absPartAddr);
>          bool isAvailableB2 = cuAboveLeft &&
>              cuAboveLeft->isDiffMER(xP - 1, yP - 1, xP, yP) &&
> -            !cuAboveLeft->isIntra(aboveLeftPartIdx);
> +            cuAboveLeft->isInter(aboveLeftPartIdx);
>          if (isAvailableB2 && (!isAvailableA1 ||
> !cuLeft->hasEqualMotion(leftPartIdx, *cuAboveLeft, aboveLeftPartIdx))
>              && (!isAvailableB1 || !cuAbove->hasEqualMotion(abovePartIdx,
> *cuAboveLeft, aboveLeftPartIdx)))
>          {
> @@ -1966,26 +1960,18 @@
>
>  bool CUData::getColMVP(MV& outMV, int& outRefIdx, int picList, int
> cuAddr, int partUnitIdx) const
>  {
> -    uint32_t absPartAddr = partUnitIdx & TMVP_UNIT_MASK;
> -
> -    int colRefPicList;
> -    int colPOC, colRefPOC, curPOC, curRefPOC;
> -    MV colmv;
> -
> -    // use coldir.
>      Frame *colPic = m_slice->m_refPicList[m_slice->isInterB() ? 1 -
> m_slice->m_colFromL0Flag : 0][m_slice->m_colRefIdx];
>      CUData *colCU = colPic->m_encData->getPicCTU(cuAddr);
>
>      if (colCU->m_partSize[partUnitIdx] == SIZE_NONE)
>          return false;
>
> -    curPOC = m_slice->m_poc;
> -    colPOC = colCU->m_slice->m_poc;
> +    uint32_t absPartAddr = partUnitIdx & TMVP_UNIT_MASK;
>
>      if (colCU->isIntra(absPartAddr))
>          return false;
>
> -    colRefPicList = m_slice->m_bCheckLDC ? picList :
> m_slice->m_colFromL0Flag;
> +    int colRefPicList = m_slice->m_bCheckLDC ? picList :
> m_slice->m_colFromL0Flag;
>
>      int colRefIdx = colCU->m_refIdx[colRefPicList][absPartAddr];
>
> @@ -1999,9 +1985,12 @@
>      }
>
>      // Scale the vector
> -    colRefPOC = colCU->m_slice->m_refPOCList[colRefPicList][colRefIdx];
> -    colmv = colCU->m_mv[colRefPicList][absPartAddr];
> -    curRefPOC = m_slice->m_refPOCList[picList][outRefIdx];
> +    int colRefPOC =
> colCU->m_slice->m_refPOCList[colRefPicList][colRefIdx];
> +    int colPOC = colCU->m_slice->m_poc;
> +    MV colmv = colCU->m_mv[colRefPicList][absPartAddr];
> +
> +    int curRefPOC = m_slice->m_refPOCList[picList][outRefIdx];
> +    int curPOC = m_slice->m_poc;
>
>      scaleMvByPOCDist(outMV, colmv, curPOC, curRefPOC, colPOC, colRefPOC);
>      return true;
> diff -r eebb372eec89 -r ef411645295a source/common/cudata.h
> --- a/source/common/cudata.h    Fri Oct 31 16:29:20 2014 -0500
> +++ b/source/common/cudata.h    Mon Nov 03 17:02:14 2014 +0900
> @@ -51,9 +51,10 @@
>
>  enum PredMode
>  {
> -    MODE_INTER,
> -    MODE_INTRA,
> -    MODE_NONE = 15
> +    MODE_NONE  = 0,
> +    MODE_INTER = (1 << 0),
> +    MODE_INTRA = (1 << 1),
> +    MODE_SKIP  = (1 << 2) | MODE_INTER
>  };
>
>  // motion vector predictor direction used in AMVP
> @@ -129,12 +130,11 @@
>      char*         m_qp;               // array of QP values
>      uint8_t*      m_log2CUSize;       // array of cu log2Size TODO: seems
> redundant to depth
>      uint8_t*      m_partSize;         // array of partition sizes
> -    uint8_t*      m_predMode;         // array of prediction modes
>      uint8_t*      m_lumaIntraDir;     // array of intra directions (luma)
>      uint8_t*      m_tqBypass;         // array of CU lossless flags
>      char*         m_refIdx[2];        // array of motion reference
> indices per list
>      uint8_t*      m_cuDepth;          // array of depths
> -    uint8_t*      m_skipFlag;         // array of skip flags
> +    uint8_t*      m_predMode;         // array of prediction modes
>      uint8_t*      m_mergeFlag;        // array of merge flags
>      uint8_t*      m_interDir;         // array of inter directions
>      uint8_t*      m_mvpIdx[2];        // array of motion vector predictor
> candidates or merge candidate indices [0]
> @@ -142,7 +142,7 @@
>      uint8_t*      m_transformSkip[3]; // array of transform skipping
> flags per plane
>      uint8_t*      m_cbf[3];           // array of coded block flags (CBF)
> per plane
>      uint8_t*      m_chromaIntraDir;   // array of intra directions
> (chroma)
> -    enum { BytesPerPartition = 22 };  // combined sizeof() of all
> per-part data
> +    enum { BytesPerPartition = 21 };  // combined sizeof() of all
> per-part data
>
>      coeff_t*      m_trCoeff[3];       // transformed coefficient buffer
> per plane
>
> @@ -173,7 +173,6 @@
>      void     updatePic(uint32_t depth) const;
>
>      void     setPartSizeSubParts(PartSize size)    {
> m_partSet(m_partSize, (uint8_t)size); }
> -    void     setSkipFlagSubParts(uint8_t skipFlag) {
> m_partSet(m_skipFlag, skipFlag); }
>      void     setPredModeSubParts(PredMode mode)    {
> m_partSet(m_predMode, (uint8_t)mode); }
>      void     clearCbf()                            { m_partSet(m_cbf[0],
> 0); m_partSet(m_cbf[1], 0); m_partSet(m_cbf[2], 0); }
>
> @@ -204,7 +203,8 @@
>
>      uint32_t getNumPartInter() const              { return
> nbPartsTable[(int)m_partSize[0]]; }
>      bool     isIntra(uint32_t absPartIdx) const   { return
> m_predMode[absPartIdx] == MODE_INTRA; }
> -    bool     isSkipped(uint32_t absPartIdx) const { return
> !!m_skipFlag[absPartIdx]; }
> +    bool     isInter(uint32_t absPartIdx) const   { return
> !!(m_predMode[absPartIdx] & MODE_INTER); }
> +    bool     isSkipped(uint32_t absPartIdx) const { return
> m_predMode[absPartIdx] == MODE_SKIP; }
>      bool     isBipredRestriction() const          { return
> m_log2CUSize[0] == 3 && m_partSize[0] != SIZE_2Nx2N; }
>
>      void     getPartIndexAndSize(uint32_t puIdx, uint32_t& absPartIdx,
> int& puWidth, int& puHeight) const;
> diff -r eebb372eec89 -r ef411645295a source/common/quant.cpp
> --- a/source/common/quant.cpp   Fri Oct 31 16:29:20 2014 -0500
> +++ b/source/common/quant.cpp   Mon Nov 03 17:02:14 2014 +0900
> @@ -333,7 +333,6 @@
>
>      bool isLuma  = ttype == TEXT_LUMA;
>      bool usePsy  = m_psyRdoqScale && isLuma && !useTransformSkip;
> -    bool isIntra = cu.m_predMode[absPartIdx] == MODE_INTRA;
>      int transformShift = MAX_TR_DYNAMIC_RANGE - X265_DEPTH - log2TrSize;
> // Represents scaling through forward transform
>      int trSize = 1 << log2TrSize;
>
> @@ -355,6 +354,7 @@
>      }
>      else
>      {
> +        bool isIntra = cu.isIntra(absPartIdx);
>          const uint32_t sizeIdx = log2TrSize - 2;
>          int useDST = !sizeIdx && isLuma && isIntra;
>          int index = DCT_4x4 + sizeIdx - useDST;
> diff -r eebb372eec89 -r ef411645295a source/encoder/analysis.cpp
> --- a/source/encoder/analysis.cpp       Fri Oct 31 16:29:20 2014 -0500
> +++ b/source/encoder/analysis.cpp       Mon Nov 03 17:02:14 2014 +0900
> @@ -178,7 +178,7 @@
>      if (!md.bestMode->distortion)
>          /* already lossless */
>          return;
> -    else if (md.bestMode->cu.m_predMode[0] == MODE_INTRA)
> +    else if (md.bestMode->cu.isIntra(0))
>      {
>          md.pred[PRED_LOSSLESS].cu.initLosslessCU(md.bestMode->cu, cuGeom);
>          PartSize size = (PartSize)md.pred[PRED_LOSSLESS].cu.m_partSize[0];
> @@ -695,7 +695,7 @@
>      bool bNoSplit = false;
>      if (md.bestMode)
>      {
> -        bNoSplit = !!md.bestMode->cu.isSkipped(0);
> +        bNoSplit = md.bestMode->cu.isSkipped(0);
>          if (mightSplit && depth && depth >= minDepth && !bNoSplit &&
> m_param->rdLevel <= 4)
>              bNoSplit = recursionDepthCheck(parentCTU, cuGeom,
> *md.bestMode);
>      }
> @@ -741,7 +741,7 @@
>          checkBestMode(*splitPred, depth);
>      }
>
> -    if (!depth || md.bestMode->cu.m_predMode[0] != MODE_INTRA)
> +    if (!depth || md.bestMode->cu.isInter(0))
>      {
>          /* early-out statistics */
>          FrameData& curEncData =
> const_cast<FrameData&>(*m_frame->m_encData);
> @@ -894,7 +894,7 @@
>                      /* prediction already generated for this CU, and if
> rd level
>                       * is not 0, it is already fully encoded */
>                  }
> -                else if (md.bestMode->cu.m_predMode[0] == MODE_INTER)
> +                else if (md.bestMode->cu.isInter(0))
>                  {
>                      for (uint32_t puIdx = 0; puIdx <
> md.bestMode->cu.getNumPartInter(); puIdx++)
>                      {
> @@ -920,7 +920,7 @@
>                          {
>
>  md.bestMode->reconYuv.copyFromYuv(md.bestMode->predYuv);
>                              if (cu.m_mergeFlag[0] && cu.m_partSize[0] ==
> SIZE_2Nx2N)
> -                                cu.setSkipFlagSubParts(true);
> +                                cu.setPredModeSubParts(MODE_SKIP);
>                          }
>                      }
>                  }
> @@ -957,7 +957,7 @@
>      bool bNoSplit = false;
>      if (md.bestMode)
>      {
> -        bNoSplit = !!md.bestMode->cu.isSkipped(0);
> +        bNoSplit = md.bestMode->cu.isSkipped(0);
>          if (mightSplit && depth && depth >= minDepth && !bNoSplit)
>              bNoSplit = recursionDepthCheck(parentCTU, cuGeom,
> *md.bestMode);
>      }
> @@ -1014,7 +1014,7 @@
>              md.bestMode = splitPred;
>      }
>
> -    if (!depth || md.bestMode->cu.m_predMode[0] != MODE_INTRA)
> +    if (!depth || md.bestMode->cu.isInter(0))
>      {
>          /* early-out statistics */
>          FrameData& curEncData =
> const_cast<FrameData&>(*m_frame->m_encData);
> @@ -1334,7 +1334,7 @@
>          tempPred->cu.m_refIdx[0][0] =
> (char)mvFieldNeighbours[i][0].refIdx;
>          tempPred->cu.m_mv[1][0] = mvFieldNeighbours[i][1].mv;
>          tempPred->cu.m_refIdx[1][0] =
> (char)mvFieldNeighbours[i][1].refIdx;
> -        tempPred->cu.setSkipFlagSubParts(false);     /* must be cleared
> between encode iterations */
> +        tempPred->cu.setPredModeSubParts(MODE_INTER); /* must be cleared
> between encode iterations */
>
>          prepMotionCompensation(tempPred->cu, cuGeom, 0);
>          motionCompensation(tempPred->predYuv, true, true);
> @@ -1367,7 +1367,7 @@
>                  tempPred->cu.m_refIdx[0][0] =
> (char)mvFieldNeighbours[i][0].refIdx;
>                  tempPred->cu.m_mv[1][0] = mvFieldNeighbours[i][1].mv;
>                  tempPred->cu.m_refIdx[1][0] =
> (char)mvFieldNeighbours[i][1].refIdx;
> -                tempPred->cu.setSkipFlagSubParts(false);
> +                tempPred->cu.setPredModeSubParts(MODE_INTER);
>                  tempPred->predYuv.copyFromYuv(bestPred->predYuv);
>              }
>
> @@ -1457,7 +1457,7 @@
>      cu.copyFromPic(ctu, cuGeom);
>      m_quant.setQPforQuant(cu);
>
> -    if (cu.m_predMode[0] == MODE_INTRA)
> +    if (cu.isIntra(0))
>      {
>          uint32_t tuDepthRange[2];
>          cu.getIntraTUQtDepthRange(tuDepthRange, 0);
> @@ -1467,9 +1467,9 @@
>          getBestIntraModeChroma(*bestMode, cuGeom);
>          residualQTIntraChroma(*bestMode, cuGeom, 0, 0);
>      }
> -    else if (cu.m_predMode[0] == MODE_INTER)
> +    else if (cu.isInter(0))
>      {
> -        X265_CHECK(!ctu.m_skipFlag[absPartIdx], "skip not expected prior
> to transform\n");
> +        X265_CHECK(!ctu.isSkipped(absPartIdx), "skip not expected prior
> to transform\n");
>
>          /* Calculate residual for current CU part into depth sized
> resiYuv */
>
> @@ -1499,7 +1499,7 @@
>          residualTransformQuantInter(*bestMode, cuGeom, 0, cuGeom.depth,
> tuDepthRange);
>
>          if (cu.m_mergeFlag[0] && cu.m_partSize[0] == SIZE_2Nx2N &&
> !cu.getQtRootCbf(0))
> -            cu.setSkipFlagSubParts(true);
> +            cu.setPredModeSubParts(MODE_SKIP);
>
>          PicYuv& reconPicYuv = *m_frame->m_reconPicYuv;
>          if (cu.getQtRootCbf(0)) // TODO: split to each component
> diff -r eebb372eec89 -r ef411645295a source/encoder/entropy.cpp
> --- a/source/encoder/entropy.cpp        Fri Oct 31 16:29:20 2014 -0500
> +++ b/source/encoder/entropy.cpp        Mon Nov 03 17:02:14 2014 +0900
> @@ -557,18 +557,17 @@
>          codeCUTransquantBypassFlag(cu.m_tqBypass[absPartIdx]);
>
>      if (!slice->isIntra())
> +    {
>          codeSkipFlag(cu, absPartIdx);
> -
> -    if (cu.isSkipped(absPartIdx))
> -    {
> -        codeMergeIndex(cu, absPartIdx);
> -        finishCU(cu, absPartIdx, depth);
> -        return;
> +        if (cu.isSkipped(absPartIdx))
> +        {
> +            codeMergeIndex(cu, absPartIdx);
> +            finishCU(cu, absPartIdx, depth);
> +            return;
> +        }
> +        codePredMode(cu.m_predMode[absPartIdx]);
>      }
>
> -    if (!slice->isIntra())
> -        codePredMode(cu.m_predMode[absPartIdx]);
> -
>      codePartSize(cu, absPartIdx, depth);
>
>      // prediction Info ( Intra : direction mode, Inter : Mv, reference
> idx )
> @@ -648,11 +647,11 @@
>
>      /* in each of these conditions, the subdiv flag is implied and not
> signaled,
>       * so we have checks to make sure the implied value matches our
> intentions */
> -    if (cu.m_predMode[absPartIdx] == MODE_INTRA &&
> cu.m_partSize[absPartIdx] == SIZE_NxN && depth == cu.m_cuDepth[absPartIdx])
> +    if (cu.isIntra(absPartIdx) && cu.m_partSize[absPartIdx] == SIZE_NxN
> && depth == cu.m_cuDepth[absPartIdx])
>      {
>          X265_CHECK(subdiv, "intra NxN requires TU depth below CU
> depth\n");
>      }
> -    else if (cu.m_predMode[absPartIdx] == MODE_INTER &&
> (cu.m_partSize[absPartIdx] != SIZE_2Nx2N) && depth ==
> cu.m_cuDepth[absPartIdx] &&
> +    else if (cu.isInter(absPartIdx) && (cu.m_partSize[absPartIdx] !=
> SIZE_2Nx2N) && depth == cu.m_cuDepth[absPartIdx] &&
>               cu.m_slice->m_sps->quadtreeTUMaxDepthInter == 1)
>

There may be a behaviour change here - for Asymmetric Merge blocks.

     {
>          X265_CHECK(subdiv, "inter TU must be smaller than CU when not
> 2Nx2N part size: log2TrSize %d, depthRange[0] %d\n", log2TrSize,
> depthRange[0]);
> @@ -722,7 +721,7 @@
>      }
>      else
>      {
> -        if (cu.m_predMode[absPartIdx] != MODE_INTRA && depth ==
> cu.m_cuDepth[absPartIdx] && !cu.getCbf(absPartIdx, TEXT_CHROMA_U, 0) &&
> !cu.getCbf(absPartIdx, TEXT_CHROMA_V, 0))
> +        if (cu.isInter(absPartIdx) && depth == cu.m_cuDepth[absPartIdx]
> && !cu.getCbf(absPartIdx, TEXT_CHROMA_U, 0) && !cu.getCbf(absPartIdx,
> TEXT_CHROMA_V, 0))
>          {
>              X265_CHECK(cu.getCbf(absPartIdx, TEXT_LUMA, 0), "CBF should
> have been set\n");
>          }
> @@ -1202,7 +1201,7 @@
>
>  void Entropy::codePredMode(int predMode)
>  {
> -    encodeBin(predMode == MODE_INTER ? 0 : 1,
> m_contextState[OFF_PRED_MODE_CTX]);
> +    encodeBin(predMode == MODE_INTRA ? 1 : 0,
> m_contextState[OFF_PRED_MODE_CTX]);
>  }
>
>  void Entropy::codeCUTransquantBypassFlag(uint32_t symbol)
> diff -r eebb372eec89 -r ef411645295a source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp   Fri Oct 31 16:29:20 2014 -0500
> +++ b/source/encoder/frameencoder.cpp   Mon Nov 03 17:02:14 2014 +0900
> @@ -1011,7 +1011,7 @@
>                  log->cntSkipCu[depth]++;
>                  log->qTreeSkipCnt[depth]++;
>              }
> -            else if (ctu.m_predMode[absPartIdx] == MODE_INTER)
> +            else if (ctu.isInter(absPartIdx))
>              {
>                  log->cntInter[depth]++;
>                  log->qTreeInterCnt[depth]++;
> @@ -1021,7 +1021,7 @@
>                  else
>                      log->cuInterDistribution[depth][AMP_ID]++;
>              }
> -            else if (ctu.m_predMode[absPartIdx] == MODE_INTRA)
> +            else if (ctu.isIntra(absPartIdx))
>              {
>                  log->cntIntra[depth]++;
>                  log->qTreeIntraCnt[depth]++;
> diff -r eebb372eec89 -r ef411645295a source/encoder/search.cpp
> --- a/source/encoder/search.cpp Fri Oct 31 16:29:20 2014 -0500
> +++ b/source/encoder/search.cpp Mon Nov 03 17:02:14 2014 +0900
> @@ -2366,7 +2366,7 @@
>
>      // No residual coding : SKIP mode
>
> -    cu.setSkipFlagSubParts(true);
> +    cu.setPredModeSubParts(MODE_SKIP);
>      cu.clearCbf();
>      cu.setTUDepthSubParts(0, 0, depth);
>
> @@ -2466,7 +2466,7 @@
>      uint32_t coeffBits, bits;
>      if (cu.m_mergeFlag[0] && cu.m_partSize[0] == SIZE_2Nx2N &&
> !cu.getQtRootCbf(0))
>      {
> -        cu.setSkipFlagSubParts(true);
> +        cu.setPredModeSubParts(MODE_SKIP);
>
>          /* Merge/Skip */
>          m_entropyCoder.resetBits();
> @@ -3233,7 +3233,7 @@
>  void Search::encodeResidualQT(CUData& cu, uint32_t absPartIdx, const
> uint32_t depth, bool bSubdivAndCbf, TextType ttype, uint32_t depthRange[2])
>  {
>      X265_CHECK(cu.m_cuDepth[0] == cu.m_cuDepth[absPartIdx], "depth not
> matching\n");
> -    X265_CHECK(cu.m_predMode[absPartIdx] != MODE_INTRA,
> "encodeResidualQT() with intra block\n");
> +    X265_CHECK(cu.isInter(absPartIdx), "encodeResidualQT() with intra
> block\n");
>
>      const uint32_t curTuDepth  = depth - cu.m_cuDepth[0];
>      const uint32_t tuDepth     = cu.m_tuDepth[absPartIdx];
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20141103/69b774f6/attachment-0001.html>


More information about the x265-devel mailing list