<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 5, 2018 at 2:19 PM,  <span dir="ltr"><<a href="mailto:bhavna@multicorewareinc.com" target="_blank">bhavna@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com">bhavna@multicorewareinc.com</a>><br>
# Date 1519796358 -19800<br>
#      Wed Feb 28 11:09:18 2018 +0530<br>
# Node ID ce647bfa20e203ed1aeb8f55559443<wbr>26ac15cb74<br>
# Parent  0b781d592c8e6e0917dc5f152129be<wbr>bb201e529d<br>
remove maxCTU size restriction in scaled save/load encodes<br>
<br>
The scaled save/load feature requires that the save encode has a maximum CTU<br>
size of 32. The 32x32 blocks are mapped to a 64x64 block in load encode. Due to<br>
this restriction we will be able to heirarchialy encode only 3 resolutions.<br>
WxH - ctu 16<br>
2Wx2H - ctu 32<br>
4Wx4H - ctu 64<br>
<br>
diff -r 0b781d592c8e -r ce647bfa20e2 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Mon Mar 05 11:24:22 2018 +0530<br>
+++ b/source/encoder/encoder.cpp        Wed Feb 28 11:09:18 2018 +0530<br>
@@ -3334,10 +3334,33 @@<br>
     int scaledNumPartition = analysis->numPartitions;<br>
     int factor = 1 << m_param->scaleFactor;<br>
<br>
+    int numPartitions = analysis->numPartitions;<br>
+    int numCUsInFrame = analysis->numCUsInFrame;<br>
+    cuLocation cuLoc;<br>
+    cuLoc.init(m_param);<br>
+<br>
     if (m_param->scaleFactor)<br>
-        analysis->numPartitions *= factor;<br>
+    {<br>
+        /* Allocate memory for scaled resoultion's numPartitions and numCUsInFrame*/<br>
+        analysis->numPartitions = m_param->num4x4Partitions;<br>
+        analysis->numCUsInFrame = cuLoc.heightInCU * cuLoc.widthInCU;<br>
+<br>
+        /* Set skipWidth/skipHeight flags when the out of bound pixels in lowRes is greater than half of maxCUSize */<br>
+        int extendedWidth = ((m_param->sourceWidth / 2 + m_param->maxCUSize - 1) >> m_param->maxLog2CUSize) * m_param->maxCUSize;<br>
+        int extendedHeight = ((m_param->sourceHeight / 2 + m_param->maxCUSize - 1) >> m_param->maxLog2CUSize) * m_param->maxCUSize;<br>
+        uint32_t outOfBoundaryLowres = extendedWidth - m_param->sourceWidth / 2;<br>
+        if (outOfBoundaryLowres * 2 >= m_param->maxCUSize)<br>
+            cuLoc.skipWidth = true;<br>
+        uint32_t outOfBoundaryLowresH = extendedHeight - m_param->sourceHeight / 2;<br>
+        if (outOfBoundaryLowresH * 2 >= m_param->maxCUSize)<br>
+            cuLoc.skipHeight = true;<br>
+    }<br>
+<br>
     /* Memory is allocated for inter and intra analysis data based on the slicetype */<br>
     allocAnalysis(analysis);<br>
+<br>
+    analysis->numPartitions = numPartitions * factor;<br>
+    analysis->numCUsInFrame = numCUsInFrame;<br>
     if (m_param->bDisableLookahead && m_rateControl->m_isVbv)<br>
     {<br>
         X265_FREAD(analysis-><wbr>lookahead.intraVbvCost, sizeof(uint32_t), analysis->numCUsInFrame, m_analysisFileIn, picData->lookahead.<wbr>intraVbvCost);<br>
@@ -3345,6 +3368,7 @@<br>
         X265_FREAD(analysis-><wbr>lookahead.satdForVbv, sizeof(uint32_t), analysis->numCuInHeight, m_analysisFileIn, picData->lookahead.satdForVbv)<wbr>;<br>
         X265_FREAD(analysis-><wbr>lookahead.intraSatdForVbv, sizeof(uint32_t), analysis->numCuInHeight, m_analysisFileIn, picData->lookahead.<wbr>intraSatdForVbv);<br>
     }<br>
+<br>
     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
     {<br>
         if (m_param->analysisReuseLevel < 2)<br>
@@ -3361,21 +3385,34 @@<br>
         X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, intraPic->chromaModes);<br>
         X265_FREAD(partSizes, sizeof(uint8_t), depthBytes, m_analysisFileIn, intraPic->partSizes);<br>
<br>
-        size_t count = 0;<br>
+        uint32_t count = 0;<br>
         for (uint32_t d = 0; d < depthBytes; d++)<br>
         {<br>
             int bytes = analysis->numPartitions >> (depthBuf[d] * 2);<br>
+            int numCTUCopied = 1;<br>
+<br>
             if (m_param->scaleFactor)<br>
             {<br>
-                if (depthBuf[d] == 0)<br>
-                    depthBuf[d] = 1;<br>
+                if (!depthBuf[d]) //copy data of one 64x64 to four scaled 64x64 CTUs.<br>
+                {<br>
+                    bytes /= 4;<br>
+                    numCTUCopied = 4;<br>
+                }<br>
+<br>
                 if (partSizes[d] == SIZE_NxN)<br>
                     partSizes[d] = SIZE_2Nx2N;<br>
+                if ((depthBuf[d] > 1 && m_param->maxCUSize == 64) || (depthBuf[d] && m_param->maxCUSize != 64))<br>
+                    depthBuf[d]--;<br>
             }<br>
-            memset(&((analysis_intra_data *)analysis->intraData)->depth[<wbr>count], depthBuf[d], bytes);<br>
-            memset(&((analysis_intra_data *)analysis->intraData)-><wbr>chromaModes[count], modeBuf[d], bytes);<br>
-            memset(&((analysis_intra_data *)analysis->intraData)-><wbr>partSizes[count], partSizes[d], bytes);<br>
-            count += bytes;<br>
+            for (int numCTU = 0; numCTU < numCTUCopied; numCTU++)<br>
+            {<br>
+                memset(&((analysis_intra_data *)analysis->intraData)->depth[<wbr>count], depthBuf[d], bytes);<br>
+                memset(&((analysis_intra_data *)analysis->intraData)-><wbr>chromaModes[count], modeBuf[d], bytes);<br>
+                memset(&((analysis_intra_data *)analysis->intraData)-><wbr>partSizes[count], partSizes[d], bytes);<br>
+                count += bytes;<br>
+                if (m_param->scaleFactor)<br>
+                    d += getCUIndex(&cuLoc, &count, bytes, 1);<br>
+            }<br>
         }<br>
<br>
         if (!m_param->scaleFactor)<br>
@@ -3384,10 +3421,18 @@<br>
         }<br>
         else<br>
         {<br>
+            cuLoc.evenRowIndex = 0;<br>
+            cuLoc.oddRowIndex = m_param->num4x4Partitions * cuLoc.widthInCU;<br>
+            cuLoc.switchCondition = 0;<br>
             uint8_t *tempLumaBuf = X265_MALLOC(uint8_t, analysis->numCUsInFrame * scaledNumPartition);<br>
             X265_FREAD(tempLumaBuf, sizeof(uint8_t), analysis->numCUsInFrame * scaledNumPartition, m_analysisFileIn, intraPic->modes);<br>
-            for (uint32_t ctu32Idx = 0, cnt = 0; ctu32Idx < analysis->numCUsInFrame * scaledNumPartition; ctu32Idx++, cnt += factor)<br>
+            uint32_t cnt = 0;<br>
+            for (uint32_t ctu32Idx = 0; ctu32Idx < analysis->numCUsInFrame * scaledNumPartition; ctu32Idx++)<br>
+            {<br>
                 memset(&((analysis_intra_data *)analysis->intraData)->modes[<wbr>cnt], tempLumaBuf[ctu32Idx], factor);<br>
+                cnt += factor;<br>
+                ctu32Idx += getCUIndex(&cuLoc, &cnt, factor, 0);<br>
+            }<br>
             X265_FREE(tempLumaBuf);<br>
         }<br>
         X265_FREE(tempBuf);<br>
@@ -3451,44 +3496,94 @@<br>
             }<br>
         }<br>
<br>
-        size_t count = 0;<br>
+        uint32_t count = 0;<br>
+        cuLoc.switchCondition = 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_inter_data *)analysis->interData)->depth[<wbr>count], depthBuf[d], bytes);<br>
-            memset(&((analysis_inter_data *)analysis->interData)->modes[<wbr>count], modeBuf[d], bytes);<br>
-            if (m_param->analysisReuseLevel > 4)<br>
+            bool isScaledMaxCUSize = false;<br>
+            int numCTUCopied = 1;<br>
+            int writeDepth = depthBuf[d];<br>
+            if (m_param->scaleFactor)<br>
             {<br>
-                if (m_param->scaleFactor && modeBuf[d] == MODE_INTRA && partSize[d] == SIZE_NxN)<br>
-                     partSize[d] = SIZE_2Nx2N;<br>
-                memset(&((analysis_inter_data *)analysis->interData)-><wbr>partSize[count], partSize[d], bytes);<br>
-                int numPU = (modeBuf[d] == MODE_INTRA) ? 1 : nbPartsTable[(int)partSize[d]]<wbr>;<br>
-                for (int pu = 0; pu < numPU; pu++)<br>
+                if (!depthBuf[d]) //copy data of one 64x64 to four scaled 64x64 CTUs.<br>
                 {<br>
-                    if (pu) d++;<br>
-                    ((analysis_inter_data *)analysis->interData)-><wbr>mergeFlag[count + pu] = mergeFlag[d];<br>
-                    if (m_param->analysisReuseLevel == 10)<br>
+                    isScaledMaxCUSize = true;<br>
+                    bytes /= 4;<br>
+                    numCTUCopied = 4;<br>
+                }<br>
+                if ((modeBuf[d] != MODE_INTRA && depthBuf[d] != 0) || (modeBuf[d] == MODE_INTRA && depthBuf[d] > 1))<br>
+                    writeDepth--;<br>
+            }<br>
+<br>
+            for (int numCTU = 0; numCTU < numCTUCopied; numCTU++)<br>
+            {<br>
+                memset(&((analysis_inter_data *)analysis->interData)->depth[<wbr>count], writeDepth, bytes);<br>
+                memset(&((analysis_inter_data *)analysis->interData)->modes[<wbr>count], modeBuf[d], bytes);<br>
+                if (m_param->analysisReuseLevel == 10 && bIntraInInter)<br>
+                    memset(&((analysis_intra_data *)analysis->intraData)-><wbr>chromaModes[count], chromaDir[d], bytes);<br>
+<br>
+                if (m_param->analysisReuseLevel > 4)<br>
+                {<br>
+                    puOrientation puOrient;<br>
+                    puOrient.init();<br>
+                    if (m_param->scaleFactor && modeBuf[d] == MODE_INTRA && partSize[d] == SIZE_NxN)<br>
+                        partSize[d] = SIZE_2Nx2N;<br>
+                    int partitionSize = partSize[d];<br>
+                    if (isScaledMaxCUSize && partSize[d] != SIZE_2Nx2N)<br>
+                        partitionSize = getPuShape(&puOrient, partSize[d], numCTU);<br>
+                    memset(&((analysis_inter_data *)analysis->interData)-><wbr>partSize[count], partitionSize, bytes);<br>
+                    int numPU = (modeBuf[d] == MODE_INTRA) ? 1 : nbPartsTable[(int)partSize[d]]<wbr>;<br>
+                    for (int pu = 0; pu < numPU; pu++)<br>
                     {<br>
-                        ((analysis_inter_data *)analysis->interData)-><wbr>interDir[count + pu] = interDir[d];<br>
-                        for (uint32_t i = 0; i < numDir; i++)<br>
+                        if (!isScaledMaxCUSize && pu)<br>
+                            d++;<br>
+                        int restoreD = d;<br>
+                        /* Adjust d value when the current CTU takes data from 2nd PU */<br>
+                        if (puOrient.isRect || (puOrient.isAmp && partitionSize == SIZE_2Nx2N))<br>
                         {<br>
-                            ((analysis_inter_data *)analysis->interData)-><wbr>mvpIdx[i][count + pu] = mvpIdx[i][d];<br>
-                            ((analysis_inter_data *)analysis->interData)-><wbr>refIdx[i][count + pu] = refIdx[i][d];<br>
-                            if (m_param->scaleFactor)<br>
+                            if ((numCTU > 1 && !puOrient.isVert) || ((numCTU % 2 == 1) && puOrient.isVert))<br>
+                                d++;<br>
+                        }<br>
+                        if (puOrient.isAmp && pu)<br>
+                            d++;<br>
+<br>
+                        ((analysis_inter_data *)analysis->interData)-><wbr>mergeFlag[count + pu] = mergeFlag[d];<br>
+                        if (m_param->analysisReuseLevel == 10)<br>
+                        {<br>
+                            ((analysis_inter_data *)analysis->interData)-><wbr>interDir[count + pu] = interDir[d];<br>
+                            MV mvCopy[2];<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_inter_data *)analysis->interData)-><wbr>mvpIdx[i][count + pu] = mvpIdx[i][d];<br>
+                                ((analysis_inter_data *)analysis->interData)-><wbr>refIdx[i][count + pu] = refIdx[i][d];<br>
+                                mvCopy[i].x = mv[i][d].x;<br>
+                                mvCopy[i].y = mv[i][d].y;<br>
+                                if (m_param->scaleFactor)<br>
+                                {<br>
+                                    mvCopy[i].x = mv[i][d].x * (int16_t)m_param->scaleFactor;<br>
+                                    mvCopy[i].y = mv[i][d].y * (int16_t)m_param->scaleFactor;<br>
+                                }<br>
+                                memcpy(&((analysis_inter_data *)analysis->interData)->mv[i][<wbr>count + pu], &mvCopy[i], sizeof(MV));<br>
                             }<br>
-                            memcpy(&((analysis_inter_data *)analysis->interData)->mv[i][<wbr>count + pu], &mv[i][d], sizeof(MV));<br>
+                        }<br>
+                        d = restoreD; // Restore d value after copying each of the 4 64x64 CTUs<br>
+<br>
+                        if (isScaledMaxCUSize && (puOrient.isRect || puOrient.isAmp))<br>
+                        {<br>
+                            /* Skip PU index when current CTU is a 2Nx2N */<br>
+                            if (partitionSize == SIZE_2Nx2N)<br>
+                                pu++;<br>
+                            /* Adjust d after completion of all 4 CTU copies */<br>
+                            if (numCTU == 3 && (pu == (numPU - 1)))<br>
+                                d++;<br>
                         }<br>
                     }<br>
                 }<br>
-                if (m_param->analysisReuseLevel == 10 && bIntraInInter)<br>
-                    memset(&((analysis_intra_data *)analysis->intraData)-><wbr>chromaModes[count], chromaDir[d], bytes);<br>
+                count += bytes;<br>
+                if (m_param->scaleFactor)<br>
+                    d += getCUIndex(&cuLoc, &count, bytes, 1);<br>
             }<br>
-            count += bytes;<br>
         }<br>
<br>
         X265_FREE(tempBuf);<br>
@@ -3509,10 +3604,18 @@<br>
                 }<br>
                 else<br>
                 {<br>
+                    cuLoc.evenRowIndex = 0;<br>
+                    cuLoc.oddRowIndex = m_param->num4x4Partitions * cuLoc.widthInCU;<br>
+                    cuLoc.switchCondition = 0;<br>
                     uint8_t *tempLumaBuf = X265_MALLOC(uint8_t, analysis->numCUsInFrame * scaledNumPartition);<br>
                     X265_FREAD(tempLumaBuf, sizeof(uint8_t), analysis->numCUsInFrame * scaledNumPartition, m_analysisFileIn, intraPic->modes);<br>
-                    for (uint32_t ctu32Idx = 0, cnt = 0; ctu32Idx < analysis->numCUsInFrame * scaledNumPartition; ctu32Idx++, cnt += factor)<br>
+                    uint32_t cnt = 0;<br>
+                    for (uint32_t ctu32Idx = 0; ctu32Idx < analysis->numCUsInFrame * scaledNumPartition; ctu32Idx++)<br>
+                    {<br>
                         memset(&((analysis_intra_data *)analysis->intraData)->modes[<wbr>cnt], tempLumaBuf[ctu32Idx], factor);<br>
+                        cnt += factor;<br>
+                        ctu32Idx += getCUIndex(&cuLoc, &cnt, factor, 0);<br>
+                    }<br>
                     X265_FREE(tempLumaBuf);<br>
                 }<br>
             }<br>
@@ -3524,9 +3627,123 @@<br>
         if (numDir == 1)<br>
             totalConsumedBytes = consumedBytes;<br>
     }<br>
+<br>
+    /* Restore to the current encode's numPartitions and numCUsInFrame */<br>
+    if (m_param->scaleFactor)<br>
+    {<br>
+        analysis->numPartitions = m_param->num4x4Partitions;<br>
+        analysis->numCUsInFrame = cuLoc.heightInCU * cuLoc.widthInCU;<br>
+    }<br>
 #undef X265_FREAD<br>
 }<br>
<br>
+/* Toggle between two consecutive CTU rows. The save's CTU is copied<br>
+twice consecutively in the first and second CTU row of load*/<br>
+<br>
+int Encoder::getCUIndex(<wbr>cuLocation* cuLoc, uint32_t* count, int bytes, int flag)<br>
+{<br>
+    int index = 0;<br>
+    cuLoc->switchCondition += bytes;<br>
+    int isBoundaryW = (*count % (m_param->num4x4Partitions * cuLoc->widthInCU) == 0);<br>
+<br>
+    /* Width boundary case :<br>
+    Skip to appropriate index when out of boundary cases occur<br>
+    Out of boundary may occur when the out of bound pixels along<br>
+    the width in low resoultion is greater than half of the maxCUSize */<br>
+    if (cuLoc->skipWidth && isBoundaryW)<br>
+    {<br>
+        if (flag)<br>
+            index++;<br>
+        else<br>
+        {<br>
+            /* Number of 4x4 blocks in out of bound region */<br>
+            int outOfBound = m_param->maxCUSize / 2;<br>
+            uint32_t sum = (uint32_t)pow((outOfBound >> 2), 2);<br>
+            index += sum;<br>
+        }<br>
+        cuLoc->switchCondition += m_param->num4x4Partitions;<br>
+    }<br>
+<br>
+    /* Completed writing 2 CTUs - move to the last remembered index of the next CTU row*/<br>
+    if (cuLoc->switchCondition == 2 * m_param->num4x4Partitions)<br>
+    {<br>
+        if (isBoundaryW)<br>
+            cuLoc->evenRowIndex = *count + (m_param->num4x4Partitions * cuLoc->widthInCU); // end of row - skip to the next even row<br>
+        else<br>
+            cuLoc->evenRowIndex = *count;<br>
+        *count = cuLoc->oddRowIndex;<br>
+<br>
+        /* Height boundary case :<br>
+        Skip to appropriate index when out of boundary cases occur<br>
+        Out of boundary may occur when the out of bound pixels along<br>
+        the height in low resoultion is greater than half of the maxCUSize */<br>
+        int isBoundaryH = (*count >= (m_param->num4x4Partitions * cuLoc->heightInCU * cuLoc->widthInCU));<br>
+        if (cuLoc->skipHeight && isBoundaryH)<br>
+        {<br>
+            if (flag)<br>
+                index += 2;<br>
+            else<br>
+            {<br>
+                int outOfBound = m_param->maxCUSize / 2;<br>
+                uint32_t sum = (uint32_t)(2 * pow((abs(outOfBound) >> 2), 2));<br>
+                index += sum;<br>
+            }<br>
+            *count = cuLoc->evenRowIndex;<br>
+            cuLoc->switchCondition = 0;<br>
+        }<br>
+    }<br>
+    /* Completed writing 4 CTUs - move to the last remembered index of<br>
+    the previous CTU row to copy the next save CTU's data*/<br>
+    else if (cuLoc->switchCondition == 4 * m_param->num4x4Partitions)<br>
+    {<br>
+        if (isBoundaryW)<br>
+            cuLoc->oddRowIndex = *count + (m_param->num4x4Partitions * cuLoc->widthInCU); // end of row - skip to the next odd row<br>
+        else<br>
+            cuLoc->oddRowIndex = *count;<br>
+        *count = cuLoc->evenRowIndex;<br>
+        cuLoc->switchCondition = 0;<br>
+    }<br>
+    return index;<br>
+}<br>
+<br>
+/*      save                        load<br>
+                       CTU0    CTU1    CTU2    CTU3<br>
+        2NxN          2Nx2N   2Nx2N   2Nx2N   2Nx2N<br>
+        NX2N          2Nx2N   2Nx2N   2Nx2N   2Nx2N<br>
+        2NxnU          2NxN    2NxN   2Nx2N   2Nx2N<br>
+        2NxnD         2Nx2N   2Nx2N    2NxN    2NxN<br>
+        nLx2N          Nx2N   2Nx2N    Nx2N   2Nx2N<br>
+        nRx2N         2Nx2N    Nx2N    2Nx2N   Nx2N<br>
+*/<br>
+int Encoder::getPuShape(<wbr>puOrientation* puOrient, int partSize, int numCTU)<br>
+{<br>
+    puOrient->isRect = true;<br>
+    if (partSize == SIZE_Nx2N)<br>
+        puOrient->isVert = true;<br>
+    if (partSize >= SIZE_2NxnU) // All AMP modes<br>
+    {<br>
+        puOrient->isAmp = true;<br>
+        puOrient->isRect = false;<br>
+        if (partSize == SIZE_2NxnD && numCTU > 1)<br>
+            return SIZE_2NxN;<br>
+        else if (partSize == SIZE_2NxnU && numCTU < 2)<br>
+            return SIZE_2NxN;<br>
+        else if (partSize == SIZE_nLx2N)<br>
+        {<br>
+            puOrient->isVert = true;<br>
+            if (!(numCTU % 2))<br>
+                return SIZE_Nx2N;<br>
+        }<br>
+        else if (partSize == SIZE_nRx2N)<br>
+        {<br>
+            puOrient->isVert = true;<br>
+            if (numCTU % 2)<br>
+                return SIZE_Nx2N;<br>
+        }<br>
+    }<br>
+    return SIZE_2Nx2N;<br>
+}<br>
+<br>
 void Encoder::<wbr>readAnalysis2PassFile(x265_<wbr>analysis_2Pass* analysis2Pass, int curPoc, int sliceType)<br>
 {<br>
<br>
diff -r 0b781d592c8e -r ce647bfa20e2 source/encoder/encoder.h<br>
--- a/source/encoder/encoder.h  Mon Mar 05 11:24:22 2018 +0530<br>
+++ b/source/encoder/encoder.h  Wed Feb 28 11:09:18 2018 +0530<br>
@@ -90,6 +90,43 @@<br>
     RPSListNode* prior;<br>
 };<br>
<br>
+struct cuLocation<br>
+{<br>
+    bool skipWidth;<br>
+    bool skipHeight;<br>
+    uint32_t heightInCU;<br>
+    uint32_t widthInCU;<br>
+    uint32_t oddRowIndex;<br>
+    uint32_t evenRowIndex;<br>
+    uint32_t switchCondition;<br>
+<br>
+    void init(x265_param* param)<br>
+    {<br>
+        skipHeight = false;<br>
+        skipWidth = false;<br>
+        heightInCU = (param->sourceHeight + param->maxCUSize - 1) >> param->maxLog2CUSize;<br>
+        widthInCU = (param->sourceWidth + param->maxCUSize - 1) >> param->maxLog2CUSize;<br>
+        evenRowIndex = 0;<br>
+        oddRowIndex = param->num4x4Partitions * widthInCU;<br>
+        switchCondition = 0; // To switch between odd and even rows<br>
+    }<br>
+};<br>
+<br>
+struct puOrientation<br>
+{<br>
+    bool isVert;<br>
+    bool isRect;<br>
+    bool isAmp;<br>
+<br>
+    void init()<br>
+    {<br>
+        isRect = false;<br>
+        isAmp = false;<br>
+        isVert = false;<br>
+    }<br>
+};<br>
+<br>
+<br>
 class FrameEncoder;<br>
 class DPB;<br>
 class Lookahead;<br>
@@ -237,6 +274,10 @@<br>
<br>
     void readAnalysisFile(x265_<wbr>analysis_data* analysis, int poc, const x265_picture* picIn);<br>
<br>
+    int getCUIndex(cuLocation* cuLoc, uint32_t* count, int bytes, int flag);<br>
+<br>
+    int getPuShape(puOrientation* puOrient, int partSize, int numCTU);<br>
+<br>
     void writeAnalysisFile(x265_<wbr>analysis_data* pic, FrameData &curEncData);<br>
     void readAnalysis2PassFile(x265_<wbr>analysis_2Pass* analysis2Pass, int poc, int sliceType);<br>
     void writeAnalysis2PassFile(x265_<wbr>analysis_2Pass* analysis2Pass, FrameData &curEncData, int slicetype);<br>
<br>______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br></blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Pushed.</div></div>