[x265] [PATCH] fix x265 zonefile feature

Mahesh Pittala mahesh at multicorewareinc.com
Fri Feb 17 18:44:28 UTC 2023


>From 01d3a62b3cb36e23d6ff4ddaa624ba343ef5239b Mon Sep 17 00:00:00 2001
From: Karam Singh <karam.singh at multicorewareinc.com>
Date: Fri, 10 Feb 2023 18:27:59 +0530
Subject: [PATCH] fix x265 zonefile feature

Signed-off-by: maheshpittala <mahesh at multicorewareinc.com>
---
 source/abrEncApp.cpp   | 20 ++++++++++----------
 source/encoder/api.cpp |  1 -
 source/x265cli.cpp     |  1 +
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/source/abrEncApp.cpp b/source/abrEncApp.cpp
index 9ad4e0abd..94644a1c0 100644
--- a/source/abrEncApp.cpp
+++ b/source/abrEncApp.cpp
@@ -186,6 +186,16 @@ namespace X265_NS {
             }
         }

+        if (m_cliopt.zoneFile)
+        {
+            if (!m_cliopt.parseZoneFile())
+            {
+                x265_log(NULL, X265_LOG_ERROR, "Unable to parse zonefile
in %s\n");
+                fclose(m_cliopt.zoneFile);
+                m_cliopt.zoneFile = NULL;
+            }
+        }
+
         /* note: we could try to acquire a different libx265 API here
based on
         * the profile found during option parsing, but it must be done
before
         * opening an encoder */
@@ -515,16 +525,6 @@ ret:
                 reconPlay = new ReconPlay(m_cliopt.reconPlayCmd, *m_param);
             char* profileName = m_cliopt.encName ? m_cliopt.encName :
(char *)"x265";

-            if (m_cliopt.zoneFile)
-            {
-                if (!m_cliopt.parseZoneFile())
-                {
-                    x265_log(NULL, X265_LOG_ERROR, "Unable to parse
zonefile in %s\n", profileName);
-                    fclose(m_cliopt.zoneFile);
-                    m_cliopt.zoneFile = NULL;
-                }
-            }
-
             if (signal(SIGINT, sigint_handler) == SIG_ERR)
                 x265_log(m_param, X265_LOG_ERROR, "Unable to register
CTRL+C handler: %s in %s\n",
                     strerror(errno), profileName);
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
index 9b53e62ae..15b898a3c 100644
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -208,7 +208,6 @@ x265_encoder *x265_encoder_open(x265_param *p)
     memcpy(zoneParam, param, sizeof(x265_param));
     for (int i = 0; i < param->rc.zonefileCount; i++)
     {
-        param->rc.zones[i].startFrame = -1;
         encoder->configureZone(zoneParam, param->rc.zones[i].zoneParam);
     }

diff --git a/source/x265cli.cpp b/source/x265cli.cpp
index 4d10076c0..1d22b7944 100755
--- a/source/x265cli.cpp
+++ b/source/x265cli.cpp
@@ -1010,6 +1010,7 @@ namespace X265_NS {
         param->rc.zones = X265_MALLOC(x265_zone, param->rc.zonefileCount);
         for (int i = 0; i < param->rc.zonefileCount; i++)
         {
+            param->rc.zones[i].startFrame = -1;
             while (fgets(line, sizeof(line), zoneFile))
             {
                 if (*line == '#' || (strcmp(line, "\r\n") == 0))
-- 
2.23.0.windows.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20230218/6ffb4a76/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265zonefilefix.diff
Type: application/octet-stream
Size: 2892 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20230218/6ffb4a76/attachment.obj>


More information about the x265-devel mailing list