[x265] [PATCH] Fix Build Warnings
Pavan Tarun Chakka Venkata
pavan.tarun at multicorewareinc.com
Thu Nov 21 10:15:00 UTC 2024
>From 2f7f33a3f1b0902779afaa189411340aeefd64ef Mon Sep 17 00:00:00 2001
From: PavanTarun <pavan.tarun at multicorewareinc.com>
Date: Tue, 19 Nov 2024 13:17:24 +0530
Subject: [PATCH] Fix Build Warnings
---
source/CMakeLists.txt | 2 +-
source/abrEncApp.cpp | 2 +-
source/common/common.h | 2 +-
source/common/param.cpp | 4 ++--
source/common/quant.cpp | 12 ++++++------
source/encoder/api.cpp | 4 ++--
source/encoder/encoder.cpp | 4 ++--
source/encoder/frameencoder.cpp | 2 +-
8 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 8317475c3..5c6dda9e8 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -614,7 +614,7 @@ endif(ARM64)
option(WARNINGS_AS_ERRORS "Stop compiles on first warning" OFF)
if(WARNINGS_AS_ERRORS)
- if(GCC)
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_definitions(-Werror)
add_definitions(-Wno-unused)
elseif(MSVC)
diff --git a/source/abrEncApp.cpp b/source/abrEncApp.cpp
index 66787ff11..012a48967 100644
--- a/source/abrEncApp.cpp
+++ b/source/abrEncApp.cpp
@@ -594,7 +594,7 @@ ret:
ReconPlay* reconPlay = NULL;
if (m_cliopt.reconPlayCmd)
reconPlay = new ReconPlay(m_cliopt.reconPlayCmd, *m_param);
- char* profileName = m_cliopt.encName ? m_cliopt.encName :
(char *)"x265";
+ char* profileName = m_cliopt.encName[0] ? m_cliopt.encName :
(char *)"x265";
if (signal(SIGINT, sigint_handler) == SIG_ERR)
x265_log(m_param, X265_LOG_ERROR, "Unable to register
CTRL+C handler: %s in %s\n",
diff --git a/source/common/common.h b/source/common/common.h
index 43025df06..c4cd919dd 100644
--- a/source/common/common.h
+++ b/source/common/common.h
@@ -225,7 +225,7 @@ typedef int16_t coeff_t; // transform coefficient
#define X265_MALLOC(type, count) (type*)x265_malloc(sizeof(type) *
(count))
#define X265_FREE(ptr) x265_free(ptr)
-#define X265_FREE_ZERO(ptr) x265_free(ptr); (ptr) = NULL
+#define X265_FREE_ZERO(ptr) { x265_free(ptr); (ptr) = NULL; }
#define CHECKED_MALLOC(var, type, count) \
{ \
var = (type*)x265_malloc(sizeof(type) * (count)); \
diff --git a/source/common/param.cpp b/source/common/param.cpp
index dd8a12ef4..eb32c8d7a 100755
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -1906,7 +1906,7 @@ int x265_check_params(x265_param* param)
CHECK((param->internalBitDepth != 10), "Dolby Vision profile - 5,
profile - 8.1, profile - 8.2 and profile - 8.4 are Main10 only\n");
CHECK((param->internalCsp != X265_CSP_I420), "Dolby Vision profile
- 5, profile - 8.1, profile - 8.2 and profile - 8.4 requires YCbCr 4:2:0
color space\n");
if (param->dolbyProfile == 81)
- CHECK(!(param->masteringDisplayColorVolume), "Dolby Vision
profile - 8.1 requires Mastering display color volume information\n");
+ CHECK(param->masteringDisplayColorVolume[0] == 0, "Dolby
Vision profile - 8.1 requires Mastering display color volume
information\n");
}
if (param->bField && param->interlaceMode)
{
@@ -2970,7 +2970,7 @@ void x265_copy_params(x265_param* dst, x265_param*
src)
dst->bSingleSeiNal = src->bSingleSeiNal;
dst->chunkStart = src->chunkStart;
dst->chunkEnd = src->chunkEnd;
- if (src->naluFile) snprintf(dst->naluFile, X265_MAX_STRING_SIZE, "%s",
src->naluFile);
+ if (src->naluFile[0]) snprintf(dst->naluFile, X265_MAX_STRING_SIZE,
"%s", src->naluFile);
else dst->naluFile[0] = 0;
dst->scaleFactor = src->scaleFactor;
dst->ctuDistortionRefine = src->ctuDistortionRefine;
diff --git a/source/common/quant.cpp b/source/common/quant.cpp
index 93462f51a..303b2a5e9 100644
--- a/source/common/quant.cpp
+++ b/source/common/quant.cpp
@@ -255,9 +255,9 @@ uint32_t Quant::signBitHidingHDQ(int16_t* coeff,
int32_t* deltaU, uint32_t numSi
#if CHECKED_BUILD || _DEBUG
// clean output buffer, the asm version of scanPosLast Never output
anything after latest non-zero coeff group
- memset(coeffNum, 0, sizeof(coeffNum));
- memset(coeffSign, 0, sizeof(coeffNum));
- memset(coeffFlag, 0, sizeof(coeffNum));
+ memset(coeffNum, 0, sizeof(coeffNum) * sizeof(uint8_t));
+ memset(coeffSign, 0, sizeof(coeffNum) * sizeof(uint16_t));
+ memset(coeffFlag, 0, sizeof(coeffNum) * sizeof(uint16_t));
#endif
const int lastScanPos = primitives.scanPosLast(codeParams.scan, coeff,
coeffSign, coeffFlag, coeffNum, numSig, g_scan4x4[codeParams.scanType],
trSize);
const int cgLastScanPos = (lastScanPos >> LOG2_SCAN_SET_SIZE);
@@ -676,9 +676,9 @@ uint32_t Quant::rdoQuant(const CUData& cu, int16_t*
dstCoeff, TextType ttype, ui
#if CHECKED_BUILD || _DEBUG
// clean output buffer, the asm version of scanPosLast Never output
anything after latest non-zero coeff group
- memset(coeffNum, 0, sizeof(coeffNum));
- memset(coeffSign, 0, sizeof(coeffNum));
- memset(coeffFlag, 0, sizeof(coeffNum));
+ memset(coeffNum, 0, sizeof(coeffNum) * sizeof(uint8_t));
+ memset(coeffSign, 0, sizeof(coeffNum) * sizeof(uint16_t));
+ memset(coeffFlag, 0, sizeof(coeffNum) * sizeof(uint16_t));
#endif
const int lastScanPos = primitives.scanPosLast(codeParams.scan,
dstCoeff, coeffSign, coeffFlag, coeffNum, numSig,
g_scan4x4[codeParams.scanType], trSize);
const int cgLastScanPos = (lastScanPos >> LOG2_SCAN_SET_SIZE);
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
index 4c70ec3af..e89f0cf8d 100644
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -817,7 +817,7 @@ void x265_alloc_analysis_data(x265_param *param,
x265_analysis_data* analysis)
//Allocate memory for distortionData pointer
CHECKED_MALLOC_ZERO(distortionData, x265_analysis_distortion_data,
1);
CHECKED_MALLOC_ZERO(distortionData->ctuDistortion, sse_t,
analysis->numPartitions * numCUs_sse_t);
- if (param->analysisLoad || param->rc.bStatRead)
+ if (param->analysisLoad[0] || param->rc.bStatRead)
{
CHECKED_MALLOC_ZERO(distortionData->scaledDistortion, double,
analysis->numCUsInFrame);
CHECKED_MALLOC_ZERO(distortionData->offset, double,
analysis->numCUsInFrame);
@@ -922,7 +922,7 @@ void x265_free_analysis_data(x265_param *param,
x265_analysis_data* analysis)
if (analysis->distortionData)
{
X265_FREE((analysis->distortionData)->ctuDistortion);
- if (param->rc.bStatRead || param->analysisLoad)
+ if (param->rc.bStatRead || param->analysisLoad[0])
{
X265_FREE((analysis->distortionData)->scaledDistortion);
X265_FREE((analysis->distortionData)->offset);
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index 3003ac1ac..b3091adf0 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -6127,8 +6127,8 @@ void Encoder::printReconfigureParams()
x265_log(newParam, X265_LOG_DEBUG, "Reconfigured param options, input
Frame: %d\n", m_pocLast + 1);
- char tmp[60];
-#define TOOLCMP(COND1, COND2, STR) if (COND1 != COND2) { snprintf(tmp,
sizeof(tmp), STR, COND1, COND2); x265_log(newParam, X265_LOG_DEBUG, tmp); }
+ char tmp[1024];
+#define TOOLCMP(COND1, COND2, STR) if (memcmp(&(COND1), &(COND2),
sizeof(COND1)) != 0) { snprintf(tmp, sizeof(tmp), STR, COND1, COND2);
x265_log(newParam, X265_LOG_DEBUG, tmp); }
TOOLCMP(oldParam->maxNumReferences, newParam->maxNumReferences,
"ref=%d to %d\n");
TOOLCMP(oldParam->bEnableFastIntra, newParam->bEnableFastIntra,
"fast-intra=%d to %d\n");
TOOLCMP(oldParam->bEnableEarlySkip, newParam->bEnableEarlySkip,
"early-skip=%d to %d\n");
diff --git a/source/encoder/frameencoder.cpp
b/source/encoder/frameencoder.cpp
index d74154914..5749f994e 100644
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -526,7 +526,7 @@ void FrameEncoder::compressFrame(int layer)
bool bUseWeightB = slice->m_sliceType == B_SLICE &&
slice->m_pps->bUseWeightedBiPred && !layer;
WeightParam* reuseWP = NULL;
- if (m_param->analysisLoad && (bUseWeightP || bUseWeightB))
+ if (m_param->analysisLoad[0] && (bUseWeightP || bUseWeightB))
reuseWP = (WeightParam*)m_frame[layer]->m_analysisData.wt;
if (bUseWeightP || bUseWeightB)
--
2.41.0.windows.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241121/7b7e2f08/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Fix-Build-Warnings.patch
Type: application/octet-stream
Size: 8435 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241121/7b7e2f08/attachment-0001.obj>
More information about the x265-devel
mailing list