[x265] [PATCH 3 of 4 x265] analysis-save/load: Validate cu-tree info only at reuse-level 10
Aruna Matheswaran
aruna at multicorewareinc.com
Tue Mar 31 07:55:13 CEST 2020
# HG changeset patch
# User Aruna Matheswaran <aruna at multicorewareinc.com>
# Date 1582707110 -19800
# Wed Feb 26 14:21:50 2020 +0530
# Node ID 7ae7c9767f14b7d093c2023235066b370aecc4ce
# Parent 74170d9678e1a7f5f57b20c8404f8601814254d8
analysis-save/load: Validate cu-tree info only at reuse-level 10
diff -r 74170d9678e1 -r 7ae7c9767f14 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Feb 19 15:13:05 2020 +0530
+++ b/source/encoder/encoder.cpp Wed Feb 26 14:21:50 2020 +0530
@@ -3694,20 +3694,6 @@
if (p->analysisLoad && !p->analysisLoadReuseLevel)
p->analysisLoadReuseLevel = 5;
- if ((p->bAnalysisType == DEFAULT) && p->rc.cuTree)
- {
- if (p->analysisSaveReuseLevel && p->analysisSaveReuseLevel < 10)
- {
- x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis-save-reuse-level 10, Disabling cu-tree\n");
- p->rc.cuTree = 0;
- }
- if (p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)
- {
- x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis-load-reuse-level 10, Disabling cu-tree\n");
- p->rc.cuTree = 0;
- }
- }
-
if ((p->analysisLoad || p->analysisSave) && (p->bDistributeModeAnalysis || p->bDistributeMotionEstimation))
{
x265_log(p, X265_LOG_WARNING, "Analysis load/save options incompatible with pmode/pme, Disabling pmode/pme\n");
@@ -5039,13 +5025,13 @@
X265_PARAM_VALIDATE(saveParam->lookaheadDepth, sizeof(int), 1, &m_param->lookaheadDepth, rc - lookahead);
X265_PARAM_VALIDATE(saveParam->chunkStart, sizeof(int), 1, &m_param->chunkStart, chunk-start);
X265_PARAM_VALIDATE(saveParam->chunkEnd, sizeof(int), 1, &m_param->chunkEnd, chunk-end);
- X265_PARAM_VALIDATE(saveParam->cuTree,sizeof(int),1,&m_param->rc.cuTree, cutree - offset);
X265_PARAM_VALIDATE(saveParam->ctuDistortionRefine, sizeof(int), 1, &m_param->ctuDistortionRefine, ctu - distortion);
int sourceHeight, sourceWidth;
if (writeFlag)
{
X265_PARAM_VALIDATE(saveParam->analysisReuseLevel, sizeof(int), 1, &m_param->analysisSaveReuseLevel, analysis - save - reuse - level);
+ X265_PARAM_VALIDATE(saveParam->cuTree, sizeof(int), 1, &m_param->rc.cuTree, cutree-offset);
sourceHeight = m_param->sourceHeight - m_conformanceWindow.bottomOffset;
sourceWidth = m_param->sourceWidth - m_conformanceWindow.rightOffset;
X265_PARAM_VALIDATE(saveParam->sourceWidth, sizeof(int), 1, &sourceWidth, res-width);
@@ -5080,6 +5066,15 @@
return -1;
}
+ int bcutree;
+ X265_FREAD(&bcutree, sizeof(int), 1, m_analysisFileIn, &(saveParam->cuTree));
+ if (loadLevel == 10 && m_param->rc.cuTree && (!bcutree || saveLevel < 2))
+ {
+ x265_log(NULL, X265_LOG_ERROR, "Error reading cu-tree info. Disabling cutree offsets. \n");
+ m_param->rc.cuTree = 0;
+ return -1;
+ }
+
bool error = false;
int curSourceHeight = m_param->sourceHeight - m_conformanceWindow.bottomOffset;
int curSourceWidth = m_param->sourceWidth - m_conformanceWindow.rightOffset;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265_push-3.patch
Type: text/x-patch
Size: 3188 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20200331/8cb26b82/attachment.bin>
More information about the x265-devel
mailing list