[x265] [PATCH] fix bug in copying vbv information when scalefactor is 0

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Tue May 29 13:45:50 CEST 2018


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1527499557 -19800
#      Mon May 28 14:55:57 2018 +0530
# Branch stable
# Node ID fe3c44a200eeb3c1bdf9467071cd593e94959866
# Parent  478bfe2b7673e93ca9283a4ce9424ac3a1ba476e
fix bug in copying vbv information when scalefactor is 0

diff -r 478bfe2b7673 -r fe3c44a200ee source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Mon May 21 14:05:52 2018 +0530
+++ b/source/encoder/encoder.cpp	Mon May 28 14:55:57 2018 +0530
@@ -3408,24 +3408,28 @@
     allocAnalysis(analysis);
     if (m_param->bDisableLookahead && m_rateControl->m_isVbv)
     {
+        int vbvCount = m_param->lookaheadDepth + m_param->bframes + 2;
         X265_FREAD(analysis->lookahead.intraVbvCost, sizeof(uint32_t), analysis->numCUsInFrame, m_analysisFileIn, picData->lookahead.intraVbvCost);
         X265_FREAD(analysis->lookahead.vbvCost, sizeof(uint32_t), analysis->numCUsInFrame, m_analysisFileIn, picData->lookahead.vbvCost);
         X265_FREAD(analysis->lookahead.satdForVbv, sizeof(uint32_t), analysis->numCuInHeight, m_analysisFileIn, picData->lookahead.satdForVbv);
         X265_FREAD(analysis->lookahead.intraSatdForVbv, sizeof(uint32_t), analysis->numCuInHeight, m_analysisFileIn, picData->lookahead.intraSatdForVbv);
-
-        int vbvCount = m_param->lookaheadDepth + m_param->bframes + 2;
-        for (int index = 0; index < vbvCount; index++)
-            analysis->lookahead.plannedSatd[index] = picData->lookahead.plannedSatd[index] * (2 * m_param->scaleFactor);
-
-        for (uint32_t i = 0; i < analysis->numCuInHeight; i++)
+        X265_FREAD(analysis->lookahead.plannedSatd, sizeof(int64_t), vbvCount, m_analysisFileIn, picData->lookahead.plannedSatd);
+
+        if (m_param->scaleFactor)
         {
-            analysis->lookahead.satdForVbv[i] = analysis->lookahead.satdForVbv[i] * (2* m_param->scaleFactor);
-            analysis->lookahead.intraSatdForVbv[i] = analysis->lookahead.intraSatdForVbv[i] * (2 * m_param->scaleFactor);
-        }
-        for (uint32_t i = 0; i < analysis->numCUsInFrame; i++)
-        {
-            analysis->lookahead.vbvCost[i] = analysis->lookahead.vbvCost[i] * (2 * m_param->scaleFactor);
-            analysis->lookahead.intraVbvCost[i] = analysis->lookahead.intraVbvCost[i] * (2 * m_param->scaleFactor);
+            for (int index = 0; index < vbvCount; index++)
+                analysis->lookahead.plannedSatd[index] *= factor;
+
+            for (uint32_t i = 0; i < analysis->numCuInHeight; i++)
+            {
+                analysis->lookahead.satdForVbv[i] *= factor;
+                analysis->lookahead.intraSatdForVbv[i] *= factor;
+            }
+            for (uint32_t i = 0; i < analysis->numCUsInFrame; i++)
+            {
+                analysis->lookahead.vbvCost[i] *= factor;
+                analysis->lookahead.intraVbvCost[i] *= factor;
+            }
         }
     }
     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hevc_latest.patch
Type: text/x-patch
Size: 3012 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180529/beb131b0/attachment.bin>


More information about the x265-devel mailing list