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