[x265] [PATCH] search: dump best motion statistics for P and B slices into analysisdata file

Gopu Govindaswamy gopu at multicorewareinc.com
Tue Oct 14 08:28:15 CEST 2014


On Tue, Oct 14, 2014 at 11:51 AM, Steve Borho <steve at borho.org> wrote:

> On 10/14, gopu at multicorewareinc.com wrote:
> > # HG changeset patch
> > # User Gopu Govindaswamy <gopu at multicorewareinc.com>
> > # Date 1413260936 -19800
> > #      Tue Oct 14 09:58:56 2014 +0530
> > # Node ID 585e8591cb95ef5a57e10f16e9f4bd61ec5a8913
> > # Parent  f26e81eb555aa586380b34314c302ea9b148f357
> > search: dump best motion statistics for P and B slices into analysisdata
> file
> >
> > diff -r f26e81eb555a -r 585e8591cb95 source/Lib/TLibCommon/TComRom.h
> > --- a/source/Lib/TLibCommon/TComRom.h Mon Oct 13 14:36:40 2014 +0530
> > +++ b/source/Lib/TLibCommon/TComRom.h Tue Oct 14 09:58:56 2014 +0530
> > @@ -68,6 +68,8 @@
> >
> >  #define SLFASE_CONSTANT 0x5f4e4a53
> >
> > +#define MAX_RECURSIVE 85 //maximum recursive call for each cu
> > +
> >  void initROM();
> >  void destroyROM();
> >
> > diff -r f26e81eb555a -r 585e8591cb95 source/encoder/analysis.cpp
> > --- a/source/encoder/analysis.cpp     Mon Oct 13 14:36:40 2014 +0530
> > +++ b/source/encoder/analysis.cpp     Tue Oct 14 09:58:56 2014 +0530
> > @@ -477,6 +477,9 @@
> >      }
> >      else
> >      {
> > +        if (m_param->analysisMode)
> > +            m_interAnalysisData = ctu->m_pic->m_interData +
> (ctu->m_cuAddr * MAX_RECURSIVE);
> > +
> >          if (m_param->rdLevel < 5)
> >          {
> >              TComDataCU* outBestCU = NULL;
> > @@ -712,8 +715,6 @@
> >          for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)
> >          {
> >              CU *child_cu =
> pic->getCU(outTempCU->m_cuAddr)->m_cuLocalData + cu->childIdx + partUnitIdx;
> > -            int qp = outTempCU->getQP(0);
> > -            subBestPartCU->initSubCU(outTempCU, child_cu, partUnitIdx,
> nextDepth, qp); // clear sub partition datas or init.
> >              if (child_cu->flags & CU::PRESENT)
> >              {
> >                  subTempPartCU->initSubCU(outTempCU, child_cu,
> partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
> > @@ -964,6 +965,10 @@
> >                  m_bJobsQueued = false;
> >                  m_modeCompletionEvent.wait();
> >
> > +                /* increment the analysisData buffer for each recursive
> call */
> > +                if (m_interAnalysisData)
> > +                    m_interAnalysisData++;
>
> this seems unlikely to be the right place for this. if the data is
> per-mode it needs to be handled in the mode functions. if it is per CU,
> it should probably be incremented at the end of this function or at
> least after the best non-split choice is selected
>

 yes this analysisData buffer is per cu, this can be incremented at the end
of function,
i will resend this patch

>
> >                  if (m_param->bEnableEarlySkip &&
> m_bestMergeCU[depth]->isSkipped(0))
> >                  {
> >                      outBestCU = m_bestMergeCU[depth];
> > @@ -1450,6 +1455,10 @@
> >                  outTempCU->initEstData();
> >                  if (m_param->bEnableCbfFastMode)
> >                      doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
> > +
> > +                /* increment the analysisData buffer for each recursive
> call */
> > +                if (m_interAnalysisData)
> > +                    m_interAnalysisData++;
> >              }
> >          }
> >
> > @@ -2093,7 +2102,7 @@
> >          cu->m_totalDistortion =
> primitives.sa8d[sizeIdx](m_origYuv[depth]->getLumaAddr(),
> m_origYuv[depth]->getStride(), predYuv->getLumaAddr(),
> predYuv->getStride());
> >          cu->m_sa8dCost = m_rdCost.calcRdSADCost(cu->m_totalDistortion,
> cu->m_totalBits);
> >      }
> > -    else if (predInterSearch(cu, cuData, predYuv, false, false))
> > +    else if (predInterSearch(cu, cuData, predYuv, false, false,
> m_interAnalysisData))
> >      {
> >          int sizeIdx = cu->getLog2CUSize(0) - 2;
> >          uint32_t distortion =
> primitives.sa8d[sizeIdx](m_origYuv[depth]->getLumaAddr(),
> m_origYuv[depth]->getStride(), predYuv->getLumaAddr(),
> predYuv->getStride());
> > @@ -2124,7 +2133,7 @@
> >          checkDQP(tempCU);
> >          checkBestMode(bestCU, tempCU, depth);
> >      }
> > -    else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth],
> bMergeOnly, true))
> > +    else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth],
> bMergeOnly, true, m_interAnalysisData))
> >      {
> >          encodeResAndCalcRdInterCU(tempCU, cuData, m_origYuv[depth],
> m_tmpPredYuv[depth], m_tmpResiYuv[depth], m_bestResiYuv[depth],
> m_tmpRecoYuv[depth]);
> >          checkDQP(tempCU);
> > diff -r f26e81eb555a -r 585e8591cb95 source/encoder/analysis.h
> > --- a/source/encoder/analysis.h       Mon Oct 13 14:36:40 2014 +0530
> > +++ b/source/encoder/analysis.h       Tue Oct 14 09:58:56 2014 +0530
> > @@ -109,6 +109,7 @@
> >
> >      StatisticLog  m_sliceTypeLog[3];
> >      StatisticLog* m_log;
> > +    x265_inter_data* m_interAnalysisData;    // To store the inter
> analysis data per CU
> >
> >      Analysis();
> >      bool create(uint32_t totalDepth, uint32_t maxWidth,
> ThreadLocalData* tld);
> > diff -r f26e81eb555a -r 585e8591cb95 source/encoder/search.cpp
> > --- a/source/encoder/search.cpp       Mon Oct 13 14:36:40 2014 +0530
> > +++ b/source/encoder/search.cpp       Tue Oct 14 09:58:56 2014 +0530
> > @@ -1684,7 +1684,7 @@
> >
> >  /* search of the best candidate for inter prediction
> >   * returns true if predYuv was filled with a motion compensated
> prediction */
> > -bool Search::predInterSearch(TComDataCU* cu, CU* cuData, TComYuv*
> predYuv, bool bMergeOnly, bool bChroma)
> > +bool Search::predInterSearch(TComDataCU* cu, CU* cuData, TComYuv*
> predYuv, bool bMergeOnly, bool bChroma, x265_inter_data* interAnalysisData)
> >  {
> >      MV amvpCand[2][MAX_NUM_REF][AMVP_NUM_CANDS];
> >      MV mvc[(MD_ABOVE_LEFT + 1) * 2 + 1];
> > @@ -1755,6 +1755,11 @@
> >          list[0].cost = MAX_UINT;
> >          list[1].cost = MAX_UINT;
> >
> > +        /* require for sharing mode, if cost is zero no need to call
> subpelCompare
> > +        * extract the best cost from mvcost and this is only for actual
> me, not required for
> > +        * lowres me and isCostZero is NULL when the me is called from
> slicetype */
>
> white-space
>
> > +        bool costZero[2];
> > +
> >          getBlkBits(partSize, slice->isInterP(), partIdx, lastMode,
> listSelBits);
> >
> >          // Uni-directional prediction
> > @@ -1812,10 +1817,24 @@
> >                      list[l].ref = ref;
> >                      list[l].cost = cost;
> >                      list[l].bits = bits;
> > +                    costZero[l] = !!satdCost;
> >                  }
> >              }
> >          }
> >
> > +        if (m_param->analysisMode == X265_ANALYSIS_SAVE &&
> interAnalysisData)
> > +        {
> > +            for (int32_t i = 0; i < 2; i++)
> > +            {
> > +                interAnalysisData->costZero[i] = costZero[i];
> > +                interAnalysisData->mvx[i] = list[i].mv.x;
> > +                interAnalysisData->mvy[i] = list[i].mv.y;
> > +                interAnalysisData->ref[i] = list[i].ref;
> > +            }
> > +            interAnalysisData->zOrder = cu->m_absIdxInCTU;
> > +            interAnalysisData->depth  = cu->getDepth(0);
> > +        }
> > +
> >          // Bi-directional prediction
> >          if (slice->isInterB() && !cu->isBipredRestriction() &&
> list[0].cost != MAX_UINT && list[1].cost != MAX_UINT)
> >          {
> > diff -r f26e81eb555a -r 585e8591cb95 source/encoder/search.h
> > --- a/source/encoder/search.h Mon Oct 13 14:36:40 2014 +0530
> > +++ b/source/encoder/search.h Tue Oct 14 09:58:56 2014 +0530
> > @@ -101,7 +101,7 @@
> >      void     estIntraPredChromaQT(TComDataCU* cu, CU* cuData, TComYuv*
> fencYuv, TComYuv* predYuv, ShortYuv* resiYuv, TComYuv* reconYuv);
> >
> >      // estimation inter prediction (non-skip)
> > -    bool     predInterSearch(TComDataCU* cu, CU* cuData, TComYuv*
> predYuv, bool bMergeOnly, bool bChroma);
> > +    bool     predInterSearch(TComDataCU* cu, CU* cuData, TComYuv*
> predYuv, bool bMergeOnly, bool bChroma, x265_inter_data*
> m_interAnalysisData);
> >
> >      // encode residual and compute rd-cost for inter mode
> >      void     encodeResAndCalcRdInterCU(TComDataCU* cu, CU* cuData,
> TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv, ShortYuv*
> bestResiYuv, TComYuv* reconYuv);
> > _______________________________________________
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20141014/cc0f4ce8/attachment-0001.html>


More information about the x265-devel mailing list