<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 23, 2020 at 9:56 PM Niranjan Bala <<a href="mailto:niranjan@multicorewareinc.com" target="_blank">niranjan@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"><div dir="ltr">From df3fe9fdbe3e362f0ef5f1fb823e50c996460c78 Mon Sep 17 00:00:00 2001<br>From: Niranjan <<a href="mailto:niranjan@multicorewareinc.com" target="_blank">niranjan@multicorewareinc.com</a>><br>Date: Mon, 21 Dec 2020 23:40:42 +0530<br>Subject: [PATCH] Fix: warnings in Windows<br><br>---<br> source/common/param.cpp            | 15 ++++++++++++++-<br> source/encoder/encoder.cpp         |  4 ++--<br> source/encoder/ratecontrol.cpp     | 14 ++++++--------<br> source/test/rate-control-tests.txt |  1 +<br> source/x265.h                      |  6 ++++++<br> source/x265cli.cpp                 |  2 +-<br> 6 files changed, 30 insertions(+), 12 deletions(-)<br><br>diff --git a/source/common/param.cpp b/source/common/param.cpp<br>index 7a9be18c3..5c0409e93 100755<br>--- a/source/common/param.cpp<br>+++ b/source/common/param.cpp<br>@@ -179,6 +179,8 @@ void x265_param_default(x265_param* param)<br>     param->bEnableHRDConcatFlag = 0;<br>     param->bEnableFades = 0;<br>     param->bEnableSceneCutAwareQp = 0;<br>+    param->forwardWindow = 0;<br>+    param->backwardWindow = 0;<br>     param->fwdScenecutWindow = 500;<br>     param->fwdRefQpDelta = 5;<br>     param->fwdNonRefQpDelta = param->fwdRefQpDelta + (SLICE_TYPE_DELTA * param->fwdRefQpDelta);<br>@@ -1347,7 +1349,14 @@ int x265_param_parse(x265_param* p, const char* name, const char* value)<br>             p->selectiveSAO = atoi(value);<br>         }<br>         OPT("fades") p->bEnableFades = atobool(value);<br>-        OPT("scenecut-aware-qp") p->bEnableSceneCutAwareQp = atoi(value);<br>+        OPT("scenecut-aware-qp")<br>+        {<br>+            p->bEnableSceneCutAwareQp = atoi(value);<br>+            if (p->bEnableSceneCutAwareQp & FORWARD)<br>+                p->forwardWindow = 1;<br>+            if (p->bEnableSceneCutAwareQp & BACKWARD)<br>+                p->backwardWindow = 1;<br>+        }<br>         OPT("masking-strength")<br>         {<br>             int window1;<br>@@ -1831,6 +1840,8 @@ int x265_check_params(x265_param* param)<br>         }<br>         else<br>         {<br>+            CHECK(param->bEnableSceneCutAwareQp < 0 || param->bEnableSceneCutAwareQp >3,<br>+            "Invalid scenecut window direction. Value must be between 0 and 3(inclusive)");<br>             CHECK(param->fwdScenecutWindow < 0 || param->fwdScenecutWindow > 1000,<br>             "Invalid forward scenecut Window duration. Value must be between 0 and 1000(inclusive)");<br>             CHECK(param->fwdRefQpDelta < 0 || param->fwdRefQpDelta > 10,<br>@@ -2659,6 +2670,8 @@ void x265_copy_params(x265_param* dst, x265_param* src)<br>     dst->bEnableSvtHevc = src->bEnableSvtHevc;<br>     dst->bEnableFades = src->bEnableFades;<br>     dst->bEnableSceneCutAwareQp = src->bEnableSceneCutAwareQp;<br>+    dst->forwardWindow = src->forwardWindow;<br>+    dst->backwardWindow = src->backwardWindow;<br>     dst->fwdScenecutWindow = src->fwdScenecutWindow;<br>     dst->fwdRefQpDelta = src->fwdRefQpDelta;<br>     dst->fwdNonRefQpDelta = src->fwdNonRefQpDelta;<br>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>index 18c3b6788..49951c725 100644<br>--- a/source/encoder/encoder.cpp<br>+++ b/source/encoder/encoder.cpp<br>@@ -1810,7 +1810,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br>                 inFrame->m_lowres.m_bIsHardScenecut = isHardSC;<br>         }<br> <br>-        if ((m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL || m_param->bEnableSceneCutAwareQp == BACKWARD) && m_param->rc.bStatRead)<br>+        if (m_param->backwardWindow && m_param->rc.bStatRead)<br>         {<br>             RateControlEntry * rcEntry = NULL;<br>             rcEntry = &(m_rateControl->m_rce2Pass[inFrame->m_poc]);<br>@@ -2242,7 +2242,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br>             frameEnc = m_lookahead->getDecidedPicture();<br>         if (frameEnc && !pass && (!m_param->chunkEnd || (m_encodedFrameNum < m_param->chunkEnd)))<br>         {<br>-            if ((m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL || m_param->bEnableSceneCutAwareQp == FORWARD) && m_param->rc.bStatRead)<br>+            if (m_param->forwardWindow && m_param->rc.bStatRead)<br>             {<br>                 RateControlEntry * rcEntry;<br>                 rcEntry = &(m_rateControl->m_rce2Pass[frameEnc->m_poc]);<br>diff --git a/source/encoder/ratecontrol.cpp b/source/encoder/ratecontrol.cpp<br>index 1299f6527..3153dcc31 100644<br>--- a/source/encoder/ratecontrol.cpp<br>+++ b/source/encoder/ratecontrol.cpp<br>@@ -1860,9 +1860,9 @@ double RateControl::rateEstimateQscale(Frame* curFrame, RateControlEntry *rce)<br>         {<br>             double lqmin = m_lmin[m_sliceType];<br>             double lqmax = m_lmax[m_sliceType];<br>-            if (m_param->bEnableSceneCutAwareQp == FORWARD || m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)<br>+            if (m_param->forwardWindow)<br>                 qScale = forwardMasking(curFrame, qScale);<br>-            if (m_param->bEnableSceneCutAwareQp == BACKWARD || m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)<br>+            if (m_param->backwardWindow)<br>                 qScale = backwardMasking(curFrame, qScale);<br>             qScale = x265_clip3(lqmin, lqmax, qScale);<br>             q = x265_qScale2qp(qScale);<br>@@ -1987,9 +1987,9 @@ double RateControl::rateEstimateQscale(Frame* curFrame, RateControlEntry *rce)<br>                 double qmin = m_lmin[m_sliceType];<br>                 double qmax = m_lmax[m_sliceType];<br> <br>-                if (m_param->bEnableSceneCutAwareQp == FORWARD || m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)<br>+                if (m_param->forwardWindow)<br>                     q = forwardMasking(curFrame, q);<br>-                if (m_param->bEnableSceneCutAwareQp == BACKWARD || m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)<br>+                if (m_param->backwardWindow)<br>                     q = backwardMasking(curFrame, q);<br> <br>                 q = x265_clip3(qmin, qmax, q);<br>@@ -2156,9 +2156,9 @@ double RateControl::rateEstimateQscale(Frame* curFrame, RateControlEntry *rce)<br>                 double qmin = m_lmin[m_sliceType];<br>                 double qmax = m_lmax[m_sliceType];<br> <br>-                if (m_param->bEnableSceneCutAwareQp == FORWARD || m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)<br>+                if (m_param->forwardWindow)<br>                     q = forwardMasking(curFrame, q);<br>-                if (m_param->bEnableSceneCutAwareQp == BACKWARD || m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)<br>+                if (m_param->backwardWindow)<br>                     q = backwardMasking(curFrame, q);<br> <br>                 q = x265_clip3(qmin, qmax, q);<br>@@ -3192,8 +3192,6 @@ double RateControl::forwardMasking(Frame* curFrame, double q)<br>     int lastIFrame = m_top->m_rateControl->m_lastScenecutAwareIFrame;<br>     double fwdRefQpDelta = double(m_param->fwdRefQpDelta);<br>     double fwdNonRefQpDelta = double(m_param->fwdNonRefQpDelta);<br>-    double bwdRefQpDelta = double(m_param->bwdRefQpDelta);<br>-    double bwdNonRefQpDelta = double(m_param->bwdNonRefQpDelta);<br>     double sliceTypeDelta = SLICE_TYPE_DELTA * fwdRefQpDelta;<br>     double window2Delta = WINDOW2_DELTA * fwdRefQpDelta;<br>     double window3Delta = WINDOW3_DELTA * fwdRefQpDelta;<br>diff --git a/source/test/rate-control-tests.txt b/source/test/rate-control-tests.txt<br>index 6c8f10cb6..e3dd2507d 100644<br>--- a/source/test/rate-control-tests.txt<br>+++ b/source/test/rate-control-tests.txt<br>@@ -46,6 +46,7 @@ sita_1920x1080_30.yuv, --preset ultrafast --crf 20 --no-cutree --keyint 50 --min<br> sita_1920x1080_30.yuv, --preset medium --crf 20 --no-cutree --keyint 50 --min-keyint 50 --no-open-gop --pass 1 --vbv-bufsize 7000 --vbv-maxrate 5000 --repeat-headers --multi-pass-opt-rps:: --preset medium --crf 20 --no-cutree --keyint 50 --min-keyint 50 --no-open-gop --pass 2 --vbv-bufsize 7000 --vbv-maxrate 5000 --repeat-headers --multi-pass-opt-rps<br> sintel_trailer_2k_1920x1080_24.yuv,--preset medium --bitrate 6000 --no-cutree --aq-mode 0 --pass 1::--preset medium --bitrate 6000 --no-cutree --aq-mode 0 --pass 2 --scenecut-aware-qp 1<br> sintel_trailer_2k_1920x1080_24.yuv,--preset medium --bitrate 6000 --no-cutree --aq-mode 0 --hist-scenecut --pass 1::--preset medium --bitrate 6000 --no-cutree --aq-mode 0 --hist-scenecut --pass 2 --scenecut-aware-qp 3 --masking-strength 300,-1,7,100,2,3<br>+sintel_trailer_2k_1920x1080_24.yuv,--preset medium --bitrate 6000 --no-cutree --aq-mode 0 --pass 1::--preset medium --bitrate 6000 --no-cutree --aq-mode 0 --pass 2 --scenecut-aware-qp 2 --masking-strength 100,-1,-1<br> <br> # multi-pass rate control and analysis<br> ducks_take_off_1080p50.y4m,--bitrate 6000 --pass 1  --multi-pass-opt-analysis  --hash 1 --ssim --psnr:: --bitrate 6000 --pass 2  --multi-pass-opt-analysis  --hash 1 --ssim --psnr<br>diff --git a/source/x265.h b/source/x265.h<br>index b064f67c2..62bc7706f 100644<br>--- a/source/x265.h<br>+++ b/source/x265.h<br>@@ -1948,6 +1948,12 @@ typedef struct x265_param<br> <br>     /* The offset by which QP is incremented for non-referenced inter-frames before a scenecut when bEnableSceneCutAwareQp is 2 or 3. */<br>     double    bwdNonRefQpDelta;<br>+<br>+    /* It is set when bEnableSceneCutAwareQp is 1 or 3 */<br>+    int       forwardWindow;<br>+<br>+    /* It is set when bEnableSceneCutAwareQp is 2 or 3 */<br>+    int       backwardWindow;<br> } x265_param;<br></div></blockquote><div>[AM] Do we really need two new params? These 2 params are duplicating 

p->bEnableSceneCutAwareQp.</div><div>We can either replace them with "<span style="color:rgb(80,0,80)">p->bEnableSceneCutAwareQp & BACKWARD" and </span>"<span style="color:rgb(80,0,80)">p->bEnableSceneCutAwareQp & BACKWARD"</span> checks respectively. Or, remove  p->bEnableSceneCutAwareQp.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"> <br> /* x265_param_alloc:<br>diff --git a/source/x265cli.cpp b/source/x265cli.cpp<br>index 0c0d27ff5..8ad5a18cb 100755<br>--- a/source/x265cli.cpp<br>+++ b/source/x265cli.cpp<br>@@ -181,7 +181,7 @@ namespace X265_NS {<br>         H1("                                 1 - Forward masking\n");<br>         H1("                                 2 - Backward masking\n");<br>         H1("                                 3 - Bidirectional masking\n");<br>-        H1("   --masking-strength <string>   Comma separated values which specifies the duration and offset for the QP increment for inter-frames");<br>+        H1("   --masking-strength <string>   Comma separated values which specifies the duration and offset for the QP increment for inter-frames\n");<br>         H0("   --radl <integer>              Number of RADL pictures allowed in front of IDR. Default %d\n", param->radl);<br>         H0("   --intra-refresh               Use Periodic Intra Refresh instead of IDR frames\n");<br>         H0("   --rc-lookahead <integer>      Number of frames for frame-type lookahead (determines encoder latency) Default %d\n", param->lookaheadDepth);<br>-- <br>2.18.0.windows.1<br><br><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#0c343d" face="verdana, sans-serif"><br></font></div><div dir="ltr"><font color="#0c343d" face="verdana, sans-serif">Thanks & Regards</font><div><font color="#0c343d" face="verdana, sans-serif"><b>Niranjan Kumar B</b></font></div><div><font size="1" color="#0c343d" face="verdana, sans-serif">Video Codec Engineer </font></div><div><font size="1" color="#0c343d" face="verdana, sans-serif">Media & AI Analytics</font></div><div><font face="trebuchet ms, sans-serif" color="#0c343d">+91 958 511 1449</font></div><div><a href="https://multicorewareinc.com/" style="color:rgb(17,85,204)" target="_blank"><img src="https://docs.google.com/uc?export=download&id=1kc3RJu9M8bnIf6Xa5rUw2d-eEVUsPBE5&revid=0B7tw9XJBmynaemR1VUpQUi9DVytRVW5SVkRwVTFjb1hBMUcwPQ"></a></div></div></div></div></div></div></div></div>
_______________________________________________<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"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="georgia, serif">Regards,</font><div><b><font face="georgia, serif">Aruna Matheswaran,</font></b></div><div><font face="georgia, serif">Video Codec Engineer,</font></div><div><font face="georgia, serif">Media & AI analytics BU,</font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" width="96" height="36" style="margin-left:0px;margin-top:0px"></span></span></span><font face="georgia, serif"><br></font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" style="margin-left:0px;margin-top:0px"></span></span></span><font face="georgia, serif"><br></font></div><div><font face="georgia, serif"><br></font></div></div></div></div></div></div></div></div></div></div>