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