[x265] [PATCH] Fix warnings about operations deprecated in C++20.

Andrey Semashev andrey.semashev at gmail.com
Tue Dec 23 23:47:29 UTC 2025


This fixes the following warnings:

* Expressions on volatile variables are deprecated
* Arithmetic between different enumeration types is deprecated

The warnings are emitted by gcc 13.3 in C++20 and later modes.
---
 source/common/scalinglist.h     | 10 +++++-----
 source/encoder/frameencoder.cpp |  2 +-
 source/encoder/sao.h            | 16 ++++++++--------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/source/common/scalinglist.h b/source/common/scalinglist.h
index 99be6df48..e829f89e5 100644
--- a/source/common/scalinglist.h
+++ b/source/common/scalinglist.h
@@ -33,11 +33,11 @@ class ScalingList
 {
 public:
 
-    enum { NUM_SIZES = 4 };            // 4x4, 8x8, 16x16, 32x32
-    enum { NUM_LISTS = 6 };            // number of quantization matrix lists (YUV * inter/intra)
-    enum { NUM_REM = 6 };              // number of remainders of QP/6
-    enum { MAX_MATRIX_COEF_NUM = 64 }; // max coefficient number per quantization matrix
-    enum { MAX_MATRIX_SIZE_NUM = 8 };  // max size number for quantization matrix
+    static const int NUM_SIZES = 4;            // 4x4, 8x8, 16x16, 32x32
+    static const int NUM_LISTS = 6;            // number of quantization matrix lists (YUV * inter/intra)
+    static const int NUM_REM = 6;              // number of remainders of QP/6
+    static const int MAX_MATRIX_COEF_NUM = 64; // max coefficient number per quantization matrix
+    static const int MAX_MATRIX_SIZE_NUM = 8;  // max size number for quantization matrix
 
     static const int     s_numCoefPerSize[NUM_SIZES];
     static const int32_t s_invQuantScales[NUM_REM];
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
index 74ef45eae..415459f89 100644
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -1733,7 +1733,7 @@ void FrameEncoder::processRowEncoder(int intRow, ThreadLocalData& tld, int layer
         }
 
         // Completed CU processing
-        curRow.completed++;
+        curRow.completed = curRow.completed + 1;
 
         FrameStats frameLog;
         curEncData.m_rowStat[row].sumQpAq += collectCTUStatistics(*ctu, &frameLog);
diff --git a/source/encoder/sao.h b/source/encoder/sao.h
index c797ca7cc..9d42a6859 100644
--- a/source/encoder/sao.h
+++ b/source/encoder/sao.h
@@ -47,14 +47,14 @@ class SAO
 {
 public:
 
-    enum { SAO_MAX_DEPTH = 4 };
-    enum { SAO_BO_BITS  = 5 };
-    enum { MAX_NUM_SAO_CLASS = 32 };
-    enum { SAO_BIT_INC = 0 }; /* in HM12.0, it wrote as X265_MAX(X265_DEPTH - 10, 0) */
-    enum { OFFSET_THRESH = 1 << X265_MIN(X265_DEPTH - 5, 5) };
-    enum { NUM_EDGETYPE = 5 };
-    enum { NUM_PLANE = 3 };
-    enum { SAO_DEPTHRATE_SIZE = 4 };
+    static const int SAO_MAX_DEPTH = 4;
+    static const int SAO_BO_BITS  = 5;
+    static const int MAX_NUM_SAO_CLASS = 32;
+    static const int SAO_BIT_INC = 0; /* in HM12.0, it wrote as X265_MAX(X265_DEPTH - 10, 0) */
+    static const int OFFSET_THRESH = 1 << X265_MIN(X265_DEPTH - 5, 5);
+    static const int NUM_EDGETYPE = 5;
+    static const int NUM_PLANE = 3;
+    static const int SAO_DEPTHRATE_SIZE = 4;
     static const uint32_t s_eoTable[NUM_EDGETYPE];
     typedef int32_t PerClass[MAX_NUM_SAO_TYPE][MAX_NUM_SAO_CLASS];
     typedef int32_t PerPlane[NUM_PLANE][MAX_NUM_SAO_TYPE][MAX_NUM_SAO_CLASS];
-- 
2.43.0



More information about the x265-devel mailing list