[x265] silence GCC 7 warnings

Mateusz Brzostek mateusz at msystem.waw.pl
Sat Feb 11 18:31:06 CET 2017


There are GCC 7 warnings:

f:/x265p/source/encoder/ratecontrol.cpp: In member function 'double x265::RateControl::rateEstimateQscale(x265::Frame*, x265::Ra
teControlEntry*)':
f:/x265p/source/encoder/ratecontrol.cpp:1899:39: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
                     lqmax =  (m_lstep * m_isGrainEnabled) ? x265_qp2qScale(ABR_INIT_QP_GRAIN_MAX) :
                              ~~~~~~~~~^~~~~~~~~~~~~~~~~~~

and

f:/x265p/source/common/bitstream.cpp: In member function 'virtual void x265::Bitstream::write(uint32_t, uint32_t)':
f:/x265p/source/common/bitstream.cpp:67:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 4: push_back(write_bits >> 24);
                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~
f:/x265p/source/common/bitstream.cpp:68:9: note: here
         case 3: push_back(write_bits >> 16);
         ^~~~
f:/x265p/source/common/bitstream.cpp:68:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 3: push_back(write_bits >> 16);
                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~
f:/x265p/source/common/bitstream.cpp:69:9: note: here
         case 2: push_back(write_bits >> 8);
         ^~~~
f:/x265p/source/common/bitstream.cpp:69:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 2: push_back(write_bits >> 8);
                 ~~~~~~~~~^~~~~~~~~~~~~~~~~
f:/x265p/source/common/bitstream.cpp:70:9: note: here
         case 1: push_back(write_bits);
         ^~~~

which we should avoid.

# HG changeset patch
# User Ma0 <mateuszb at poczta.onet.pl>
# Date 1486833849 -3600
#      Sat Feb 11 18:24:09 2017 +0100
# Node ID 7eda184e1f0908187fe65e0f57d932d7bf11fb38
# Parent  fe2f2dd96f8cf9fb88a720a96aab4ff5b21768df
silence GCC 7 warnings

diff -r fe2f2dd96f8c -r 7eda184e1f09 source/common/bitstream.cpp
--- a/source/common/bitstream.cpp    Fri Feb 10 14:23:32 2017 +0530
+++ b/source/common/bitstream.cpp    Sat Feb 11 18:24:09 2017 +0100
@@ -64,9 +64,9 @@
 
         switch (writeBytes)
         {
-        case 4: push_back(write_bits >> 24);
-        case 3: push_back(write_bits >> 16);
-        case 2: push_back(write_bits >> 8);
+        case 4: push_back(write_bits >> 24);  // fall-through
+        case 3: push_back(write_bits >> 16);  // fall-through
+        case 2: push_back(write_bits >> 8);   // fall-through
         case 1: push_back(write_bits);
         }
 
diff -r fe2f2dd96f8c -r 7eda184e1f09 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp    Fri Feb 10 14:23:32 2017 +0530
+++ b/source/encoder/ratecontrol.cpp    Sat Feb 11 18:24:09 2017 +0100
@@ -1896,17 +1896,17 @@
             else if (m_framesDone == 0 && !m_isVbv && m_param->rc.rateControlMode == X265_RC_ABR)
             {
                 /* for ABR alone, clip the first I frame qp */
-                    lqmax =  (m_lstep * m_isGrainEnabled) ? x265_qp2qScale(ABR_INIT_QP_GRAIN_MAX) :
+                lqmax = (m_isGrainEnabled && m_lstep) ? x265_qp2qScale(ABR_INIT_QP_GRAIN_MAX) :
                         x265_qp2qScale(ABR_INIT_QP_MAX);
-                    q = X265_MIN(lqmax, q);
+                q = X265_MIN(lqmax, q);
             }
             q = x265_clip3(lqmin, lqmax, q);
             /* Set a min qp at scenechanges and transitions */
             if (m_isSceneTransition)
             {
-               double minScenecutQscale =x265_qp2qScale(ABR_SCENECUT_INIT_QP_MIN);
-               q = X265_MAX(minScenecutQscale, q);
-               m_lastQScaleFor[P_SLICE] = X265_MAX(minScenecutQscale, m_lastQScaleFor[P_SLICE]);
+                double minScenecutQscale =x265_qp2qScale(ABR_SCENECUT_INIT_QP_MIN);
+                q = X265_MAX(minScenecutQscale, q);
+                m_lastQScaleFor[P_SLICE] = X265_MAX(minScenecutQscale, m_lastQScaleFor[P_SLICE]);
             }
             rce->qpNoVbv = x265_qScale2qp(q);
             if(m_sliceType == P_SLICE)



More information about the x265-devel mailing list