[x265-commits] [x265] scaling: allow refinement of inter/intra frames when scal...
Kavitha Sampath
kavitha at multicorewareinc.com
Tue May 1 01:03:03 CEST 2018
details: http://hg.videolan.org/x265/rev/d953f508ed0d
branches:
changeset: 12335:d953f508ed0d
user: Kavitha Sampath <kavitha at multicorewareinc.com>
date: Tue Apr 24 16:41:13 2018 +0530
description:
scaling: allow refinement of inter/intra frames when scalefactor is zero
Also disable analysis of CU with min-cu size when scale factor is zero
Subject: [x265] Merge with default
details: http://hg.videolan.org/x265/rev/fde57c299665
branches: stable
changeset: 12336:fde57c299665
user: Pradeep Ramachandran <pradeep at multicorewareinc.com>
date: Mon Apr 30 17:20:12 2018 +0530
description:
Merge with default
Subject: [x265] cleanup - runtime flag to enable/disable avx512
details: http://hg.videolan.org/x265/rev/091f07265371
branches: stable
changeset: 12337:091f07265371
user: Jayashree <jayashree.c at multicorewareinc.com>
date: Tue Apr 24 10:37:02 2018 +0530
description:
cleanup - runtime flag to enable/disable avx512
diffstat:
doc/reST/api.rst | 2 +-
source/CMakeLists.txt | 2 +-
source/common/param.cpp | 29 +++++++++++++++++++----------
source/common/param.h | 2 +-
source/encoder/analysis.cpp | 6 +++---
source/encoder/encoder.cpp | 16 ++++++++--------
source/test/testbench.cpp | 2 +-
source/x265.h | 6 +++---
source/x265cli.h | 2 +-
9 files changed, 38 insertions(+), 29 deletions(-)
diffs (236 lines):
diff -r 07defe235cde -r 091f07265371 doc/reST/api.rst
--- a/doc/reST/api.rst Thu Apr 12 16:57:19 2018 +0530
+++ b/doc/reST/api.rst Tue Apr 24 10:37:02 2018 +0530
@@ -411,7 +411,7 @@ The user also need to specify the :optio
double x265_calculate_vmafscore(x265_param*, x265_vmaf_data*);
/* x265_calculate_vmaf_framelevelscore:
- * returns VMAF score for each frame in a given input video. */
+ * returns VMAF score for each frame in a given input video. The frame level VMAF score does not include temporal scores. */
double x265_calculate_vmaf_framelevelscore(x265_vmaf_framedata*);
.. Note::
diff -r 07defe235cde -r 091f07265371 source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Apr 12 16:57:19 2018 +0530
+++ b/source/CMakeLists.txt Tue Apr 24 10:37:02 2018 +0530
@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CP
option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 158)
+set(X265_BUILD 159)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 07defe235cde -r 091f07265371 source/common/param.cpp
--- a/source/common/param.cpp Thu Apr 12 16:57:19 2018 +0530
+++ b/source/common/param.cpp Tue Apr 24 10:37:02 2018 +0530
@@ -99,13 +99,13 @@ void x265_param_free(x265_param* p)
{
x265_free(p);
}
-bool benableavx512 = false;
+
void x265_param_default(x265_param* param)
{
memset(param, 0, sizeof(x265_param));
/* Applying default values to all elements in the param structure */
- param->cpuid = X265_NS::cpu_detect(benableavx512);
+ param->cpuid = X265_NS::cpu_detect(false);
param->bEnableWavefront = 1;
param->frameNumThreads = 0;
@@ -615,21 +615,30 @@ int x265_param_parse(x265_param* p, cons
if (0) ;
OPT("asm")
{
- sscanf(value, "%s", p->asmname);
- if (strcmp(value, "avx512")==0)
+#if X265_ARCH_X86
+ if (!strcasecmp(value, "avx512"))
{
- p->bEnableavx512 = 1;
- benableavx512 = true;
+ p->bEnableavx512 = true;
+
+ p->cpuid = X265_NS::cpu_detect(p->bEnableavx512);
+ if (!(p->cpuid & X265_CPU_AVX512))
+ x265_log(p, X265_LOG_WARNING, "AVX512 is not supported\n");
}
else
{
- p->bEnableavx512 = 0;
- benableavx512 = false;
+ p->bEnableavx512 = false;
+
+ if (bValueWasNull)
+ p->cpuid = atobool(value);
+ else
+ p->cpuid = parseCpuName(value, bError, p->bEnableavx512);
}
+#else
if (bValueWasNull)
p->cpuid = atobool(value);
else
p->cpuid = parseCpuName(value, bError);
+#endif
}
OPT("fps")
{
@@ -1080,7 +1089,7 @@ double x265_atof(const char* str, bool&
* false || no - disabled
* integer bitmap value
* comma separated list of SIMD names, eg: SSE4.1,XOP */
-int parseCpuName(const char* value, bool& bError)
+int parseCpuName(const char* value, bool& bError, bool bEnableavx512)
{
if (!value)
{
@@ -1091,7 +1100,7 @@ int parseCpuName(const char* value, bool
if (isdigit(value[0]))
cpu = x265_atoi(value, bError);
else
- cpu = !strcmp(value, "auto") || x265_atobool(value, bError) ? X265_NS::cpu_detect(benableavx512) : 0;
+ cpu = !strcmp(value, "auto") || x265_atobool(value, bError) ? X265_NS::cpu_detect(bEnableavx512) : 0;
if (bError)
{
diff -r 07defe235cde -r 091f07265371 source/common/param.h
--- a/source/common/param.h Thu Apr 12 16:57:19 2018 +0530
+++ b/source/common/param.h Tue Apr 24 10:37:02 2018 +0530
@@ -33,7 +33,7 @@ void x265_param_apply_fastfirstpass(x26
char* x265_param2string(x265_param *param, int padx, int pady);
int x265_atoi(const char *str, bool& bError);
double x265_atof(const char *str, bool& bError);
-int parseCpuName(const char *value, bool& bError);
+int parseCpuName(const char *value, bool& bError, bool bEnableavx512);
void setParamAspectRatio(x265_param *p, int width, int height);
void getParamAspectRatio(x265_param *p, int& width, int& height);
bool parseLambdaFile(x265_param *param);
diff -r 07defe235cde -r 091f07265371 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Thu Apr 12 16:57:19 2018 +0530
+++ b/source/encoder/analysis.cpp Tue Apr 24 10:37:02 2018 +0530
@@ -523,7 +523,7 @@ uint64_t Analysis::compressIntraCU(const
int split = 0;
if (m_param->intraRefine && m_param->intraRefine != 4)
{
- split = ((cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1)) && bDecidedDepth);
+ split = m_param->scaleFactor && ((cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1)) && bDecidedDepth);
if (cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize]) && !bDecidedDepth)
bAlreadyDecided = false;
}
@@ -2420,7 +2420,7 @@ void Analysis::recodeCU(const CUData& pa
m_refineLevel = m_param->interRefine;
else
m_refineLevel = m_frame->m_classifyFrame ? 1 : 3;
- int split = (m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1) && bDecidedDepth);
+ int split = (m_param->scaleFactor && m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1) && bDecidedDepth);
td.split = split;
if (bDecidedDepth)
@@ -2494,7 +2494,7 @@ void Analysis::recodeCU(const CUData& pa
mode.cu.m_mvd[list][pu.puAbsPartIdx] = mode.cu.m_mv[list][pu.puAbsPartIdx] - mode.amvpCand[list][ref][mode.cu.m_mvpIdx[list][pu.puAbsPartIdx]]/*mvp*/;
}
}
- else if(m_param->scaleFactor)
+ else
{
MVField candMvField[MRG_MAX_NUM_CANDS][2]; // double length for mv of both lists
uint8_t candDir[MRG_MAX_NUM_CANDS];
diff -r 07defe235cde -r 091f07265371 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Thu Apr 12 16:57:19 2018 +0530
+++ b/source/encoder/encoder.cpp Tue Apr 24 10:37:02 2018 +0530
@@ -2694,27 +2694,27 @@ void Encoder::configure(x265_param *p)
if (p->intraRefine)
{
- if (!p->analysisLoad || p->analysisReuseLevel < 10 || !p->scaleFactor)
+ if (!p->analysisLoad || p->analysisReuseLevel < 10)
{
- x265_log(p, X265_LOG_WARNING, "Intra refinement requires analysis load, analysis-reuse-level 10, scale factor. Disabling intra refine.\n");
+ x265_log(p, X265_LOG_WARNING, "Intra refinement requires analysis load, analysis-reuse-level 10. Disabling intra refine.\n");
p->intraRefine = 0;
}
}
if (p->interRefine)
{
- if (!p->analysisLoad || p->analysisReuseLevel < 10 || !p->scaleFactor)
+ if (!p->analysisLoad || p->analysisReuseLevel < 10)
{
- x265_log(p, X265_LOG_WARNING, "Inter refinement requires analysis load, analysis-reuse-level 10, scale factor. Disabling inter refine.\n");
+ x265_log(p, X265_LOG_WARNING, "Inter refinement requires analysis load, analysis-reuse-level 10. Disabling inter refine.\n");
p->interRefine = 0;
}
}
if (p->bDynamicRefine)
{
- if (!p->analysisLoad || p->analysisReuseLevel < 10 || !p->scaleFactor)
+ if (!p->analysisLoad || p->analysisReuseLevel < 10)
{
- x265_log(p, X265_LOG_WARNING, "Dynamic refinement requires analysis load, analysis-reuse-level 10, scale factor. Disabling dynamic refine.\n");
+ x265_log(p, X265_LOG_WARNING, "Dynamic refinement requires analysis load, analysis-reuse-level 10. Disabling dynamic refine.\n");
p->bDynamicRefine = 0;
}
if (p->interRefine)
@@ -2737,9 +2737,9 @@ void Encoder::configure(x265_param *p)
if (p->mvRefine)
{
- if (!p->analysisLoad || p->analysisReuseLevel < 10 || !p->scaleFactor)
+ if (!p->analysisLoad || p->analysisReuseLevel < 10)
{
- x265_log(p, X265_LOG_WARNING, "MV refinement requires analysis load, analysis-reuse-level 10, scale factor. Disabling MV refine.\n");
+ x265_log(p, X265_LOG_WARNING, "MV refinement requires analysis load, analysis-reuse-level 10. Disabling MV refine.\n");
p->mvRefine = 0;
}
else if (p->interRefine >= 2)
diff -r 07defe235cde -r 091f07265371 source/test/testbench.cpp
--- a/source/test/testbench.cpp Thu Apr 12 16:57:19 2018 +0530
+++ b/source/test/testbench.cpp Tue Apr 24 10:37:02 2018 +0530
@@ -118,7 +118,7 @@ int main(int argc, char *argv[])
if (!strncmp(name, "cpuid", strlen(name)))
{
bool bError = false;
- cpuid = parseCpuName(value, bError);
+ cpuid = parseCpuName(value, bError, enableavx512);
if (bError)
{
printf("Invalid CPU name: %s\n", value);
diff -r 07defe235cde -r 091f07265371 source/x265.h
--- a/source/x265.h Thu Apr 12 16:57:19 2018 +0530
+++ b/source/x265.h Tue Apr 24 10:37:02 2018 +0530
@@ -614,7 +614,7 @@ typedef struct x265_vmaf_commondata
char *pool;
}x265_vmaf_commondata;
-static const x265_vmaf_commondata vcd[] = {NULL, (char *)"/usr/local/share/model/vmaf_v0.6.1.pkl", NULL, NULL, 0, 0, 0, 0, 0, 0, 0, NULL};
+static const x265_vmaf_commondata vcd[] = { { NULL, (char *)"/usr/local/share/model/vmaf_v0.6.1.pkl", NULL, NULL, 0, 0, 0, 0, 0, 0, 0, NULL } };
/* x265 input parameters
*
@@ -635,8 +635,8 @@ typedef struct x265_param
* hence the encoding will happen without avx512 assembly primitives even if the cpu has
* avx512 capabilities.
* Ensure to use --asm avx512 if you need to encode with avx512 assembly primitives*/
- int bEnableavx512;
- char* asmname;
+
+ bool bEnableavx512;
/*== Parallelism Features ==*/
/* Number of concurrently encoded frames between 1 and X265_MAX_FRAME_THREADS
diff -r 07defe235cde -r 091f07265371 source/x265cli.h
--- a/source/x265cli.h Thu Apr 12 16:57:19 2018 +0530
+++ b/source/x265cli.h Tue Apr 24 10:37:02 2018 +0530
@@ -566,7 +566,7 @@ static void showHelp(x265_param *param)
H0(" --[no-]aud Emit access unit delimiters at the start of each access unit. Default %s\n", OPT(param->bEnableAccessUnitDelimiters));
H1(" --hash <integer> Decoded Picture Hash SEI 0: disabled, 1: MD5, 2: CRC, 3: Checksum. Default %d\n", param->decodedPictureHashSEI);
H0(" --atc-sei <integer> Emit the alternative transfer characteristics SEI message where the integer is the preferred transfer characteristics. Default disabled\n");
- H0(" --pic-struct <integer> Set the picture structure and emits it in the picture timing SEI message. Values in the range 0..12. See D.3.3 of the HEVC spec. for a detailed explanation.");
+ H0(" --pic-struct <integer> Set the picture structure and emits it in the picture timing SEI message. Values in the range 0..12. See D.3.3 of the HEVC spec. for a detailed explanation.\n");
H0(" --log2-max-poc-lsb <integer> Maximum of the picture order count\n");
H0(" --[no-]vui-timing-info Emit VUI timing information in the bistream. Default %s\n", OPT(param->bEmitVUITimingInfo));
H0(" --[no-]vui-hrd-info Emit VUI HRD information in the bistream. Default %s\n", OPT(param->bEmitVUIHRDInfo));
More information about the x265-commits
mailing list