changeset 12611:acc5d16999e2

analysis-save/load: fix crash during analysis sharing between non-dyadic resolutions.
author Aruna Matheswaran <aruna@multicorewareinc.com>
date Mon, 20 Jan 2020 18:07:59 +0530
parents 8e6db24c1517
children ba9cb149de98
files source/encoder/encoder.cpp
diffstat 1 files changed, 6 insertions(+-), 4 deletions(-) [+]
line wrap: on
line diff
--- a/source/encoder/encoder.cpp	Mon Jan 06 23:08:36 2020 +0530
+++ b/source/encoder/encoder.cpp	Mon Jan 20 18:07:59 2020 +0530
@@ -3780,9 +3780,10 @@ void Encoder::configure(x265_param *p)
                 x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data. Conformance window right offset missing\n");
                 m_aborted = true;
             }
-            else if (m_conformanceWindow.rightOffset)
+            else if (m_conformanceWindow.rightOffset && p->analysisLoadReuseLevel > 1)
             {
-                padsize = m_conformanceWindow.rightOffset * 2;
+                int scaleFactor = p->scaleFactor < 2 ? 1 : p->scaleFactor;
+                padsize = m_conformanceWindow.rightOffset * scaleFactor;
                 p->sourceWidth += padsize;
                 m_conformanceWindow.bEnabled = true;
                 m_conformanceWindow.rightOffset = padsize;
@@ -3793,9 +3794,10 @@ void Encoder::configure(x265_param *p)
                 x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data. Conformance window bottom offset missing\n");
                 m_aborted = true;
             }
-            else if (m_conformanceWindow.bottomOffset)
+            else if (m_conformanceWindow.bottomOffset && p->analysisLoadReuseLevel > 1)
             {
-                padsize = m_conformanceWindow.bottomOffset * 2;
+                int scaleFactor = p->scaleFactor < 2 ? 1 : p->scaleFactor;
+                padsize = m_conformanceWindow.bottomOffset * scaleFactor;
                 p->sourceHeight += padsize;
                 m_conformanceWindow.bEnabled = true;
                 m_conformanceWindow.bottomOffset = padsize;