[x265] [PATCH]Fix for zonefile feature Crash
Dinesh Kumar Reddy
dinesh at multicorewareinc.com
Fri Mar 1 11:09:08 CET 2019
# HG changeset patch
# User Dinesh<dinesh at multicorewareinc.com>
# Date 1551246140 -19800
# Wed Feb 27 11:12:20 2019 +0530
# Node ID c9bc9aef4cde7b812fd97b8eac7a204904aa02ad
# Parent 31ab7e09a3b5b15ffcc532826d4dd5d37e611483
Zone: fix for encoder crash
diff -r 31ab7e09a3b5 -r c9bc9aef4cde source/common/param.cpp
--- a/source/common/param.cpp Tue Feb 26 13:52:24 2019 +0530
+++ b/source/common/param.cpp Wed Feb 27 11:12:20 2019 +0530
@@ -94,6 +94,7 @@
x265_param *x265_param_alloc()
{
x265_param* param = (x265_param*)x265_malloc(sizeof(x265_param));
+ param->rc.zones = (x265_zone*)x265_malloc(sizeof(x265_zone));
#ifdef SVT_HEVC
param->svtHevcParam =
(EB_H265_ENC_CONFIGURATION*)x265_malloc(sizeof(EB_H265_ENC_CONFIGURATION));
#endif
@@ -102,6 +103,7 @@
void x265_param_free(x265_param* p)
{
+ x265_free(p->rc.zones);
#ifdef SVT_HEVC
x265_free(p->svtHevcParam);
#endif
@@ -2246,11 +2248,7 @@
if (src->rc.zones)
{
- dst->rc.zones->startFrame = src->rc.zones->startFrame;
- dst->rc.zones->endFrame = src->rc.zones->endFrame;
- dst->rc.zones->bForceQp = src->rc.zones->bForceQp;
- dst->rc.zones->qp = src->rc.zones->qp;
- dst->rc.zones->bitrateFactor = src->rc.zones->bitrateFactor;
+ memcpy(dst->rc.zones, src->rc.zones, sizeof(x265_zone));
}
else
dst->rc.zones = NULL;
diff -r 31ab7e09a3b5 -r c9bc9aef4cde source/encoder/api.cpp
--- a/source/encoder/api.cpp Tue Feb 26 13:52:24 2019 +0530
+++ b/source/encoder/api.cpp Wed Feb 27 11:12:20 2019 +0530
@@ -94,7 +94,7 @@
Encoder* encoder = NULL;
x265_param* param = PARAM_NS::x265_param_alloc();
- x265_param* latestParam = PARAM_NS::x265_param_alloc();
+ x265_param* latestParam = PARAM_NS::x265_param_alloc();
x265_param* zoneParam = PARAM_NS::x265_param_alloc();
if (!param || !latestParam)
goto fail;
@@ -177,7 +177,7 @@
encoder->create();
- memcpy(zoneParam, param, sizeof(x265_param));
+ x265_copy_params(zoneParam, param);
for (int i = 0; i < param->rc.zonefileCount; i++)
{
encoder->configureZone(zoneParam, param->rc.zones[i].zoneParam);
@@ -200,11 +200,11 @@
goto fail;
x265_print_params(param);
- return encoder;
+ return encoder;
fail:
delete encoder;
- PARAM_NS::x265_param_free(param);
+ PARAM_NS::x265_param_free(param);
PARAM_NS::x265_param_free(latestParam);
return NULL;
}
@@ -287,12 +287,13 @@
bool isReconfigureRc =
encoder->isReconfigureRc(encoder->m_latestParam, param_in);
if ((encoder->m_reconfigure && !isReconfigureRc) ||
(encoder->m_reconfigureRc && isReconfigureRc)) /* Reconfigure in progress */
return 1;
- x265_copy_params(&save, encoder->m_latestParam);
+
+ memcpy(&save, encoder->m_latestParam, sizeof(x265_param));
int ret = encoder->reconfigureParam(encoder->m_latestParam, param_in);
if (ret)
{
/* reconfigure failed, recover saved param set */
- x265_copy_params(encoder->m_latestParam, &save);
+ memcpy(encoder->m_latestParam, &save, sizeof(x265_param));
ret = -1;
}
else
diff -r 31ab7e09a3b5 -r c9bc9aef4cde source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Tue Feb 26 13:52:24 2019 +0530
+++ b/source/encoder/encoder.cpp Wed Feb 27 11:12:20 2019 +0530
@@ -850,7 +850,10 @@
free((char*)m_param->toneMapFile);
free((char*)m_param->analysisSave);
free((char*)m_param->analysisLoad);
- PARAM_NS::x265_param_free(m_param);
+#ifdef SVT_HEVC
+ x265_free(m_param->svtHevcParam);
+#endif
+ x265_free(m_param);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20190301/711b36f2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Zone.patch
Type: application/octet-stream
Size: 3625 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20190301/711b36f2/attachment-0001.obj>
More information about the x265-devel
mailing list