<div dir="ltr">Pushed into Release_3.1 and grafted to default.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 10, 2019 at 11:27 AM Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com">aruna@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 Aruna Matheswaran<br>
# Date 1567490246 -19800<br>
#      Tue Sep 03 11:27:26 2019 +0530<br>
# Node ID 55bc4aa1433c01c99002e702bc49e572399cbd32<br>
# Parent  a092e82e6acfe7afe6a9a381e9ef52323e4e2467<br>
2-pass: Fix incorrect weighted prediction when cu-tree is enabled<br>
<br>
diff -r a092e82e6acf -r 55bc4aa1433c source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp      Thu Aug 01 22:55:21 2019 +0200<br>
+++ b/source/encoder/slicetype.cpp      Tue Sep 03 11:27:26 2019 +0530<br>
@@ -437,175 +437,178 @@<br>
         curFrame->m_lowres.wp_sum[y] = 0;<br>
     }<br>
<br>
-    /* Calculate Qp offset for each 16x16 or 8x8 block in the frame */    <br>
-    if ((param->rc.aqMode == X265_AQ_NONE || param->rc.aqStrength == 0) || (param->rc.bStatRead && param->rc.cuTree && IS_REFERENCED(curFrame)))<br>
-    {<br>
-        if (param->rc.aqMode && param->rc.aqStrength == 0)<br>
-        {<br>
-            if (quantOffsets)<br>
+       if (!(param->rc.bStatRead && param->rc.cuTree && IS_REFERENCED(curFrame)))<br>
+       {<br>
+               /* Calculate Qp offset for each 16x16 or 8x8 block in the frame */<br>
+               if (param->rc.aqMode == X265_AQ_NONE || param->rc.aqStrength == 0)<br>
+               {<br>
+                       if (param->rc.aqMode && param->rc.aqStrength == 0)<br>
+                       {<br>
+                               if (quantOffsets)<br>
+                               {<br>
+                                       for (int cuxy = 0; cuxy < blockCount; cuxy++)<br>
+                                       {<br>
+                                               curFrame->m_lowres.qpCuTreeOffset[cuxy] = curFrame->m_lowres.qpAqOffset[cuxy] = quantOffsets[cuxy];<br>
+                                               curFrame->m_lowres.invQscaleFactor[cuxy] = x265_exp2fix8(curFrame->m_lowres.qpCuTreeOffset[cuxy]);<br>
+                                       }<br>
+                               }<br>
+                               else<br>
+                               {<br>
+                                       memset(curFrame->m_lowres.qpCuTreeOffset, 0, blockCount * sizeof(double));<br>
+                                       memset(curFrame->m_lowres.qpAqOffset, 0, blockCount * sizeof(double));<br>
+                                       for (int cuxy = 0; cuxy < blockCount; cuxy++)<br>
+                                               curFrame->m_lowres.invQscaleFactor[cuxy] = 256;<br>
+                               }<br>
+                       }<br>
+<br>
+            /* Need variance data for weighted prediction and dynamic refinement*/<br>
+            if (param->bEnableWeightedPred || param->bEnableWeightedBiPred)<br>
             {<br>
-                for (int cuxy = 0; cuxy < blockCount; cuxy++)<br>
-                {<br>
-                    curFrame->m_lowres.qpCuTreeOffset[cuxy] = curFrame->m_lowres.qpAqOffset[cuxy] = quantOffsets[cuxy];<br>
-                    curFrame->m_lowres.invQscaleFactor[cuxy] = x265_exp2fix8(curFrame->m_lowres.qpCuTreeOffset[cuxy]);<br>
-                }<br>
-            }<br>
-            else<br>
-            {<br>
-               memset(curFrame->m_lowres.qpCuTreeOffset, 0, blockCount * sizeof(double));<br>
-               memset(curFrame->m_lowres.qpAqOffset, 0, blockCount * sizeof(double));<br>
-               for (int cuxy = 0; cuxy < blockCount; cuxy++)<br>
-                   curFrame->m_lowres.invQscaleFactor[cuxy] = 256;<br>
+                for (int blockY = 0; blockY < maxRow; blockY += loopIncr)<br>
+                    for (int blockX = 0; blockX < maxCol; blockX += loopIncr)<br>
+                        acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>
             }<br>
-        }<br>
-<br>
-        /* Need variance data for weighted prediction and dynamic refinement*/<br>
-        if (param->bEnableWeightedPred || param->bEnableWeightedBiPred)<br>
-        {<br>
-            for (int blockY = 0; blockY < maxRow; blockY += loopIncr)<br>
-                for (int blockX = 0; blockX < maxCol; blockX += loopIncr)<br>
-                    acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>
-        }<br>
-    }<br>
-    else<br>
-    {<br>
-        if (param->rc.hevcAq)<br>
-        {<br>
-            // New method for calculating variance and qp offset<br>
-            xPreanalyze(curFrame);<br>
-        }<br>
-        else<br>
-        {<br>
+               }<br>
+               else<br>
+               {<br>
+                       if (param->rc.hevcAq)<br>
+                       {<br>
+                               // New method for calculating variance and qp offset<br>
+                               xPreanalyze(curFrame);<br>
+                       }<br>
+                       else<br>
+                       {<br>
 #define AQ_EDGE_BIAS 0.5<br>
 #define EDGE_INCLINATION 45<br>
-            uint32_t numCuInHeight = (maxRow + param->maxCUSize - 1) / param->maxCUSize;<br>
-            int maxHeight = numCuInHeight * param->maxCUSize;<br>
-            intptr_t stride = curFrame->m_fencPic->m_stride;<br>
-            pixel *edgePic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));<br>
-            pixel *gaussianPic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));<br>
-            pixel *thetaPic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));<br>
-            memset(edgePic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));<br>
-            memset(gaussianPic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));<br>
-            memset(thetaPic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));<br>
-            if (param->rc.aqMode == X265_AQ_EDGE)<br>
-                edgeFilter(curFrame, edgePic, gaussianPic, thetaPic, stride, maxRow, maxCol);<br>
-<br>
-            int blockXY = 0, inclinedEdge = 0;<br>
-            double avg_adj_pow2 = 0, avg_adj = 0, qp_adj = 0;<br>
-            double bias_strength = 0.f;<br>
-            double strength = 0.f;<br>
-            if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE || param->rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED || param->rc.aqMode == X265_AQ_EDGE)<br>
-            {<br>
-                double bit_depth_correction = 1.f / (1 << (2 * (X265_DEPTH - 8)));<br>
-                for (int blockY = 0; blockY < maxRow; blockY += loopIncr)<br>
-                {<br>
-                    for (int blockX = 0; blockX < maxCol; blockX += loopIncr)<br>
-                    {<br>
-                        uint32_t energy, edgeDensity, avgAngle;<br>
-                        energy = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>
-                        if (param->rc.aqMode == X265_AQ_EDGE)<br>
-                        {<br>
-                            pixel *edgeImage = edgePic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;<br>
-                            pixel *edgeTheta = thetaPic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;<br>
-                            edgeDensity = edgeDensityCu(curFrame, edgeImage, edgeTheta, avgAngle, blockX, blockY, param->rc.qgSize);<br>
-                            if (edgeDensity)<br>
-                            {<br>
-                                qp_adj = pow(edgeDensity * bit_depth_correction + 1, 0.1);<br>
-                                //Increasing the QP of a block if its edge orientation lies around the multiples of 45 degree<br>
-                                if ((avgAngle >= EDGE_INCLINATION - 15 && avgAngle <= EDGE_INCLINATION + 15) || (avgAngle >= EDGE_INCLINATION + 75 && avgAngle <= EDGE_INCLINATION + 105))<br>
-                                    curFrame->m_lowres.edgeInclined[blockXY] = 1;<br>
-                                else<br>
-                                    curFrame->m_lowres.edgeInclined[blockXY] = 0;<br>
-                            }<br>
-                            else<br>
-                            {<br>
-                                qp_adj = pow(energy * bit_depth_correction + 1, 0.1);<br>
-                                curFrame->m_lowres.edgeInclined[blockXY] = 0;<br>
-                            }<br>
-                        }<br>
-                        else<br>
-                            qp_adj = pow(energy * bit_depth_correction + 1, 0.1);<br>
-                        curFrame->m_lowres.qpCuTreeOffset[blockXY] = qp_adj;<br>
-                        avg_adj += qp_adj;<br>
-                        avg_adj_pow2 += qp_adj * qp_adj;<br>
-                        blockXY++;<br>
-                    }<br>
-                }<br>
-                avg_adj /= blockCount;<br>
-                avg_adj_pow2 /= blockCount;<br>
-                strength = param->rc.aqStrength * avg_adj;<br>
-                avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - modeTwoConst) / avg_adj;<br>
-                bias_strength = param->rc.aqStrength;<br>
-            }<br>
-            else<br>
-                strength = param->rc.aqStrength * 1.0397f;<br>
-<br>
-            X265_FREE(edgePic);<br>
-            X265_FREE(gaussianPic);<br>
-            X265_FREE(thetaPic);<br>
-            blockXY = 0;<br>
-            for (int blockY = 0; blockY < maxRow; blockY += loopIncr)<br>
-            {<br>
-                for (int blockX = 0; blockX < maxCol; blockX += loopIncr)<br>
-                {<br>
-                    if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED)<br>
-                    {<br>
-                        qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>
-                        qp_adj = strength * (qp_adj - avg_adj) + bias_strength * (1.f - modeTwoConst / (qp_adj * qp_adj));<br>
-                    }<br>
-                    else if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE)<br>
-                    {<br>
-                        qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>
-                        qp_adj = strength * (qp_adj - avg_adj);<br>
-                    }<br>
-                    else if (param->rc.aqMode == X265_AQ_EDGE)<br>
-                    {<br>
-                        inclinedEdge = curFrame->m_lowres.edgeInclined[blockXY];<br>
-                        qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>
-                        if(inclinedEdge && (qp_adj - avg_adj > 0))<br>
-                            qp_adj = ((strength + AQ_EDGE_BIAS) * (qp_adj - avg_adj));<br>
-                        else<br>
-                            qp_adj = strength * (qp_adj - avg_adj);<br>
-                    }<br>
-                    else<br>
-                    {<br>
-                        uint32_t energy = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>
-                        qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - (modeOneConst + 2 * (X265_DEPTH - 8)));<br>
-                    }<br>
-<br>
-                    if (param->bHDROpt)<br>
-                    {<br>
-                        uint32_t sum = lumaSumCu(curFrame, blockX, blockY, param->rc.qgSize);<br>
-                        uint32_t lumaAvg = sum / (loopIncr * loopIncr);<br>
-                        if (lumaAvg < 301)<br>
-                            qp_adj += 3;<br>
-                        else if (lumaAvg >= 301 && lumaAvg < 367)<br>
-                            qp_adj += 2;<br>
-                        else if (lumaAvg >= 367 && lumaAvg < 434)<br>
-                            qp_adj += 1;<br>
-                        else if (lumaAvg >= 501 && lumaAvg < 567)<br>
-                            qp_adj -= 1;<br>
-                        else if (lumaAvg >= 567 && lumaAvg < 634)<br>
-                            qp_adj -= 2;<br>
-                        else if (lumaAvg >= 634 && lumaAvg < 701)<br>
-                            qp_adj -= 3;<br>
-                        else if (lumaAvg >= 701 && lumaAvg < 767)<br>
-                            qp_adj -= 4;<br>
-                        else if (lumaAvg >= 767 && lumaAvg < 834)<br>
-                            qp_adj -= 5;<br>
-                        else if (lumaAvg >= 834)<br>
-                            qp_adj -= 6;<br>
-                    }<br>
-                    if (quantOffsets != NULL)<br>
-                        qp_adj += quantOffsets[blockXY];<br>
-                    curFrame->m_lowres.qpAqOffset[blockXY] = qp_adj;<br>
-                    curFrame->m_lowres.qpCuTreeOffset[blockXY] = qp_adj;<br>
-                    curFrame->m_lowres.invQscaleFactor[blockXY] = x265_exp2fix8(qp_adj);<br>
-                    blockXY++;<br>
-                }<br>
-            }<br>
-        }<br>
-    }<br>
+                               uint32_t numCuInHeight = (maxRow + param->maxCUSize - 1) / param->maxCUSize;<br>
+                               int maxHeight = numCuInHeight * param->maxCUSize;<br>
+                               intptr_t stride = curFrame->m_fencPic->m_stride;<br>
+                               pixel *edgePic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));<br>
+                               pixel *gaussianPic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));<br>
+                               pixel *thetaPic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));<br>
+                               memset(edgePic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));<br>
+                               memset(gaussianPic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));<br>
+                               memset(thetaPic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));<br>
+                               if (param->rc.aqMode == X265_AQ_EDGE)<br>
+                                       edgeFilter(curFrame, edgePic, gaussianPic, thetaPic, stride, maxRow, maxCol);<br>
+<br>
+                               int blockXY = 0, inclinedEdge = 0;<br>
+                               double avg_adj_pow2 = 0, avg_adj = 0, qp_adj = 0;<br>
+                               double bias_strength = 0.f;<br>
+                               double strength = 0.f;<br>
+                               if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE || param->rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED || param->rc.aqMode == X265_AQ_EDGE)<br>
+                               {<br>
+                                       double bit_depth_correction = 1.f / (1 << (2 * (X265_DEPTH - 8)));<br>
+                                       for (int blockY = 0; blockY < maxRow; blockY += loopIncr)<br>
+                                       {<br>
+                                               for (int blockX = 0; blockX < maxCol; blockX += loopIncr)<br>
+                                               {<br>
+                                                       uint32_t energy, edgeDensity, avgAngle;<br>
+                                                       energy = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>
+                                                       if (param->rc.aqMode == X265_AQ_EDGE)<br>
+                                                       {<br>
+                                                               pixel *edgeImage = edgePic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;<br>
+                                                               pixel *edgeTheta = thetaPic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;<br>
+                                                               edgeDensity = edgeDensityCu(curFrame, edgeImage, edgeTheta, avgAngle, blockX, blockY, param->rc.qgSize);<br>
+                                                               if (edgeDensity)<br>
+                                                               {<br>
+                                                                       qp_adj = pow(edgeDensity * bit_depth_correction + 1, 0.1);<br>
+                                                                       //Increasing the QP of a block if its edge orientation lies around the multiples of 45 degree<br>
+                                                                       if ((avgAngle >= EDGE_INCLINATION - 15 && avgAngle <= EDGE_INCLINATION + 15) || (avgAngle >= EDGE_INCLINATION + 75 && avgAngle <= EDGE_INCLINATION + 105))<br>
+                                                                               curFrame->m_lowres.edgeInclined[blockXY] = 1;<br>
+                                                                       else<br>
+                                                                               curFrame->m_lowres.edgeInclined[blockXY] = 0;<br>
+                                                               }<br>
+                                                               else<br>
+                                                               {<br>
+                                                                       qp_adj = pow(energy * bit_depth_correction + 1, 0.1);<br>
+                                                                       curFrame->m_lowres.edgeInclined[blockXY] = 0;<br>
+                                                               }<br>
+                                                       }<br>
+                                                       else<br>
+                                                               qp_adj = pow(energy * bit_depth_correction + 1, 0.1);<br>
+                                                       curFrame->m_lowres.qpCuTreeOffset[blockXY] = qp_adj;<br>
+                                                       avg_adj += qp_adj;<br>
+                                                       avg_adj_pow2 += qp_adj * qp_adj;<br>
+                                                       blockXY++;<br>
+                                               }<br>
+                                       }<br>
+                                       avg_adj /= blockCount;<br>
+                                       avg_adj_pow2 /= blockCount;<br>
+                                       strength = param->rc.aqStrength * avg_adj;<br>
+                                       avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - modeTwoConst) / avg_adj;<br>
+                                       bias_strength = param->rc.aqStrength;<br>
+                               }<br>
+                               else<br>
+                                       strength = param->rc.aqStrength * 1.0397f;<br>
+<br>
+                               X265_FREE(edgePic);<br>
+                               X265_FREE(gaussianPic);<br>
+                               X265_FREE(thetaPic);<br>
+                               blockXY = 0;<br>
+                               for (int blockY = 0; blockY < maxRow; blockY += loopIncr)<br>
+                               {<br>
+                                       for (int blockX = 0; blockX < maxCol; blockX += loopIncr)<br>
+                                       {<br>
+                                               if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED)<br>
+                                               {<br>
+                                                       qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>
+                                                       qp_adj = strength * (qp_adj - avg_adj) + bias_strength * (1.f - modeTwoConst / (qp_adj * qp_adj));<br>
+                                               }<br>
+                                               else if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE)<br>
+                                               {<br>
+                                                       qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>
+                                                       qp_adj = strength * (qp_adj - avg_adj);<br>
+                                               }<br>
+                                               else if (param->rc.aqMode == X265_AQ_EDGE)<br>
+                                               {<br>
+                                                       inclinedEdge = curFrame->m_lowres.edgeInclined[blockXY];<br>
+                                                       qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];<br>
+                                                       if (inclinedEdge && (qp_adj - avg_adj > 0))<br>
+                                                               qp_adj = ((strength + AQ_EDGE_BIAS) * (qp_adj - avg_adj));<br>
+                                                       else<br>
+                                                               qp_adj = strength * (qp_adj - avg_adj);<br>
+                                               }<br>
+                                               else<br>
+                                               {<br>
+                                                       uint32_t energy = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>
+                                                       qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - (modeOneConst + 2 * (X265_DEPTH - 8)));<br>
+                                               }<br>
+<br>
+                                               if (param->bHDROpt)<br>
+                                               {<br>
+                                                       uint32_t sum = lumaSumCu(curFrame, blockX, blockY, param->rc.qgSize);<br>
+                                                       uint32_t lumaAvg = sum / (loopIncr * loopIncr);<br>
+                                                       if (lumaAvg < 301)<br>
+                                                               qp_adj += 3;<br>
+                                                       else if (lumaAvg >= 301 && lumaAvg < 367)<br>
+                                                               qp_adj += 2;<br>
+                                                       else if (lumaAvg >= 367 && lumaAvg < 434)<br>
+                                                               qp_adj += 1;<br>
+                                                       else if (lumaAvg >= 501 && lumaAvg < 567)<br>
+                                                               qp_adj -= 1;<br>
+                                                       else if (lumaAvg >= 567 && lumaAvg < 634)<br>
+                                                               qp_adj -= 2;<br>
+                                                       else if (lumaAvg >= 634 && lumaAvg < 701)<br>
+                                                               qp_adj -= 3;<br>
+                                                       else if (lumaAvg >= 701 && lumaAvg < 767)<br>
+                                                               qp_adj -= 4;<br>
+                                                       else if (lumaAvg >= 767 && lumaAvg < 834)<br>
+                                                               qp_adj -= 5;<br>
+                                                       else if (lumaAvg >= 834)<br>
+                                                               qp_adj -= 6;<br>
+                                               }<br>
+                                               if (quantOffsets != NULL)<br>
+                                                       qp_adj += quantOffsets[blockXY];<br>
+                                               curFrame->m_lowres.qpAqOffset[blockXY] = qp_adj;<br>
+                                               curFrame->m_lowres.qpCuTreeOffset[blockXY] = qp_adj;<br>
+                                               curFrame->m_lowres.invQscaleFactor[blockXY] = x265_exp2fix8(qp_adj);<br>
+                                               blockXY++;<br>
+                                       }<br>
+                               }<br>
+                       }<br>
+               }<br>
+       }<br>
<br>
     if (param->rc.qgSize == 8)<br>
     {<br>
@@ -624,6 +627,11 @@<br>
<br>
     if (param->bEnableWeightedPred || param->bEnableWeightedBiPred)<br>
     {<br>
+               if (param->rc.bStatRead && param->rc.cuTree && IS_REFERENCED(curFrame))<br>
+                   for (int blockY = 0; blockY < maxRow; blockY += loopIncr)<br>
+                           for (int blockX = 0; blockX < maxCol; blockX += loopIncr)<br>
+                                   acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);<br>
+<br>
         int hShift = CHROMA_H_SHIFT(param->internalCsp);<br>
         int vShift = CHROMA_V_SHIFT(param->internalCsp);<br>
         maxCol = ((maxCol + 8) >> 4) << 4;<br>
@@ -1356,9 +1364,7 @@<br>
         ProfileScopeEvent(prelookahead);<br>
         m_lock.release();<br>
         preFrame->m_lowres.init(preFrame->m_fencPic, preFrame->m_poc);<br>
-        if (m_lookahead.m_param->rc.bStatRead && m_lookahead.m_param->rc.cuTree && IS_REFERENCED(preFrame))<br>
-            /* cu-tree offsets were read from stats file */;<br>
-        else if (m_lookahead.m_bAdaptiveQuant)<br>
+        if (m_lookahead.m_bAdaptiveQuant)<br>
             tld.calcAdaptiveQuantFrame(preFrame, m_lookahead.m_param);<br>
         tld.lowresIntraEstimate(preFrame->m_lowres, m_lookahead.m_param->rc.qgSize);<br>
         preFrame->m_lowresInit = true;<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><font face="georgia, serif">Regards,</font><div><font face="georgia, serif">Aruna</font></div></div></div>