<div dir="ltr">Please ignore this patch. I have sent an updated version which can be found in the link -
<a href="https://mailman.videolan.org/pipermail/x265-devel/2019-September/012661.html">https://mailman.videolan.org/pipermail/x265-devel/2019-September/012661.html</a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 10, 2019 at 11:08 AM <<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 Pooja Venkatesan <<a href="mailto:pooja@multicorewareinc.com" target="_blank">pooja@multicorewareinc.com</a>><br>
# Date 1567500944 -19800<br>
# Tue Sep 03 14:25:44 2019 +0530<br>
# Node ID f6d9a0145c4fcd7ac0a2a776a4f99fc431f8fd4a<br>
# Parent a092e82e6acfe7afe6a9a381e9ef52323e4e2467<br>
Add option to enable slicetype based SAO filter.<br>
<br>
diff -r a092e82e6acf -r f6d9a0145c4f doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/doc/reST/cli.rst Tue Sep 03 14:25:44 2019 +0530<br>
@@ -1979,9 +1979,22 @@<br>
If deblocking is disabled, or the offsets are non-zero, these<br>
changes from the default configuration are signaled in the PPS.<br>
<br>
-.. option:: --sao, --no-sao<br>
-<br>
- Toggle Sample Adaptive Offset loop filter, default enabled<br>
+.. option:: --sao <0..4><br>
+<br>
+ Toggle Sample Adaptive Offset loop filter at slice level. Default 4.<br>
+ +--------------+---------------------------------------+<br>
+ | Level | Description |<br>
+ +==============+=======================================+<br>
+ | 0 | Disable SAO for all slices |<br>
+ +--------------+---------------------------------------+<br>
+ | 1 | Enable SAO only for I-slices |<br>
+ +--------------+---------------------------------------+<br>
+ | 2 | Enable SAO for I-slices & P-slices |<br>
+ +--------------+---------------------------------------+<br>
+ | 3 | Enable SAO for all reference slices |<br>
+ +--------------+---------------------------------------+<br>
+ | 4 | Enable SAO for all slices |<br>
+ +--------------+---------------------------------------+<br>
<br>
.. option:: --sao-non-deblock, --no-sao-non-deblock<br>
<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/common/param.cpp<br>
--- a/source/common/param.cpp Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/common/param.cpp Tue Sep 03 14:25:44 2019 +0530<br>
@@ -212,7 +212,7 @@<br>
param->bEnableLoopFilter = 1;<br>
<br>
/* SAO Loop Filter */<br>
- param->bEnableSAO = 1;<br>
+ param->enableSAO = 4;<br>
param->bSaoNonDeblocked = 0;<br>
param->bLimitSAO = 0;<br>
<br>
@@ -374,7 +374,7 @@<br>
param->bFrameAdaptive = 0;<br>
param->subpelRefine = 0;<br>
param->searchMethod = X265_DIA_SEARCH;<br>
- param->bEnableSAO = 0;<br>
+ param->enableSAO = 0;<br>
param->bEnableSignHiding = 0;<br>
param->bEnableWeightedPred = 0;<br>
param->rdLevel = 2;<br>
@@ -403,7 +403,7 @@<br>
param->rc.aqMode = X265_AQ_NONE;<br>
param->rc.hevcAq = 0;<br>
param->rc.qgSize = 32;<br>
- param->bEnableSAO = 0;<br>
+ param->enableSAO = 0;<br>
param->bEnableFastIntra = 1;<br>
}<br>
else if (!strcmp(preset, "veryfast"))<br>
@@ -550,7 +550,7 @@<br>
!strcmp(tune, "fast-decode"))<br>
{<br>
param->bEnableLoopFilter = 0;<br>
- param->bEnableSAO = 0;<br>
+ param->enableSAO = 0;<br>
param->bEnableWeightedPred = 0;<br>
param->bEnableWeightedBiPred = 0;<br>
param->bIntraInBFrames = 0;<br>
@@ -577,7 +577,7 @@<br>
param->bEnableRecursionSkip = 0;<br>
param->psyRd = 4.0;<br>
param->psyRdoq = 10.0;<br>
- param->bEnableSAO = 0;<br>
+ param->enableSAO = 0;<br>
param->rc.bEnableConstVbv = 1;<br>
}<br>
else if (!strcmp(tune, "animation"))<br>
@@ -1001,7 +1001,7 @@<br>
else<br>
p->bEnableLoopFilter = atobool(value);<br>
}<br>
- OPT("sao") p->bEnableSAO = atobool(value);<br>
+ OPT("sao") p->enableSAO = atoi(value);<br>
OPT("sao-non-deblock") p->bSaoNonDeblocked = atobool(value);<br>
OPT("ssim") p->bEnableSsim = atobool(value);<br>
OPT("psnr") p->bEnablePsnr = atobool(value);<br>
@@ -1861,7 +1861,7 @@<br>
TOOLOPT(param->bEnableLoopFilter, "deblock");<br>
}<br>
TOOLOPT(param->bSaoNonDeblocked, "sao-non-deblock");<br>
- TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");<br>
+ TOOLOPT(!param->bSaoNonDeblocked && param->enableSAO, "sao");<br>
TOOLOPT(param->rc.bStatWrite, "stats-write");<br>
TOOLOPT(param->rc.bStatRead, "stats-read");<br>
TOOLOPT(param->bSingleSeiNal, "single-sei");<br>
@@ -1968,7 +1968,7 @@<br>
BOOL(p->bEnableLoopFilter, "deblock");<br>
if (p->bEnableLoopFilter)<br>
s += sprintf(s, "=%d:%d", p->deblockingFilterTCOffset, p->deblockingFilterBetaOffset);<br>
- BOOL(p->bEnableSAO, "sao");<br>
+ s += sprintf(s, " sao=%d", p->enableSAO);<br>
BOOL(p->bSaoNonDeblocked, "sao-non-deblock");<br>
s += sprintf(s, " rd=%d", p->rdLevel);<br>
BOOL(p->bEnableEarlySkip, "early-skip");<br>
@@ -2261,7 +2261,7 @@<br>
dst->bEnableLoopFilter = src->bEnableLoopFilter;<br>
dst->deblockingFilterBetaOffset = src->deblockingFilterBetaOffset;<br>
dst->deblockingFilterTCOffset = src->deblockingFilterTCOffset;<br>
- dst->bEnableSAO = src->bEnableSAO;<br>
+ dst->enableSAO = src->enableSAO;<br>
dst->bSaoNonDeblocked = src->bSaoNonDeblocked;<br>
dst->rdLevel = src->rdLevel;<br>
dst->bEnableEarlySkip = src->bEnableEarlySkip;<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/common/slice.h<br>
--- a/source/common/slice.h Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/common/slice.h Tue Sep 03 14:25:44 2019 +0530<br>
@@ -356,6 +356,7 @@<br>
bool m_bCheckLDC; // TODO: is this necessary?<br>
bool m_sLFaseFlag; // loop filter boundary flag<br>
bool m_colFromL0Flag; // collocated picture from List0 or List1 flag<br>
+ int m_bUseSao;<br>
<br>
int m_iPPSQpMinus26;<br>
int numRefIdxDefault[2];<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/encoder/encoder.cpp Tue Sep 03 14:25:44 2019 +0530<br>
@@ -1621,6 +1621,28 @@<br>
}<br>
/* determine references, setup RPS, etc */<br>
m_dpb->prepareEncode(frameEnc);<br>
+ if (m_param->enableSAO)<br>
+ {<br>
+ Slice* slice = frameEnc->m_encData->m_slice;<br>
+ slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 1;<br>
+ switch (m_param->enableSAO)<br>
+ {<br>
+ case 3: if (!IS_REFERENCED(frameEnc))<br>
+ slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>
+ break;<br>
+ case 2: if (!!m_param->bframes && slice->m_sliceType == B_SLICE)<br>
+ slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>
+ break;<br>
+ case 1: if (slice->m_sliceType != I_SLICE)<br>
+ slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>
+ break;<br>
+ }<br>
+ }<br>
+ else<br>
+ {<br>
+ Slice* slice = frameEnc->m_encData->m_slice;<br>
+ slice->m_bUseSao = curEncoder->m_frameFilter.m_useSao = 0;<br>
+ }<br>
<br>
if (m_param->rc.rateControlMode != X265_RC_CQP)<br>
m_lookahead->getEstimatedPictureCost(frameEnc);<br>
@@ -2543,7 +2565,7 @@<br>
sps->quadtreeTUMaxDepthInter = m_param->tuQTMaxInterDepth;<br>
sps->quadtreeTUMaxDepthIntra = m_param->tuQTMaxIntraDepth;<br>
<br>
- sps->bUseSAO = m_param->bEnableSAO;<br>
+ sps->bUseSAO = m_param->enableSAO ? 1 : 0;<br>
<br>
sps->bUseAMP = m_param->bEnableAMP;<br>
sps->maxAMPDepth = m_param->bEnableAMP ? m_param->maxCUDepth : 0;<br>
@@ -2891,7 +2913,6 @@<br>
<br>
}<br>
<br>
-<br>
if (p->interlaceMode)<br>
x265_log(p, X265_LOG_WARNING, "Support for interlaced video is experimental\n");<br>
<br>
@@ -3076,9 +3097,9 @@<br>
}<br>
<br>
/* some options make no sense if others are disabled */<br>
- p->bSaoNonDeblocked &= p->bEnableSAO;<br>
+ p->bSaoNonDeblocked &= (p->enableSAO == 4 ? 1 : 0);<br>
p->bEnableTSkipFast &= p->bEnableTransformSkip;<br>
- p->bLimitSAO &= p->bEnableSAO;<br>
+ p->bLimitSAO &= (p->enableSAO == 4 ? 1 : 0);<br>
/* initialize the conformance window */<br>
m_conformanceWindow.bEnabled = false;<br>
m_conformanceWindow.rightOffset = 0;<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/encoder/entropy.cpp<br>
--- a/source/encoder/entropy.cpp Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/encoder/entropy.cpp Tue Sep 03 14:25:44 2019 +0530<br>
@@ -641,12 +641,18 @@<br>
WRITE_FLAG(1, "slice_temporal_mvp_enable_flag");<br>
}<br>
const SAOParam *saoParam = encData.m_saoParam;<br>
- if (slice.m_sps->bUseSAO)<br>
+ if (slice.m_bUseSao)<br>
{<br>
WRITE_FLAG(saoParam->bSaoFlag[0], "slice_sao_luma_flag");<br>
if (encData.m_param->internalCsp != X265_CSP_I400)<br>
WRITE_FLAG(saoParam->bSaoFlag[1], "slice_sao_chroma_flag");<br>
}<br>
+ else if(encData.m_param->enableSAO)<br>
+ {<br>
+ WRITE_FLAG(0, "slice_sao_luma_flag");<br>
+ if (encData.m_param->internalCsp != X265_CSP_I400)<br>
+ WRITE_FLAG(0, "slice_sao_chroma_flag");<br>
+ }<br>
<br>
// check if numRefIdx match the defaults (1, hard-coded in PPS). If not, override<br>
// TODO: this might be a place to optimize a few bits per slice, by using param->refs for L0 default<br>
@@ -706,7 +712,7 @@<br>
<br>
if (encData.m_param->maxSlices <= 1)<br>
{<br>
- bool isSAOEnabled = slice.m_sps->bUseSAO ? saoParam->bSaoFlag[0] || saoParam->bSaoFlag[1] : false;<br>
+ bool isSAOEnabled = slice.m_sps->bUseSAO && slice.m_bUseSao ? saoParam->bSaoFlag[0] || saoParam->bSaoFlag[1] : false;<br>
bool isDBFEnabled = !slice.m_pps->bPicDisableDeblockingFilter;<br>
<br>
if (isSAOEnabled || isDBFEnabled)<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/encoder/frameencoder.cpp Tue Sep 03 14:25:44 2019 +0530<br>
@@ -110,9 +110,9 @@<br>
m_numRows = numRows;<br>
m_numCols = numCols;<br>
m_reconfigure = false;<br>
- m_filterRowDelay = ((m_param->bEnableSAO && m_param->bSaoNonDeblocked)<br>
- || (!m_param->bEnableLoopFilter && m_param->bEnableSAO)) ?<br>
- 2 : (m_param->bEnableSAO || m_param->bEnableLoopFilter ? 1 : 0);<br>
+ m_filterRowDelay = ((m_param->enableSAO && m_param->bSaoNonDeblocked)<br>
+ || (!m_param->bEnableLoopFilter && m_param->enableSAO)) ?<br>
+ 2 : (m_param->enableSAO || m_param->bEnableLoopFilter ? 1 : 0);<br>
m_filterRowDelayCus = m_filterRowDelay * numCols;<br>
m_rows = new CTURow[m_numRows];<br>
bool ok = !!m_numRows;<br>
@@ -634,7 +634,7 @@<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 (!m_param->enableSAO)<br>
for (uint32_t i = 0; i < numSubstreams; i++)<br>
m_rows[i].rowGoOnCoder.setBitstream(&m_outStreams[i]);<br>
}<br>
@@ -981,7 +981,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 (m_param->enableSAO)<br>
encodeSlice(0);<br>
<br>
m_entropyCoder.setBitstream(&m_bs);<br>
@@ -1515,11 +1515,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 (m_param->enableSAO && 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 | m_param->enableSAO)<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 +1833,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>
+ if (!m_param->enableSAO && (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 | m_param->enableSAO) & (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 a092e82e6acf -r f6d9a0145c4f source/encoder/framefilter.cpp<br>
--- a/source/encoder/framefilter.cpp Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/encoder/framefilter.cpp Tue Sep 03 14:25:44 2019 +0530<br>
@@ -163,7 +163,7 @@<br>
<br>
if (m_parallelFilter)<br>
{<br>
- if (m_param->bEnableSAO)<br>
+ if (m_useSao)<br>
{<br>
for(int row = 0; row < m_numRows; row++)<br>
m_parallelFilter[row].m_sao.destroy((row == 0 ? 1 : 0));<br>
@@ -178,6 +178,7 @@<br>
{<br>
m_param = frame->m_param;<br>
m_frameEncoder = frame;<br>
+ m_useSao = 1;<br>
m_numRows = numRows;<br>
m_numCols = numCols;<br>
m_hChromaShift = CHROMA_H_SHIFT(m_param->internalCsp);<br>
@@ -196,12 +197,12 @@<br>
<br>
if (m_parallelFilter)<br>
{<br>
- if (m_param->bEnableSAO)<br>
+ if (m_useSao)<br>
{<br>
for(int row = 0; row < numRows; row++)<br>
{<br>
if (!m_parallelFilter[row].m_sao.create(m_param, (row == 0 ? 1 : 0)))<br>
- m_param->bEnableSAO = 0;<br>
+ m_useSao = 0;<br>
else<br>
{<br>
if (row != 0)<br>
@@ -235,7 +236,7 @@<br>
{<br>
for(int row = 0; row < m_numRows; row++)<br>
{<br>
- if (m_param->bEnableSAO)<br>
+ if (m_useSao)<br>
m_parallelFilter[row].m_sao.startSlice(frame, initState);<br>
<br>
m_parallelFilter[row].m_lastCol.set(0);<br>
@@ -245,7 +246,7 @@<br>
}<br>
<br>
// Reset SAO common statistics<br>
- if (m_param->bEnableSAO)<br>
+ if (m_useSao)<br>
m_parallelFilter[0].m_sao.resetStats();<br>
}<br>
}<br>
@@ -472,11 +473,11 @@<br>
deblockCTU(ctuPrev, cuGeoms[ctuGeomMap[cuAddr - 1]], Deblock::EDGE_HOR);<br>
<br>
// When SAO Disable, setting column counter here<br>
- if (!m_frameFilter->m_param->bEnableSAO & !ctuPrev->m_bFirstRowInSlice)<br>
+ if (!m_frameFilter->m_useSao & !ctuPrev->m_bFirstRowInSlice)<br>
m_prevRow->processPostCu(col - 1);<br>
}<br>
<br>
- if (m_frameFilter->m_param->bEnableSAO)<br>
+ if (m_frameFilter->m_useSao)<br>
{<br>
// Save SAO bottom row reference pixels<br>
copySaoAboveRef(ctuPrev, reconPic, cuAddr - 1, col - 1);<br>
@@ -514,12 +515,12 @@<br>
deblockCTU(ctuPrev, cuGeoms[ctuGeomMap[cuAddr]], Deblock::EDGE_HOR);<br>
<br>
// When SAO Disable, setting column counter here<br>
- if (!m_frameFilter->m_param->bEnableSAO & !ctuPrev->m_bFirstRowInSlice)<br>
+ if (!m_frameFilter->m_useSao & !ctuPrev->m_bFirstRowInSlice)<br>
m_prevRow->processPostCu(numCols - 1);<br>
}<br>
<br>
// TODO: move processPostCu() into processSaoUnitCu()<br>
- if (m_frameFilter->m_param->bEnableSAO)<br>
+ if (m_frameFilter->m_useSao)<br>
{<br>
const CUData* ctu = m_encData->getPicCTU(m_rowAddr + numCols - 2);<br>
<br>
@@ -570,7 +571,7 @@<br>
m_frameEncoder->m_cuStats.countLoopFilter++;<br>
#endif<br>
<br>
- if (!m_param->bEnableLoopFilter && !m_param->bEnableSAO)<br>
+ if (!m_param->bEnableLoopFilter && !m_useSao)<br>
{<br>
processPostRow(row);<br>
return;<br>
@@ -596,7 +597,7 @@<br>
x265_log(m_param, X265_LOG_WARNING, "detected ParallelFilter race condition on last row\n");<br>
<br>
/* Apply SAO on last row of CUs, because we always apply SAO on row[X-1] */<br>
- if (m_param->bEnableSAO)<br>
+ if (m_useSao)<br>
{<br>
for(int col = 0; col < m_numCols; col++)<br>
{<br>
@@ -634,7 +635,7 @@<br>
<br>
if (numRowFinished == m_numRows)<br>
{<br>
- if (m_param->bEnableSAO)<br>
+ if (m_useSao)<br>
{<br>
// Merge numNoSao into RootNode (Node0)<br>
for(int i = 1; i < m_numRows; i++)<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/encoder/framefilter.h<br>
--- a/source/encoder/framefilter.h Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/encoder/framefilter.h Tue Sep 03 14:25:44 2019 +0530<br>
@@ -46,6 +46,7 @@<br>
<br>
x265_param* m_param;<br>
Frame* m_frame;<br>
+ bool m_useSao;<br>
FrameEncoder* m_frameEncoder;<br>
int m_hChromaShift;<br>
int m_vChromaShift;<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/test/regression-tests.txt<br>
--- a/source/test/regression-tests.txt Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/test/regression-tests.txt Tue Sep 03 14:25:44 2019 +0530<br>
@@ -17,7 +17,7 @@<br>
BasketballDrive_1920x1080_50.y4m,--preset veryfast --tune zerolatency --no-temporal-mvp<br>
BasketballDrive_1920x1080_50.y4m,--preset faster --aq-strength 2 --merange 190 --slices 3<br>
BasketballDrive_1920x1080_50.y4m,--preset medium --ctu 16 --max-tu-size 8 --subme 7 --qg-size 16 --cu-lossless --tu-inter-depth 3 --limit-tu 1<br>
-BasketballDrive_1920x1080_50.y4m,--preset medium --keyint -1 --nr-inter 100 -F4 --no-sao<br>
+BasketballDrive_1920x1080_50.y4m,--preset medium --keyint -1 --nr-inter 100 -F4 --sao 0<br>
BasketballDrive_1920x1080_50.y4m,--preset medium --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 2 --bitrate 7000 --limit-modes::--preset medium --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 2 --bitrate 7000 --limit-modes<br>
BasketballDrive_1920x1080_50.y4m,--preset slow --nr-intra 100 -F4 --aq-strength 3 --qg-size 16 --limit-refs 1<br>
BasketballDrive_1920x1080_50.y4m,--preset slower --lossless --chromaloc 3 --subme 0 --limit-tu 4<br>
@@ -32,7 +32,7 @@<br>
Coastguard-4k.y4m,--preset medium --rdoq-level 1 --tune ssim --no-signhide --me umh --slices 2<br>
Coastguard-4k.y4m,--preset slow --tune psnr --cbqpoffs -1 --crqpoffs 1 --limit-refs 1<br>
CrowdRun_1920x1080_50_10bit_422.yuv,--preset ultrafast --weightp --tune zerolatency --qg-size 16<br>
-CrowdRun_1920x1080_50_10bit_422.yuv,--preset superfast --weightp --no-wpp --sao<br>
+CrowdRun_1920x1080_50_10bit_422.yuv,--preset superfast --weightp --no-wpp --sao 4<br>
CrowdRun_1920x1080_50_10bit_422.yuv,--preset veryfast --temporal-layers --tune grain<br>
CrowdRun_1920x1080_50_10bit_422.yuv,--preset faster --max-tu-size 4 --min-cu-size 32<br>
CrowdRun_1920x1080_50_10bit_422.yuv,--preset fast --aq-mode 0 --sar 2 --range full<br>
@@ -74,7 +74,7 @@<br>
News-4k.y4m,--preset ultrafast --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 2 --bitrate 15000::--preset ultrafast --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 2 --bitrate 15000<br>
News-4k.y4m,--preset superfast --lookahead-slices 6 --aq-mode 0<br>
News-4k.y4m,--preset superfast --slices 4 --aq-mode 0 <br>
-News-4k.y4m,--preset medium --tune ssim --no-sao --qg-size 16<br>
+News-4k.y4m,--preset medium --tune ssim --sao 0 --qg-size 16<br>
News-4k.y4m,--preset veryslow --no-rskip<br>
News-4k.y4m,--preset veryslow --pme --crf 40<br>
OldTownCross_1920x1080_50_10bit_422.yuv,--preset superfast --weightp<br>
@@ -134,7 +134,7 @@<br>
parkrun_ter_720p50.y4m,--preset slower --fast-intra --no-rect --tune grain<br>
silent_cif_420.y4m,--preset superfast --weightp --rect<br>
silent_cif_420.y4m,--preset medium --me full --rect --amp<br>
-silent_cif_420.y4m,--preset placebo --ctu 32 --no-sao --qg-size 16<br>
+silent_cif_420.y4m,--preset placebo --ctu 32 --sao 0 --qg-size 16<br>
washdc_422_ntsc.y4m,--preset ultrafast --weightp --tu-intra-depth 4<br>
vtc1nw_422_ntsc.y4m,--preset superfast --weightp --nr-intra 100 -F4<br>
washdc_422_ntsc.y4m,--preset superfast --psy-rd 1 --tune zerolatency<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/test/smoke-tests.txt<br>
--- a/source/test/smoke-tests.txt Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/test/smoke-tests.txt Tue Sep 03 14:25:44 2019 +0530<br>
@@ -19,7 +19,7 @@<br>
DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=veryfast --min-cu 16<br>
DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=fast --weightb --interlace bff<br>
DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=veryslow --limit-ref 1 --limit-mode --tskip --limit-tu 1<br>
-CrowdRun_1920x1080_50_10bit_444.yuv,--preset=superfast --bitrate 7000 --sao --limit-sao<br>
+CrowdRun_1920x1080_50_10bit_444.yuv,--preset=superfast --bitrate 7000 --sao 4 --limit-sao<br>
# Main12 intraCost overflow bug test<br>
720p50_parkrun_ter.y4m,--preset medium<br>
720p50_parkrun_ter.y4m,--preset=fast --hevc-aq --no-cutree<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/x265.h<br>
--- a/source/x265.h Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/x265.h Tue Sep 03 14:25:44 2019 +0530<br>
@@ -1208,12 +1208,16 @@<br>
* This is the coded div2 value, actual offset is doubled at use */<br>
int deblockingFilterBetaOffset;<br>
<br>
- /* Enable the Sample Adaptive Offset loop filter, which reduces distortion<br>
+ /* Tune the Sample Adaptive Offset loop filter, which reduces distortion<br>
* effects by adjusting reconstructed sample values based on histogram<br>
* analysis to better approximate the original samples. When enabled it adds<br>
* a CU row of reference lag, reducing frame parallelism effectiveness.<br>
- * Default is enabled */<br>
- int bEnableSAO;<br>
+ * Default is 4 - enabled for all slices <br>
+ * The tune rate in which SAO has to be applied.<br>
+ * 1 - Filtering applied only on I-frames(I) [Light tune]<br>
+ * 2 - No Filtering on B frames (I, P) [Medium tune]<br>
+ * 3 - No Filtering on non-ref b frames (I, P, B) [Strong tune] */<br>
+ int enableSAO;<br>
<br>
/* Note: when deblocking and SAO are both enabled, the loop filter CU lag is<br>
* only one row, as they operate in series on the same row. */<br>
diff -r a092e82e6acf -r f6d9a0145c4f source/x265cli.h<br>
--- a/source/x265cli.h Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/x265cli.h Tue Sep 03 14:25:44 2019 +0530<br>
@@ -199,8 +199,7 @@<br>
{ "lft", no_argument, NULL, 0 }, /* DEPRECATED */<br>
{ "no-deblock", no_argument, NULL, 0 },<br>
{ "deblock", required_argument, NULL, 0 },<br>
- { "no-sao", no_argument, NULL, 0 },<br>
- { "sao", no_argument, NULL, 0 },<br>
+ { "sao", required_argument, NULL, 0 },<br>
{ "no-sao-non-deblock", no_argument, NULL, 0 },<br>
{ "sao-non-deblock", no_argument, NULL, 0 },<br>
{ "no-ssim", no_argument, NULL, 0 },<br>
@@ -586,7 +585,7 @@<br>
H0(" It represents the percentage of maximum AU size used. Default %.1f\n", param->maxAUSizeFactor);<br>
H0("\nLoop filters (deblock and SAO):\n");<br>
H0(" --[no-]deblock Enable Deblocking Loop Filter, optionally specify tC:Beta offsets Default %s\n", OPT(param->bEnableLoopFilter));<br>
- H0(" --[no-]sao Enable Sample Adaptive Offset. Default %s\n", OPT(param->bEnableSAO));<br>
+ H0(" --sao <0..4> Enable Slice-based Sample Adaptive Offset. Default %d\n", param->enableSAO);<br>
H1(" --[no-]sao-non-deblock Use non-deblocked pixels, else right/bottom boundary areas skipped. Default %s\n", OPT(param->bSaoNonDeblocked));<br>
H0(" --[no-]limit-sao Limit Sample Adaptive Offset types. Default %s\n", OPT(param->bLimitSAO));<br>
H0("\nVUI options:\n");<br>
</blockquote></div>