changeset 12634:00b686782ad0

zone: Remove unnessary conditions on zone reconfig This commit - Removes unnessary conditions on zone reconfig - Fixes crash with dynamic zone reconfig
author Snehaa Giridharan <snehaa@multicorewareinc.com>
date Thu, 13 Feb 2020 11:57:33 +0530
parents 10e354213df2
children 96739081845a
files source/common/param.cpp source/encoder/api.cpp source/encoder/encoder.cpp
diffstat 3 files changed, 5 insertions(+-), 11 deletions(-) [+]
line wrap: on
line diff
--- a/source/common/param.cpp	Wed Mar 18 18:51:39 2020 +0530
+++ b/source/common/param.cpp	Thu Feb 13 11:57:33 2020 +0530
@@ -2440,7 +2440,7 @@ void x265_copy_params(x265_param* dst, x
     dst->bResetZoneConfig = src->bResetZoneConfig;
     dst->decoderVbvMaxRate = src->decoderVbvMaxRate;
 
-    if (src->rc.zonefileCount && src->rc.zones)
+    if (src->rc.zonefileCount && src->rc.zones && src->bResetZoneConfig)
     {
         for (int i = 0; i < src->rc.zonefileCount; i++)
         {
--- a/source/encoder/api.cpp	Wed Mar 18 18:51:39 2020 +0530
+++ b/source/encoder/api.cpp	Thu Feb 13 11:57:33 2020 +0530
@@ -1016,12 +1016,12 @@ x265_zone *x265_zone_alloc(int zoneCount
 
 void x265_zone_free(x265_param *param)
 {
-    if (param && param->rc.zonefileCount) {
+    if (param && param->rc.zones && (param->rc.zoneCount || param->rc.zonefileCount))
+    {
         for (int i = 0; i < param->rc.zonefileCount; i++)
             x265_free(param->rc.zones[i].zoneParam);
+        x265_free(param->rc.zones);
     }
-    if (param && (param->rc.zoneCount || param->rc.zonefileCount))
-        x265_free(param->rc.zones);
 }
 
 static const x265_api libapi =
--- a/source/encoder/encoder.cpp	Wed Mar 18 18:51:39 2020 +0530
+++ b/source/encoder/encoder.cpp	Thu Feb 13 11:57:33 2020 +0530
@@ -4209,7 +4209,7 @@ void Encoder::configure(x265_param *p)
         x265_log(p, X265_LOG_WARNING, "Radl requires fixed gop-length (keyint == min-keyint). Disabling radl.\n");
     }
 
-    if ((p->chunkStart || p->chunkEnd) && p->bOpenGOP)
+    if ((p->chunkStart || p->chunkEnd) && p->bOpenGOP && m_param->bResetZoneConfig)
     {
         p->chunkStart = p->chunkEnd = 0;
         x265_log(p, X265_LOG_WARNING, "Chunking requires closed gop structure. Disabling chunking.\n");
@@ -4242,12 +4242,6 @@ void Encoder::configure(x265_param *p)
         x265_log(p, X265_LOG_WARNING, "Turning on repeat - headers for zone encoding\n");
     }
 
-    if (!m_param->bResetZoneConfig && (p->keyframeMax != p->keyframeMin))
-        x265_log(p, X265_LOG_WARNING, "External zone reconfiguration requires a fixed GOP size to enable appropriate signaling of HRD info\n");
-
-    if (!m_param->bResetZoneConfig && (p->reconfigWindowSize != (uint64_t)p->keyframeMax))
-        x265_log(p, X265_LOG_WARNING, "Zone size must be multiple of GOP size to enable appropriate signaling of HRD info\n");
-
     if (m_param->bEnableHME)
     {
         if (m_param->sourceHeight < 540)