[x265] [PATCH 2 of 3] rc: accumulate mv bits, coeff bits per frame

Deepthi Nandakumar deepthi at multicorewareinc.com
Fri Jun 27 10:35:11 CEST 2014


Thanks, can you merge with the latest tip?


On Fri, Jun 27, 2014 at 12:13 AM, Aarthi Priya Thirumalai <
aarthi at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Aarthi Thirumalai<aarthi at multicorewareinc.com>
> # Date 1403808050 -19800
> #      Fri Jun 27 00:10:50 2014 +0530
> # Node ID 11ddf73017d44933090a8943f4fc5098b231b56d
> # Parent  1b669c33ff3a8d8f6c9bd1e18979c009baed2433
> rc: accumulate mv bits, coeff bits per frame
>
> diff -r 1b669c33ff3a -r 11ddf73017d4 source/Lib/TLibEncoder/TEncCu.cpp
>  --- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Jun 25 22:46:45 2014 +0530
> +++ b/source/Lib/TLibEncoder/TEncCu.cpp Fri Jun 27 00:10:50 2014 +0530
> @@ -1365,12 +1365,14 @@
>      m_entropyCoder->encodePredMode(outTempCU, 0);
>      m_entropyCoder->encodePartSize(outTempCU, 0, depth);
>      m_entropyCoder->encodePredInfo(outTempCU, 0);
>  +    outTempCU->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>
>      // Encode Coefficients
>      bool bCodeDQP = getdQPFlag();
>      m_entropyCoder->encodeCoeff(outTempCU, 0, depth,
> outTempCU->getCUSize(0), bCodeDQP);
>      m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
>      outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
> +    outTempCU->m_coeffBits = outTempCU->m_totalBits - outTempCU->m_mvBits;
>
>      if (m_rdCost->psyRdEnabled())
>      {
> @@ -1411,12 +1413,14 @@
>      m_entropyCoder->encodePredMode(outTempCU, 0);
>      m_entropyCoder->encodePartSize(outTempCU, 0, depth);
>      m_entropyCoder->encodePredInfo(outTempCU, 0);
> +    outTempCU->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>
>      // Encode Coefficients
>      bool bCodeDQP = getdQPFlag();
>      m_entropyCoder->encodeCoeff(outTempCU, 0, depth,
> outTempCU->getCUSize(0), bCodeDQP);
>      m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
>      outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
> +    outTempCU->m_coeffBits = outTempCU->m_totalBits - outTempCU->m_mvBits;
>
>      if (m_rdCost->psyRdEnabled())
>      {
> diff -r 1b669c33ff3a -r 11ddf73017d4 source/Lib/TLibEncoder/TEncSearch.cpp
>  --- a/source/Lib/TLibEncoder/TEncSearch.cpp Wed Jun 25 22:46:45 2014
> +0530
> +++ b/source/Lib/TLibEncoder/TEncSearch.cpp Fri Jun 27 00:10:50 2014 +0530
> @@ -4059,6 +4059,7 @@
>          }
>          m_entropyCoder->encodeSkipFlag(cu, 0);
>          m_entropyCoder->encodeMergeIndex(cu, 0);
> +        cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>          return m_entropyCoder->getNumberOfWrittenBits();
>      }
>      else
> @@ -4073,8 +4074,11 @@
>          m_entropyCoder->encodePartSize(cu, 0, cu->getDepth(0));
>          m_entropyCoder->encodePredInfo(cu, 0);
>          bool bDummy = false;
> +        cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>          m_entropyCoder->encodeCoeff(cu, 0, cu->getDepth(0),
> cu->getCUSize(0), bDummy);
> -        return m_entropyCoder->getNumberOfWrittenBits();
> +        int totalBits = m_entropyCoder->getNumberOfWrittenBits();
> +        cu->m_coeffBits = totalBits - cu->m_mvBits;
>  +        return totalBits;
>      }
>  }
>
> diff -r 1b669c33ff3a -r 11ddf73017d4 source/encoder/compress.cpp
> --- a/source/encoder/compress.cpp Wed Jun 25 22:46:45 2014 +0530
> +++ b/source/encoder/compress.cpp Fri Jun 27 00:10:50 2014 +0530
> @@ -63,6 +63,7 @@
>      m_entropyCoder->encodePredMode(cu, 0);
>      m_entropyCoder->encodePartSize(cu, 0, depth);
>      m_entropyCoder->encodePredInfo(cu, 0);
> +    cu->m_mvBits += m_entropyCoder->getNumberOfWrittenBits();
>
>      // Encode Coefficients
>      bool bCodeDQP = getdQPFlag();
> @@ -71,6 +72,7 @@
>      m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
>
>      cu->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
> +    cu->m_coeffBits = cu->m_totalBits - cu->m_mvBits;
>      if (m_rdCost->psyRdEnabled())
>      {
>          int part = g_convertToBit[cu->getCUSize(0)];
> diff -r 1b669c33ff3a -r 11ddf73017d4 source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp Wed Jun 25 22:46:45 2014 +0530
> +++ b/source/encoder/frameencoder.cpp Fri Jun 27 00:10:50 2014 +0530
> @@ -694,6 +694,11 @@
>          // Store probabilities of second LCU in line into buffer
>          if (col == 1 && m_param->bEnableWavefront)
>              getBufferSBac(lin)->loadContexts(getSbacCoder(subStrm));
> +
> +        // Collect Frame Stats for 2 pass
> +        m_frame->m_stats.mvBits += cu->m_mvBits;
> +        m_frame->m_stats.coeffBits += cu->m_coeffBits;
> +        m_frame->m_stats.miscBits += cu->m_totalBits - (cu->m_mvBits +
> cu->m_coeffBits);
>      }
>
>      if (slice->getPPS()->getCabacInitPresentFlag())
>
>
> On Thu, Jun 26, 2014 at 4:25 PM, Deepthi Nandakumar <
> deepthi at multicorewareinc.com> wrote:
>
>> Pls fix extra newlines and whitespace nits.
>>
>>
>> On Wed, Jun 25, 2014 at 10:54 PM, <aarthi at multicorewareinc.com> wrote:
>>
>>> # HG changeset patch
>>> # User Aarthi Thirumalai<aarthi at multicorewareinc.com>
>>> # Date 1403716735 -19800
>>> #      Wed Jun 25 22:48:55 2014 +0530
>>> # Node ID 0995efabd44470c1192994e1aceeb40ae606467f
>>> # Parent  e71e34d02d7777e228eab43edf1910a71a44417d
>>> rc: accumulate mv bits, coeff bits per frame.
>>>
>>> diff -r e71e34d02d77 -r 0995efabd444 source/Lib/TLibEncoder/TEncCu.cpp
>>> --- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Jun 25 22:46:45 2014 +0530
>>> +++ b/source/Lib/TLibEncoder/TEncCu.cpp Wed Jun 25 22:48:55 2014 +0530
>>> @@ -555,6 +555,7 @@
>>>          m_entropyCoder->resetBits();
>>>          m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
>>>          outBestCU->m_totalBits +=
>>> m_entropyCoder->getNumberOfWrittenBits(); // split bits
>>> +
>>>          if (m_rdCost->psyRdEnabled())
>>>          {
>>>              outBestCU->m_totalPsyCost =
>>> m_rdCost->calcPsyRdCost(outBestCU->m_totalDistortion,
>>> outBestCU->m_totalBits,
>>> @@ -616,7 +617,7 @@
>>>              m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);
>>>              outTempCU->m_totalBits +=
>>> m_entropyCoder->getNumberOfWrittenBits(); // split bits
>>>          }
>>> -
>>> +
>>>          if (m_rdCost->psyRdEnabled())
>>>          {
>>>              outTempCU->m_totalPsyCost =
>>> m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion,
>>> outTempCU->m_totalBits,
>>> @@ -907,6 +908,7 @@
>>>          m_entropyCoder->resetBits();
>>>          m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
>>>          outBestCU->m_totalBits +=
>>> m_entropyCoder->getNumberOfWrittenBits(); // split bits
>>> +
>>>          if (m_rdCost->psyRdEnabled())
>>>          {
>>>              outBestCU->m_totalPsyCost =
>>> m_rdCost->calcPsyRdCost(outBestCU->m_totalDistortion,
>>> outBestCU->m_totalBits,
>>> @@ -1168,6 +1170,7 @@
>>>          return;
>>>      }
>>>
>>> +
>>>      if (slice->getPPS()->getTransquantBypassEnableFlag())
>>>      {
>>>          m_entropyCoder->encodeCUTransquantBypassFlag(cu, absPartIdx);
>>> @@ -1390,12 +1393,14 @@
>>>      m_entropyCoder->encodePartSize(outTempCU, 0, depth);
>>>      m_entropyCoder->encodePredInfo(outTempCU, 0);
>>>      m_entropyCoder->encodeIPCMInfo(outTempCU, 0);
>>> +    outTempCU->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>>>
>>>      // Encode Coefficients
>>>      bool bCodeDQP = getdQPFlag();
>>>      m_entropyCoder->encodeCoeff(outTempCU, 0, depth,
>>> outTempCU->getCUSize(0), bCodeDQP);
>>>      m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
>>>      outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
>>> +    outTempCU->m_coeffBits = outTempCU->m_totalBits -
>>> outTempCU->m_mvBits;
>>>
>>>      if (m_rdCost->psyRdEnabled())
>>>      {
>>> @@ -1437,12 +1442,13 @@
>>>      m_entropyCoder->encodePartSize(outTempCU, 0, depth);
>>>      m_entropyCoder->encodePredInfo(outTempCU, 0);
>>>      m_entropyCoder->encodeIPCMInfo(outTempCU, 0);
>>> -
>>> +    outTempCU->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>>>      // Encode Coefficients
>>>      bool bCodeDQP = getdQPFlag();
>>>      m_entropyCoder->encodeCoeff(outTempCU, 0, depth,
>>> outTempCU->getCUSize(0), bCodeDQP);
>>>      m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
>>>      outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
>>> +    outTempCU->m_coeffBits = outTempCU->m_totalBits -
>>> outTempCU->m_mvBits;
>>>
>>>      if (m_rdCost->psyRdEnabled())
>>>      {
>>> @@ -1492,12 +1498,14 @@
>>>      m_entropyCoder->encodeSkipFlag(outTempCU, 0);
>>>      m_entropyCoder->encodePredMode(outTempCU, 0);
>>>      m_entropyCoder->encodePartSize(outTempCU, 0, depth);
>>> +    outTempCU->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>>>      m_entropyCoder->encodeIPCMInfo(outTempCU, 0);
>>>
>>>      m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
>>>
>>>      outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
>>>      outTempCU->m_totalRDCost =
>>> m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
>>> +    outTempCU->m_coeffBits = outTempCU->m_totalBits -
>>> outTempCU->m_mvBits;
>>>
>>>      xCheckDQP(outTempCU);
>>>      xCheckBestMode(outBestCU, outTempCU, depth);
>>> diff -r e71e34d02d77 -r 0995efabd444
>>> source/Lib/TLibEncoder/TEncSearch.cpp
>>> --- a/source/Lib/TLibEncoder/TEncSearch.cpp     Wed Jun 25 22:46:45 2014
>>> +0530
>>> +++ b/source/Lib/TLibEncoder/TEncSearch.cpp     Wed Jun 25 22:48:55 2014
>>> +0530
>>> @@ -4211,6 +4211,7 @@
>>>          }
>>>          m_entropyCoder->encodeSkipFlag(cu, 0);
>>>          m_entropyCoder->encodeMergeIndex(cu, 0);
>>> +        cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>>>          return m_entropyCoder->getNumberOfWrittenBits();
>>>      }
>>>      else
>>> @@ -4225,8 +4226,11 @@
>>>          m_entropyCoder->encodePartSize(cu, 0, cu->getDepth(0));
>>>          m_entropyCoder->encodePredInfo(cu, 0);
>>>          bool bDummy = false;
>>> +        cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
>>>          m_entropyCoder->encodeCoeff(cu, 0, cu->getDepth(0),
>>> cu->getCUSize(0), bDummy);
>>> -        return m_entropyCoder->getNumberOfWrittenBits();
>>> +        int totalBits = m_entropyCoder->getNumberOfWrittenBits();
>>> +        cu->m_coeffBits = totalBits - cu->m_mvBits;
>>> +        return totalBits;
>>>      }
>>>  }
>>>
>>> diff -r e71e34d02d77 -r 0995efabd444 source/encoder/compress.cpp
>>> --- a/source/encoder/compress.cpp       Wed Jun 25 22:46:45 2014 +0530
>>> +++ b/source/encoder/compress.cpp       Wed Jun 25 22:48:55 2014 +0530
>>> @@ -64,6 +64,7 @@
>>>      m_entropyCoder->encodePartSize(cu, 0, depth);
>>>      m_entropyCoder->encodePredInfo(cu, 0);
>>>      m_entropyCoder->encodeIPCMInfo(cu, 0);
>>> +    cu->m_mvBits += m_entropyCoder->getNumberOfWrittenBits();
>>>
>>>      // Encode Coefficients
>>>      bool bCodeDQP = getdQPFlag();
>>> @@ -72,6 +73,7 @@
>>>      m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
>>>
>>>      cu->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
>>> +    cu->m_coeffBits = cu->m_totalBits - cu->m_mvBits;
>>>      cu->m_totalRDCost = m_rdCost->calcRdCost(cu->m_totalDistortion,
>>> cu->m_totalBits);
>>>  }
>>>
>>> @@ -625,7 +627,7 @@
>>>                  m_entropyCoder->resetBits();
>>>                  m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
>>>                  outBestCU->m_totalBits +=
>>> m_entropyCoder->getNumberOfWrittenBits(); // split bits
>>> -                outBestCU->m_totalRDCost  =
>>> m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
>>> +                outBestCU->m_totalRDCost =
>>> m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
>>>              }
>>>
>>>              // copy original YUV samples to PCM buffer
>>> diff -r e71e34d02d77 -r 0995efabd444 source/encoder/frameencoder.cpp
>>> --- a/source/encoder/frameencoder.cpp   Wed Jun 25 22:46:45 2014 +0530
>>> +++ b/source/encoder/frameencoder.cpp   Wed Jun 25 22:48:55 2014 +0530
>>> @@ -694,6 +694,11 @@
>>>          // Store probabilities of second LCU in line into buffer
>>>          if (col == 1 && m_param->bEnableWavefront)
>>>              getBufferSBac(lin)->loadContexts(getSbacCoder(subStrm));
>>> +
>>> +        // Collect Frame Stats for 2 pass
>>> +        m_frame->m_stats.mvBits += cu->m_mvBits;
>>> +        m_frame->m_stats.coeffBits += cu->m_coeffBits;
>>> +        m_frame->m_stats.miscBits += cu->m_totalBits - (cu->m_mvBits +
>>> cu->m_coeffBits);
>>>      }
>>>
>>>      if (slice->getPPS()->getCabacInitPresentFlag())
>>> _______________________________________________
>>> x265-devel mailing list
>>> x265-devel at videolan.org
>>> https://mailman.videolan.org/listinfo/x265-devel
>>>
>>
>>
>> _______________________________________________
>> x265-devel mailing list
>> x265-devel at videolan.org
>> https://mailman.videolan.org/listinfo/x265-devel
>>
>>
>
> _______________________________________________
> 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/20140627/f6412f34/attachment-0001.html>


More information about the x265-devel mailing list