[x265] [PATCH] rc: compute inter, intra and skip cus per frame for the first pass

Aarthi Priya Thirumalai aarthi at multicorewareinc.com
Tue Jul 1 21:10:27 CEST 2014


On Mon, Jun 30, 2014 at 11:45 PM, Steve Borho <steve at borho.org> wrote:

> On Mon, Jun 30, 2014 at 11:38 AM,  <aarthi at multicorewareinc.com> wrote:
> > # HG changeset patch
> > # User Aarthi Thirumalai
> > # Date 1403785166 -19800
> > #      Thu Jun 26 17:49:26 2014 +0530
> > # Node ID 2dd5aded9e192783dfc8f8307a05e3b2a55b7f1d
> > # Parent  bab912d0834914e8947a126e6b0ec4dbc75d7843
> > rc: compute inter, intra and skip cus per frame for the first pass
> >
> > diff -r bab912d08349 -r 2dd5aded9e19 source/Lib/TLibEncoder/TEncCu.cpp
> > --- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Jun 25 22:49:38 2014 +0530
> > +++ b/source/Lib/TLibEncoder/TEncCu.cpp Thu Jun 26 17:49:26 2014 +0530
> > @@ -341,6 +341,7 @@
> >              do
> >              {
> >                  m_log->totalCu++;
> > +                m_log->rowIntraCuCnt++;
> >                  part = cu->getDepth(i);
> >                  int next = numPartition >> (part * 2);
> >                  if (part == g_maxCUDepth - 1 && cu->getPartitionSize(i)
> != SIZE_2Nx2N)
> > @@ -383,6 +384,7 @@
> >                  if (cu->isSkipped(i))
> >                  {
> >                      m_log->cntSkipCu[part]++;
> > +                    m_log->rowSkipCuCnt++;
>
> I suspect there's an impedance mismatch here between AVC and HEVC.
> For x264 these inter/intra/skip decisions are for the whole MB, but
> for us these decisions are made at each CU at every level of the
> quad-tree.
>

yea, you are right, I missed that. we need to compute the inter,intra and
skip cus of the frame in terms of the number of 16x16 blocks to be used for
the 2nd pass.

>
> We can keep such statistics but they would need to be weighted per
> depth - perhaps multiplied by the number of pixels in the coding unit
> so that at the end of the frame you know what percentages of the frame
> were inter, intra, or merge coded.
>
> >                  }
> >                  else
> >                  {
> > @@ -390,6 +392,7 @@
> >                      if (cu->getPredictionMode(0) == MODE_INTER)
> >                      {
> >                          m_log->cntInter[part]++;
> > +                        m_log->rowInterCuCnt++;
> >                          if (cu->getPartitionSize(0) < AMP_ID)
> >
>  m_log->cuInterDistribution[part][cu->getPartitionSize(0)]++;
> >                          else
> > @@ -397,6 +400,7 @@
> >                      }
> >                      else if (cu->getPredictionMode(0) == MODE_INTRA)
> >                      {
> > +                        m_log->rowIntraCuCnt++;
> >                          if (part == g_maxCUDepth - 1 &&
> cu->getPartitionSize(0) == SIZE_NxN)
> >                          {
> >                              m_log->cntIntraNxN++;
> > diff -r bab912d08349 -r 2dd5aded9e19 source/Lib/TLibEncoder/TEncCu.h
> > --- a/source/Lib/TLibEncoder/TEncCu.h   Wed Jun 25 22:49:38 2014 +0530
> > +++ b/source/Lib/TLibEncoder/TEncCu.h   Thu Jun 26 17:49:26 2014 +0530
> > @@ -65,7 +65,9 @@
> >      uint64_t cntSkipCu[4];
> >      uint64_t cntTotalCu[4];
> >      uint64_t totalCu;
> > -
> > +    uint32_t rowInterCuCnt;
> > +    uint32_t rowIntraCuCnt;
> > +    uint32_t rowSkipCuCnt;
> >      StatisticLog()
> >      {
> >          memset(this, 0, sizeof(StatisticLog));
> > diff -r bab912d08349 -r 2dd5aded9e19 source/encoder/frameencoder.cpp
> > --- a/source/encoder/frameencoder.cpp   Wed Jun 25 22:49:38 2014 +0530
> > +++ b/source/encoder/frameencoder.cpp   Thu Jun 26 17:49:26 2014 +0530
> > @@ -1037,6 +1037,14 @@
> >              enableRowFilter(i);
> >          }
> >      }
> > +
> > +    // copy no. of intra, inter Cu cnt per row into frame stats
> > +    m_frame->m_stats.cuCount_i += tld.m_cuCoder.m_log->rowIntraCuCnt;
> > +    m_frame->m_stats.cuCount_p += tld.m_cuCoder.m_log->rowInterCuCnt;
> > +    m_frame->m_stats.cuCount_skip += tld.m_cuCoder.m_log->rowSkipCuCnt;
> > +    //clear the row cu data from thread local object
> > +    tld.m_cuCoder.m_log->rowIntraCuCnt =
> tld.m_cuCoder.m_log->rowInterCuCnt = tld.m_cuCoder.m_log->rowSkipCuCnt = 0;
> > +
> >      m_totalTime += x265_mdate() - startTime;
> >      curRow.m_busy = false;
> >  }
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140702/17953b98/attachment-0001.html>


More information about the x265-devel mailing list