<div dir="ltr">pushed to release_4.1 branch</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 30, 2024 at 6:14 PM Uthayakumar Muthu <<a href="mailto:uthayakumar.muthu@multicorewareinc.com">uthayakumar.muthu@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Here is the updated patch for fixing build warnings issue in x265 after reverting the ctu-info change in analysis.cpp file.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 30, 2024 at 9:39 AM Uthayakumar Muthu <<a href="mailto:uthayakumar.muthu@multicorewareinc.com" target="_blank">uthayakumar.muthu@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">From adbd4ef80c06cc8177ee055e7f762c91bd9ce1ef Mon Sep 17 00:00:00 2001<br>From: Uthayakumar Muthu <<a href="mailto:uthayakumar.muthu@multicorewareinc.com" target="_blank">uthayakumar.muthu@multicorewareinc.com</a>><br>Date: Tue, 29 Oct 2024 13:48:11 +0000<br>Subject: [PATCH] Updated Fix Build Warnings issue in x265<br><br>---<br> source/CMakeLists.txt | 1 +<br> source/abrEncApp.cpp | 2 +-<br> source/common/cpu.cpp | 1 +<br> source/common/cudata.cpp | 2 +-<br> source/common/cudata.h | 2 +-<br> source/common/param.cpp | 246 +++++++++++++++----------------<br> source/common/primitives.cpp | 4 +-<br> source/common/x86/loopfilter.asm | 2 +-<br> source/encoder/analysis.cpp | 59 ++++----<br> source/encoder/api.cpp | 6 +-<br> source/encoder/encoder.cpp | 7 +-<br> source/encoder/ratecontrol.cpp | 4 +-<br> source/x265.cpp | 5 +-<br> source/x265cli.cpp | 4 +-<br> 14 files changed, 177 insertions(+), 168 deletions(-)<br><br>diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>index 0a4a0c0bd..107a9d3bb 100755<br>--- a/source/CMakeLists.txt<br>+++ b/source/CMakeLists.txt<br>@@ -570,6 +570,7 @@ option(WARNINGS_AS_ERRORS "Stop compiles on first warning" OFF)<br> if(WARNINGS_AS_ERRORS)<br> if(GCC)<br> add_definitions(-Werror)<br>+ add_definitions(-Wno-unused)<br> elseif(MSVC)<br> add_definitions(/WX)<br> endif()<br>diff --git a/source/abrEncApp.cpp b/source/abrEncApp.cpp<br>index 4c433122b..b90c0e560 100644<br>--- a/source/abrEncApp.cpp<br>+++ b/source/abrEncApp.cpp<br>@@ -591,7 +591,7 @@ ret:<br> strerror(errno), profileName);<br> <br> x265_picture pic_orig[MAX_VIEWS];<br>- x265_picture *pic_in[MAX_VIEWS];<br>+ x265_picture *pic_in[MAX_VIEWS] = { NULL };<br> for (int view = 0; view < m_param->numViews - !!m_param->format; view++)<br> pic_in[view] = &pic_orig[view];<br> /* Allocate recon picture if analysis save/load is enabled */<br>diff --git a/source/common/cpu.cpp b/source/common/cpu.cpp<br>index d18aeb8d2..485aa681f 100644<br>--- a/source/common/cpu.cpp<br>+++ b/source/common/cpu.cpp<br>@@ -393,6 +393,7 @@ uint32_t cpu_detect(bool benableavx512)<br> <br> uint32_t cpu_detect(bool benableavx512)<br> {<br>+ (void)benableavx512;<br> int flags = 0;<br> <br> #ifdef ENABLE_ASSEMBLY<br>diff --git a/source/common/cudata.cpp b/source/common/cudata.cpp<br>index 6ea6048b7..550845867 100644<br>--- a/source/common/cudata.cpp<br>+++ b/source/common/cudata.cpp<br>@@ -73,7 +73,7 @@ inline bool isEqualRow(int addrA, int addrB)<br> /* Check whether 2 addresses point to the same row or column */<br> inline bool isEqualRowOrCol(int addrA, int addrB)<br> {<br>- return isEqualCol(addrA, addrB) | isEqualRow(addrA, addrB);<br>+ return isEqualCol(addrA, addrB) || isEqualRow(addrA, addrB);<br> }<br> <br> /* Check whether one address points to the first column */<br>diff --git a/source/common/cudata.h b/source/common/cudata.h<br>index 7c25a4e07..08dc70611 100644<br>--- a/source/common/cudata.h<br>+++ b/source/common/cudata.h<br>@@ -51,7 +51,7 @@ enum PartSize<br> SIZE_2NxnD, // asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2)<br> SIZE_nLx2N, // asymmetric motion partition, ( N/2)x2N + (3N/2)x2N<br> SIZE_nRx2N, // asymmetric motion partition, (3N/2)x2N + ( N/2)x2N<br>- NUM_SIZES<br>+ NUM_PART_SIZES<br> };<br> <br> enum PredMode<br>diff --git a/source/common/param.cpp b/source/common/param.cpp<br>index 78ba6849e..da039d914 100755<br>--- a/source/common/param.cpp<br>+++ b/source/common/param.cpp<br>@@ -2046,7 +2046,7 @@ static void appendtool(x265_param* param, char* buf, size_t size, const char* to<br> if (strlen(buf) + strlen(toolstr) + overhead >= size)<br> {<br> x265_log(param, X265_LOG_INFO, "tools:%s\n", buf);<br>- snprintf(buf, sizeof(buf), " %s", toolstr);<br>+ snprintf(buf, size, " %s", toolstr);<br> }<br> else<br> {<br>@@ -2211,34 +2211,34 @@ char *x265_param2string(x265_param* p, int padx, int pady)<br> if (!buf)<br> return NULL;<br> #define BOOL(param, cliopt) \<br>- s += snprintf(s, sizeof(s), " %s", (param) ? cliopt : "no-" cliopt);<br>+ s += snprintf(s, bufSize - (s - buf), " %s", (param) ? cliopt : "no-" cliopt);<br> <br>- s += snprintf(s, sizeof(s), "cpuid=%d", p->cpuid);<br>- s += snprintf(s, sizeof(s), " frame-threads=%d", p->frameNumThreads);<br>+ s += snprintf(s, bufSize - (s - buf), "cpuid=%d", p->cpuid);<br>+ s += snprintf(s, bufSize - (s - buf), " frame-threads=%d", p->frameNumThreads);<br> if (p->numaPools)<br>- s += snprintf(s, sizeof(s), " numa-pools=%s", p->numaPools);<br>+ s += snprintf(s, bufSize - (s - buf), " numa-pools=%s", p->numaPools);<br> BOOL(p->bEnableWavefront, "wpp");<br> BOOL(p->bDistributeModeAnalysis, "pmode");<br> BOOL(p->bDistributeMotionEstimation, "pme");<br> BOOL(p->bEnablePsnr, "psnr");<br> BOOL(p->bEnableSsim, "ssim");<br>- s += snprintf(s, sizeof(s), " log-level=%d", p->logLevel);<br>+ s += snprintf(s, bufSize - (s - buf), " log-level=%d", p->logLevel);<br> if (p->csvfn)<br>- s += snprintf(s, sizeof(s), " csv csv-log-level=%d", p->csvLogLevel);<br>- s += snprintf(s, sizeof(s), " bitdepth=%d", p->internalBitDepth);<br>- s += snprintf(s, sizeof(s), " input-csp=%d", p->internalCsp);<br>- s += snprintf(s, sizeof(s), " fps=%u/%u", p->fpsNum, p->fpsDenom);<br>- s += snprintf(s, sizeof(s), " input-res=%dx%d", p->sourceWidth - padx, p->sourceHeight - pady);<br>- s += snprintf(s, sizeof(s), " interlace=%d", p->interlaceMode);<br>- s += snprintf(s, sizeof(s), " total-frames=%d", p->totalFrames);<br>+ s += snprintf(s, bufSize - (s - buf), " csv csv-log-level=%d", p->csvLogLevel);<br>+ s += snprintf(s, bufSize - (s - buf), " bitdepth=%d", p->internalBitDepth);<br>+ s += snprintf(s, bufSize - (s - buf), " input-csp=%d", p->internalCsp);<br>+ s += snprintf(s, bufSize - (s - buf), " fps=%u/%u", p->fpsNum, p->fpsDenom);<br>+ s += snprintf(s, bufSize - (s - buf), " input-res=%dx%d", p->sourceWidth - padx, p->sourceHeight - pady);<br>+ s += snprintf(s, bufSize - (s - buf), " interlace=%d", p->interlaceMode);<br>+ s += snprintf(s, bufSize - (s - buf), " total-frames=%d", p->totalFrames);<br> if (p->chunkStart)<br>- s += snprintf(s, sizeof(s), " chunk-start=%d", p->chunkStart);<br>+ s += snprintf(s, bufSize - (s - buf), " chunk-start=%d", p->chunkStart);<br> if (p->chunkEnd)<br>- s += snprintf(s, sizeof(s), " chunk-end=%d", p->chunkEnd);<br>- s += snprintf(s, sizeof(s), " level-idc=%d", p->levelIdc);<br>- s += snprintf(s, sizeof(s), " high-tier=%d", p->bHighTier);<br>- s += snprintf(s, sizeof(s), " uhd-bd=%d", p->uhdBluray);<br>- s += snprintf(s, sizeof(s), " ref=%d", p->maxNumReferences);<br>+ s += snprintf(s, bufSize - (s - buf), " chunk-end=%d", p->chunkEnd);<br>+ s += snprintf(s, bufSize - (s - buf), " level-idc=%d", p->levelIdc);<br>+ s += snprintf(s, bufSize - (s - buf), " high-tier=%d", p->bHighTier);<br>+ s += snprintf(s, bufSize - (s - buf), " uhd-bd=%d", p->uhdBluray);<br>+ s += snprintf(s, bufSize - (s - buf), " ref=%d", p->maxNumReferences);<br> BOOL(p->bAllowNonConformance, "allow-non-conformance");<br> BOOL(p->bRepeatHeaders, "repeat-headers");<br> BOOL(p->bAnnexB, "annexb");<br>@@ -2247,173 +2247,173 @@ char *x265_param2string(x265_param* p, int padx, int pady)<br> BOOL(p->bEnableEndOfSequence, "eos");<br> BOOL(p->bEmitHRDSEI, "hrd");<br> BOOL(p->bEmitInfoSEI, "info");<br>- s += snprintf(s, sizeof(s), " hash=%d", p->decodedPictureHashSEI);<br>- s += snprintf(s, sizeof(s), " temporal-layers=%d", p->bEnableTemporalSubLayers);<br>+ s += snprintf(s, bufSize - (s - buf), " hash=%d", p->decodedPictureHashSEI);<br>+ s += snprintf(s, bufSize - (s - buf), " temporal-layers=%d", p->bEnableTemporalSubLayers);<br> BOOL(p->bOpenGOP, "open-gop");<br>- s += snprintf(s, sizeof(s), " min-keyint=%d", p->keyframeMin);<br>- s += snprintf(s, sizeof(s), " keyint=%d", p->keyframeMax);<br>- s += snprintf(s, sizeof(s), " gop-lookahead=%d", p->gopLookahead);<br>- s += snprintf(s, sizeof(s), " bframes=%d", p->bframes);<br>- s += snprintf(s, sizeof(s), " b-adapt=%d", p->bFrameAdaptive);<br>+ s += snprintf(s, bufSize - (s - buf), " min-keyint=%d", p->keyframeMin);<br>+ s += snprintf(s, bufSize - (s - buf), " keyint=%d", p->keyframeMax);<br>+ s += snprintf(s, bufSize - (s - buf), " gop-lookahead=%d", p->gopLookahead);<br>+ s += snprintf(s, bufSize - (s - buf), " bframes=%d", p->bframes);<br>+ s += snprintf(s, bufSize - (s - buf), " b-adapt=%d", p->bFrameAdaptive);<br> BOOL(p->bBPyramid, "b-pyramid");<br>- s += snprintf(s, sizeof(s), " bframe-bias=%d", p->bFrameBias);<br>- s += snprintf(s, sizeof(s), " rc-lookahead=%d", p->lookaheadDepth);<br>- s += snprintf(s, sizeof(s), " lookahead-slices=%d", p->lookaheadSlices);<br>- s += snprintf(s, sizeof(s), " scenecut=%d", p->scenecutThreshold);<br>+ s += snprintf(s, bufSize - (s - buf), " bframe-bias=%d", p->bFrameBias);<br>+ s += snprintf(s, bufSize - (s - buf), " rc-lookahead=%d", p->lookaheadDepth);<br>+ s += snprintf(s, bufSize - (s - buf), " lookahead-slices=%d", p->lookaheadSlices);<br>+ s += snprintf(s, bufSize - (s - buf), " scenecut=%d", p->scenecutThreshold);<br> BOOL(p->bHistBasedSceneCut, "hist-scenecut");<br>- s += snprintf(s, sizeof(s), " radl=%d", p->radl);<br>+ s += snprintf(s, bufSize - (s - buf), " radl=%d", p->radl);<br> BOOL(p->bEnableHRDConcatFlag, "splice");<br> BOOL(p->bIntraRefresh, "intra-refresh");<br>- s += snprintf(s, sizeof(s), " ctu=%d", p->maxCUSize);<br>- s += snprintf(s, sizeof(s), " min-cu-size=%d", p->minCUSize);<br>+ s += snprintf(s, bufSize - (s - buf), " ctu=%d", p->maxCUSize);<br>+ s += snprintf(s, bufSize - (s - buf), " min-cu-size=%d", p->minCUSize);<br> BOOL(p->bEnableRectInter, "rect");<br> BOOL(p->bEnableAMP, "amp");<br>- s += snprintf(s, sizeof(s), " max-tu-size=%d", p->maxTUSize);<br>- s += snprintf(s, sizeof(s), " tu-inter-depth=%d", p->tuQTMaxInterDepth);<br>- s += snprintf(s, sizeof(s), " tu-intra-depth=%d", p->tuQTMaxIntraDepth);<br>- s += snprintf(s, sizeof(s), " limit-tu=%d", p->limitTU);<br>- s += snprintf(s, sizeof(s), " rdoq-level=%d", p->rdoqLevel);<br>- s += snprintf(s, sizeof(s), " dynamic-rd=%.2f", p->dynamicRd);<br>+ s += snprintf(s, bufSize - (s - buf), " max-tu-size=%d", p->maxTUSize);<br>+ s += snprintf(s, bufSize - (s - buf), " tu-inter-depth=%d", p->tuQTMaxInterDepth);<br>+ s += snprintf(s, bufSize - (s - buf), " tu-intra-depth=%d", p->tuQTMaxIntraDepth);<br>+ s += snprintf(s, bufSize - (s - buf), " limit-tu=%d", p->limitTU);<br>+ s += snprintf(s, bufSize - (s - buf), " rdoq-level=%d", p->rdoqLevel);<br>+ s += snprintf(s, bufSize - (s - buf), " dynamic-rd=%.2f", p->dynamicRd);<br> BOOL(p->bSsimRd, "ssim-rd");<br> BOOL(p->bEnableSignHiding, "signhide");<br> BOOL(p->bEnableTransformSkip, "tskip");<br>- s += snprintf(s, sizeof(s), " nr-intra=%d", p->noiseReductionIntra);<br>- s += snprintf(s, sizeof(s), " nr-inter=%d", p->noiseReductionInter);<br>+ s += snprintf(s, bufSize - (s - buf), " nr-intra=%d", p->noiseReductionIntra);<br>+ s += snprintf(s, bufSize - (s - buf), " nr-inter=%d", p->noiseReductionInter);<br> BOOL(p->bEnableConstrainedIntra, "constrained-intra");<br> BOOL(p->bEnableStrongIntraSmoothing, "strong-intra-smoothing");<br>- s += snprintf(s, sizeof(s), " max-merge=%d", p->maxNumMergeCand);<br>- s += snprintf(s, sizeof(s), " limit-refs=%d", p->limitReferences);<br>+ s += snprintf(s, bufSize - (s - buf), " max-merge=%d", p->maxNumMergeCand);<br>+ s += snprintf(s, bufSize - (s - buf), " limit-refs=%d", p->limitReferences);<br> BOOL(p->limitModes, "limit-modes");<br>- s += snprintf(s, sizeof(s), " me=%d", p->searchMethod);<br>- s += snprintf(s, sizeof(s), " subme=%d", p->subpelRefine);<br>- s += snprintf(s, sizeof(s), " merange=%d", p->searchRange);<br>+ s += snprintf(s, bufSize - (s - buf), " me=%d", p->searchMethod);<br>+ s += snprintf(s, bufSize - (s - buf), " subme=%d", p->subpelRefine);<br>+ s += snprintf(s, bufSize - (s - buf), " merange=%d", p->searchRange);<br> BOOL(p->bEnableTemporalMvp, "temporal-mvp");<br> BOOL(p->bEnableFrameDuplication, "frame-dup");<br> if(p->bEnableFrameDuplication)<br>- s += snprintf(s, sizeof(s), " dup-threshold=%d", p->dupThreshold);<br>+ s += snprintf(s, bufSize - (s - buf), " dup-threshold=%d", p->dupThreshold);<br> BOOL(p->bEnableHME, "hme");<br> if (p->bEnableHME)<br> {<br>- s += snprintf(s, sizeof(s), " Level 0,1,2=%d,%d,%d", p->hmeSearchMethod[0], p->hmeSearchMethod[1], p->hmeSearchMethod[2]);<br>- s += snprintf(s, sizeof(s), " merange L0,L1,L2=%d,%d,%d", p->hmeRange[0], p->hmeRange[1], p->hmeRange[2]);<br>+ s += snprintf(s, bufSize - (s - buf), " Level 0,1,2=%d,%d,%d", p->hmeSearchMethod[0], p->hmeSearchMethod[1], p->hmeSearchMethod[2]);<br>+ s += snprintf(s, bufSize - (s - buf), " merange L0,L1,L2=%d,%d,%d", p->hmeRange[0], p->hmeRange[1], p->hmeRange[2]);<br> }<br> BOOL(p->bEnableWeightedPred, "weightp");<br> BOOL(p->bEnableWeightedBiPred, "weightb");<br> BOOL(p->bSourceReferenceEstimation, "analyze-src-pics");<br> BOOL(p->bEnableLoopFilter, "deblock");<br> if (p->bEnableLoopFilter)<br>- s += snprintf(s, sizeof(s), "=%d:%d", p->deblockingFilterTCOffset, p->deblockingFilterBetaOffset);<br>+ s += snprintf(s, bufSize - (s - buf), "=%d:%d", p->deblockingFilterTCOffset, p->deblockingFilterBetaOffset);<br> BOOL(p->bEnableSAO, "sao");<br> BOOL(p->bSaoNonDeblocked, "sao-non-deblock");<br>- s += snprintf(s, sizeof(s), " rd=%d", p->rdLevel);<br>- s += snprintf(s, sizeof(s), " selective-sao=%d", p->selectiveSAO);<br>+ s += snprintf(s, bufSize - (s - buf), " rd=%d", p->rdLevel);<br>+ s += snprintf(s, bufSize - (s - buf), " selective-sao=%d", p->selectiveSAO);<br> BOOL(p->bEnableEarlySkip, "early-skip");<br> BOOL(p->recursionSkipMode, "rskip");<br> if (p->recursionSkipMode == EDGE_BASED_RSKIP)<br>- s += snprintf(s, sizeof(s), " rskip-edge-threshold=%f", p->edgeVarThreshold);<br>+ s += snprintf(s, bufSize - (s - buf), " rskip-edge-threshold=%f", p->edgeVarThreshold);<br> <br> BOOL(p->bEnableFastIntra, "fast-intra");<br> BOOL(p->bEnableTSkipFast, "tskip-fast");<br> BOOL(p->bCULossless, "cu-lossless");<br> BOOL(p->bIntraInBFrames, "b-intra");<br> BOOL(p->bEnableSplitRdSkip, "splitrd-skip");<br>- s += snprintf(s, sizeof(s), " rdpenalty=%d", p->rdPenalty);<br>- s += snprintf(s, sizeof(s), " psy-rd=%.2f", p->psyRd);<br>- s += snprintf(s, sizeof(s), " psy-rdoq=%.2f", p->psyRdoq);<br>+ s += snprintf(s, bufSize - (s - buf), " rdpenalty=%d", p->rdPenalty);<br>+ s += snprintf(s, bufSize - (s - buf), " psy-rd=%.2f", p->psyRd);<br>+ s += snprintf(s, bufSize - (s - buf), " psy-rdoq=%.2f", p->psyRdoq);<br> BOOL(p->bEnableRdRefine, "rd-refine");<br> BOOL(p->bLossless, "lossless");<br>- s += snprintf(s, sizeof(s), " cbqpoffs=%d", p->cbQpOffset);<br>- s += snprintf(s, sizeof(s), " crqpoffs=%d", p->crQpOffset);<br>- s += snprintf(s, sizeof(s), " rc=%s", p->rc.rateControlMode == X265_RC_ABR ? (<br>+ s += snprintf(s, bufSize - (s - buf), " cbqpoffs=%d", p->cbQpOffset);<br>+ s += snprintf(s, bufSize - (s - buf), " crqpoffs=%d", p->crQpOffset);<br>+ s += snprintf(s, bufSize - (s - buf), " rc=%s", p->rc.rateControlMode == X265_RC_ABR ? (<br> p->rc.bitrate == p->rc.vbvMaxBitrate ? "cbr" : "abr")<br> : p->rc.rateControlMode == X265_RC_CRF ? "crf" : "cqp");<br> if (p->rc.rateControlMode == X265_RC_ABR || p->rc.rateControlMode == X265_RC_CRF)<br> {<br> if (p->rc.rateControlMode == X265_RC_CRF)<br>- s += snprintf(s, sizeof(s), " crf=%.1f", p->rc.rfConstant);<br>+ s += snprintf(s, bufSize - (s - buf), " crf=%.1f", p->rc.rfConstant);<br> else<br>- s += snprintf(s, sizeof(s), " bitrate=%d", p->rc.bitrate);<br>- s += snprintf(s, sizeof(s), " qcomp=%.2f qpstep=%d", p->rc.qCompress, p->rc.qpStep);<br>- s += snprintf(s, sizeof(s), " stats-write=%d", p->rc.bStatWrite);<br>- s += snprintf(s, sizeof(s), " stats-read=%d", p->rc.bStatRead);<br>+ s += snprintf(s, bufSize - (s - buf), " bitrate=%d", p->rc.bitrate);<br>+ s += snprintf(s, bufSize - (s - buf), " qcomp=%.2f qpstep=%d", p->rc.qCompress, p->rc.qpStep);<br>+ s += snprintf(s, bufSize - (s - buf), " stats-write=%d", p->rc.bStatWrite);<br>+ s += snprintf(s, bufSize - (s - buf), " stats-read=%d", p->rc.bStatRead);<br> if (p->rc.bStatRead)<br>- s += snprintf(s, sizeof(s), " cplxblur=%.1f qblur=%.1f",<br>+ s += snprintf(s, bufSize - (s - buf), " cplxblur=%.1f qblur=%.1f",<br> p->rc.complexityBlur, p->rc.qblur);<br> if (p->rc.bStatWrite && !p->rc.bStatRead)<br> BOOL(p->rc.bEnableSlowFirstPass, "slow-firstpass");<br> if (p->rc.vbvBufferSize)<br> {<br>- s += snprintf(s, sizeof(s), " vbv-maxrate=%d vbv-bufsize=%d vbv-init=%.1f min-vbv-fullness=%.1f max-vbv-fullness=%.1f",<br>+ s += snprintf(s, bufSize - (s - buf), " vbv-maxrate=%d vbv-bufsize=%d vbv-init=%.1f min-vbv-fullness=%.1f max-vbv-fullness=%.1f",<br> p->rc.vbvMaxBitrate, p->rc.vbvBufferSize, p->rc.vbvBufferInit, p->minVbvFullness, p->maxVbvFullness);<br> if (p->vbvBufferEnd)<br>- s += snprintf(s, sizeof(s), " vbv-end=%.1f vbv-end-fr-adj=%.1f", p->vbvBufferEnd, p->vbvEndFrameAdjust);<br>+ s += snprintf(s, bufSize - (s - buf), " vbv-end=%.1f vbv-end-fr-adj=%.1f", p->vbvBufferEnd, p->vbvEndFrameAdjust);<br> if (p->rc.rateControlMode == X265_RC_CRF)<br>- s += snprintf(s, sizeof(s), " crf-max=%.1f crf-min=%.1f", p->rc.rfConstantMax, p->rc.rfConstantMin);<br>+ s += snprintf(s, bufSize - (s - buf), " crf-max=%.1f crf-min=%.1f", p->rc.rfConstantMax, p->rc.rfConstantMin);<br> }<br> }<br> else if (p->rc.rateControlMode == X265_RC_CQP)<br>- s += snprintf(s, sizeof(s), " qp=%d", p->rc.qp);<br>+ s += snprintf(s, bufSize - (s - buf), " qp=%d", p->rc.qp);<br> if (!(p->rc.rateControlMode == X265_RC_CQP && p->rc.qp == 0))<br> {<br>- s += snprintf(s, sizeof(s), " ipratio=%.2f", p->rc.ipFactor);<br>+ s += snprintf(s, bufSize - (s - buf), " ipratio=%.2f", p->rc.ipFactor);<br> if (p->bframes)<br>- s += snprintf(s, sizeof(s), " pbratio=%.2f", p->rc.pbFactor);<br>+ s += snprintf(s, bufSize - (s - buf), " pbratio=%.2f", p->rc.pbFactor);<br> }<br>- s += snprintf(s, sizeof(s), " aq-mode=%d", p->rc.aqMode);<br>- += snprintf(s, sizeof(s), " aq-strength=%.2f", p->rc.aqStrength);<br>+ s += snprintf(s, bufSize - (s - buf), " aq-mode=%d", p->rc.aqMode);<br>+ s += snprintf(s, bufSize - (s - buf), " aq-strength=%.2f", p->rc.aqStrength);<br> BOOL(p->rc.cuTree, "cutree");<br>- s += snprintf(s, sizeof(s), " zone-count=%d", p->rc.zoneCount);<br>+ s += snprintf(s, bufSize - (s - buf), " zone-count=%d", p->rc.zoneCount);<br> if (p->rc.zoneCount)<br> {<br> for (int i = 0; i < p->rc.zoneCount; ++i)<br> {<br>- s += snprintf(s, sizeof(s), " zones: start-frame=%d end-frame=%d",<br>+ s += snprintf(s, bufSize - (s - buf), " zones: start-frame=%d end-frame=%d",<br> p->rc.zones[i].startFrame, p->rc.zones[i].endFrame);<br> if (p->rc.zones[i].bForceQp)<br>- s += snprintf(s, sizeof(s), " qp=%d", p->rc.zones[i].qp);<br>+ s += snprintf(s, bufSize - (s - buf), " qp=%d", p->rc.zones[i].qp);<br> else<br>- s += snprintf(s, sizeof(s), " bitrate-factor=%f", p->rc.zones[i].bitrateFactor);<br>+ s += snprintf(s, bufSize - (s - buf), " bitrate-factor=%f", p->rc.zones[i].bitrateFactor);<br> }<br> }<br> BOOL(p->rc.bStrictCbr, "strict-cbr");<br>- s += snprintf(s, sizeof(s), " qg-size=%d", p->rc.qgSize);<br>+ s += snprintf(s, bufSize - (s - buf), " qg-size=%d", p->rc.qgSize);<br> BOOL(p->rc.bEnableGrain, "rc-grain");<br>- s += snprintf(s, sizeof(s), " qpmax=%d qpmin=%d", p->rc.qpMax, p->rc.qpMin);<br>+ s += snprintf(s, bufSize - (s - buf), " qpmax=%d qpmin=%d", p->rc.qpMax, p->rc.qpMin);<br> BOOL(p->rc.bEnableConstVbv, "const-vbv");<br>- s += snprintf(s, sizeof(s), " sar=%d", p->vui.aspectRatioIdc);<br>+ s += snprintf(s, bufSize - (s - buf), " sar=%d", p->vui.aspectRatioIdc);<br> if (p->vui.aspectRatioIdc == X265_EXTENDED_SAR)<br>- s += snprintf(s, sizeof(s), " sar-width : sar-height=%d:%d", p->vui.sarWidth, p->vui.sarHeight);<br>- s += snprintf(s, sizeof(s), " overscan=%d", p->vui.bEnableOverscanInfoPresentFlag);<br>+ s += snprintf(s, bufSize - (s - buf), " sar-width : sar-height=%d:%d", p->vui.sarWidth, p->vui.sarHeight);<br>+ s += snprintf(s, bufSize - (s - buf), " overscan=%d", p->vui.bEnableOverscanInfoPresentFlag);<br> if (p->vui.bEnableOverscanInfoPresentFlag)<br>- s += snprintf(s, sizeof(s), " overscan-crop=%d", p->vui.bEnableOverscanAppropriateFlag);<br>- s += snprintf(s, sizeof(s), " videoformat=%d", p->vui.videoFormat);<br>- s += snprintf(s, sizeof(s), " range=%d", p->vui.bEnableVideoFullRangeFlag);<br>- s += snprintf(s, sizeof(s), " colorprim=%d", p->vui.colorPrimaries);<br>- s += snprintf(s, sizeof(s), " transfer=%d", p->vui.transferCharacteristics);<br>- s += snprintf(s, sizeof(s), " colormatrix=%d", p->vui.matrixCoeffs);<br>- s += snprintf(s, sizeof(s), " chromaloc=%d", p->vui.bEnableChromaLocInfoPresentFlag);<br>+ s += snprintf(s, bufSize - (s - buf), " overscan-crop=%d", p->vui.bEnableOverscanAppropriateFlag);<br>+ s += snprintf(s, bufSize - (s - buf), " videoformat=%d", p->vui.videoFormat);<br>+ s += snprintf(s, bufSize - (s - buf), " range=%d", p->vui.bEnableVideoFullRangeFlag);<br>+ s += snprintf(s, bufSize - (s - buf), " colorprim=%d", p->vui.colorPrimaries);<br>+ s += snprintf(s, bufSize - (s - buf), " transfer=%d", p->vui.transferCharacteristics);<br>+ s += snprintf(s, bufSize - (s - buf), " colormatrix=%d", p->vui.matrixCoeffs);<br>+ s += snprintf(s, bufSize - (s - buf), " chromaloc=%d", p->vui.bEnableChromaLocInfoPresentFlag);<br> if (p->vui.bEnableChromaLocInfoPresentFlag)<br>- s += snprintf(s, sizeof(s), " chromaloc-top=%d chromaloc-bottom=%d",<br>+ s += snprintf(s, bufSize - (s - buf), " chromaloc-top=%d chromaloc-bottom=%d",<br> p->vui.chromaSampleLocTypeTopField, p->vui.chromaSampleLocTypeBottomField);<br>- s += snprintf(s, sizeof(s), " display-window=%d", p->vui.bEnableDefaultDisplayWindowFlag);<br>+ s += snprintf(s, bufSize - (s - buf), " display-window=%d", p->vui.bEnableDefaultDisplayWindowFlag);<br> if (p->vui.bEnableDefaultDisplayWindowFlag)<br>- s += snprintf(s, sizeof(s), " left=%d top=%d right=%d bottom=%d",<br>+ s += snprintf(s, bufSize - (s - buf), " left=%d top=%d right=%d bottom=%d",<br> p->vui.defDispWinLeftOffset, p->vui.defDispWinTopOffset,<br> p->vui.defDispWinRightOffset, p->vui.defDispWinBottomOffset);<br> if (p->masteringDisplayColorVolume)<br>- s += snprintf(s, sizeof(s), " master-display=%s", p->masteringDisplayColorVolume);<br>+ s += snprintf(s, bufSize - (s - buf), " master-display=%s", p->masteringDisplayColorVolume);<br> if (p->bEmitCLL)<br>- s += snprintf(s, sizeof(s), " cll=%hu,%hu", p->maxCLL, p->maxFALL);<br>- s += snprintf(s, sizeof(s), " min-luma=%hu", p->minLuma);<br>- s += snprintf(s, sizeof(s), " max-luma=%hu", p->maxLuma);<br>- s += snprintf(s, sizeof(s), " log2-max-poc-lsb=%d", p->log2MaxPocLsb);<br>+ s += snprintf(s, bufSize - (s - buf), " cll=%hu,%hu", p->maxCLL, p->maxFALL);<br>+ s += snprintf(s, bufSize - (s - buf), " min-luma=%hu", p->minLuma);<br>+ s += snprintf(s, bufSize - (s - buf), " max-luma=%hu", p->maxLuma);<br>+ s += snprintf(s, bufSize - (s - buf), " log2-max-poc-lsb=%d", p->log2MaxPocLsb);<br> BOOL(p->bEmitVUITimingInfo, "vui-timing-info");<br> BOOL(p->bEmitVUIHRDInfo, "vui-hrd-info");<br>- s += snprintf(s, sizeof(s), " slices=%d", p->maxSlices);<br>+ s += snprintf(s, bufSize - (s - buf), " slices=%d", p->maxSlices);<br> BOOL(p->bOptQpPPS, "opt-qp-pps");<br> BOOL(p->bOptRefListLengthPPS, "opt-ref-list-length-pps");<br> BOOL(p->bMultiPassOptRPS, "multi-pass-opt-rps");<br>- s += snprintf(s, sizeof(s), " scenecut-bias=%.2f", p->scenecutBias);<br>+ s += snprintf(s, bufSize - (s - buf), " scenecut-bias=%.2f", p->scenecutBias);<br> BOOL(p->bOptCUDeltaQP, "opt-cu-delta-qp");<br> BOOL(p->bAQMotion, "aq-motion");<br> BOOL(p->bEmitHDR10SEI, "hdr10");<br>@@ -2421,49 +2421,49 @@ char *x265_param2string(x265_param* p, int padx, int pady)<br> BOOL(p->bDhdr10opt, "dhdr10-opt");<br> BOOL(p->bEmitIDRRecoverySEI, "idr-recovery-sei");<br> if (p->analysisSave)<br>- s += snprintf(s, sizeof(s), " analysis-save");<br>+ s += snprintf(s, bufSize - (s - buf), " analysis-save");<br> if (p->analysisLoad)<br>- s += snprintf(s, sizeof(s), " analysis-load");<br>- s += snprintf(s, sizeof(s), " analysis-reuse-level=%d", p->analysisReuseLevel);<br>- s += snprintf(s, sizeof(s), " analysis-save-reuse-level=%d", p->analysisSaveReuseLevel);<br>- s += snprintf(s, sizeof(s), " analysis-load-reuse-level=%d", p->analysisLoadReuseLevel);<br>- s += snprintf(s, sizeof(s), " scale-factor=%d", p->scaleFactor);<br>- s += snprintf(s, sizeof(s), " refine-intra=%d", p->intraRefine);<br>- s += snprintf(s, sizeof(s), " refine-inter=%d", p->interRefine);<br>- s += snprintf(s, sizeof(s), " refine-mv=%d", p->mvRefine);<br>- s += snprintf(s, sizeof(s), " refine-ctu-distortion=%d", p->ctuDistortionRefine);<br>+ s += snprintf(s, bufSize - (s - buf), " analysis-load");<br>+ s += snprintf(s, bufSize - (s - buf), " analysis-reuse-level=%d", p->analysisReuseLevel);<br>+ s += snprintf(s, bufSize - (s - buf), " analysis-save-reuse-level=%d", p->analysisSaveReuseLevel);<br>+ s += snprintf(s, bufSize - (s - buf), " analysis-load-reuse-level=%d", p->analysisLoadReuseLevel);<br>+ s += snprintf(s, bufSize - (s - buf), " scale-factor=%d", p->scaleFactor);<br>+ s += snprintf(s, bufSize - (s - buf), " refine-intra=%d", p->intraRefine);<br>+ s += snprintf(s, bufSize - (s - buf), " refine-inter=%d", p->interRefine);<br>+ s += snprintf(s, bufSize - (s - buf), " refine-mv=%d", p->mvRefine);<br>+ s += snprintf(s, bufSize - (s - buf), " refine-ctu-distortion=%d", p->ctuDistortionRefine);<br> BOOL(p->bLimitSAO, "limit-sao");<br>- s += snprintf(s, sizeof(s), " ctu-info=%d", p->bCTUInfo);<br>+ s += snprintf(s, bufSize - (s - buf), " ctu-info=%d", p->bCTUInfo);<br> BOOL(p->bLowPassDct, "lowpass-dct");<br>- s += snprintf(s, sizeof(s), " refine-analysis-type=%d", p->bAnalysisType);<br>- s += snprintf(s, sizeof(s), " copy-pic=%d", p->bCopyPicToFrame);<br>- s += snprintf(s, sizeof(s), " max-ausize-factor=%.1f", p->maxAUSizeFactor);<br>+ s += snprintf(s, bufSize - (s - buf), " refine-analysis-type=%d", p->bAnalysisType);<br>+ s += snprintf(s, bufSize - (s - buf), " copy-pic=%d", p->bCopyPicToFrame);<br>+ s += snprintf(s, bufSize - (s - buf), " max-ausize-factor=%.1f", p->maxAUSizeFactor);<br> BOOL(p->bDynamicRefine, "dynamic-refine");<br> BOOL(p->bSingleSeiNal, "single-sei");<br> BOOL(p->rc.hevcAq, "hevc-aq");<br> BOOL(p->bEnableSvtHevc, "svt");<br> BOOL(p->bField, "field");<br>- s += snprintf(s, sizeof(s), " qp-adaptation-range=%.2f", p->rc.qpAdaptationRange);<br>- s += snprintf(s, sizeof(s), " scenecut-aware-qp=%d", p->bEnableSceneCutAwareQp);<br>+ s += snprintf(s, bufSize - (s - buf), " qp-adaptation-range=%.2f", p->rc.qpAdaptationRange);<br>+ s += snprintf(s, bufSize - (s - buf), " scenecut-aware-qp=%d", p->bEnableSceneCutAwareQp);<br> if (p->bEnableSceneCutAwareQp)<br>- s += snprintf(s, sizeof(s), " fwd-scenecut-window=%d fwd-ref-qp-delta=%f fwd-nonref-qp-delta=%f bwd-scenecut-window=%d bwd-ref-qp-delta=%f bwd-nonref-qp-delta=%f", p->fwdMaxScenecutWindow, p->fwdRefQpDelta[0], p->fwdNonRefQpDelta[0], p->bwdMaxScenecutWindow, p->bwdRefQpDelta[0], p->bwdNonRefQpDelta[0]);<br>- s += snprintf(s, sizeof(s), "conformance-window-offsets right=%d bottom=%d", p->confWinRightOffset, p->confWinBottomOffset);<br>- s += snprintf(s, sizeof(s), " decoder-max-rate=%d", p->decoderVbvMaxRate);<br>+ s += snprintf(s, bufSize - (s - buf), " fwd-scenecut-window=%d fwd-ref-qp-delta=%f fwd-nonref-qp-delta=%f bwd-scenecut-window=%d bwd-ref-qp-delta=%f bwd-nonref-qp-delta=%f", p->fwdMaxScenecutWindow, p->fwdRefQpDelta[0], p->fwdNonRefQpDelta[0], p->bwdMaxScenecutWindow, p->bwdRefQpDelta[0], p->bwdNonRefQpDelta[0]);<br>+ s += snprintf(s, bufSize - (s - buf), "conformance-window-offsets right=%d bottom=%d", p->confWinRightOffset, p->confWinBottomOffset);<br>+ s += snprintf(s, bufSize - (s - buf), " decoder-max-rate=%d", p->decoderVbvMaxRate);<br> BOOL(p->bliveVBV2pass, "vbv-live-multi-pass");<br> if (p->filmGrain)<br>- s += snprintf(s, sizeof(s), " film-grain=%s", p->filmGrain); // Film grain characteristics model filename<br>+ s += snprintf(s, bufSize - (s - buf), " film-grain=%s", p->filmGrain); // Film grain characteristics model filename<br> if (p->aomFilmGrain)<br>- s += sprintf(s, " aom-film-grain=%s", p->aomFilmGrain);<br>+ s += snprintf(s, bufSize - (s - buf), " aom-film-grain=%s", p->aomFilmGrain);<br> BOOL(p->bEnableTemporalFilter, "mcstf");<br> #if ENABLE_ALPHA<br> BOOL(p->bEnableAlpha, "alpha");<br> #endif<br> #if ENABLE_MULTIVIEW<br>- s += sprintf(s, " num-views=%d", p->numViews);<br>- s += sprintf(s, " format=%d", p->format);<br>+ s += snprintf(s, bufSize - (s - buf), " num-views=%d", p->numViews);<br>+ s += snprintf(s, bufSize - (s - buf), " format=%d", p->format);<br> #endif<br> #if ENABLE_SCC_EXT<br>- s += sprintf(s, "scc=%d", p->bEnableSCC);<br>+ s += snprintf(s, bufSize - (s - buf), "scc=%d", p->bEnableSCC);<br> #endif<br> BOOL(p->bEnableSBRC, "sbrc");<br> #undef BOOL<br>diff --git a/source/common/primitives.cpp b/source/common/primitives.cpp<br>index 20f095a63..4db706d74 100644<br>--- a/source/common/primitives.cpp<br>+++ b/source/common/primitives.cpp<br>@@ -236,11 +236,11 @@ void x265_report_simd(x265_param* param)<br> continue;<br> if ((cpuid & X265_NS::cpu_names[i].flags) == X265_NS::cpu_names[i].flags<br> && (!i || X265_NS::cpu_names[i].flags != X265_NS::cpu_names[i - 1].flags))<br>- p += snprintf(p, sizeof(p), " %s", X265_NS::cpu_names[i].name);<br>+ p += snprintf(p, sizeof(buf) - (p - buf), " %s", X265_NS::cpu_names[i].name);<br> }<br> <br> if (p == none)<br>- snprintf(p, sizeof(p), " none!");<br>+ snprintf(p, sizeof(buf) - (p - buf), " none!");<br> x265_log(param, X265_LOG_INFO, "%s\n", buf);<br> }<br> }<br>diff --git a/source/common/x86/loopfilter.asm b/source/common/x86/loopfilter.asm<br>index 485c52b70..dab6169d6 100644<br>--- a/source/common/x86/loopfilter.asm<br>+++ b/source/common/x86/loopfilter.asm<br>@@ -3867,7 +3867,7 @@ cglobal pelFilterLumaStrong_H, 5,7,10<br> movh [r0 + r6], m0<br> movhps [r0 + r1], m0<br> movh [r0], m3<br>- movhps [r0 + r2 * 2], m3,<br>+ movhps [r0 + r2 * 2], m3<br> movh [r0 + r2 * 1], m9<br> movhps [r0 + r1 * 2], m9<br> %else<br>diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp<br>index c99c796af..fc989a1d7 100644<br>--- a/source/encoder/analysis.cpp<br>+++ b/source/encoder/analysis.cpp<br>@@ -157,36 +157,39 @@ Mode& Analysis::compressCTU(CUData& ctu, Frame& frame, const CUGeom& cuGeom, con<br> calculateNormFactor(ctu, qp);<br> <br> uint32_t numPartition = ctu.m_numPartitions;<br>- if (m_param->bCTUInfo && (*m_frame->m_ctuInfo + ctu.m_cuAddr))<br>+ if (m_param->bCTUInfo && m_frame->m_ctuInfo)<br> {<br>- x265_ctu_info_t* ctuTemp = *m_frame->m_ctuInfo + ctu.m_cuAddr;<br>- int32_t depthIdx = 0;<br>- uint32_t maxNum8x8Partitions = 64;<br>- uint8_t* depthInfoPtr = m_frame->m_addOnDepth[ctu.m_cuAddr];<br>- uint8_t* contentInfoPtr = m_frame->m_addOnCtuInfo[ctu.m_cuAddr];<br>- int* prevCtuInfoChangePtr = m_frame->m_addOnPrevChange[ctu.m_cuAddr];<br>- do<br>+ if (*(m_frame->m_ctuInfo + ctu.m_cuAddr))<br> {<br>- uint8_t depth = (uint8_t)ctuTemp->ctuPartitions[depthIdx];<br>- uint8_t content = (uint8_t)(*((int32_t *)ctuTemp->ctuInfo + depthIdx));<br>- int prevCtuInfoChange = m_frame->m_prevCtuInfoChange[ctu.m_cuAddr * maxNum8x8Partitions + depthIdx];<br>- memset(depthInfoPtr, depth, sizeof(uint8_t) * numPartition >> 2 * depth);<br>- memset(contentInfoPtr, content, sizeof(uint8_t) * numPartition >> 2 * depth);<br>- memset(prevCtuInfoChangePtr, 0, sizeof(int) * numPartition >> 2 * depth);<br>- for (uint32_t l = 0; l < numPartition >> 2 * depth; l++)<br>- prevCtuInfoChangePtr[l] = prevCtuInfoChange;<br>- depthInfoPtr += ctu.m_numPartitions >> 2 * depth;<br>- contentInfoPtr += ctu.m_numPartitions >> 2 * depth;<br>- prevCtuInfoChangePtr += ctu.m_numPartitions >> 2 * depth;<br>- depthIdx++;<br>- } while (ctuTemp->ctuPartitions[depthIdx] != 0);<br>-<br>- m_additionalCtuInfo = m_frame->m_addOnCtuInfo[ctu.m_cuAddr];<br>- m_prevCtuInfoChange = m_frame->m_addOnPrevChange[ctu.m_cuAddr];<br>- memcpy(ctu.m_cuDepth, m_frame->m_addOnDepth[ctu.m_cuAddr], sizeof(uint8_t) * numPartition);<br>- //Calculate log2CUSize from depth<br>- for (uint32_t i = 0; i < cuGeom.numPartitions; i++)<br>- ctu.m_log2CUSize[i] = (uint8_t)m_param->maxLog2CUSize - ctu.m_cuDepth[i];<br>+ x265_ctu_info_t* ctuTemp = *m_frame->m_ctuInfo + ctu.m_cuAddr;<br>+ int32_t depthIdx = 0;<br>+ uint32_t maxNum8x8Partitions = 64;<br>+ uint8_t* depthInfoPtr = m_frame->m_addOnDepth[ctu.m_cuAddr];<br>+ uint8_t* contentInfoPtr = m_frame->m_addOnCtuInfo[ctu.m_cuAddr];<br>+ int* prevCtuInfoChangePtr = m_frame->m_addOnPrevChange[ctu.m_cuAddr];<br>+ do<br>+ {<br>+ uint8_t depth = (uint8_t)ctuTemp->ctuPartitions[depthIdx];<br>+ uint8_t content = (uint8_t)(*((int32_t *)ctuTemp->ctuInfo + depthIdx));<br>+ int prevCtuInfoChange = m_frame->m_prevCtuInfoChange[ctu.m_cuAddr * maxNum8x8Partitions + depthIdx];<br>+ memset(depthInfoPtr, depth, sizeof(uint8_t) * numPartition >> 2 * depth);<br>+ memset(contentInfoPtr, content, sizeof(uint8_t) * numPartition >> 2 * depth);<br>+ memset(prevCtuInfoChangePtr, 0, sizeof(int) * numPartition >> 2 * depth);<br>+ for (uint32_t l = 0; l < numPartition >> 2 * depth; l++)<br>+ prevCtuInfoChangePtr[l] = prevCtuInfoChange;<br>+ depthInfoPtr += ctu.m_numPartitions >> 2 * depth;<br>+ contentInfoPtr += ctu.m_numPartitions >> 2 * depth;<br>+ prevCtuInfoChangePtr += ctu.m_numPartitions >> 2 * depth;<br>+ depthIdx++;<br>+ } while (ctuTemp->ctuPartitions[depthIdx] != 0);<br>+<br>+ m_additionalCtuInfo = m_frame->m_addOnCtuInfo[ctu.m_cuAddr];<br>+ m_prevCtuInfoChange = m_frame->m_addOnPrevChange[ctu.m_cuAddr];<br>+ memcpy(ctu.m_cuDepth, m_frame->m_addOnDepth[ctu.m_cuAddr], sizeof(uint8_t) * numPartition);<br>+ //Calculate log2CUSize from depth<br>+ for (uint32_t i = 0; i < cuGeom.numPartitions; i++)<br>+ ctu.m_log2CUSize[i] = (uint8_t)m_param->maxLog2CUSize - ctu.m_cuDepth[i];<br>+ }<br> }<br> if (m_param->analysisMultiPassRefine && m_param->rc.bStatRead && (m_slice->m_sliceType != I_SLICE))<br> {<br>diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp<br>index 06dcbf2e1..9d8650008 100644<br>--- a/source/encoder/api.cpp<br>+++ b/source/encoder/api.cpp<br>@@ -1902,9 +1902,9 @@ int compute_vmaf(double* vmaf_score, char* fmt, int width, int height, int bitde<br> <br> VmafConfiguration cfg = {<br> .log_level = VMAF_LOG_LEVEL_INFO,<br>- .n_threads = n_thread,<br>- .n_subsample = n_subsample,<br>- .cpumask = disable_avx ? -1 : 0,<br>+ .n_threads = static_cast<unsigned int>(n_thread),<br>+ .n_subsample = static_cast<unsigned int>(n_subsample),<br>+ .cpumask = static_cast<uint64_t>(disable_avx),<br> .gpumask = 0,<br> };<br> <br>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>index 60799846d..5e715b713 100644<br>--- a/source/encoder/encoder.cpp<br>+++ b/source/encoder/encoder.cpp<br>@@ -3449,11 +3449,12 @@ void Encoder::getStreamHeaders(NALList& list, Entropy& sbacCoder, Bitstream& bs)<br> char *opts = x265_param2string(m_param, m_sps.conformanceWindow.rightOffset, m_sps.conformanceWindow.bottomOffset);<br> if (opts)<br> {<br>- int len = strlen(opts) + strlen(PFX(version_str)) + strlen(PFX(build_info_str)) + 200;<br>- char *buffer = X265_MALLOC(char, len);<br>+ char *buffer = X265_MALLOC(char, strlen(opts) + strlen(PFX(version_str)) +<br>+ strlen(PFX(build_info_str)) + 200);<br> if (buffer)<br> {<br>- snprintf(buffer, len, "x265 (build %d) - %s:%s - H.265/HEVC codec - "<br>+ snprintf(buffer, strlen(opts) + strlen(PFX(version_str)) + strlen(PFX(build_info_str)) + 200,<br>+ "x265 (build %d) - %s:%s - H.265/HEVC codec - "<br> "Copyright 2013-2018 (c) Multicoreware, Inc - "<br> "<a href="http://x265.org" target="_blank">http://x265.org</a> - options: %s",<br> X265_BUILD, PFX(version_str), PFX(build_info_str), opts);<br>diff --git a/source/encoder/ratecontrol.cpp b/source/encoder/ratecontrol.cpp<br>index 50adefc19..e46896987 100644<br>--- a/source/encoder/ratecontrol.cpp<br>+++ b/source/encoder/ratecontrol.cpp<br>@@ -3250,8 +3250,8 @@ int RateControl::writeRateControlFrameStats(Frame* curFrame, RateControlEntry* r<br> <br> for (i = 0; i < num; i++)<br> {<br>- snprintf(deltaPOC, sizeof(deltaPOC), "%s%d~", deltaPOC, rpsWriter->deltaPOC[i]);<br>- snprintf(bUsed, sizeof(bUsed), "%s%d~", bUsed, rpsWriter->bUsed[i]);<br>+ snprintf(deltaPOC + strlen(deltaPOC), sizeof(deltaPOC) - strlen(deltaPOC), "%d~", rpsWriter->deltaPOC[i]);<br>+ snprintf(bUsed + strlen(bUsed), sizeof(bUsed) - strlen(bUsed), "%d~", rpsWriter->bUsed[i]);<br> }<br> <br> if (fprintf(m_statFileOut,<br>diff --git a/source/x265.cpp b/source/x265.cpp<br>index 31a627d87..c9d2513e2 100644<br>--- a/source/x265.cpp<br>+++ b/source/x265.cpp<br>@@ -156,7 +156,10 @@ static bool parseAbrConfig(FILE* abrConfig, CLIOptions cliopt[], uint8_t numEnco<br> <br> for (uint32_t i = 0; i < numEncodes; i++)<br> {<br>- fgets(line, sizeof(line), abrConfig);<br>+ if (fgets(line, sizeof(line), abrConfig) == NULL) {<br>+ fprintf(stderr, "Error reading line from configuration file.\n");<br>+ return false;<br>+ }<br> if (*line == '#' || (strcmp(line, "\r\n") == 0))<br> continue;<br> int index = (int)strcspn(line, "\r\n");<br>diff --git a/source/x265cli.cpp b/source/x265cli.cpp<br>index 790df9a88..53a47e340 100755<br>--- a/source/x265cli.cpp<br>+++ b/source/x265cli.cpp<br>@@ -1014,7 +1014,7 @@ namespace X265_NS {<br> for (int view = 0; view < param->numLayers; view++)<br> {<br> char* buf = new char[strlen(temp) + 7];<br>- sprintf(buf, "%s-%d.yuv", token, view);<br>+ snprintf(buf, strlen(temp) + 7, "%s-%d.yuv", token, view);<br> reconfn[view] = buf;<br> }<br> }<br>@@ -1037,7 +1037,7 @@ namespace X265_NS {<br> }<br> }<br> #if ENABLE_LIBVMAF<br>- if (!reconfn)<br>+ if (!reconfn[0])<br> {<br> x265_log(param, X265_LOG_ERROR, "recon file must be specified to get VMAF score, try --help for help\n");<br> return true;<br>-- <br>2.43.0<br><br></div>
</blockquote></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div>