Re: [x265] [PATCH 2 of 2] Implement slice-level SAO filter
Pushed to default. On Wed, Sep 11, 2019 at 10:48 PM wrote: > # HG changeset patch > # User Soundariya Ranin Venkatesh > # 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(_outStreams[i]); > +} > } > else > { > for (uint32_t i = 0; i < numSubstreams; i++) > +{ > m_outStreams[i].resetBits(); > +if (!slice->m_bUseSao) > +m_rows[i].rowGoOnCoder.setBitstream(_outStreams[i]); > +else > +m_rows[i].rowGoOnCoder.setBitstream(NULL); > +} > } > > m_rce.encodeOrder = m_frame->m_encodeOrder; > @@ -981,7 +989,7 @@ > m_entropyCoder.setBitstream(_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(_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@videolan.org > https://mailman.videolan.org/listinfo/x265-devel > -- Regards, Aruna ___ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel
Re: [x265] [PATCH 2 of 2] Implement slice-level SAO filter
Please ignore this patch. I have sent an updated version which can be found in the link - https://mailman.videolan.org/pipermail/x265-devel/2019-September/012662.html On Tue, Sep 10, 2019 at 11:08 AM wrote: > # HG changeset patch > # User Soundariya Ranin Venkatesh > # Date 1567501320 -19800 > # Tue Sep 03 14:32:00 2019 +0530 > # Node ID b1799841d3307237a741eb7d097cba2efd76f1eb > # Parent f6d9a0145c4fcd7ac0a2a776a4f99fc431f8fd4a > Implement slice-level SAO filter. > > diff -r f6d9a0145c4f -r b1799841d330 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->enableSAO) > +if (!slice->m_bUseSao) > +{ > for (uint32_t i = 0; i < numSubstreams; i++) > m_rows[i].rowGoOnCoder.setBitstream(_outStreams[i]); > +} > } > else > { > for (uint32_t i = 0; i < numSubstreams; i++) > +{ > m_outStreams[i].resetBits(); > +if (!slice->m_bUseSao) > +m_rows[i].rowGoOnCoder.setBitstream(_outStreams[i]); > +else > +m_rows[i].rowGoOnCoder.setBitstream(NULL); > +} > } > > m_rce.encodeOrder = m_frame->m_encodeOrder; > @@ -981,7 +989,7 @@ > m_entropyCoder.setBitstream(_bs); > > // finish encode of each CTU row, only required when SAO is enabled > -if (m_param->enableSAO) > +if (slice->m_bUseSao) > encodeSlice(0); > > m_entropyCoder.setBitstream(_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->enableSAO && 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->enableSAO) > +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->enableSAO && (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->enableSAO) & (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 f6d9a0145c4f -r b1799841d330 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@videolan.org https://mailman.videolan.org/listinfo/x265-devel