[x265] [PATCH rfc] aq: implementation of Fine-grained Adaptive Quantization

Steve Borho steve at borho.org
Tue Mar 17 14:34:13 CET 2015


On 03/17, Gopu Govindaswamy wrote:
> Thanks for review
> 
> On Tue, Mar 17, 2015 at 4:27 AM, Steve Borho <steve at borho.org> wrote:
> 
> > On 03/16, gopu at multicorewareinc.com wrote:
<snip>
> > >      else if (mightNotSplit)
> > >      {
> > > -        m_quant.setQPforQuant(parentCTU);
> > > +        m_quant.setQPforQuant(parentCTU, qp);
> >
> > this seems wrong in general; shouldn't quant always use the QP set in
> > the CU data structure? it seems like we should be ensuring
> > m_quant.setQPforQuant() is always called after configuring the QP for
> > the CU.
> >
> 
> we have a different qp for each CU size based on the --max-dqp-depth, in
> this case
> when the qp is change for any CU size then need to configure this same QP
> for Quant also,
> 
> 
> >
> > > -        md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom);
> > > +        md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);

This CU is only ever one size, it is only configured for one QP. if
m_quant.setQPforQuant() were delayed until after this setup, and you
passed one of these CUs instead of the parentCTU, it would have the
proper QP.

> > >          checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N, NULL, NULL);
> > >          checkBestMode(md.pred[PRED_INTRA], depth);
> > >
> > >          if (cuGeom.log2CUSize == 3 &&
> > m_slice->m_sps->quadtreeTULog2MinSize < 3)
> > >          {
> > > -            md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU, cuGeom);
> > > +            md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU, cuGeom, qp);
> > >              checkIntra(md.pred[PRED_INTRA_NxN], cuGeom, SIZE_NxN, NULL,
> > NULL);
> > >              checkBestMode(md.pred[PRED_INTRA_NxN], depth);
> > >          }
> > > @@ -280,7 +284,7 @@
> > >          Mode* splitPred = &md.pred[PRED_SPLIT];
> > >          splitPred->initCosts();
> > >          CUData* splitCU = &splitPred->cu;
> > > -        splitCU->initSubCU(parentCTU, cuGeom);
> > > +        splitCU->initSubCU(parentCTU, cuGeom, qp);
> > >
> > >          uint32_t nextDepth = depth + 1;
> > >          ModeDepth& nd = m_modeDepth[nextDepth];
> > > @@ -496,6 +500,10 @@
> > >
> > >      X265_CHECK(m_param->rdLevel >= 2, "compressInterCU_dist does not
> > support RD 0 or 1\n");
> > >
> > > +    int32_t qp = 0;
> > > +    if (depth <= (uint32_t)m_param->rc.maxCuDQPDepth)
> > > +        qp = calculateQpforCuSize(parentCTU, cuGeom);
> > > +
> > >      if (mightNotSplit && depth >= minDepth)
> > >      {
> > >          int bTryAmp = m_slice->m_sps->maxAMPDepth > depth &&
> > (cuGeom.log2CUSize < 6 || m_param->rdLevel > 4);
> > > @@ -504,28 +512,28 @@
> > >          PMODE pmode(*this, cuGeom);
> > >
> > >          /* Initialize all prediction CUs based on parentCTU */
> > > -        md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom);
> > > -        md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom);
> > > +        md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
> > > +        md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
> > >          if (bTryIntra)
> > >          {
> > > -            md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom);
> > > +            md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);
> > >              if (cuGeom.log2CUSize == 3 &&
> > m_slice->m_sps->quadtreeTULog2MinSize < 3 && m_param->rdLevel >= 5)
> > > -                md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU, cuGeom);
> > > +                md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >              pmode.modes[pmode.m_jobTotal++] = PRED_INTRA;
> > >          }
> > > -        md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom);
> > pmode.modes[pmode.m_jobTotal++] = PRED_2Nx2N;
> > > -        md.pred[PRED_BIDIR].cu.initSubCU(parentCTU, cuGeom);
> > > +        md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
> > pmode.modes[pmode.m_jobTotal++] = PRED_2Nx2N;
> > > +        md.pred[PRED_BIDIR].cu.initSubCU(parentCTU, cuGeom, qp);
> > >          if (m_param->bEnableRectInter)
> > >          {
> > > -            md.pred[PRED_2NxN].cu.initSubCU(parentCTU, cuGeom);
> > pmode.modes[pmode.m_jobTotal++] = PRED_2NxN;
> > > -            md.pred[PRED_Nx2N].cu.initSubCU(parentCTU, cuGeom);
> > pmode.modes[pmode.m_jobTotal++] = PRED_Nx2N;
> > > +            md.pred[PRED_2NxN].cu.initSubCU(parentCTU, cuGeom, qp);
> > pmode.modes[pmode.m_jobTotal++] = PRED_2NxN;
> > > +            md.pred[PRED_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
> > pmode.modes[pmode.m_jobTotal++] = PRED_Nx2N;
> > >          }
> > >          if (bTryAmp)
> > >          {
> > > -            md.pred[PRED_2NxnU].cu.initSubCU(parentCTU, cuGeom);
> > pmode.modes[pmode.m_jobTotal++] = PRED_2NxnU;
> > > -            md.pred[PRED_2NxnD].cu.initSubCU(parentCTU, cuGeom);
> > pmode.modes[pmode.m_jobTotal++] = PRED_2NxnD;
> > > -            md.pred[PRED_nLx2N].cu.initSubCU(parentCTU, cuGeom);
> > pmode.modes[pmode.m_jobTotal++] = PRED_nLx2N;
> > > -            md.pred[PRED_nRx2N].cu.initSubCU(parentCTU, cuGeom);
> > pmode.modes[pmode.m_jobTotal++] = PRED_nRx2N;
> > > +            md.pred[PRED_2NxnU].cu.initSubCU(parentCTU, cuGeom, qp);
> > pmode.modes[pmode.m_jobTotal++] = PRED_2NxnU;
> > > +            md.pred[PRED_2NxnD].cu.initSubCU(parentCTU, cuGeom, qp);
> > pmode.modes[pmode.m_jobTotal++] = PRED_2NxnD;
> > > +            md.pred[PRED_nLx2N].cu.initSubCU(parentCTU, cuGeom, qp);
> > pmode.modes[pmode.m_jobTotal++] = PRED_nLx2N;
> > > +            md.pred[PRED_nRx2N].cu.initSubCU(parentCTU, cuGeom, qp);
> > pmode.modes[pmode.m_jobTotal++] = PRED_nRx2N;
> > >          }
> > >
> > >          pmode.tryBondPeers(*m_frame->m_encData->m_jobProvider,
> > pmode.m_jobTotal);
> > > @@ -654,7 +662,7 @@
> > >
> > >          if (md.bestMode->rdCost == MAX_INT64 && !bTryIntra)
> > >          {
> > > -            md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom);
> > > +            md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);
> > >              checkIntraInInter(md.pred[PRED_INTRA], cuGeom);
> > >              encodeIntraInInter(md.pred[PRED_INTRA], cuGeom);
> > >              checkBestMode(md.pred[PRED_INTRA], depth);
> > > @@ -680,7 +688,7 @@
> > >          Mode* splitPred = &md.pred[PRED_SPLIT];
> > >          splitPred->initCosts();
> > >          CUData* splitCU = &splitPred->cu;
> > > -        splitCU->initSubCU(parentCTU, cuGeom);
> > > +        splitCU->initSubCU(parentCTU, cuGeom, qp);
> > >
> > >          uint32_t nextDepth = depth + 1;
> > >          ModeDepth& nd = m_modeDepth[nextDepth];
> > > @@ -744,13 +752,17 @@
> > >      bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY);
> > >      uint32_t minDepth = topSkipMinDepth(parentCTU, cuGeom);
> > >
> > > +    int32_t qp = 0;
> > > +    if (depth <= (uint32_t)m_param->rc.maxCuDQPDepth)
> > > +        qp = calculateQpforCuSize(parentCTU, cuGeom);
> > > +
> > >      if (mightNotSplit && depth >= minDepth)
> > >      {
> > >          bool bTryIntra = m_slice->m_sliceType != B_SLICE ||
> > m_param->bIntraInBFrames;
> > >
> > >          /* Compute Merge Cost */
> > > -        md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom);
> > > -        md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom);
> > > +        md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
> > > +        md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
> > >          checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP], md.pred[PRED_MERGE],
> > cuGeom);
> > >
> > >          bool earlyskip = false;
> > > @@ -759,24 +771,24 @@
> > >
> > >          if (!earlyskip)
> > >          {
> > > -            md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom);
> > > +            md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
> > >              checkInter_rd0_4(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N);
> > >
> > >              if (m_slice->m_sliceType == B_SLICE)
> > >              {
> > > -                md.pred[PRED_BIDIR].cu.initSubCU(parentCTU, cuGeom);
> > > +                md.pred[PRED_BIDIR].cu.initSubCU(parentCTU, cuGeom, qp);
> > >                  checkBidir2Nx2N(md.pred[PRED_2Nx2N],
> > md.pred[PRED_BIDIR], cuGeom);
> > >              }
> > >
> > >              Mode *bestInter = &md.pred[PRED_2Nx2N];
> > >              if (m_param->bEnableRectInter)
> > >              {
> > > -                md.pred[PRED_Nx2N].cu.initSubCU(parentCTU, cuGeom);
> > > +                md.pred[PRED_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
> > >                  checkInter_rd0_4(md.pred[PRED_Nx2N], cuGeom, SIZE_Nx2N);
> > >                  if (md.pred[PRED_Nx2N].sa8dCost < bestInter->sa8dCost)
> > >                      bestInter = &md.pred[PRED_Nx2N];
> > >
> > > -                md.pred[PRED_2NxN].cu.initSubCU(parentCTU, cuGeom);
> > > +                md.pred[PRED_2NxN].cu.initSubCU(parentCTU, cuGeom, qp);
> > >                  checkInter_rd0_4(md.pred[PRED_2NxN], cuGeom, SIZE_2NxN);
> > >                  if (md.pred[PRED_2NxN].sa8dCost < bestInter->sa8dCost)
> > >                      bestInter = &md.pred[PRED_2NxN];
> > > @@ -798,24 +810,24 @@
> > >
> > >                  if (bHor)
> > >                  {
> > > -                    md.pred[PRED_2NxnU].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_2NxnU].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkInter_rd0_4(md.pred[PRED_2NxnU], cuGeom,
> > SIZE_2NxnU);
> > >                      if (md.pred[PRED_2NxnU].sa8dCost <
> > bestInter->sa8dCost)
> > >                          bestInter = &md.pred[PRED_2NxnU];
> > >
> > > -                    md.pred[PRED_2NxnD].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_2NxnD].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkInter_rd0_4(md.pred[PRED_2NxnD], cuGeom,
> > SIZE_2NxnD);
> > >                      if (md.pred[PRED_2NxnD].sa8dCost <
> > bestInter->sa8dCost)
> > >                          bestInter = &md.pred[PRED_2NxnD];
> > >                  }
> > >                  if (bVer)
> > >                  {
> > > -                    md.pred[PRED_nLx2N].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_nLx2N].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkInter_rd0_4(md.pred[PRED_nLx2N], cuGeom,
> > SIZE_nLx2N);
> > >                      if (md.pred[PRED_nLx2N].sa8dCost <
> > bestInter->sa8dCost)
> > >                          bestInter = &md.pred[PRED_nLx2N];
> > >
> > > -                    md.pred[PRED_nRx2N].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_nRx2N].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkInter_rd0_4(md.pred[PRED_nRx2N], cuGeom,
> > SIZE_nRx2N);
> > >                      if (md.pred[PRED_nRx2N].sa8dCost <
> > bestInter->sa8dCost)
> > >                          bestInter = &md.pred[PRED_nRx2N];
> > > @@ -847,7 +859,7 @@
> > >                  if ((bTryIntra && md.bestMode->cu.getQtRootCbf(0)) ||
> > >                      md.bestMode->sa8dCost == MAX_INT64)
> > >                  {
> > > -                    md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkIntraInInter(md.pred[PRED_INTRA], cuGeom);
> > >                      encodeIntraInInter(md.pred[PRED_INTRA], cuGeom);
> > >                      checkBestMode(md.pred[PRED_INTRA], depth);
> > > @@ -865,7 +877,7 @@
> > >
> > >                  if (bTryIntra || md.bestMode->sa8dCost == MAX_INT64)
> > >                  {
> > > -                    md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkIntraInInter(md.pred[PRED_INTRA], cuGeom);
> > >                      if (md.pred[PRED_INTRA].sa8dCost <
> > md.bestMode->sa8dCost)
> > >                          md.bestMode = &md.pred[PRED_INTRA];
> > > @@ -893,7 +905,7 @@
> > >                      {
> > >                          /* generate recon pixels with no rate
> > distortion considerations */
> > >                          CUData& cu = md.bestMode->cu;
> > > -                        m_quant.setQPforQuant(cu);
> > > +                        m_quant.setQPforQuant(cu, qp);
> > >
> > >                          uint32_t tuDepthRange[2];
> > >                          cu.getInterTUQtDepthRange(tuDepthRange, 0);
> > > @@ -918,7 +930,7 @@
> > >                      {
> > >                          /* generate recon pixels with no rate
> > distortion considerations */
> > >                          CUData& cu = md.bestMode->cu;
> > > -                        m_quant.setQPforQuant(cu);
> > > +                        m_quant.setQPforQuant(cu, qp);
> > >
> > >                          uint32_t tuDepthRange[2];
> > >                          cu.getIntraTUQtDepthRange(tuDepthRange, 0);
> > > @@ -952,7 +964,7 @@
> > >          Mode* splitPred = &md.pred[PRED_SPLIT];
> > >          splitPred->initCosts();
> > >          CUData* splitCU = &splitPred->cu;
> > > -        splitCU->initSubCU(parentCTU, cuGeom);
> > > +        splitCU->initSubCU(parentCTU, cuGeom, qp);
> > >
> > >          uint32_t nextDepth = depth + 1;
> > >          ModeDepth& nd = m_modeDepth[nextDepth];
> > > @@ -1025,14 +1037,18 @@
> > >      bool mightSplit = !(cuGeom.flags & CUGeom::LEAF);
> > >      bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY);
> > >
> > > +    int32_t qp = 0;
> > > +    if (depth <= (uint32_t)m_param->rc.maxCuDQPDepth)
> > > +        qp = calculateQpforCuSize(parentCTU, cuGeom);
> > > +
> > >      if (m_param->analysisMode == X265_ANALYSIS_LOAD)
> > >      {
> > >          uint8_t* reuseDepth  =
> > &m_reuseInterDataCTU->depth[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
> > >          uint8_t* reuseModes  =
> > &m_reuseInterDataCTU->modes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
> > >          if (mightNotSplit && depth == reuseDepth[zOrder] && zOrder ==
> > cuGeom.absPartIdx && reuseModes[zOrder] == MODE_SKIP)
> > >          {
> > > -            md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom);
> > > -            md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom);
> > > +            md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
> > > +            md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
> > >              checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP],
> > md.pred[PRED_MERGE], cuGeom, true);
> > >
> > >              if (m_bTryLossless)
> > > @@ -1051,20 +1067,20 @@
> > >
> > >      if (mightNotSplit)
> > >      {
> > > -        md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom);
> > > -        md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom);
> > > +        md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
> > > +        md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
> > >          checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP], md.pred[PRED_MERGE],
> > cuGeom, false);
> > >          bool earlySkip = m_param->bEnableEarlySkip && md.bestMode &&
> > !md.bestMode->cu.getQtRootCbf(0);
> > >
> > >          if (!earlySkip)
> > >          {
> > > -            md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom);
> > > +            md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
> > >              checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N,
> > false);
> > >              checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
> > >
> > >              if (m_slice->m_sliceType == B_SLICE)
> > >              {
> > > -                md.pred[PRED_BIDIR].cu.initSubCU(parentCTU, cuGeom);
> > > +                md.pred[PRED_BIDIR].cu.initSubCU(parentCTU, cuGeom, qp);
> > >                  checkBidir2Nx2N(md.pred[PRED_2Nx2N],
> > md.pred[PRED_BIDIR], cuGeom);
> > >                  if (md.pred[PRED_BIDIR].sa8dCost < MAX_INT64)
> > >                  {
> > > @@ -1075,11 +1091,11 @@
> > >
> > >              if (m_param->bEnableRectInter)
> > >              {
> > > -                md.pred[PRED_Nx2N].cu.initSubCU(parentCTU, cuGeom);
> > > +                md.pred[PRED_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
> > >                  checkInter_rd5_6(md.pred[PRED_Nx2N], cuGeom, SIZE_Nx2N,
> > false);
> > >                  checkBestMode(md.pred[PRED_Nx2N], cuGeom.depth);
> > >
> > > -                md.pred[PRED_2NxN].cu.initSubCU(parentCTU, cuGeom);
> > > +                md.pred[PRED_2NxN].cu.initSubCU(parentCTU, cuGeom, qp);
> > >                  checkInter_rd5_6(md.pred[PRED_2NxN], cuGeom, SIZE_2NxN,
> > false);
> > >                  checkBestMode(md.pred[PRED_2NxN], cuGeom.depth);
> > >              }
> > > @@ -1102,21 +1118,21 @@
> > >
> > >                  if (bHor)
> > >                  {
> > > -                    md.pred[PRED_2NxnU].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_2NxnU].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkInter_rd5_6(md.pred[PRED_2NxnU], cuGeom,
> > SIZE_2NxnU, bMergeOnly);
> > >                      checkBestMode(md.pred[PRED_2NxnU], cuGeom.depth);
> > >
> > > -                    md.pred[PRED_2NxnD].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_2NxnD].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkInter_rd5_6(md.pred[PRED_2NxnD], cuGeom,
> > SIZE_2NxnD, bMergeOnly);
> > >                      checkBestMode(md.pred[PRED_2NxnD], cuGeom.depth);
> > >                  }
> > >                  if (bVer)
> > >                  {
> > > -                    md.pred[PRED_nLx2N].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_nLx2N].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkInter_rd5_6(md.pred[PRED_nLx2N], cuGeom,
> > SIZE_nLx2N, bMergeOnly);
> > >                      checkBestMode(md.pred[PRED_nLx2N], cuGeom.depth);
> > >
> > > -                    md.pred[PRED_nRx2N].cu.initSubCU(parentCTU, cuGeom);
> > > +                    md.pred[PRED_nRx2N].cu.initSubCU(parentCTU, cuGeom,
> > qp);
> > >                      checkInter_rd5_6(md.pred[PRED_nRx2N], cuGeom,
> > SIZE_nRx2N, bMergeOnly);
> > >                      checkBestMode(md.pred[PRED_nRx2N], cuGeom.depth);
> > >                  }
> > > @@ -1124,13 +1140,13 @@
> > >
> > >              if (m_slice->m_sliceType != B_SLICE ||
> > m_param->bIntraInBFrames)
> > >              {
> > > -                md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom);
> > > +                md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);
> > >                  checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N,
> > NULL, NULL);
> > >                  checkBestMode(md.pred[PRED_INTRA], depth);
> > >
> > >                  if (cuGeom.log2CUSize == 3 &&
> > m_slice->m_sps->quadtreeTULog2MinSize < 3)
> > >                  {
> > > -                    md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU,
> > cuGeom);
> > > +                    md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU,
> > cuGeom, qp);
> > >                      checkIntra(md.pred[PRED_INTRA_NxN], cuGeom,
> > SIZE_NxN, NULL, NULL);
> > >                      checkBestMode(md.pred[PRED_INTRA_NxN], depth);
> > >                  }
> > > @@ -1150,7 +1166,7 @@
> > >          Mode* splitPred = &md.pred[PRED_SPLIT];
> > >          splitPred->initCosts();
> > >          CUData* splitCU = &splitPred->cu;
> > > -        splitCU->initSubCU(parentCTU, cuGeom);
> > > +        splitCU->initSubCU(parentCTU, cuGeom, qp);
> > >
> > >          uint32_t nextDepth = depth + 1;
> > >          ModeDepth& nd = m_modeDepth[nextDepth];
> > > @@ -1896,7 +1912,7 @@
> > >      return false;
> > >  }
> > >
> > > -int Analysis::calculateQpforCuSize(CUData& ctu, const CUGeom& cuGeom)
> > > +int Analysis::calculateQpforCuSize(const CUData& ctu, const CUGeom&
> > cuGeom)
> > >  {
> > >      uint32_t ctuAddr = ctu.m_cuAddr;
> > >      FrameData& curEncData = *m_frame->m_encData;
> > > diff -r 6461985f33ac -r 615b61dd2be5 source/encoder/analysis.h
> > > --- a/source/encoder/analysis.h       Sun Mar 15 11:58:32 2015 -0500
> > > +++ b/source/encoder/analysis.h       Mon Mar 16 16:36:51 2015 +0530
> > > @@ -139,7 +139,7 @@
> > >      /* generate residual and recon pixels for an entire CTU recursively
> > (RD0) */
> > >      void encodeResidue(const CUData& parentCTU, const CUGeom& cuGeom);
> > >
> > > -    int calculateQpforCuSize(CUData& ctu, const CUGeom& cuGeom);
> > > +    int calculateQpforCuSize(const CUData& ctu, const CUGeom& cuGeom);
> > >
> > >      /* check whether current mode is the new best */
> > >      inline void checkBestMode(Mode& mode, uint32_t depth)
> > > diff -r 6461985f33ac -r 615b61dd2be5 source/encoder/encoder.cpp
> > > --- a/source/encoder/encoder.cpp      Sun Mar 15 11:58:32 2015 -0500
> > > +++ b/source/encoder/encoder.cpp      Mon Mar 16 16:36:51 2015 +0530
> > > @@ -1551,15 +1551,11 @@
> > >      bool bIsVbv = m_param->rc.vbvBufferSize > 0 &&
> > m_param->rc.vbvMaxBitrate > 0;
> > >
> > >      if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
> > > -    {
> > >          pps->bUseDQP = true;
> > > -        pps->maxCuDQPDepth = 0; /* TODO: make configurable? */
> > > -    }
> > >      else
> > > -    {
> > >          pps->bUseDQP = false;
> > > -        pps->maxCuDQPDepth = 0;
> > > -    }
> > > +
> > > +    pps->maxCuDQPDepth = m_param->rc.maxCuDQPDepth;
> > >
> > >      pps->chromaQpOffset[0] = m_param->cbQpOffset;
> > >      pps->chromaQpOffset[1] = m_param->crQpOffset;
> > > @@ -1778,6 +1774,17 @@
> > >          p->analysisMode = X265_ANALYSIS_OFF;
> > >          x265_log(p, X265_LOG_WARNING, "Analysis save and load mode not
> > supported for distributed mode analysis\n");
> > >      }
> > > +    bool bIsVbv = m_param->rc.vbvBufferSize > 0 &&
> > m_param->rc.vbvMaxBitrate > 0;
> > > +    if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
> > > +    {
> > > +        if (p->rc.maxCuDQPDepth > (NUM_CU_DEPTH - 2))
> > > +        {
> > > +            p->rc.maxCuDQPDepth = 0;
> > > +            x265_log(p, X265_LOG_WARNING, "The maxCUDQPDepth should be
> > less than maxCUDepth - 1(0, 1 or 2) setting maxCUDQPDepth = %d \n", 0);
> > > +        }
> > > +    }
> > > +    else
> > > +        p->rc.maxCuDQPDepth = 0;
> >
> > there should be some kind of a warning here explaining why the option
> > the user asked for has been ignored
> >
> 
> OK,
> 
> 
> >
> > >  }
> > >
> > >  void Encoder::allocAnalysis(x265_analysis_data* analysis)
> > > diff -r 6461985f33ac -r 615b61dd2be5 source/x265.h
> > > --- a/source/x265.h   Sun Mar 15 11:58:32 2015 -0500
> > > +++ b/source/x265.h   Mon Mar 16 16:36:51 2015 +0530
> > > @@ -977,6 +977,13 @@
> > >          /* Enable stricter conditions to check bitrate deviations in
> > CBR mode. May compromise
> > >           * quality to maintain bitrate adherence */
> > >          int bStrictCbr;
> > > +
> > > +        /* Max depth of a minimum CuDQP for sub-LCU-level delta QP
> > > +         * the default maxCuDQPDepth is 0 then the CuDQP signaled once
> > per CTU, this param
> > > +         * enable the CuDQP signaled for sub-LCU-level also, minimum
> > maxCuDQPDepth is 0
> > > +         * and max maxCuDQPDepth is equal to maxCUDepth, always the
> > CuDQP signaled
> > > +         * if currentDepth is less than or equal to maxCuDQPDepth */
> > > +        int maxCuDQPDepth;
> >
> > This is mixing LCU and CTU in the same paragraph. we've systematically
> > removed all references to LCU in our public headers and docs and are
> > using CTU everywhere. That's ignoring the fact that I can't make any
> > sense of this description, as it's currently written.
> >
> 
> OK, i will modify the discription and update the rest Doc also
> 
> 
> >
> > >      } rc;
> > >
> > >      /*== Video Usability Information ==*/
> > > diff -r 6461985f33ac -r 615b61dd2be5 source/x265cli.h
> > > --- a/source/x265cli.h        Sun Mar 15 11:58:32 2015 -0500
> > > +++ b/source/x265cli.h        Mon Mar 16 16:36:51 2015 +0530
> > > @@ -202,6 +202,7 @@
> > >      { "strict-cbr",           no_argument, NULL, 0 },
> > >      { "temporal-layers",      no_argument, NULL, 0 },
> > >      { "no-temporal-layers",   no_argument, NULL, 0 },
> > > +    { "max-dqp-depth",  required_argument, NULL, 0 },
> > >      { 0, 0, 0, 0 },
> > >      { 0, 0, 0, 0 },
> > >      { 0, 0, 0, 0 },
> > > _______________________________________________
> > > x265-devel mailing list
> > > x265-devel at videolan.org
> > > https://mailman.videolan.org/listinfo/x265-devel
> >
> > --
> > Steve Borho
> > _______________________________________________
> > x265-devel mailing list
> > x265-devel at videolan.org
> > https://mailman.videolan.org/listinfo/x265-devel
> >
> 
> 
> 
> -- 
> Thanks & Regards
> Gopu G
> Multicoreware Inc

> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel


-- 
Steve Borho


More information about the x265-devel mailing list