[x265] [PATCH] Fix build warnings in arm
Pavan Tarun Chakka Venkata
pavan.tarun at multicorewareinc.com
Fri Mar 28 06:51:17 UTC 2025
>From 0bb94979eee99370e5aa494717fe80a9d5701e81 Mon Sep 17 00:00:00 2001
From: PavanTarun <pavan.tarun at multicorewareinc.com>
Date: Fri, 28 Mar 2025 05:56:28 +0000
Subject: [PATCH] Fix build warnings in arm
---
source/CMakeLists.txt | 1 -
source/common/aarch64/loopfilter-prim.cpp | 10 +++++-----
source/common/common.h | 1 +
source/common/cpu.cpp | 2 ++
source/common/param.cpp | 4 ++++
source/common/scaler.cpp | 3 ---
source/encoder/entropy.cpp | 4 ++--
source/encoder/level.cpp | 9 ---------
source/encoder/ratecontrol.cpp | 10 +++-------
source/encoder/sao.cpp | 5 -----
source/encoder/search.cpp | 4 ----
source/encoder/slicetype.cpp | 4 ----
source/test/pixelharness.cpp | 19 -------------------
source/test/pixelharness.h | 2 +-
source/x265.cpp | 2 +-
15 files changed, 19 insertions(+), 61 deletions(-)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 4f5b3ed82..c1473caa5 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -622,7 +622,6 @@ option(WARNINGS_AS_ERRORS "Stop compiles on first warning" OFF)
if(WARNINGS_AS_ERRORS)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_definitions(-Werror)
- add_definitions(-Wno-unused)
elseif(MSVC)
add_definitions(/WX)
endif()
diff --git a/source/common/aarch64/loopfilter-prim.cpp b/source/common/aarch64/loopfilter-prim.cpp
index 320cb8153..54ea561ab 100644
--- a/source/common/aarch64/loopfilter-prim.cpp
+++ b/source/common/aarch64/loopfilter-prim.cpp
@@ -279,11 +279,11 @@ void pelFilterLumaStrong_V_neon(pixel *src, intptr_t srcStep, intptr_t offset,
// -1 index means value is zero because TBL instructions
// zero elements that have out of range indices.
- const uint8x8_t idx0 = { -1, 0, 1, 2, 3, 4, 5, -1 };
- const uint8x8_t idx1 = { -1, 1, 2, 3, 4, 5, 6, -1 };
- const uint8x8_t idx2 = { -1, 2, 3, 4, 5, 6, 7, -1 };
- const uint8x8_t idx3 = { -1, 3, 4, 5, 6, -1, 3, -1 };
- const uint8x8_t idx4 = { -1, 4, -1, 1, 2, 3, 4, -1 };
+ const uint8x8_t idx0 = { 255, 0, 1, 2, 3, 4, 5, 255 };
+ const uint8x8_t idx1 = { 255, 1, 2, 3, 4, 5, 6, 255 };
+ const uint8x8_t idx2 = { 255, 2, 3, 4, 5, 6, 7, 255 };
+ const uint8x8_t idx3 = { 255, 3, 4, 5, 6, 255, 3, 255 };
+ const uint8x8_t idx4 = { 255, 4, 255, 1, 2, 3, 4, 255 };
const int16x8_t neg_shift = { 0, -3, -2, -3, -3, -2, -3, 0 };
diff --git a/source/common/common.h b/source/common/common.h
index f5e2f63fe..794073577 100644
--- a/source/common/common.h
+++ b/source/common/common.h
@@ -39,6 +39,7 @@
#include <stdint.h>
#include <memory.h>
#include <assert.h>
+#include <stdlib.h>
#include "x265.h"
diff --git a/source/common/cpu.cpp b/source/common/cpu.cpp
index 35c43deaf..d4a4e63c5 100644
--- a/source/common/cpu.cpp
+++ b/source/common/cpu.cpp
@@ -62,7 +62,9 @@ static void sigill_handler(int sig)
#endif // if X265_ARCH_ARM
namespace X265_NS {
+#if X265_ARCH_X86
static bool enable512 = false;
+#endif
const cpu_name_t cpu_names[] =
{
#if X265_ARCH_X86
diff --git a/source/common/param.cpp b/source/common/param.cpp
index 02cface59..759e67216 100755
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -904,12 +904,16 @@ int x265_param_parse(x265_param* p, const char* name, const char* value)
bool bValueWasNull = !value;
bool bExtraParams = false;
char nameBuf[64];
+#ifdef SVT_HEVC
static int count;
+#endif
if (!name)
return X265_PARAM_BAD_NAME;
+#ifdef SVT_HEVC
count++;
+#endif
// skip -- prefix if provided
if (name[0] == '-' && name[1] == '-')
name += 2;
diff --git a/source/common/scaler.cpp b/source/common/scaler.cpp
index 879654793..4577f4871 100644
--- a/source/common/scaler.cpp
+++ b/source/common/scaler.cpp
@@ -511,10 +511,7 @@ int ScalerFilterManager::init(int algorithmFlags, VideoDesc *srcVideoDesc, Video
int dstHCrPos;
int srcVCrPos;
int dstVCrPos;
- int dst_stride = SCALER_ALIGN(dstW * sizeof(int16_t) + 66, 16);
m_bitDepth = dstVideoDesc->m_inputDepth;
- if (m_bitDepth == 16)
- dst_stride <<= 1;
m_algorithmFlags = algorithmFlags;
lumXInc = (((int64_t)srcW << 16) + (dstW >> 1)) / dstW;
diff --git a/source/encoder/entropy.cpp b/source/encoder/entropy.cpp
index ece8d6bc9..c7cc470a3 100644
--- a/source/encoder/entropy.cpp
+++ b/source/encoder/entropy.cpp
@@ -1782,7 +1782,7 @@ void Entropy::codePredWeightTable(const Slice& slice)
else
#endif
WRITE_FLAG(!!wp[0].wtPresent, "luma_weight_lX_flag");
- totalSignalledWeightFlags += wp[0].wtPresent;
+ totalSignalledWeightFlags = totalSignalledWeightFlags + wp[0].wtPresent;
}
if (bChroma)
@@ -1796,7 +1796,7 @@ void Entropy::codePredWeightTable(const Slice& slice)
else
#endif
WRITE_FLAG(!!wp[1].wtPresent, "chroma_weight_lX_flag");
- totalSignalledWeightFlags += 2 * wp[1].wtPresent;
+ totalSignalledWeightFlags = totalSignalledWeightFlags + 2 * wp[1].wtPresent;
}
}
diff --git a/source/encoder/level.cpp b/source/encoder/level.cpp
index 34ad23d1f..5f3c4bc22 100644
--- a/source/encoder/level.cpp
+++ b/source/encoder/level.cpp
@@ -64,15 +64,6 @@ LevelSpec levels[] =
{ MAX_UINT, MAX_UINT64, MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, 1, Level::LEVEL8_5, "8.5", 85 },
};
-static inline int _confirm(x265_param* param, bool bflag, const char* message)
-{
- if (!bflag)
- return 0;
-
- x265_log(param, X265_LOG_ERROR, "%s\n", message);
- return 1;
-}
-
/* determine minimum decoder level required to decode the described video */
void determineLevel(const x265_param ¶m, VPS& vps)
{
diff --git a/source/encoder/ratecontrol.cpp b/source/encoder/ratecontrol.cpp
index 6749503b1..6b8b384e4 100644
--- a/source/encoder/ratecontrol.cpp
+++ b/source/encoder/ratecontrol.cpp
@@ -664,7 +664,6 @@ bool RateControl::init(const SPS& sps)
}
/* read stats */
p = statsIn;
- double totalQpAq = 0;
for (int i = 0; i < m_numEntries; i++)
{
RateControlEntry *rce, *rcePocOrder;
@@ -729,7 +728,6 @@ bool RateControl::init(const SPS& sps)
return false;
}
rce->qScale = rce->newQScale = x265_qp2qScale(qpRc);
- totalQpAq += qpAq;
rce->qpNoVbv = qNoVbv;
rce->qpaRc = qpRc;
rce->qpAq = qpAq;
@@ -1108,7 +1106,7 @@ fail:
bool RateControl::initPass2()
{
- uint64_t allConstBits = 0, allCodedBits = 0;
+ uint64_t allConstBits = 0;
uint64_t allAvailableBits = uint64_t(m_param->rc.bitrate * 1000. * m_numEntries * m_frameDuration);
int startIndex, endIndex;
int fps = X265_MIN(m_param->keyframeMax, (int)(m_fps + 0.5));
@@ -1127,7 +1125,6 @@ bool RateControl::initPass2()
for (endIndex = m_start; endIndex < m_numEntries; endIndex++)
{
allConstBits += m_rce2Pass[endIndex].miscBits;
- allCodedBits += m_rce2Pass[endIndex].coeffBits + m_rce2Pass[endIndex].mvBits;
}
if (allAvailableBits < allConstBits)
@@ -1225,14 +1222,13 @@ bool RateControl::vbv2Pass(uint64_t allAvailableBits, int endPos, int startPos)
int t0, t1;
double qScaleMin = x265_qp2qScale(m_param->rc.qpMin);
double qScaleMax = x265_qp2qScale(m_param->rc.qpMax);
- int iterations = 0 , adjMin, adjMax;
+ int adjMin, adjMax;
CHECKED_MALLOC(fills, double, m_numEntries + 1);
fills++;
/* adjust overall stream size */
do
{
- iterations++;
prevBits = expectedBits;
if (expectedBits)
@@ -1907,7 +1903,7 @@ double RateControl::tuneQScaleForGrain(double rcOverflow)
int newQp = rcOverflow > 1.1 ? curQp + 2 : rcOverflow > 1 ? curQp + 1 : curQp - 1 ;
double projectedBitrate = int(m_fps + 0.5) * m_qpToEncodedBits[newQp];
if (curBitrate > 0 && projectedBitrate > 0)
- q = abs(projectedBitrate - m_bitrate) < abs (curBitrate - m_bitrate) ? x265_qp2qScale(newQp) : m_lastQScaleFor[P_SLICE];
+ q = std::abs(projectedBitrate - m_bitrate) < std::abs (curBitrate - m_bitrate) ? x265_qp2qScale(newQp) : m_lastQScaleFor[P_SLICE];
else
q = rcOverflow > 1 ? qScaleAvg * qpstep : rcOverflow < 1 ? qScaleAvg / qpstep : m_lastQScaleFor[P_SLICE];
return q;
diff --git a/source/encoder/sao.cpp b/source/encoder/sao.cpp
index 329f36ccf..0dee092d7 100644
--- a/source/encoder/sao.cpp
+++ b/source/encoder/sao.cpp
@@ -733,7 +733,6 @@ void SAO::calcSaoStatsCTU(int addr, int plane)
const CUData* cu = m_frame->m_encData->getPicCTU(addr);
const pixel* fenc0 = m_frame->m_fencPic->getPlaneAddr(plane, addr);
const pixel* rec0 = reconPic->getPlaneAddr(plane, addr);
- const pixel* fenc;
const pixel* rec;
intptr_t stride = plane ? reconPic->m_strideC : reconPic->m_stride;
uint32_t picWidth = m_param->sourceWidth;
@@ -863,7 +862,6 @@ void SAO::calcSaoStatsCTU(int addr, int plane)
skipR = 5;
}
- fenc = fenc0;
rec = rec0;
startX = !lpelx;
@@ -873,7 +871,6 @@ void SAO::calcSaoStatsCTU(int addr, int plane)
endY = (bpely == picHeight) ? ctuHeight - 1 : ctuHeight - skipB + plane_offset;
if (startY)
{
- fenc += stride;
rec += stride;
}
@@ -888,7 +885,6 @@ void SAO::calcSaoStatsCTU(int addr, int plane)
skipB = 4;
skipR = 5;
}
- fenc = fenc0;
rec = rec0;
startX = !lpelx;
endX = (rpelx == picWidth) ? ctuWidth - 1 : ctuWidth - skipR + plane_offset;
@@ -898,7 +894,6 @@ void SAO::calcSaoStatsCTU(int addr, int plane)
if (startY)
{
- fenc += stride;
rec += stride;
}
diff --git a/source/encoder/search.cpp b/source/encoder/search.cpp
index 2a324700d..0522f52cc 100644
--- a/source/encoder/search.cpp
+++ b/source/encoder/search.cpp
@@ -276,7 +276,6 @@ void Search::codeCoeffQTChroma(const CUData& cu, uint32_t tuDepth, uint32_t absP
return;
}
- uint32_t tuDepthC = tuDepth;
uint32_t log2TrSizeC = log2TrSize - m_hChromaShift;
if (log2TrSizeC < 2)
@@ -285,7 +284,6 @@ void Search::codeCoeffQTChroma(const CUData& cu, uint32_t tuDepth, uint32_t absP
if (absPartIdx & 3)
return;
log2TrSizeC = 2;
- tuDepthC--;
}
uint32_t qtLayer = log2TrSize - 2;
@@ -5717,12 +5715,10 @@ void Search::saveResidualQTData(CUData& cu, ShortYuv& resiYuv, uint32_t absPartI
uint32_t log2TrSizeC = log2TrSize - m_hChromaShift;
uint32_t codeChroma = (m_csp != X265_CSP_I400 && m_frame->m_fencPic->m_picCsp != X265_CSP_I400) ? 1 : 0;
- uint32_t tuDepthC = tuDepth;
if (log2TrSizeC < 2)
{
X265_CHECK(log2TrSize == 2 && m_csp != X265_CSP_I444 && tuDepth, "invalid tuDepth\n");
log2TrSizeC = 2;
- tuDepthC--;
codeChroma &= !(absPartIdx & 3);
}
diff --git a/source/encoder/slicetype.cpp b/source/encoder/slicetype.cpp
index e94a7eb9c..992d7b687 100644
--- a/source/encoder/slicetype.cpp
+++ b/source/encoder/slicetype.cpp
@@ -1473,7 +1473,6 @@ void LookaheadTLD::computePictureStatistics(Frame *curFrame)
uint64_t picTotVariance = 0;
uint32_t variance;
- uint64_t blockXY = 0;
pixel* src = curFrame->m_fencPic->m_picOrg[0];
for (int blockY = 0; blockY < maxRow; blockY += 8)
@@ -1489,7 +1488,6 @@ void LookaheadTLD::computePictureStatistics(Frame *curFrame)
blockOffsetLuma, 0);
rowVariance += variance;
- blockXY++;
}
picTotVariance += (uint16_t)(rowVariance / maxCol);
}
@@ -1520,7 +1518,6 @@ void LookaheadTLD::computePictureStatistics(Frame *curFrame)
blockOffsetChroma, 1);
rowVariance += variance;
- blockXY++;
}
picTotVariance += (uint16_t)(rowVariance / maxColChroma);
}
@@ -1544,7 +1541,6 @@ void LookaheadTLD::computePictureStatistics(Frame *curFrame)
blockOffsetChroma, 2);
rowVariance += variance;
- blockXY++;
}
picTotVariance += (uint16_t)(rowVariance / maxColChroma);
}
diff --git a/source/test/pixelharness.cpp b/source/test/pixelharness.cpp
index 10f66cda1..2c9b5200c 100644
--- a/source/test/pixelharness.cpp
+++ b/source/test/pixelharness.cpp
@@ -998,8 +998,6 @@ bool PixelHarness::check_pixel_add_ps_aligned(pixel_add_ps_t ref, pixel_add_ps_t
bool PixelHarness::check_pixel_var(var_t ref, var_t opt)
{
- int j = 0;
-
intptr_t stride = STRIDE;
for (int i = 0; i < ITERS; i++)
@@ -1011,7 +1009,6 @@ bool PixelHarness::check_pixel_var(var_t ref, var_t opt)
return false;
reportfail();
- j += INCR;
}
return true;
@@ -1350,8 +1347,6 @@ bool PixelHarness::check_saoCuStatsE1_t(saoCuStatsE1_t ref, saoCuStatsE1_t opt)
int8_t _upBuff1_ref[MAX_CU_SIZE + 2], *upBuff1_ref = _upBuff1_ref + 1;
int8_t _upBuff1_vec[MAX_CU_SIZE + 2], *upBuff1_vec = _upBuff1_vec + 1;
- int j = 0;
-
for (int i = 0; i < ITERS; i++)
{
// initialize input data to random, the dynamic range wrong but good to verify our asm code
@@ -1377,7 +1372,6 @@ bool PixelHarness::check_saoCuStatsE1_t(saoCuStatsE1_t ref, saoCuStatsE1_t opt)
return false;
reportfail();
- j += INCR;
}
return true;
@@ -1397,7 +1391,6 @@ bool PixelHarness::check_saoCuStatsE2_t(saoCuStatsE2_t ref, saoCuStatsE2_t opt)
int8_t _upBuff1_vec[MAX_CU_SIZE + 2], *upBuff1_vec = _upBuff1_vec + 1;
int8_t _upBufft_vec[MAX_CU_SIZE + 2], *upBufft_vec = _upBufft_vec + 1;
- int j = 0;
// NOTE: verify more times since our asm is NOT exact match to C, the output of upBuff* will be DIFFERENT
for (int i = 0; i < ITERS * 10; i++)
@@ -1428,7 +1421,6 @@ bool PixelHarness::check_saoCuStatsE2_t(saoCuStatsE2_t ref, saoCuStatsE2_t opt)
return false;
reportfail();
- j += INCR;
}
return true;
@@ -1446,8 +1438,6 @@ bool PixelHarness::check_saoCuStatsE3_t(saoCuStatsE3_t ref, saoCuStatsE3_t opt)
int8_t _upBuff1_ref[MAX_CU_SIZE + 2], *upBuff1_ref = _upBuff1_ref + 1;
int8_t _upBuff1_vec[MAX_CU_SIZE + 2], *upBuff1_vec = _upBuff1_vec + 1;
- int j = 0;
-
// (const pixel *fenc, const pixel *rec, intptr_t stride, int8_t *upBuff1, int endX, int endY, int32_t *stats, int32_t *count)
for (int i = 0; i < ITERS; i++)
{
@@ -1476,7 +1466,6 @@ bool PixelHarness::check_saoCuStatsE3_t(saoCuStatsE3_t ref, saoCuStatsE3_t opt)
return false;
reportfail();
- j += INCR;
}
return true;
@@ -1729,7 +1718,6 @@ bool PixelHarness::check_scanPosLast(scanPosLast_t ref, scanPosLast_t opt)
uint16_t ref_coeffSign[MLS_GRP_NUM], opt_coeffSign[MLS_GRP_NUM]; // bit mask map for non-zero coeff sign
uint16_t ref_coeffFlag[MLS_GRP_NUM], opt_coeffFlag[MLS_GRP_NUM]; // bit mask map for non-zero coeff
- int totalCoeffs = 0;
for (int i = 0; i < 32 * 32; i++)
{
ref_src[i] = rand() & SHORT_MAX;
@@ -1741,7 +1729,6 @@ bool PixelHarness::check_scanPosLast(scanPosLast_t ref, scanPosLast_t opt)
// more negtive
if ((rand() % 10) < 8)
ref_src[i] *= -1;
- totalCoeffs += (ref_src[i] != 0);
}
// extra test area all of 0x1234
@@ -1865,7 +1852,6 @@ bool PixelHarness::check_costCoeffNxN(costCoeffNxN_t ref, costCoeffNxN_t opt)
memset(ref_absCoeff, 0xCD, sizeof(ref_absCoeff));
memset(opt_absCoeff, 0xCD, sizeof(opt_absCoeff));
- int totalCoeffs = 0;
for (int i = 0; i < 32 * 32; i++)
{
ref_src[i] = rand() & SHORT_MAX;
@@ -1877,7 +1863,6 @@ bool PixelHarness::check_costCoeffNxN(costCoeffNxN_t ref, costCoeffNxN_t opt)
// more negtive
if ((rand() % 10) < 8)
ref_src[i] *= -1;
- totalCoeffs += (ref_src[i] != 0);
}
// extra test area all of 0x1234
@@ -2230,7 +2215,6 @@ bool PixelHarness::check_pelFilterChroma_V(pelFilterChroma_t ref, pelFilterChrom
bool PixelHarness::check_integral_initv(integralv_t ref, integralv_t opt)
{
intptr_t srcStep = 64;
- int j = 0;
uint32_t dst_ref[BUFFSIZE] = { 0 };
uint32_t dst_opt[BUFFSIZE] = { 0 };
@@ -2261,7 +2245,6 @@ bool PixelHarness::check_integral_initv(integralv_t ref, integralv_t opt)
return false;
reportfail()
- j += INCR;
}
return true;
}
@@ -2272,7 +2255,6 @@ bool PixelHarness::check_integral_inith(integralh_t ref, integralh_t opt)
* to check correctness for two cases: stride multiple of 16 and stride not a multiple of 16; fine for High bit depth
* where data movement in AVX2 is 8 elements at a time */
intptr_t srcStep[2] = { 56, 64 };
- int j = 0;
uint32_t dst_ref[BUFFSIZE] = { 0 };
uint32_t dst_opt[BUFFSIZE] = { 0 };
@@ -2291,7 +2273,6 @@ bool PixelHarness::check_integral_inith(integralh_t ref, integralh_t opt)
return false;
reportfail()
- j += INCR;
}
}
return true;
diff --git a/source/test/pixelharness.h b/source/test/pixelharness.h
index ee43cbeae..5dd354029 100644
--- a/source/test/pixelharness.h
+++ b/source/test/pixelharness.h
@@ -109,7 +109,7 @@ protected:
bool check_addAvg_aligned(addAvg_t, addAvg_t);
bool check_saoCuOrgE0_t(saoCuOrgE0_t ref, saoCuOrgE0_t opt);
bool check_saoCuOrgE1_t(saoCuOrgE1_t ref, saoCuOrgE1_t opt);
- bool check_saoCuOrgE2_t(saoCuOrgE2_t ref[], saoCuOrgE2_t opt[]);
+ bool check_saoCuOrgE2_t(saoCuOrgE2_t ref[2], saoCuOrgE2_t opt[2]);
bool check_saoCuOrgE3_t(saoCuOrgE3_t ref, saoCuOrgE3_t opt);
bool check_saoCuOrgE3_32_t(saoCuOrgE3_t ref, saoCuOrgE3_t opt);
bool check_saoCuOrgB0_t(saoCuOrgB0_t ref, saoCuOrgB0_t opt);
diff --git a/source/x265.cpp b/source/x265.cpp
index d1a362070..1617ef414 100644
--- a/source/x265.cpp
+++ b/source/x265.cpp
@@ -208,7 +208,7 @@ static bool parseAbrConfig(FILE* abrConfig, CLIOptions cliopt[], uint8_t numEnco
{
argv[argc] = strPool;
strPool += strlen(token) + 1;
- strPoolSize -= (int)strlen(token) + 1;
+ strPoolSize = strPoolSize - (int)strlen(token) + 1;
strcpy(argv[argc], token);
token = strtok(NULL, " ");
argc++;
--
2.43.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250328/b2eb6e56/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-build-warnings-in-arm.patch
Type: application/octet-stream
Size: 19200 bytes
Desc: 0001-Fix-build-warnings-in-arm.patch
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250328/b2eb6e56/attachment-0001.obj>
More information about the x265-devel
mailing list