[x265] [PATCH] Fix: Build warnings in Windows + cleanup

Niranjan Bala niranjan at multicorewareinc.com
Tue Dec 29 05:27:36 UTC 2020


>From 055ebe61d9816323ebe8b1c5187c48c4185bbaaf Mon Sep 17 00:00:00 2001
From: Niranjan <niranjan at multicorewareinc.com>
Date: Mon, 21 Dec 2020 23:40:42 +0530
Subject: [PATCH] Fix: Build warnings in Windows + cleanup

---
 doc/reST/cli.rst                   |  2 ++
 source/common/param.cpp            |  2 ++
 source/encoder/encoder.cpp         |  4 ++--
 source/encoder/ratecontrol.cpp     | 14 ++++++--------
 source/test/rate-control-tests.txt |  1 +
 source/x265cli.cpp                 |  2 +-
 6 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
index 7579e9b2a..29da59a9d 100755
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -2047,6 +2047,8 @@ Quality, rate control and rate distortion options
  |                 | **Range of values:** 0 to 10
         |

+-----------------+---------------------------------------------------------------+

+ **CLI ONLY**
+
 .. option:: --vbv-live-multi-pass, --no-vbv-live-multi-pass

    It enables the Qp tuning at frame level based on real time VBV Buffer
fullness
diff --git a/source/common/param.cpp b/source/common/param.cpp
index 7a9be18c3..8a6a974f1 100755
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -1831,6 +1831,8 @@ int x265_check_params(x265_param* param)
         }
         else
         {
+            CHECK(param->bEnableSceneCutAwareQp < 0 ||
param->bEnableSceneCutAwareQp > 3,
+            "Invalid masking direction. Value must be between 0 and
3(inclusive)");
             CHECK(param->fwdScenecutWindow < 0 || param->fwdScenecutWindow
> 1000,
             "Invalid forward scenecut Window duration. Value must be
between 0 and 1000(inclusive)");
             CHECK(param->fwdRefQpDelta < 0 || param->fwdRefQpDelta > 10,
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index 18c3b6788..e20e46869 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -1810,7 +1810,7 @@ int Encoder::encode(const x265_picture* pic_in,
x265_picture* pic_out)
                 inFrame->m_lowres.m_bIsHardScenecut = isHardSC;
         }

-        if ((m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL ||
m_param->bEnableSceneCutAwareQp == BACKWARD) && m_param->rc.bStatRead)
+        if ((m_param->bEnableSceneCutAwareQp & BACKWARD) &&
m_param->rc.bStatRead)
         {
             RateControlEntry * rcEntry = NULL;
             rcEntry = &(m_rateControl->m_rce2Pass[inFrame->m_poc]);
@@ -2242,7 +2242,7 @@ int Encoder::encode(const x265_picture* pic_in,
x265_picture* pic_out)
             frameEnc = m_lookahead->getDecidedPicture();
         if (frameEnc && !pass && (!m_param->chunkEnd || (m_encodedFrameNum
< m_param->chunkEnd)))
         {
-            if ((m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL ||
m_param->bEnableSceneCutAwareQp == FORWARD) && m_param->rc.bStatRead)
+            if ((m_param->bEnableSceneCutAwareQp & FORWARD) &&
m_param->rc.bStatRead)
             {
                 RateControlEntry * rcEntry;
                 rcEntry = &(m_rateControl->m_rce2Pass[frameEnc->m_poc]);
diff --git a/source/encoder/ratecontrol.cpp b/source/encoder/ratecontrol.cpp
index 1299f6527..1b46c0148 100644
--- a/source/encoder/ratecontrol.cpp
+++ b/source/encoder/ratecontrol.cpp
@@ -1860,9 +1860,9 @@ double RateControl::rateEstimateQscale(Frame*
curFrame, RateControlEntry *rce)
         {
             double lqmin = m_lmin[m_sliceType];
             double lqmax = m_lmax[m_sliceType];
-            if (m_param->bEnableSceneCutAwareQp == FORWARD ||
m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)
+            if (m_param->bEnableSceneCutAwareQp & FORWARD)
                 qScale = forwardMasking(curFrame, qScale);
-            if (m_param->bEnableSceneCutAwareQp == BACKWARD ||
m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)
+            if (m_param->bEnableSceneCutAwareQp & BACKWARD)
                 qScale = backwardMasking(curFrame, qScale);
             qScale = x265_clip3(lqmin, lqmax, qScale);
             q = x265_qScale2qp(qScale);
@@ -1987,9 +1987,9 @@ double RateControl::rateEstimateQscale(Frame*
curFrame, RateControlEntry *rce)
                 double qmin = m_lmin[m_sliceType];
                 double qmax = m_lmax[m_sliceType];

-                if (m_param->bEnableSceneCutAwareQp == FORWARD ||
m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)
+                if (m_param->bEnableSceneCutAwareQp & FORWARD)
                     q = forwardMasking(curFrame, q);
-                if (m_param->bEnableSceneCutAwareQp == BACKWARD ||
m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)
+                if (m_param->bEnableSceneCutAwareQp & BACKWARD)
                     q = backwardMasking(curFrame, q);

                 q = x265_clip3(qmin, qmax, q);
@@ -2156,9 +2156,9 @@ double RateControl::rateEstimateQscale(Frame*
curFrame, RateControlEntry *rce)
                 double qmin = m_lmin[m_sliceType];
                 double qmax = m_lmax[m_sliceType];

-                if (m_param->bEnableSceneCutAwareQp == FORWARD ||
m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)
+                if (m_param->bEnableSceneCutAwareQp & FORWARD)
                     q = forwardMasking(curFrame, q);
-                if (m_param->bEnableSceneCutAwareQp == BACKWARD ||
m_param->bEnableSceneCutAwareQp == BI_DIRECTIONAL)
+                if (m_param->bEnableSceneCutAwareQp & BACKWARD)
                     q = backwardMasking(curFrame, q);

                 q = x265_clip3(qmin, qmax, q);
@@ -3192,8 +3192,6 @@ double RateControl::forwardMasking(Frame* curFrame,
double q)
     int lastIFrame = m_top->m_rateControl->m_lastScenecutAwareIFrame;
     double fwdRefQpDelta = double(m_param->fwdRefQpDelta);
     double fwdNonRefQpDelta = double(m_param->fwdNonRefQpDelta);
-    double bwdRefQpDelta = double(m_param->bwdRefQpDelta);
-    double bwdNonRefQpDelta = double(m_param->bwdNonRefQpDelta);
     double sliceTypeDelta = SLICE_TYPE_DELTA * fwdRefQpDelta;
     double window2Delta = WINDOW2_DELTA * fwdRefQpDelta;
     double window3Delta = WINDOW3_DELTA * fwdRefQpDelta;
diff --git a/source/test/rate-control-tests.txt
b/source/test/rate-control-tests.txt
index 6c8f10cb6..e3dd2507d 100644
--- a/source/test/rate-control-tests.txt
+++ b/source/test/rate-control-tests.txt
@@ -46,6 +46,7 @@ sita_1920x1080_30.yuv, --preset ultrafast --crf 20
--no-cutree --keyint 50 --min
 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
 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
 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
+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

 # multi-pass rate control and analysis
 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
diff --git a/source/x265cli.cpp b/source/x265cli.cpp
index 0c0d27ff5..41d73e174 100755
--- a/source/x265cli.cpp
+++ b/source/x265cli.cpp
@@ -181,7 +181,7 @@ namespace X265_NS {
         H1("                                 1 - Forward masking\n");
         H1("                                 2 - Backward masking\n");
         H1("                                 3 - Bidirectional masking\n");
-        H1("   --masking-strength <string>   Comma separated values which
specifies the duration and offset for the QP increment for inter-frames");
+        H1("   --masking-strength <string>   Comma separated values which
specify the duration and offset for the QP increment for inter-frames when
scenecut-aware-qp is enabled.\n");
         H0("   --radl <integer>              Number of RADL pictures
allowed in front of IDR. Default %d\n", param->radl);
         H0("   --intra-refresh               Use Periodic Intra Refresh
instead of IDR frames\n");
         H0("   --rc-lookahead <integer>      Number of frames for
frame-type lookahead (determines encoder latency) Default %d\n",
param->lookaheadDepth);
-- 
2.18.0.windows.1

-- 

Thanks & Regards
*Niranjan Kumar B*
Video Codec Engineer
Media & AI Analytics
+91 958 511 1449
<https://multicorewareinc.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20201229/14ce7669/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.diff
Type: application/octet-stream
Size: 8774 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20201229/14ce7669/attachment-0001.obj>


More information about the x265-devel mailing list