<div dir="ltr">Pushed in the default branch  <div> <br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Thanks,</div><div dir="ltr"><span></span><span></span>Kalyan Goswami, PhD</div><div dir="ltr"><span style="font-size:12.8px">Video Architect @ MulticoreWare</span></div><div dir="ltr"><div><a href="http://www.multicorewareinc.com/" target="_blank">http:</a><a href="http://www.multicorewareinc.com/" style="font-size:12.8px" target="_blank">//www.multicorewareinc.com</a></div><div><span style="font-size:12.8px">+91 9884989331</span><br></div><div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 28, 2018 at 2:47 PM <<a href="mailto:jayashri@multicorewareinc.com">jayashri@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"># HG changeset patch<br>
# User Jayashri Murugan<br>
# Date 1537464480 25200<br>
#      Thu Sep 20 10:28:00 2018 -0700<br>
# Node ID d571bdb0b0ae9894dce12d9d0fc3ea4d639a01a2<br>
# Parent  23a8a7456916d98040b56a09a93ce3b1149613d9<br>
Reuse CU depth for B frame and allow I, P frame to follow x265 depth decision<br>
<br>
diff -r 23a8a7456916 -r d571bdb0b0ae source/common/param.cpp<br>
--- a/source/common/param.cpp   Wed Sep 19 14:30:48 2018 -0700<br>
+++ b/source/common/param.cpp   Thu Sep 20 10:28:00 2018 -0700<br>
@@ -1157,6 +1157,10 @@<br>
             {<br>
                 p->bAnalysisType = AVC_INFO;<br>
             }<br>
+            else if (strcmp(strdup(value), "hevc") == 0)<br>
+            {<br>
+                p->bAnalysisType = HEVC_INFO;<br>
+            }<br>
             else if (strcmp(strdup(value), "off") == 0)<br>
             {<br>
                 p->bAnalysisType = NO_INFO;<br>
@@ -1714,7 +1718,11 @@<br>
     TOOLVAL(param->lookaheadThreads, "lthreads=%d")<br>
     TOOLVAL(param->bCTUInfo, "ctu-info=%d");<br>
     if (param->bAnalysisType == AVC_INFO)<br>
+    {<br>
         TOOLOPT(param->bAnalysisType, "refine-analysis-type=avc");<br>
+    }<br>
+    else if (param->bAnalysisType == HEVC_INFO)<br>
+        TOOLOPT(param->bAnalysisType, "refine-analysis-type=hevc");<br>
     TOOLOPT(param->bDynamicRefine, "dynamic-refine");<br>
     if (param->maxSlices > 1)<br>
         TOOLVAL(param->maxSlices, "slices=%d");<br>
diff -r 23a8a7456916 -r d571bdb0b0ae source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp       Wed Sep 19 14:30:48 2018 -0700<br>
+++ b/source/encoder/analysis.cpp       Thu Sep 20 10:28:00 2018 -0700<br>
@@ -275,7 +275,8 @@<br>
             /* generate residual for entire CTU at once and copy to reconPic */<br>
             encodeResidue(ctu, cuGeom);<br>
         }<br>
-        else if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || ((m_param->bAnalysisType == AVC_INFO) && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))<br>
+        else if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10 && (!(m_param->bAnalysisType == HEVC_INFO) || m_slice->m_sliceType != P_SLICE)) ||<br>
+                 ((m_param->bAnalysisType == AVC_INFO) && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))<br>
         {<br>
             x265_analysis_inter_data* interDataCTU = m_frame->m_analysisData.interData;<br>
             int posCTU = ctu.m_cuAddr * numPartition;<br>
@@ -516,7 +517,7 @@<br>
     bool mightSplit = !(cuGeom.flags & CUGeom::LEAF);<br>
     bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY);<br>
<br>
-    bool bAlreadyDecided = m_param->intraRefine != 4 && parentCTU.m_lumaIntraDir[cuGeom.absPartIdx] != (uint8_t)ALL_IDX;<br>
+    bool bAlreadyDecided = m_param->intraRefine != 4 && parentCTU.m_lumaIntraDir[cuGeom.absPartIdx] != (uint8_t)ALL_IDX && !(m_param->bAnalysisType == HEVC_INFO);<br>
     bool bDecidedDepth = m_param->intraRefine != 4 && parentCTU.m_cuDepth[cuGeom.absPartIdx] == depth;<br>
     int split = 0;<br>
     if (m_param->intraRefine && m_param->intraRefine != 4)<br>
@@ -2423,7 +2424,7 @@<br>
         (m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1))));<br>
     td.split = split;<br>
<br>
-    if (bDecidedDepth && mightNotSplit)<br>
+    if ((bDecidedDepth && mightNotSplit) || (m_param->bAnalysisType == HEVC_INFO && parentCTU.m_cuDepth[cuGeom.absPartIdx] == 4))<br>
     {<br>
         setLambdaFromQP(parentCTU, qp, lqp);<br>
<br>
@@ -2562,7 +2563,10 @@<br>
<br>
         if (m_refineLevel > 1 || (m_refineLevel && parentCTU.m_predMode[cuGeom.absPartIdx] == MODE_SKIP  && !mode.cu.isSkipped(0)))<br>
         {<br>
-            m_evaluateInter = 1;<br>
+            if (parentCTU.m_cuDepth[cuGeom.absPartIdx] < 4 && mightNotSplit)<br>
+                m_evaluateInter = 1;<br>
+            else<br>
+                bDecidedDepth = true;<br>
             m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, cuGeom, qp) : compressInterCU_rd0_4(parentCTU, cuGeom, qp);<br>
             m_evaluateInter = 0;<br>
         }<br>
diff -r 23a8a7456916 -r d571bdb0b0ae source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp    Wed Sep 19 14:30:48 2018 -0700<br>
+++ b/source/encoder/api.cpp    Thu Sep 20 10:28:00 2018 -0700<br>
@@ -463,20 +463,20 @@<br>
     //Allocate memory for intraData pointer<br>
     CHECKED_MALLOC_ZERO(intraData, x265_analysis_intra_data, 1);<br>
     CHECKED_MALLOC(intraData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
-    CHECKED_MALLOC(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
-    CHECKED_MALLOC(intraData->partSizes, char, analysis->numPartitions * analysis->numCUsInFrame);<br>
-    CHECKED_MALLOC(intraData->chromaModes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+    CHECKED_MALLOC_ZERO(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+    CHECKED_MALLOC_ZERO(intraData->partSizes, char, analysis->numPartitions * analysis->numCUsInFrame);<br>
+    CHECKED_MALLOC_ZERO(intraData->chromaModes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
     if (param->rc.cuTree)<br>
-        CHECKED_MALLOC(intraData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+        CHECKED_MALLOC_ZERO(intraData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
     analysis->intraData = intraData;<br>
<br>
     //Allocate memory for interData pointer based on ReuseLevels<br>
     CHECKED_MALLOC_ZERO(interData, x265_analysis_inter_data, 1);<br>
     CHECKED_MALLOC(interData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
-    CHECKED_MALLOC(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+    CHECKED_MALLOC_ZERO(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
<br>
     if (param->rc.cuTree)<br>
-        CHECKED_MALLOC(interData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+        CHECKED_MALLOC_ZERO(interData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
     CHECKED_MALLOC_ZERO(interData->mvpIdx[0], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
     CHECKED_MALLOC_ZERO(interData->mvpIdx[1], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
     CHECKED_MALLOC_ZERO(interData->mv[0], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);<br>
@@ -484,16 +484,16 @@<br>
<br>
     if (param->analysisReuseLevel > 4)<br>
     {<br>
-        CHECKED_MALLOC(interData->partSize, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+        CHECKED_MALLOC_ZERO(interData->partSize, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
         CHECKED_MALLOC_ZERO(interData->mergeFlag, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
     }<br>
     if (param->analysisReuseLevel >= 7)<br>
     {<br>
-        CHECKED_MALLOC(interData->interDir, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
-        CHECKED_MALLOC(interData->sadCost, int64_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+        CHECKED_MALLOC_ZERO(interData->interDir, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+        CHECKED_MALLOC_ZERO(interData->sadCost, int64_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
         for (int dir = 0; dir < numDir; dir++)<br>
         {<br>
-            CHECKED_MALLOC(interData->refIdx[dir], int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+            CHECKED_MALLOC_ZERO(interData->refIdx[dir], int8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
             CHECKED_MALLOC_ZERO(analysis->modeFlag[dir], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
         }<br>
     }<br>
diff -r 23a8a7456916 -r d571bdb0b0ae source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Wed Sep 19 14:30:48 2018 -0700<br>
+++ b/source/encoder/encoder.cpp        Thu Sep 20 10:28:00 2018 -0700<br>
@@ -1145,7 +1145,7 @@<br>
         {<br>
             /* reads analysis data for the frame and allocates memory based on slicetype */<br>
             static int paramBytes = 0;<br>
-            if (!inFrame->m_poc)<br>
+            if (!inFrame->m_poc && m_param->bAnalysisType != HEVC_INFO)<br>
             {<br>
                 x265_analysis_data analysisData = pic_in->analysisData;<br>
                 paramBytes = validateAnalysisData(&analysisData, 0);<br>
@@ -2885,7 +2885,7 @@<br>
         p->rc.rfConstantMin = 0;<br>
     }<br>
<br>
-    if ((p->analysisLoad || p->analysisSave) && p->rc.cuTree && p->analysisReuseLevel < 10)<br>
+    if (!(p->bAnalysisType == HEVC_INFO) && (p->analysisLoad || p->analysisSave) && p->rc.cuTree && p->analysisReuseLevel < 10)<br>
     {<br>
         x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis reuse level 10, Disabling cu-tree\n");<br>
         p->rc.cuTree = 0;<br>
@@ -2954,7 +2954,7 @@<br>
         p->interRefine = 1;<br>
     }<br>
<br>
-    if (p->limitTU && (p->interRefine || p->bDynamicRefine))<br>
+    if (!(p->bAnalysisType == HEVC_INFO) && p->limitTU && (p->interRefine || p->bDynamicRefine))<br>
     {<br>
         x265_log(p, X265_LOG_WARNING, "Inter refinement does not support limitTU. Disabling limitTU.\n");<br>
         p->limitTU = 0;<br>
@@ -3465,6 +3465,8 @@<br>
     }<br>
     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
     {<br>
+        if (m_param->bAnalysisType == HEVC_INFO)<br>
+            return;<br>
         if (m_param->analysisReuseLevel < 2)<br>
             return;<br>
<br>
@@ -3542,98 +3544,107 @@<br>
             bIntraInInter = (analysis->sliceType == X265_TYPE_P || m_param->bIntraInBFrames);<br>
             if (bIntraInInter) numBuf++;<br>
         }<br>
-<br>
-        tempBuf = X265_MALLOC(uint8_t, depthBytes * numBuf);<br>
-        depthBuf = tempBuf;<br>
-        modeBuf = tempBuf + depthBytes;<br>
-        if (m_param->rc.cuTree)<br>
-            cuQPBuf = X265_MALLOC(int8_t, depthBytes);<br>
-<br>
-        X265_FREAD(depthBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->depth);<br>
-        X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->modes);<br>
-        if (m_param->rc.cuTree) { X265_FREAD(cuQPBuf, sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->cuQPOff); }<br>
-<br>
-        if (m_param->analysisReuseLevel > 4)<br>
+        if (m_param->bAnalysisType == HEVC_INFO)<br>
+        {<br>
+            depthBytes = analysis->numCUsInFrame * analysis->numPartitions;<br>
+            memcpy(((x265_analysis_inter_data *)analysis->interData)->depth, interPic->depth, depthBytes);<br>
+        }<br>
+        else<br>
         {<br>
-            partSize = modeBuf + depthBytes;<br>
-            mergeFlag = partSize + depthBytes;<br>
-            X265_FREAD(partSize, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->partSize);<br>
-            X265_FREAD(mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mergeFlag);<br>
-<br>
-            if (m_param->analysisReuseLevel == 10)<br>
+            tempBuf = X265_MALLOC(uint8_t, depthBytes * numBuf);<br>
+            depthBuf = tempBuf;<br>
+            modeBuf = tempBuf + depthBytes;<br>
+            if (m_param->rc.cuTree)<br>
+                cuQPBuf = X265_MALLOC(int8_t, depthBytes);<br>
+<br>
+            X265_FREAD(depthBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->depth);<br>
+            X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->modes);<br>
+            if (m_param->rc.cuTree) { X265_FREAD(cuQPBuf, sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->cuQPOff); }<br>
+<br>
+            if (m_param->analysisReuseLevel > 4)<br>
             {<br>
-                interDir = mergeFlag + depthBytes;<br>
-                X265_FREAD(interDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->interDir);<br>
-                if (bIntraInInter)<br>
+                partSize = modeBuf + depthBytes;<br>
+                mergeFlag = partSize + depthBytes;<br>
+                X265_FREAD(partSize, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->partSize);<br>
+                X265_FREAD(mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mergeFlag);<br>
+<br>
+                if (m_param->analysisReuseLevel == 10)<br>
                 {<br>
-                    chromaDir = interDir + depthBytes;<br>
-                    X265_FREAD(chromaDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, intraPic->chromaModes);<br>
-                }<br>
-                for (uint32_t i = 0; i < numDir; i++)<br>
-                {<br>
-                    mvpIdx[i] = X265_MALLOC(uint8_t, depthBytes);<br>
-                    refIdx[i] = X265_MALLOC(int8_t, depthBytes);<br>
-                    mv[i] = X265_MALLOC(MV, depthBytes);<br>
-                    X265_FREAD(mvpIdx[i], sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mvpIdx[i]);<br>
-                    X265_FREAD(refIdx[i], sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->refIdx[i]);<br>
-                    X265_FREAD(mv[i], sizeof(MV), depthBytes, m_analysisFileIn, interPic->mv[i]);<br>
+                    interDir = mergeFlag + depthBytes;<br>
+                    X265_FREAD(interDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->interDir);<br>
+                    if (bIntraInInter)<br>
+                    {<br>
+                        chromaDir = interDir + depthBytes;<br>
+                        X265_FREAD(chromaDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, intraPic->chromaModes);<br>
+                    }<br>
+                    for (uint32_t i = 0; i < numDir; i++)<br>
+                    {<br>
+                        mvpIdx[i] = X265_MALLOC(uint8_t, depthBytes);<br>
+                        refIdx[i] = X265_MALLOC(int8_t, depthBytes);<br>
+                        mv[i] = X265_MALLOC(MV, depthBytes);<br>
+                        X265_FREAD(mvpIdx[i], sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mvpIdx[i]);<br>
+                        X265_FREAD(refIdx[i], sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->refIdx[i]);<br>
+                        X265_FREAD(mv[i], sizeof(MV), depthBytes, m_analysisFileIn, interPic->mv[i]);<br>
+                    }<br>
                 }<br>
             }<br>
-        }<br>
-<br>
-        size_t count = 0;<br>
-        for (uint32_t d = 0; d < depthBytes; d++)<br>
-        {<br>
-            int bytes = analysis->numPartitions >> (depthBuf[d] * 2);<br>
-            if (m_param->scaleFactor && modeBuf[d] == MODE_INTRA && depthBuf[d] == 0)<br>
-                depthBuf[d] = 1;<br>
-            memset(&(analysis->interData)->depth[count], depthBuf[d], bytes);<br>
-            memset(&(analysis->interData)->modes[count], modeBuf[d], bytes);<br>
-            if (m_param->rc.cuTree)<br>
-                memset(&(analysis->interData)->cuQPOff[count], cuQPBuf[d], bytes);<br>
-            if (m_param->analysisReuseLevel > 4)<br>
+<br>
+            size_t count = 0;<br>
+            for (uint32_t d = 0; d < depthBytes; d++)<br>
             {<br>
-                if (m_param->scaleFactor && modeBuf[d] == MODE_INTRA && partSize[d] == SIZE_NxN)<br>
-                    partSize[d] = SIZE_2Nx2N;<br>
-                memset(&(analysis->interData)->partSize[count], partSize[d], bytes);<br>
-                int numPU = (modeBuf[d] == MODE_INTRA) ? 1 : nbPartsTable[(int)partSize[d]];<br>
-                for (int pu = 0; pu < numPU; pu++)<br>
+                int bytes = analysis->numPartitions >> (depthBuf[d] * 2);<br>
+                if (m_param->scaleFactor && modeBuf[d] == MODE_INTRA && depthBuf[d] == 0)<br>
+                    depthBuf[d] = 1;<br>
+                memset(&(analysis->interData)->depth[count], depthBuf[d], bytes);<br>
+                memset(&(analysis->interData)->modes[count], modeBuf[d], bytes);<br>
+                if (m_param->rc.cuTree)<br>
+                    memset(&(analysis->interData)->cuQPOff[count], cuQPBuf[d], bytes);<br>
+                if (m_param->analysisReuseLevel > 4)<br>
                 {<br>
-                    if (pu) d++;<br>
-                    (analysis->interData)->mergeFlag[count + pu] = mergeFlag[d];<br>
-                    if (m_param->analysisReuseLevel == 10)<br>
+                    if (m_param->scaleFactor && modeBuf[d] == MODE_INTRA && partSize[d] == SIZE_NxN)<br>
+                        partSize[d] = SIZE_2Nx2N;<br>
+                    memset(&(analysis->interData)->partSize[count], partSize[d], bytes);<br>
+                    int numPU = (modeBuf[d] == MODE_INTRA) ? 1 : nbPartsTable[(int)partSize[d]];<br>
+                    for (int pu = 0; pu < numPU; pu++)<br>
                     {<br>
-                        (analysis->interData)->interDir[count + pu] = interDir[d];<br>
-                        for (uint32_t i = 0; i < numDir; i++)<br>
+                        if (pu) d++;<br>
+                        (analysis->interData)->mergeFlag[count + pu] = mergeFlag[d];<br>
+                        if (m_param->analysisReuseLevel == 10)<br>
                         {<br>
-                            (analysis->interData)->mvpIdx[i][count + pu] = mvpIdx[i][d];<br>
-                            (analysis->interData)->refIdx[i][count + pu] = refIdx[i][d];<br>
-                            if (m_param->scaleFactor)<br>
+                            (analysis->interData)->interDir[count + pu] = interDir[d];<br>
+                            for (uint32_t i = 0; i < numDir; i++)<br>
                             {<br>
-                                mv[i][d].x *= (int16_t)m_param->scaleFactor;<br>
-                                mv[i][d].y *= (int16_t)m_param->scaleFactor;<br>
+                                (analysis->interData)->mvpIdx[i][count + pu] = mvpIdx[i][d];<br>
+                                (analysis->interData)->refIdx[i][count + pu] = refIdx[i][d];<br>
+                                if (m_param->scaleFactor)<br>
+                                {<br>
+                                    mv[i][d].x *= (int16_t)m_param->scaleFactor;<br>
+                                    mv[i][d].y *= (int16_t)m_param->scaleFactor;<br>
+                                }<br>
+                                memcpy(&(analysis->interData)->mv[i][count + pu], &mv[i][d], sizeof(MV));<br>
                             }<br>
-                            memcpy(&(analysis->interData)->mv[i][count + pu], &mv[i][d], sizeof(MV));<br>
                         }<br>
                     }<br>
+                    if (m_param->analysisReuseLevel == 10 && bIntraInInter)<br>
+                        memset(&(analysis->intraData)->chromaModes[count], chromaDir[d], bytes);<br>
                 }<br>
-                if (m_param->analysisReuseLevel == 10 && bIntraInInter)<br>
-                    memset(&(analysis->intraData)->chromaModes[count], chromaDir[d], bytes);<br>
+                count += bytes;<br>
             }<br>
-            count += bytes;<br>
+<br>
+            if (m_param->rc.cuTree)<br>
+                X265_FREE(cuQPBuf);<br>
+            X265_FREE(tempBuf);<br>
         }<br>
-<br>
-        if (m_param->rc.cuTree)<br>
-            X265_FREE(cuQPBuf);<br>
-        X265_FREE(tempBuf);<br>
-<br>
         if (m_param->analysisReuseLevel == 10)<br>
         {<br>
-            for (uint32_t i = 0; i < numDir; i++)<br>
+            if (m_param->bAnalysisType != HEVC_INFO)<br>
             {<br>
-                X265_FREE(mvpIdx[i]);<br>
-                X265_FREE(refIdx[i]);<br>
-                X265_FREE(mv[i]);<br>
+                for (uint32_t i = 0; i < numDir; i++)<br>
+                {<br>
+                    X265_FREE(mvpIdx[i]);<br>
+                    X265_FREE(refIdx[i]);<br>
+                    X265_FREE(mv[i]);<br>
+                }<br>
             }<br>
             if (bIntraInInter)<br>
             {<br>
diff -r 23a8a7456916 -r d571bdb0b0ae source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp      Wed Sep 19 14:30:48 2018 -0700<br>
+++ b/source/encoder/slicetype.cpp      Thu Sep 20 10:28:00 2018 -0700<br>
@@ -1090,7 +1090,7 @@<br>
         if (m_param->rc.cuTree && !m_param->rc.bStatRead)<br>
             /* update row satds based on cutree offsets */<br>
             curFrame->m_lowres.satdCost = frameCostRecalculate(frames, p0, p1, b);<br>
-        else if (!m_param->analysisLoad || m_param->scaleFactor)<br>
+        else if (!m_param->analysisLoad || m_param->scaleFactor || m_param->bAnalysisType == HEVC_INFO)<br>
         {<br>
             if (m_param->rc.aqMode)<br>
                 curFrame->m_lowres.satdCost = curFrame->m_lowres.costEstAq[b - p0][p1 - b];<br>
@@ -1245,7 +1245,7 @@<br>
     }<br>
<br>
     int bframes, brefs;<br>
-    if (!m_param->analysisLoad)<br>
+    if (!m_param->analysisLoad || m_param->bAnalysisType == HEVC_INFO)<br>
     {<br>
         for (bframes = 0, brefs = 0;; bframes++)<br>
         {<br>
diff -r 23a8a7456916 -r d571bdb0b0ae source/x265.h<br>
--- a/source/x265.h     Wed Sep 19 14:30:48 2018 -0700<br>
+++ b/source/x265.h     Thu Sep 20 10:28:00 2018 -0700<br>
@@ -317,6 +317,7 @@<br>
 {<br>
     NO_INFO = 0,<br>
     AVC_INFO = 1,<br>
+    HEVC_INFO = 2,<br>
 }AnalysisRefineType;<br>
<br>
 /* Arbitrary User SEI<br>
diff -r 23a8a7456916 -r d571bdb0b0ae source/x265cli.h<br>
--- a/source/x265cli.h  Wed Sep 19 14:30:48 2018 -0700<br>
+++ b/source/x265cli.h  Thu Sep 20 10:28:00 2018 -0700<br>
@@ -501,7 +501,7 @@<br>
     H0("   --analysis-load <filename>    Load analysis buffers from the file specified. Default Disabled\n");<br>
     H0("   --analysis-reuse-file <filename>    Specify file name used for either dumping or reading analysis data. Deault x265_analysis.dat\n");<br>
     H0("   --analysis-reuse-level <1..10>      Level of analysis reuse indicates amount of info stored/reused in save/load mode, 1:least..10:most. Default %d\n", param->analysisReuseLevel);<br>
-    H0("   --refine-analysis-type <string>     Reuse anlaysis information received through API call. Supported options are avc. Default disabled - %d\n", param->bAnalysisType);<br>
+    H0("   --refine-analysis-type <string>     Reuse anlaysis information received through API call. Supported options are avc and hevc. Default disabled - %d\n", param->bAnalysisType);<br>
     H0("   --scale-factor <int>          Specify factor by which input video is scaled down for analysis save mode. Default %d\n", param->scaleFactor);<br>
     H0("   --refine-intra <0..4>         Enable intra refinement for encode that uses analysis-load.\n"<br>
         "                                    - 0 : Forces both mode and depth from the save encode.\n"<br>
_______________________________________________<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>