[x265] [PATCH 1/1] Fix Build Warnings issue in x265

Mahesh Pittala mahesh at multicorewareinc.com
Wed Oct 30 14:14:48 UTC 2024


pushed to release_4.1 branch

On Wed, Oct 30, 2024 at 6:14 PM Uthayakumar Muthu <
uthayakumar.muthu at multicorewareinc.com> wrote:

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


More information about the x265-devel mailing list