Guest User

gpb

a guest
Mar 17th, 2015
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 22.09 KB | None | 0 0
  1. diff -r b9948752d551 source/common/cudata.cpp
  2. --- a/source/common/cudata.cpp  Mon Mar 16 20:40:12 2015 -0500
  3. +++ b/source/common/cudata.cpp  Mon Mar 16 23:38:49 2015 -0700
  4. @@ -1379,7 +1379,7 @@
  5.  uint32_t CUData::getInterMergeCandidates(uint32_t absPartIdx, uint32_t puIdx, MVField(*candMvField)[2], uint8_t* candDir) const
  6.  {
  7.      uint32_t absPartAddr = m_absIdxInCTU + absPartIdx;
  8. -    const bool isInterB = m_slice->isInterB();
  9. +    const bool isInterB = (m_slice->isInterP() || m_slice->isInterB());
  10.  
  11.      const uint32_t maxNumMergeCand = m_slice->m_maxNumMergeCand;
  12.  
  13. @@ -1708,7 +1708,7 @@
  14.          if (tempRefIdx != -1)
  15.          {
  16.              uint32_t cuAddr = neighbours[MD_COLLOCATED].cuAddr[picList];
  17. -            const Frame* colPic = m_slice->m_refPicList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
  18. +            const Frame* colPic = m_slice->m_refPicList[(m_slice->isInterP() || m_slice->isInterB()) && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
  19.              const CUData* colCU = colPic->m_encData->getPicCTU(cuAddr);
  20.  
  21.              // Scale the vector
  22. @@ -1885,7 +1885,7 @@
  23.  
  24.  bool CUData::getColMVP(MV& outMV, int& outRefIdx, int picList, int cuAddr, int partUnitIdx) const
  25.  {
  26. -    const Frame* colPic = m_slice->m_refPicList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
  27. +    const Frame* colPic = m_slice->m_refPicList[(m_slice->isInterP() || m_slice->isInterB()) && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
  28.      const CUData* colCU = colPic->m_encData->getPicCTU(cuAddr);
  29.  
  30.      uint32_t absPartAddr = partUnitIdx & TMVP_UNIT_MASK;
  31. @@ -1920,7 +1920,7 @@
  32.  // Cache the collocated MV.
  33.  bool CUData::getCollocatedMV(int cuAddr, int partUnitIdx, InterNeighbourMV *neighbour) const
  34.  {
  35. -    const Frame* colPic = m_slice->m_refPicList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
  36. +    const Frame* colPic = m_slice->m_refPicList[(m_slice->isInterP() || m_slice->isInterB()) && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
  37.      const CUData* colCU = colPic->m_encData->getPicCTU(cuAddr);
  38.  
  39.      uint32_t absPartAddr = partUnitIdx & TMVP_UNIT_MASK;
  40. diff -r b9948752d551 source/common/deblock.cpp
  41. --- a/source/common/deblock.cpp Mon Mar 16 20:40:12 2015 -0500
  42. +++ b/source/common/deblock.cpp Mon Mar 16 23:38:49 2015 -0700
  43. @@ -214,11 +214,6 @@
  44.      const MV& mvP0 = refP0 ? cuP->m_mv[0][partP] : zeroMv;
  45.      const MV& mvQ0 = refQ0 ? cuQ->m_mv[0][partQ] : zeroMv;
  46.  
  47. -    if (sliceQ->isInterP() && sliceP->isInterP())
  48. -    {
  49. -        return ((refP0 != refQ0) ||
  50. -                (abs(mvQ0.x - mvP0.x) >= 4) || (abs(mvQ0.y - mvP0.y) >= 4)) ? 1 : 0;
  51. -    }
  52.  
  53.      // (sliceQ->isInterB() || sliceP->isInterB())
  54.      const Frame* refP1 = sliceP->getRefPic(1, cuP->m_refIdx[1][partP]);
  55. diff -r b9948752d551 source/common/predict.cpp
  56. --- a/source/common/predict.cpp Mon Mar 16 20:40:12 2015 -0500
  57. +++ b/source/common/predict.cpp Mon Mar 16 23:38:49 2015 -0700
  58. @@ -84,7 +84,7 @@
  59.      int refIdx0 = cu.m_refIdx[0][pu.puAbsPartIdx];
  60.      int refIdx1 = cu.m_refIdx[1][pu.puAbsPartIdx];
  61.  
  62. -    if (cu.m_slice->isInterP())
  63. +    if (0)
  64.      {
  65.          /* P Slice */
  66.          WeightValues wv0[3];
  67. diff -r b9948752d551 source/common/slice.cpp
  68. --- a/source/common/slice.cpp   Mon Mar 16 20:40:12 2015 -0500
  69. +++ b/source/common/slice.cpp   Mon Mar 16 23:38:49 2015 -0700
  70. @@ -87,7 +87,7 @@
  71.  
  72.      X265_CHECK(cIdx == numPocTotalCurr, "RPS index check fail\n");
  73.  
  74. -    if (m_sliceType == B_SLICE)
  75. +    if (m_sliceType == P_SLICE || m_sliceType == B_SLICE)
  76.      {
  77.          cIdx = 0;
  78.          for (i = 0; i < numPocStCurr1; i++, cIdx++)
  79. @@ -109,7 +109,7 @@
  80.          m_refPicList[0][rIdx] = rpsCurrList0[cIdx];
  81.      }
  82.  
  83. -    if (m_sliceType != B_SLICE)
  84. +    if (!(m_sliceType == P_SLICE || m_sliceType == B_SLICE))
  85.      {
  86.          m_numRefIdx[1] = 0;
  87.          memset(m_refPicList[1], 0, sizeof(m_refPicList[1]));
  88. diff -r b9948752d551 source/encoder/analysis.cpp
  89. --- a/source/encoder/analysis.cpp   Mon Mar 16 20:40:12 2015 -0500
  90. +++ b/source/encoder/analysis.cpp   Mon Mar 16 23:38:49 2015 -0700
  91. @@ -138,7 +138,7 @@
  92.              m_reuseIntraDataCTU = (analysis_intra_data *)m_frame->m_analysisData.intraData;
  93.          else
  94.          {
  95. -            int numPredDir = m_slice->isInterP() ? 1 : 2;
  96. +            int numPredDir = 2; //m_slice->isInterP() ? 1 : 2;
  97.              m_reuseInterDataCTU = (analysis_inter_data *)m_frame->m_analysisData.interData;
  98.              m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];
  99.              m_reuseBestMergeCand = &m_reuseInterDataCTU->bestMergeCand[ctu.m_cuAddr * CUGeom::MAX_GEOMS];
  100. @@ -390,7 +390,7 @@
  101.  
  102.              case PRED_2Nx2N:
  103.                  slave.checkInter_rd0_4(md.pred[PRED_2Nx2N], pmode.cuGeom, SIZE_2Nx2N);
  104. -                if (m_slice->m_sliceType == B_SLICE)
  105. +                if (m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE)
  106.                      slave.checkBidir2Nx2N(md.pred[PRED_2Nx2N], md.pred[PRED_BIDIR], pmode.cuGeom);
  107.                  break;
  108.  
  109. @@ -436,7 +436,7 @@
  110.              case PRED_2Nx2N:
  111.                  slave.checkInter_rd5_6(md.pred[PRED_2Nx2N], pmode.cuGeom, SIZE_2Nx2N, false);
  112.                  md.pred[PRED_BIDIR].rdCost = MAX_INT64;
  113. -                if (m_slice->m_sliceType == B_SLICE)
  114. +                if (m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE)
  115.                  {
  116.                      slave.checkBidir2Nx2N(md.pred[PRED_2Nx2N], md.pred[PRED_BIDIR], pmode.cuGeom);
  117.                      if (md.pred[PRED_BIDIR].sa8dCost < MAX_INT64)
  118. @@ -584,7 +584,7 @@
  119.                  checkBestMode(*bestInter, depth);
  120.  
  121.                  /* If BIDIR is available and within 17/16 of best inter option, choose by RDO */
  122. -                if (m_slice->m_sliceType == B_SLICE && md.pred[PRED_BIDIR].sa8dCost != MAX_INT64 &&
  123. +                if ((m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE) && md.pred[PRED_BIDIR].sa8dCost != MAX_INT64 &&
  124.                      md.pred[PRED_BIDIR].sa8dCost * 16 <= bestInter->sa8dCost * 17)
  125.                  {
  126.                      encodeResAndCalcRdInterCU(md.pred[PRED_BIDIR], cuGeom);
  127. @@ -599,7 +599,7 @@
  128.                  if (!md.bestMode || bestInter->sa8dCost < md.bestMode->sa8dCost)
  129.                      md.bestMode = bestInter;
  130.  
  131. -                if (m_slice->m_sliceType == B_SLICE && md.pred[PRED_BIDIR].sa8dCost < md.bestMode->sa8dCost)
  132. +                if ((m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE) && md.pred[PRED_BIDIR].sa8dCost < md.bestMode->sa8dCost)
  133.                      md.bestMode = &md.pred[PRED_BIDIR];
  134.  
  135.                  if (bTryIntra && md.pred[PRED_INTRA].sa8dCost < md.bestMode->sa8dCost)
  136. @@ -762,7 +762,7 @@
  137.              md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom);
  138.              checkInter_rd0_4(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N);
  139.  
  140. -            if (m_slice->m_sliceType == B_SLICE)
  141. +            if (m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE)
  142.              {
  143.                  md.pred[PRED_BIDIR].cu.initSubCU(parentCTU, cuGeom);
  144.                  checkBidir2Nx2N(md.pred[PRED_2Nx2N], md.pred[PRED_BIDIR], cuGeom);
  145. @@ -837,7 +837,7 @@
  146.                  checkBestMode(*bestInter, depth);
  147.  
  148.                  /* If BIDIR is available and within 17/16 of best inter option, choose by RDO */
  149. -                if (m_slice->m_sliceType == B_SLICE && md.pred[PRED_BIDIR].sa8dCost != MAX_INT64 &&
  150. +                if ((m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE) && md.pred[PRED_BIDIR].sa8dCost != MAX_INT64 &&
  151.                      md.pred[PRED_BIDIR].sa8dCost * 16 <= bestInter->sa8dCost * 17)
  152.                  {
  153.                      encodeResAndCalcRdInterCU(md.pred[PRED_BIDIR], cuGeom);
  154. @@ -859,7 +859,7 @@
  155.                  if (!md.bestMode || bestInter->sa8dCost < md.bestMode->sa8dCost)
  156.                      md.bestMode = bestInter;
  157.  
  158. -                if (m_slice->m_sliceType == B_SLICE &&
  159. +                if ((m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE) &&
  160.                      md.pred[PRED_BIDIR].sa8dCost < md.bestMode->sa8dCost)
  161.                      md.bestMode = &md.pred[PRED_BIDIR];
  162.  
  163. @@ -1062,7 +1062,7 @@
  164.              checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N, false);
  165.              checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
  166.  
  167. -            if (m_slice->m_sliceType == B_SLICE)
  168. +            if (m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE)
  169.              {
  170.                  md.pred[PRED_BIDIR].cu.initSubCU(parentCTU, cuGeom);
  171.                  checkBidir2Nx2N(md.pred[PRED_2Nx2N], md.pred[PRED_BIDIR], cuGeom);
  172. @@ -1233,7 +1233,7 @@
  173.              continue;
  174.  
  175.          tempPred->cu.m_mvpIdx[0][0] = (uint8_t)i; // merge candidate ID is stored in L0 MVP idx
  176. -        X265_CHECK(m_slice->m_sliceType == B_SLICE || !(candDir[i] & 0x10), " invalid merge for P slice\n");
  177. +        X265_CHECK((m_slice->m_sliceType == P_SLICE || m_slice->m_sliceType == B_SLICE) || !(candDir[i] & 0x10), " invalid merge for P slice\n");
  178.          tempPred->cu.m_interDir[0] = candDir[i];
  179.          tempPred->cu.m_mv[0][0] = candMvField[i][0].mv;
  180.          tempPred->cu.m_mv[1][0] = candMvField[i][1].mv;
  181. @@ -1441,7 +1441,7 @@
  182.      interMode.initCosts();
  183.      interMode.cu.setPartSizeSubParts(partSize);
  184.      interMode.cu.setPredModeSubParts(MODE_INTER);
  185. -    int numPredDir = m_slice->isInterP() ? 1 : 2;
  186. +    int numPredDir = 2; //m_slice->isInterP() ? 1 : 2;
  187.  
  188.      if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_reuseInterDataCTU)
  189.      {
  190. @@ -1489,7 +1489,7 @@
  191.      interMode.initCosts();
  192.      interMode.cu.setPartSizeSubParts(partSize);
  193.      interMode.cu.setPredModeSubParts(MODE_INTER);
  194. -    int numPredDir = m_slice->isInterP() ? 1 : 2;
  195. +    int numPredDir = 2; //m_slice->isInterP() ? 1 : 2;
  196.  
  197.      if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_reuseInterDataCTU)
  198.      {
  199. diff -r b9948752d551 source/encoder/dpb.cpp
  200. --- a/source/encoder/dpb.cpp    Mon Mar 16 20:40:12 2015 -0500
  201. +++ b/source/encoder/dpb.cpp    Mon Mar 16 23:38:49 2015 -0700
  202. @@ -145,8 +145,8 @@
  203.      // Mark pictures in m_piclist as unreferenced if they are not included in RPS
  204.      applyReferencePictureSet(&slice->m_rps, pocCurr);
  205.  
  206. -    slice->m_numRefIdx[0] = X265_MIN(m_maxRefL0, slice->m_rps.numberOfNegativePictures); // Ensuring L0 contains just the -ve POC
  207. -    slice->m_numRefIdx[1] = X265_MIN(m_maxRefL1, slice->m_rps.numberOfPositivePictures);
  208. +    slice->m_numRefIdx[0] = X265_MIN(m_maxRefL0, slice->m_rps.numberOfNegativePictures); // Ensuring L0 contains just the -ve POC
  209. +    slice->m_numRefIdx[1] = X265_MIN(m_maxRefL1, slice->m_rps.numberOfNegativePictures);
  210.      slice->setRefPicList(m_picList);
  211.  
  212.      X265_CHECK(slice->m_sliceType != B_SLICE || slice->m_numRefIdx[1], "B slice without L1 references (non-fatal)\n");
  213. @@ -171,7 +171,7 @@
  214.      /* Increment reference count of all motion-referenced frames to prevent them
  215.       * from being recycled. These counts are decremented at the end of
  216.       * compressFrame() */
  217. -    int numPredDir = slice->isInterP() ? 1 : slice->isInterB() ? 2 : 0;
  218. +    int numPredDir = (slice->isInterP() || slice->isInterB()) ? 2 : 0;
  219.      for (int l = 0; l < numPredDir; l++)
  220.      {
  221.          for (int ref = 0; ref < slice->m_numRefIdx[l]; ref++)
  222. diff -r b9948752d551 source/encoder/encoder.cpp
  223. --- a/source/encoder/encoder.cpp    Mon Mar 16 20:40:12 2015 -0500
  224. +++ b/source/encoder/encoder.cpp    Mon Mar 16 23:38:49 2015 -0700
  225. @@ -594,7 +594,7 @@
  226.                      freeAnalysis(&pic_out->analysisData);
  227.                  }
  228.              }
  229. -            if (slice->m_sliceType == P_SLICE)
  230. +            /* if (slice->m_sliceType == P_SLICE)
  231.              {
  232.                  if (slice->m_weightPredTable[0][0][0].bPresentFlag)
  233.                      m_numLumaWPFrames++;
  234. @@ -602,7 +602,8 @@
  235.                      slice->m_weightPredTable[0][0][2].bPresentFlag)
  236.                      m_numChromaWPFrames++;
  237.              }
  238. -            else if (slice->m_sliceType == B_SLICE)
  239. +            else */
  240. +            if (slice->m_sliceType == P_SLICE || slice->m_sliceType == B_SLICE)
  241.              {
  242.                  bool bLuma = false, bChroma = false;
  243.                  for (int l = 0; l < 2; l++)
  244. @@ -1308,7 +1308,7 @@
  245.  
  246.          if (!slice->isIntra())
  247.          {
  248. -            int numLists = slice->isInterP() ? 1 : 2;
  249. +            int numLists = 2; //slice->isInterP() ? 1 : 2;
  250.              for (int list = 0; list < numLists; list++)
  251.              {
  252.                  p += sprintf(buf + p, " [L%d ", list);
  253. @@ -1364,7 +1364,7 @@
  254.              fputs(", -, -", m_csvfpt);
  255.          else
  256.          {
  257. -            int numLists = slice->isInterP() ? 1 : 2;
  258. +            int numLists = 2; //slice->isInterP() ? 1 : 2;
  259.              for (int list = 0; list < numLists; list++)
  260.              {
  261.                  fprintf(m_csvfpt, ", ");
  262. @@ -1887,15 +1887,6 @@
  263.          analysis->sliceType = X265_TYPE_I;
  264.          consumedBytes += frameRecordSize;
  265.      }
  266. -    else if (analysis->sliceType == X265_TYPE_P)
  267. -    {
  268. -        X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU, m_analysisFile);
  269. -        X265_FREAD(((analysis_inter_data *)analysis->interData)->depth, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
  270. -        X265_FREAD(((analysis_inter_data *)analysis->interData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
  271. -        X265_FREAD(((analysis_inter_data *)analysis->interData)->bestMergeCand, sizeof(uint32_t), analysis->numCUsInFrame * CUGeom::MAX_GEOMS, m_analysisFile);
  272. -        consumedBytes += frameRecordSize;
  273. -        totalConsumedBytes = consumedBytes;
  274. -    }
  275.      else
  276.      {
  277.          X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2, m_analysisFile);
  278. @@ -1924,12 +1915,6 @@
  279.                        sizeof(analysis->numCUsInFrame) + sizeof(analysis->numPartitions);
  280.      if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)
  281.          analysis->frameRecordSize += sizeof(uint8_t) * analysis->numCUsInFrame * analysis->numPartitions * 4;
  282. -    else if (analysis->sliceType == X265_TYPE_P)
  283. -    {
  284. -        analysis->frameRecordSize += sizeof(int32_t) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU;
  285. -        analysis->frameRecordSize += sizeof(uint8_t) * analysis->numCUsInFrame * analysis->numPartitions * 2;
  286. -        analysis->frameRecordSize += sizeof(uint32_t) * analysis->numCUsInFrame * CUGeom::MAX_GEOMS;
  287. -    }
  288.      else
  289.      {
  290.          analysis->frameRecordSize += sizeof(int32_t) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2;
  291. @@ -1950,13 +1935,6 @@
  292.          X265_FWRITE(((analysis_intra_data*)analysis->intraData)->partSizes, sizeof(char), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
  293.          X265_FWRITE(((analysis_intra_data*)analysis->intraData)->chromaModes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
  294.      }
  295. -    else if (analysis->sliceType == X265_TYPE_P)
  296. -    {
  297. -        X265_FWRITE(((analysis_inter_data*)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU, m_analysisFile);
  298. -        X265_FWRITE(((analysis_inter_data*)analysis->interData)->depth, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
  299. -        X265_FWRITE(((analysis_inter_data*)analysis->interData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);
  300. -        X265_FWRITE(((analysis_inter_data*)analysis->interData)->bestMergeCand, sizeof(uint32_t), analysis->numCUsInFrame * CUGeom::MAX_GEOMS, m_analysisFile);
  301. -    }
  302.      else
  303.      {
  304.          X265_FWRITE(((analysis_inter_data*)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2, m_analysisFile);
  305. diff -r b9948752d551 source/encoder/entropy.cpp
  306. --- a/source/encoder/entropy.cpp    Mon Mar 16 20:40:12 2015 -0500
  307. +++ b/source/encoder/entropy.cpp    Mon Mar 16 23:38:49 2015 -0700
  308. @@ -380,7 +380,7 @@
  309.          picType = 0;
  310.          break;
  311.      case P_SLICE:
  312. -        picType = 1;
  313. +        picType = 2;
  314.          break;
  315.      case B_SLICE:
  316.          picType = 2;
  317. @@ -439,12 +439,12 @@
  318.  
  319.      if (!slice.isIntra())
  320.      {
  321. -        bool overrideFlag = (slice.m_numRefIdx[0] != 1 || (slice.isInterB() && slice.m_numRefIdx[1] != 1));
  322. +        bool overrideFlag = (slice.m_numRefIdx[0] != 1 || ((slice.isInterP() || slice.isInterB()) && slice.m_numRefIdx[1] != 1));
  323.          WRITE_FLAG(overrideFlag, "num_ref_idx_active_override_flag");
  324.          if (overrideFlag)
  325.          {
  326.              WRITE_UVLC(slice.m_numRefIdx[0] - 1, "num_ref_idx_l0_active_minus1");
  327. -            if (slice.isInterB())
  328. +            if ((slice.isInterP() || slice.isInterB()))
  329.                  WRITE_UVLC(slice.m_numRefIdx[1] - 1, "num_ref_idx_l1_active_minus1");
  330.              else
  331.              {
  332. @@ -457,12 +457,12 @@
  333.          X265_CHECK(!slice.m_numRefIdx[0] && !slice.m_numRefIdx[1], "expected no references for I slice\n");
  334.      }
  335.  
  336. -    if (slice.isInterB())
  337. +    if ((slice.isInterP() || slice.isInterB()))
  338.          WRITE_FLAG(0, "mvd_l1_zero_flag");
  339.  
  340.      if (slice.m_sps->bTemporalMVPEnabled)
  341.      {
  342. -        if (slice.m_sliceType == B_SLICE)
  343. +        if (slice.m_sliceType == P_SLICE || slice.m_sliceType == B_SLICE)
  344.              WRITE_FLAG(slice.m_colFromL0Flag, "collocated_from_l0_flag");
  345.  
  346.          if (slice.m_sliceType != I_SLICE &&
  347. @@ -871,7 +871,7 @@
  348.              codeMergeIndex(cu, subPartIdx);
  349.          else
  350.          {
  351. -            if (cu.m_slice->isInterB())
  352. +            if (cu.m_slice->isInterP() || cu.m_slice->isInterB())
  353.                  codeInterDir(cu, subPartIdx);
  354.  
  355.              uint32_t interDir = cu.m_interDir[subPartIdx];
  356. @@ -1014,7 +1014,7 @@
  357.      const WeightParam *wp;
  358.      bool            bChroma      = true; // 4:0:0 not yet supported
  359.      bool            bDenomCoded  = false;
  360. -    int             numRefDirs   = slice.m_sliceType == B_SLICE ? 2 : 1;
  361. +    int             numRefDirs   = (slice.m_sliceType == P_SLICE || slice.m_sliceType == B_SLICE) ? 2 : 1;
  362.      uint32_t        totalSignalledWeightFlags = 0;
  363.  
  364.      if ((slice.m_sliceType == P_SLICE && slice.m_pps->bUseWeightPred) ||
  365. diff -r b9948752d551 source/encoder/frameencoder.cpp
  366. --- a/source/encoder/frameencoder.cpp   Mon Mar 16 20:40:12 2015 -0500
  367. +++ b/source/encoder/frameencoder.cpp   Mon Mar 16 23:38:49 2015 -0700
  368. @@ -337,7 +338,7 @@
  369.          slice->disableWeights();
  370.  
  371.      // Generate motion references
  372. -    int numPredDir = slice->isInterP() ? 1 : slice->isInterB() ? 2 : 0;
  373. +    int numPredDir = (slice->isInterP() || slice->isInterB()) ? 2 : 0;
  374.      for (int l = 0; l < numPredDir; l++)
  375.      {
  376.          for (int ref = 0; ref < slice->m_numRefIdx[l]; ref++)
  377. @@ -690,7 +694,7 @@
  378.  
  379.      bool bUseWeightP = slice->m_pps->bUseWeightPred && slice->m_sliceType == P_SLICE;
  380.      bool bUseWeightB = slice->m_pps->bUseWeightedBiPred && slice->m_sliceType == B_SLICE;
  381. -    int numPredDir = slice->isInterP() ? 1 : slice->isInterB() ? 2 : 0;
  382. +    int numPredDir = (slice->isInterP() || slice->isInterB()) ? 2 : 0;
  383.  
  384.      m_rows[0].active = true;
  385.      if (m_param->bEnableWavefront)
  386. diff -r b9948752d551 source/encoder/search.cpp
  387. --- a/source/encoder/search.cpp Mon Mar 16 20:40:12 2015 -0500
  388. +++ b/source/encoder/search.cpp Mon Mar 16 23:38:49 2015 -0700
  389. @@ -1998,7 +1998,7 @@
  390.  
  391.      const Slice *slice = m_slice;
  392.      int numPart     = cu.getNumPartInter();
  393. -    int numPredDir  = slice->isInterP() ? 1 : 2;
  394. +    int numPredDir  = 2; //slice->isInterP() ? 1 : 2;
  395.      const int* numRefIdx = slice->m_numRefIdx;
  396.      uint32_t lastMode = 0;
  397.      int      totalmebits = 0;
  398. @@ -2044,7 +2044,7 @@
  399.          bestME[0].cost = MAX_UINT;
  400.          bestME[1].cost = MAX_UINT;
  401.  
  402. -        getBlkBits((PartSize)cu.m_partSize[0], slice->isInterP(), puIdx, lastMode, m_listSelBits);
  403. +        getBlkBits((PartSize)cu.m_partSize[0], (!slice->isInterP() && !slice->isInterB()), puIdx, lastMode, m_listSelBits);
  404.          bool bDoUnidir = true;
  405.  
  406.          cu.getNeighbourMV(puIdx, pu.puAbsPartIdx, interMode.interNeighbours);
  407. @@ -2200,7 +2200,7 @@
  408.          uint32_t bidirCost = MAX_UINT;
  409.          int bidirBits = 0;
  410.  
  411. -        if (slice->isInterB() && !cu.isBipredRestriction() &&  /* biprediction is possible for this PU */
  412. +        if ((slice->isInterP() || slice->isInterB()) && !cu.isBipredRestriction() &&  /* biprediction is possible for this PU */
  413.              cu.m_partSize[pu.puAbsPartIdx] != SIZE_2Nx2N &&    /* 2Nx2N biprediction is handled elsewhere */
  414.              bestME[0].cost != MAX_UINT && bestME[1].cost != MAX_UINT)
  415.          {
  416. diff -r b9948752d551 source/encoder/slicetype.cpp
  417. --- a/source/encoder/slicetype.cpp  Mon Mar 16 20:40:12 2015 -0500
  418. +++ b/source/encoder/slicetype.cpp  Mon Mar 16 23:38:49 2015 -0700
  419. @@ -770,9 +770,11 @@
  420.          break;
  421.  
  422.      case P_SLICE:
  423. -        b = p1 = poc - l0poc;
  424. +        b = poc - l0poc;
  425. +        p1 = b + poc - l1poc;
  426.          frames[p0] = &slice->m_refPicList[0][0]->m_lowres;
  427.          frames[b] = &curFrame->m_lowres;
  428. +        frames[p1] = &slice->m_refPicList[1][0]->m_lowres;
  429.          break;
  430.  
  431.      case B_SLICE:
  432. diff -r b9948752d551 source/encoder/weightPrediction.cpp
  433. --- a/source/encoder/weightPrediction.cpp   Mon Mar 16 20:40:12 2015 -0500
  434. +++ b/source/encoder/weightPrediction.cpp   Mon Mar 16 23:38:49 2015 -0700
  435. @@ -228,7 +228,7 @@
  436.  
  437.      memset(&cache, 0, sizeof(cache));
  438.      cache.intraCost = fenc.intraCost;
  439. -    cache.numPredDir = slice.isInterP() ? 1 : 2;
  440. +    cache.numPredDir = 2; //slice.isInterP() ? 1 : 2;
  441.      cache.lowresWidthInCU = fenc.width >> 3;
  442.      cache.lowresHeightInCU = fenc.lines >> 3;
  443.      cache.csp = fencPic->m_picCsp;
  444. @@ -507,7 +512,7 @@
  445.          bool bWeighted = false;
  446.  
  447.          p = sprintf(buf, "poc: %d weights:", slice.m_poc);
  448. -        int numPredDir = slice.isInterP() ? 1 : 2;
  449. +        int numPredDir = 2; //slice.isInterP() ? 1 : 2;
  450.          for (int list = 0; list < numPredDir; list++)
  451.          {
  452.              WeightParam* w = &wp[list][0][0];
Advertisement
Add Comment
Please, Sign In to add comment