[x265] [PATCH 2 of 2] Implement slice-level SAO filter

Aruna Matheswaran aruna at multicorewareinc.com
Thu Sep 12 08:10:32 CEST 2019


Pushed to default.

On Wed, Sep 11, 2019 at 10:48 PM <pooja at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Soundariya Ranin Venkatesh <soundariya at multicorewareinc.com>
> # Date 1567501320 -19800
> #      Tue Sep 03 14:32:00 2019 +0530
> # Node ID ef2a478cde8712ba9b558257111f4abc50283609
> # Parent  5e791399ec4a0a788f880a9967c9e21fbaa22fa3
> Implement slice-level SAO filter.
>
> diff -r 5e791399ec4a -r ef2a478cde87 source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp   Tue Sep 03 14:25:44 2019 +0530
> +++ b/source/encoder/frameencoder.cpp   Tue Sep 03 14:32:00 2019 +0530
> @@ -634,14 +634,22 @@
>          if (!m_param->bEnableWavefront)
>              m_backupStreams = new Bitstream[numSubstreams];
>          m_substreamSizes = X265_MALLOC(uint32_t, numSubstreams);
> -        if (!m_param->bEnableSAO)
> +        if (!slice->m_bUseSao)
> +        {
>              for (uint32_t i = 0; i < numSubstreams; i++)
>                  m_rows[i].rowGoOnCoder.setBitstream(&m_outStreams[i]);
> +        }
>      }
>      else
>      {
>          for (uint32_t i = 0; i < numSubstreams; i++)
> +        {
>              m_outStreams[i].resetBits();
> +            if (!slice->m_bUseSao)
> +                m_rows[i].rowGoOnCoder.setBitstream(&m_outStreams[i]);
> +            else
> +                m_rows[i].rowGoOnCoder.setBitstream(NULL);
> +        }
>      }
>
>      m_rce.encodeOrder = m_frame->m_encodeOrder;
> @@ -981,7 +989,7 @@
>      m_entropyCoder.setBitstream(&m_bs);
>
>      // finish encode of each CTU row, only required when SAO is enabled
> -    if (m_param->bEnableSAO)
> +    if (slice->m_bUseSao)
>          encodeSlice(0);
>
>      m_entropyCoder.setBitstream(&m_bs);
> @@ -1221,7 +1229,7 @@
>      const uint32_t lastCUAddr = (slice->m_endCUAddr +
> m_param->num4x4Partitions - 1) / m_param->num4x4Partitions;
>      const uint32_t numSubstreams = m_param->bEnableWavefront ?
> slice->m_sps->numCuInHeight : 1;
>
> -    SAOParam* saoParam = slice->m_sps->bUseSAO ?
> m_frame->m_encData->m_saoParam : NULL;
> +    SAOParam* saoParam = slice->m_sps->bUseSAO && slice->m_bUseSao ?
> m_frame->m_encData->m_saoParam : NULL;
>      for (uint32_t cuAddr = sliceAddr; cuAddr < lastCUAddr; cuAddr++)
>      {
>          uint32_t col = cuAddr % widthInLCUs;
> @@ -1515,11 +1523,11 @@
>              curRow.bufferedEntropy.loadContexts(rowCoder);
>
>          /* SAO parameter estimation using non-deblocked pixels for CTU
> bottom and right boundary areas */
> -        if (m_param->bEnableSAO && m_param->bSaoNonDeblocked)
> +        if (slice->m_bUseSao && m_param->bSaoNonDeblocked)
>
>  m_frameFilter.m_parallelFilter[row].m_sao.calcSaoStatsCu_BeforeDblk(m_frame,
> col, row);
>
>          /* Deblock with idle threading */
> -        if (m_param->bEnableLoopFilter | m_param->bEnableSAO)
> +        if (m_param->bEnableLoopFilter | slice->m_bUseSao)
>          {
>              // NOTE: in VBV mode, we may reencode anytime, so we can't do
> Deblock stage-Horizon and SAO
>              if (!bIsVbv)
> @@ -1833,12 +1841,12 @@
>
>      /* flush row bitstream (if WPP and no SAO) or flush frame if no WPP
> and no SAO */
>      /* end_of_sub_stream_one_bit / end_of_slice_segment_flag */
> -    if (!m_param->bEnableSAO && (m_param->bEnableWavefront ||
> bLastRowInSlice))
> -        rowCoder.finishSlice();
> +       if (!slice->m_bUseSao && (m_param->bEnableWavefront ||
> bLastRowInSlice))
> +               rowCoder.finishSlice();
>
>
>      /* Processing left Deblock block with current threading */
> -    if ((m_param->bEnableLoopFilter | m_param->bEnableSAO) & (rowInSlice
> >= 2))
> +    if ((m_param->bEnableLoopFilter | slice->m_bUseSao) & (rowInSlice >=
> 2))
>      {
>          /* Check conditional to start previous row process with current
> threading */
>          if (m_frameFilter.m_parallelFilter[row - 2].m_lastDeblocked.get()
> == (int)numCols)
> diff -r 5e791399ec4a -r ef2a478cde87 source/encoder/frameencoder.h
> --- a/source/encoder/frameencoder.h     Tue Sep 03 14:25:44 2019 +0530
> +++ b/source/encoder/frameencoder.h     Tue Sep 03 14:32:00 2019 +0530
> @@ -150,6 +150,7 @@
>      uint32_t                 m_filterRowDelay;
>      uint32_t                 m_filterRowDelayCus;
>      uint32_t                 m_refLagRows;
> +    bool                     m_bUseSao;
>
>      CTURow*                  m_rows;
>      uint16_t                 m_sliceAddrBits;
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>


-- 
Regards,
Aruna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20190912/a6ff3c3f/attachment.html>


More information about the x265-devel mailing list