<div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 27, 2024 at 6:02 PM Anusuya Kumarasamy <<a href="mailto:anusuya.kumarasamy@multicorewareinc.com">anusuya.kumarasamy@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"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 27, 2024 at 3:33 PM Anusuya Kumarasamy <<a href="mailto:anusuya.kumarasamy@multicorewareinc.com" target="_blank">anusuya.kumarasamy@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 81a2d7c2f02003f0fd1710f948c74291bb150f4c Mon Sep 17 00:00:00 2001<br>From: AnusuyaKumarasamy <<a href="mailto:anusuya.kumarasamy@multicorewareinc.com" target="_blank">anusuya.kumarasamy@multicorewareinc.com</a>><br>Date: Mon, 23 Sep 2024 12:53:46 +0530<br>Subject: [PATCH 3/5] Reverted the api changes<br><br>---<br> source/abrEncApp.cpp            |  13 ++--<br> source/encoder/api.cpp          |   4 +-<br> source/encoder/encoder.cpp      | 126 ++++++++++++++++----------------<br> source/encoder/encoder.h        |   2 +-<br> source/encoder/frameencoder.cpp |   2 +-<br> source/x265.h                   |   4 +-<br> 6 files changed, 75 insertions(+), 76 deletions(-)<br><br>diff --git a/source/abrEncApp.cpp b/source/abrEncApp.cpp<br>index 3462aa5c6..c5dcf3559 100644<br>--- a/source/abrEncApp.cpp<br>+++ b/source/abrEncApp.cpp<br>@@ -596,11 +596,10 @@ ret:<br>                 pic_in[view] = &pic_orig[view];<br>             /* Allocate recon picture if analysis save/load is enabled */<br>             std::priority_queue<int64_t>* pts_queue = m_cliopt.output->needPTS() ? new std::priority_queue<int64_t>() : NULL;<br>-            x265_picture* pic_recon[MAX_LAYERS];<br>+            x265_picture* pic_recon;<br>             x265_picture pic_out[MAX_LAYERS];<br> <br>-            for (int i = 0; i < m_param->numLayers; i++)<br>-                pic_recon[i] = (m_cliopt.recon[i] || m_param->analysisSave || m_param->analysisLoad || pts_queue || reconPlay || m_param->csvLogLevel) ? &pic_out[i] : NULL;<br>+            pic_recon = (m_cliopt.recon || m_param->analysisSave || m_param->analysisLoad || pts_queue || reconPlay || m_param->csvLogLevel) ? pic_out : NULL;<br>             uint32_t inFrameCount = 0;<br>             uint32_t outFrameCount = 0;<br>             x265_nal *p_nal;<br>@@ -809,7 +808,7 @@ ret:<br>                     }<br> <br>                     if (reconPlay && numEncoded)<br>-                        reconPlay->writePicture(*pic_recon[0]);<br>+                        reconPlay->writePicture(*pic_recon);<br> <br>                     outFrameCount += numEncoded;<br> <br>@@ -820,7 +819,7 @@ ret:<br> <br>                     for (int layer = 0; layer < m_param->numLayers; layer++)<br>                     {<br>-                        if (numEncoded && pic_recon[layer] && m_cliopt.recon[layer])<br>+                        if (numEncoded && pic_recon && m_cliopt.recon[layer])<br>                             m_cliopt.recon[layer]->writePicture(pic_out[layer]);<br>                     }<br>                     if (nal)<br>@@ -848,7 +847,7 @@ ret:<br>                 }<br> <br>                 if (reconPlay && numEncoded)<br>-                    reconPlay->writePicture(*pic_recon[0]);<br>+                    reconPlay->writePicture(*pic_recon);<br> <br>                 outFrameCount += numEncoded;<br>                 if (isAbrSave && numEncoded)<br>@@ -858,7 +857,7 @@ ret:<br> <br>                 for (int layer = 0; layer < m_param->numLayers; layer++)<br>                 {<br>-                    if (numEncoded && pic_recon[layer] && m_cliopt.recon[layer])<br>+                    if (numEncoded && pic_recon && m_cliopt.recon[layer])<br>                         m_cliopt.recon[layer]->writePicture(pic_out[layer]);<br>                 }<br>                 if (nal)<br>diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp<br>index 2a96c2044..9d84fabea 100644<br>--- a/source/encoder/api.cpp<br>+++ b/source/encoder/api.cpp<br>@@ -405,7 +405,7 @@ int x265_encoder_reconfig_zone(x265_encoder* enc, x265_zone* zone_in)<br>     return 0;<br> }<br> <br>-int x265_encoder_encode(x265_encoder *enc, x265_nal **pp_nal, uint32_t *pi_nal, x265_picture *pic_in, x265_picture **pic_out)<br>+int x265_encoder_encode(x265_encoder *enc, x265_nal **pp_nal, uint32_t *pi_nal, x265_picture *pic_in, x265_picture *pic_out)<br> {<br>     if (!enc)<br>         return -1;<br>@@ -603,7 +603,7 @@ fail:<br>     if (numEncoded && encoder->m_param->csvLogLevel && encoder->m_outputCount >= encoder->m_latestParam->chunkStart)<br>     {<br>         for (int layer = 0; layer < encoder->m_param->numLayers; layer++)<br>-            x265_csvlog_frame(encoder->m_param, pic_out[layer]);<br>+            x265_csvlog_frame(encoder->m_param, pic_out + layer );<br>     }<br> <br>     if (numEncoded < 0)<br>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>index f4a998fa9..13b98e986 100644<br>--- a/source/encoder/encoder.cpp<br>+++ b/source/encoder/encoder.cpp<br>@@ -1471,7 +1471,7 @@ bool Encoder::generateMcstfRef(Frame* frameEnc, FrameEncoder* currEncoder)<br>  * returns 0 if no frames are currently available for output<br>  *         1 if frame was output, m_nalList contains access unit<br>  *         negative on malloc error or abort */<br>-int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)<br>+int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br> {<br> #if CHECKED_BUILD || _DEBUG<br>     if (g_checkFailures)<br>@@ -1974,95 +1974,95 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)<br>                 /* Free up inputPic->analysisData since it has already been used */<br>                 if ((m_param->analysisLoad && !m_param->analysisSave) || ((m_param->bAnalysisType == AVC_INFO) && slice->m_sliceType != I_SLICE))<br>                     x265_free_analysis_data(m_param, &outFrame->m_analysisData);<br>-                if (pic_out[sLayer])<br>+                if (pic_out && pic_out + sLayer)<br>                 {<br>                     PicYuv* recpic = outFrame->m_reconPic[0];<br>-                    pic_out[sLayer]->poc = slice->m_poc;<br>-                    pic_out[sLayer]->bitDepth = X265_DEPTH;<br>-                    pic_out[sLayer]->userData = outFrame->m_userData;<br>-                    pic_out[sLayer]->colorSpace = m_param->internalCsp;<br>-                    pic_out[sLayer]->frameData.tLayer = outFrame->m_tempLayer;<br>-                    pic_out[sLayer]->layerID = sLayer;<br>-                    frameData = &(pic_out[sLayer]->frameData);<br>-<br>-                    pic_out[sLayer]->pts = outFrame->m_pts;<br>-                    pic_out[sLayer]->dts = outFrame->m_dts;<br>-                    pic_out[sLayer]->reorderedPts = outFrame->m_reorderedPts;<br>-                    pic_out[sLayer]->sliceType = outFrame->m_lowres.sliceType;<br>-                    pic_out[sLayer]->planes[0] = recpic->m_picOrg[0];<br>-                    pic_out[sLayer]->stride[0] = (int)(recpic->m_stride * sizeof(pixel));<br>+                    (pic_out + sLayer)->poc = slice->m_poc;<br>+                    (pic_out + sLayer)->bitDepth = X265_DEPTH;<br>+                    (pic_out + sLayer)->userData = outFrame->m_userData;<br>+                    (pic_out + sLayer)->colorSpace = m_param->internalCsp;<br>+                    (pic_out + sLayer)->frameData.tLayer = outFrame->m_tempLayer;<br>+                    (pic_out + sLayer)->layerID = sLayer;<br>+                    frameData = &((pic_out + sLayer)->frameData);<br>+<br>+                    (pic_out + sLayer)->pts = outFrame->m_pts;<br>+                    (pic_out + sLayer)->dts = outFrame->m_dts;<br>+                    (pic_out + sLayer)->reorderedPts = outFrame->m_reorderedPts;<br>+                    (pic_out + sLayer)->sliceType = outFrame->m_lowres.sliceType;<br>+                    (pic_out + sLayer)->planes[0] = recpic->m_picOrg[0];<br>+                    (pic_out + sLayer)->stride[0] = (int)(recpic->m_stride * sizeof(pixel));<br>                     if (m_param->internalCsp != X265_CSP_I400)<br>                     {<br>-                        pic_out[sLayer]->planes[1] = recpic->m_picOrg[1];<br>-                        pic_out[sLayer]->stride[1] = (int)(recpic->m_strideC * sizeof(pixel));<br>-                        pic_out[sLayer]->planes[2] = recpic->m_picOrg[2];<br>-                        pic_out[sLayer]->stride[2] = (int)(recpic->m_strideC * sizeof(pixel));<br>+                        (pic_out + sLayer)->planes[1] = recpic->m_picOrg[1];<br>+                        (pic_out + sLayer)->stride[1] = (int)(recpic->m_strideC * sizeof(pixel));<br>+                        (pic_out + sLayer)->planes[2] = recpic->m_picOrg[2];<br>+                        (pic_out + sLayer)->stride[2] = (int)(recpic->m_strideC * sizeof(pixel));<br>                     }<br> <br>-                    /* Dump analysis data from pic_out[sLayer] to file in save mode and free */<br>+                    /* Dump analysis data from (pic_out + sLayer) to file in save mode and free */<br>                     if (m_param->analysisSave)<br>                     {<br>-                        pic_out[sLayer]->analysisData.poc = pic_out[sLayer]->poc;<br>-                        pic_out[sLayer]->analysisData.sliceType = pic_out[sLayer]->sliceType;<br>-                        pic_out[sLayer]->analysisData.bScenecut = outFrame->m_lowres.bScenecut;<br>-                        pic_out[sLayer]->analysisData.satdCost = outFrame->m_lowres.satdCost;<br>-                        pic_out[sLayer]->analysisData.numCUsInFrame = outFrame->m_analysisData.numCUsInFrame;<br>-                        pic_out[sLayer]->analysisData.numPartitions = outFrame->m_analysisData.numPartitions;<br>-                        pic_out[sLayer]->analysisData.wt = outFrame->m_analysisData.wt;<br>-                        pic_out[sLayer]->analysisData.interData = outFrame->m_analysisData.interData;<br>-                        pic_out[sLayer]->analysisData.intraData = outFrame->m_analysisData.intraData;<br>-                        pic_out[sLayer]->analysisData.distortionData = outFrame->m_analysisData.distortionData;<br>-                        pic_out[sLayer]->analysisData.modeFlag[0] = outFrame->m_analysisData.modeFlag[0];<br>-                        pic_out[sLayer]->analysisData.modeFlag[1] = outFrame->m_analysisData.modeFlag[1];<br>+                        (pic_out + sLayer)->analysisData.poc = (pic_out + sLayer)->poc;<br>+                        (pic_out + sLayer)->analysisData.sliceType = (pic_out + sLayer)->sliceType;<br>+                        (pic_out + sLayer)->analysisData.bScenecut = outFrame->m_lowres.bScenecut;<br>+                        (pic_out + sLayer)->analysisData.satdCost = outFrame->m_lowres.satdCost;<br>+                        (pic_out + sLayer)->analysisData.numCUsInFrame = outFrame->m_analysisData.numCUsInFrame;<br>+                        (pic_out + sLayer)->analysisData.numPartitions = outFrame->m_analysisData.numPartitions;<br>+                        (pic_out + sLayer)->analysisData.wt = outFrame->m_analysisData.wt;<br>+                        (pic_out + sLayer)->analysisData.interData = outFrame->m_analysisData.interData;<br>+                        (pic_out + sLayer)->analysisData.intraData = outFrame->m_analysisData.intraData;<br>+                        (pic_out + sLayer)->analysisData.distortionData = outFrame->m_analysisData.distortionData;<br>+                        (pic_out + sLayer)->analysisData.modeFlag[0] = outFrame->m_analysisData.modeFlag[0];<br>+                        (pic_out + sLayer)->analysisData.modeFlag[1] = outFrame->m_analysisData.modeFlag[1];<br>                         if (m_param->bDisableLookahead)<br>                         {<br>                             int factor = 1;<br>                             if (m_param->scaleFactor)<br>                                 factor = m_param->scaleFactor * 2;<br>-                            pic_out[sLayer]->analysisData.numCuInHeight = outFrame->m_analysisData.numCuInHeight;<br>-                            pic_out[sLayer]->analysisData.lookahead.dts = outFrame->m_dts;<br>-                            pic_out[sLayer]->analysisData.lookahead.reorderedPts = outFrame->m_reorderedPts;<br>-                            pic_out[sLayer]->analysisData.satdCost *= factor;<br>-                            pic_out[sLayer]->analysisData.lookahead.keyframe = outFrame->m_lowres.bKeyframe;<br>-                            pic_out[sLayer]->analysisData.lookahead.lastMiniGopBFrame = outFrame->m_lowres.bLastMiniGopBFrame;<br>+                            (pic_out + sLayer)->analysisData.numCuInHeight = outFrame->m_analysisData.numCuInHeight;<br>+                            (pic_out + sLayer)->analysisData.lookahead.dts = outFrame->m_dts;<br>+                            (pic_out + sLayer)->analysisData.lookahead.reorderedPts = outFrame->m_reorderedPts;<br>+                            (pic_out + sLayer)->analysisData.satdCost *= factor;<br>+                            (pic_out + sLayer)->analysisData.lookahead.keyframe = outFrame->m_lowres.bKeyframe;<br>+                            (pic_out + sLayer)->analysisData.lookahead.lastMiniGopBFrame = outFrame->m_lowres.bLastMiniGopBFrame;<br>                             if (m_rateControl->m_isVbv)<br>                             {<br>                                 int vbvCount = m_param->lookaheadDepth + m_param->bframes + 2;<br>                                 for (int index = 0; index < vbvCount; index++)<br>                                 {<br>-                                    pic_out[sLayer]->analysisData.lookahead.plannedSatd[index] = outFrame->m_lowres.plannedSatd[index];<br>-                                    pic_out[sLayer]->analysisData.lookahead.plannedType[index] = outFrame->m_lowres.plannedType[index];<br>+                                    (pic_out + sLayer)->analysisData.lookahead.plannedSatd[index] = outFrame->m_lowres.plannedSatd[index];<br>+                                    (pic_out + sLayer)->analysisData.lookahead.plannedType[index] = outFrame->m_lowres.plannedType[index];<br>                                 }<br>-                                for (uint32_t index = 0; index < pic_out[sLayer]->analysisData.numCuInHeight; index++)<br>+                                for (uint32_t index = 0; index < (pic_out + sLayer)->analysisData.numCuInHeight; index++)<br>                                 {<br>                                     outFrame->m_analysisData.lookahead.intraSatdForVbv[index] = outFrame->m_encData->m_rowStat[index].intraSatdForVbv;<br>                                     outFrame->m_analysisData.lookahead.satdForVbv[index] = outFrame->m_encData->m_rowStat[index].satdForVbv;<br>                                 }<br>-                                pic_out[sLayer]->analysisData.lookahead.intraSatdForVbv = outFrame->m_analysisData.lookahead.intraSatdForVbv;<br>-                                pic_out[sLayer]->analysisData.lookahead.satdForVbv = outFrame->m_analysisData.lookahead.satdForVbv;<br>-                                for (uint32_t index = 0; index < pic_out[sLayer]->analysisData.numCUsInFrame; index++)<br>+                                (pic_out + sLayer)->analysisData.lookahead.intraSatdForVbv = outFrame->m_analysisData.lookahead.intraSatdForVbv;<br>+                                (pic_out + sLayer)->analysisData.lookahead.satdForVbv = outFrame->m_analysisData.lookahead.satdForVbv;<br>+                                for (uint32_t index = 0; index < (pic_out + sLayer)->analysisData.numCUsInFrame; index++)<br>                                 {<br>                                     outFrame->m_analysisData.lookahead.intraVbvCost[index] = outFrame->m_encData->m_cuStat[index].intraVbvCost;<br>                                     outFrame->m_analysisData.lookahead.vbvCost[index] = outFrame->m_encData->m_cuStat[index].vbvCost;<br>                                 }<br>-                                pic_out[sLayer]->analysisData.lookahead.intraVbvCost = outFrame->m_analysisData.lookahead.intraVbvCost;<br>-                                pic_out[sLayer]->analysisData.lookahead.vbvCost = outFrame->m_analysisData.lookahead.vbvCost;<br>+                                (pic_out + sLayer)->analysisData.lookahead.intraVbvCost = outFrame->m_analysisData.lookahead.intraVbvCost;<br>+                                (pic_out + sLayer)->analysisData.lookahead.vbvCost = outFrame->m_analysisData.lookahead.vbvCost;<br>                             }<br>                         }<br>-                        writeAnalysisFile(&pic_out[sLayer]->analysisData, *outFrame->m_encData);<br>-                        pic_out[sLayer]->analysisData.saveParam = pic_out[sLayer]->analysisData.saveParam;<br>+                        writeAnalysisFile(&(pic_out + sLayer)->analysisData, *outFrame->m_encData);<br>+                        (pic_out + sLayer)->analysisData.saveParam = (pic_out + sLayer)->analysisData.saveParam;<br>                         if (m_param->bUseAnalysisFile)<br>-                            x265_free_analysis_data(m_param, &pic_out[sLayer]->analysisData);<br>+                            x265_free_analysis_data(m_param, &(pic_out + sLayer)->analysisData);<br>                     }<br>                 }<br>                 if (m_param->rc.bStatWrite && (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion))<br>                 {<br>-                    if (pic_out[sLayer])<br>+                    if (pic_out && (pic_out + sLayer))<br>                     {<br>-                        pic_out[sLayer]->analysisData.poc = pic_out[sLayer]->poc;<br>-                        pic_out[sLayer]->analysisData.interData = outFrame->m_analysisData.interData;<br>-                        pic_out[sLayer]->analysisData.intraData = outFrame->m_analysisData.intraData;<br>-                        pic_out[sLayer]->analysisData.distortionData = outFrame->m_analysisData.distortionData;<br>+                        (pic_out + sLayer)->analysisData.poc = (pic_out + sLayer)->poc;<br>+                        (pic_out + sLayer)->analysisData.interData = outFrame->m_analysisData.interData;<br>+                        (pic_out + sLayer)->analysisData.intraData = outFrame->m_analysisData.intraData;<br>+                        (pic_out + sLayer)->analysisData.distortionData = outFrame->m_analysisData.distortionData;<br>                     }<br>                     writeAnalysisFileRefine(&outFrame->m_analysisData, *outFrame->m_encData);<br>                 }<br>@@ -2122,11 +2122,11 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)<br>                     finishFrameStats(outFrame, curEncoder, frameData, m_pocLast, sLayer);<br>                 if (m_param->analysisSave)<br>                 {<br>-                    pic_out[sLayer]->analysisData.frameBits = frameData->bits;<br>+                    (pic_out + sLayer)->analysisData.frameBits = frameData->bits;<br>                     if (!slice->isIntra())<br>                     {<br>                         for (int ref = 0; ref < MAX_NUM_REF; ref++)<br>-                            pic_out[sLayer]->analysisData.list0POC[ref] = frameData->list0POC[ref];<br>+                            (pic_out + sLayer)->analysisData.list0POC[ref] = frameData->list0POC[ref];<br> <br>                         double totalIntraPercent = 0;<br> <br>@@ -2137,12 +2137,12 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)<br> <br>                         for (uint32_t depth = 0; depth < m_param->maxCUDepth; depth++)<br>                             totalIntraPercent += frameData->puStats.percentIntraPu[depth];<br>-                        pic_out[sLayer]->analysisData.totalIntraPercent = totalIntraPercent;<br>+                        (pic_out + sLayer)->analysisData.totalIntraPercent = totalIntraPercent;<br> <br>                         if (!slice->isInterP())<br>                         {<br>                             for (int ref = 0; ref < MAX_NUM_REF; ref++)<br>-                                pic_out[sLayer]->analysisData.list1POC[ref] = frameData->list1POC[ref];<br>+                                (pic_out + sLayer)->analysisData.list1POC[ref] = frameData->list1POC[ref];<br>                         }<br>                     }<br>                 }<br>@@ -2151,10 +2151,10 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)<br>                 if (m_param->rc.bStatWrite)<br>                     if (m_rateControl->writeRateControlFrameStats(outFrame, &curEncoder->m_rce))<br>                         m_aborted = true;<br>-                if (pic_out[sLayer])<br>+                if (pic_out && (pic_out + sLayer))<br>                 {<br>                     /* m_rcData is allocated for every frame */<br>-                    pic_out[sLayer]->rcData = outFrame->m_rcData;<br>+                    (pic_out + sLayer)->rcData = outFrame->m_rcData;<br>                     outFrame->m_rcData->qpaRc = outFrame->m_encData->m_avgQpRc;<br>                     outFrame->m_rcData->qRceq = curEncoder->m_rce.qRceq;<br>                     outFrame->m_rcData->qpNoVbv = curEncoder->m_rce.qpNoVbv;<br>@@ -2185,7 +2185,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)<br>                 }<br> <br>                 /* Allow this frame to be recycled if no frame encoders are using it for reference */<br>-                if (!pic_out[sLayer])<br>+                if (!(pic_out) || !(pic_out + sLayer))<br>                 {<br>                     ATOMIC_DEC(&outFrame->m_countRefEncoders);<br>                     m_dpb->recycleUnreferenced();<br>@@ -3117,7 +3117,7 @@ void Encoder::finishFrameStats(Frame* curFrame, FrameEncoder *curEncoder, x265_f<br>         m_analyzeAll[layer].addPsnr(psnrY, psnrU, psnrV);<br> <br>     double ssim = 0.0;<br>-    if (m_param->bEnableSsim && curEncoder->m_ssimCnt)<br>+    if (m_param->bEnableSsim && curEncoder->m_ssimCnt[layer])<br>     {<br>         ssim = curEncoder->m_ssim[layer] / curEncoder->m_ssimCnt[layer];<br>         m_analyzeAll[layer].addSsim(ssim);<br>diff --git a/source/encoder/encoder.h b/source/encoder/encoder.h<br>index 1dbb41596..e5020c1dc 100644<br>--- a/source/encoder/encoder.h<br>+++ b/source/encoder/encoder.h<br>@@ -300,7 +300,7 @@ public:<br>     void stopJobs();<br>     void destroy();<br> <br>-    int encode(const x265_picture* pic, x265_picture **pic_out);<br>+    int encode(const x265_picture* pic, x265_picture *pic_out);<br> <br>     int reconfigureParam(x265_param* encParam, x265_param* param);<br> <br>diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp<br>index 6f930c527..deb478a0f 100644<br>--- a/source/encoder/frameencoder.cpp<br>+++ b/source/encoder/frameencoder.cpp<br>@@ -1475,7 +1475,7 @@ void FrameEncoder::encodeSlice(uint32_t sliceAddr, int layer)<br> void FrameEncoder::processRow(int row, int threadId, int layer)<br> {<br>     int64_t startTime = x265_mdate();<br>-    if (ATOMIC_INC(&m_activeWorkerCount) == 1 && m_stallStartTime)<br>+    if (ATOMIC_INC(&m_activeWorkerCount) == 1 && m_stallStartTime[layer])<br>         m_totalNoWorkerTime[layer] += x265_mdate() - m_stallStartTime[layer];<br> <br>     const uint32_t realRow = m_idx_to_row[row >> 1];<br>diff --git a/source/x265.h b/source/x265.h<br>index 08ccb4b74..532d01b22 100644<br>--- a/source/x265.h<br>+++ b/source/x265.h<br>@@ -2493,7 +2493,7 @@ int x265_encoder_headers(x265_encoder *, x265_nal **pp_nal, uint32_t *pi_nal);<br>  *      the payloads of all output NALs are guaranteed to be sequential in memory.<br>  *      To flush the encoder and retrieve delayed output pictures, pass pic_in as NULL.<br>  *      Once flushing has begun, all subsequent calls must pass pic_in as NULL. */<br>-int x265_encoder_encode(x265_encoder *encoder, x265_nal **pp_nal, uint32_t *pi_nal, x265_picture *pic_in, x265_picture **pic_out);<br>+int x265_encoder_encode(x265_encoder *encoder, x265_nal **pp_nal, uint32_t *pi_nal, x265_picture *pic_in, x265_picture *pic_out);<br> <br> /* x265_encoder_reconfig:<br>  *      various parameters from x265_param are copied.<br>@@ -2647,7 +2647,7 @@ typedef struct x265_api<br>     int           (*encoder_reconfig)(x265_encoder*, x265_param*);<br>     int           (*encoder_reconfig_zone)(x265_encoder*, x265_zone*);<br>     int           (*encoder_headers)(x265_encoder*, x265_nal**, uint32_t*);<br>-    int           (*encoder_encode)(x265_encoder*, x265_nal**, uint32_t*, x265_picture*, x265_picture**);<br>+    int           (*encoder_encode)(x265_encoder*, x265_nal**, uint32_t*, x265_picture*, x265_picture*);<br>     void          (*encoder_get_stats)(x265_encoder*, x265_stats*, uint32_t);<br>     void          (*encoder_log)(x265_encoder*, int, char**);<br>     void          (*encoder_close)(x265_encoder*);<br>-- <br>2.36.0.windows.1<br><br></div>
</blockquote></div>
</blockquote></div>