[x265] [PATCH] Fix HDR10+ LLC JSON support

2018-07-12 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1529069445 -19800
#  Fri Jun 15 19:00:45 2018 +0530
# Node ID 18eaffdd36384d04c907bdd9c3fd9962d95af66d
# Parent  7763d20f092a208904b3ae3ec1762441d1573696
Fix HDR10+ LLC JSON support

diff -r 7763d20f092a -r 18eaffdd3638 source/dynamicHDR10/metadataFromJson.cpp
--- a/source/dynamicHDR10/metadataFromJson.cpp  Thu Jul 12 12:14:00 2018 +0530
+++ b/source/dynamicHDR10/metadataFromJson.cpp  Fri Jun 15 19:00:45 2018 +0530
@@ -88,7 +88,7 @@
 if(!percentileData.empty())
 {
 JsonArray distributionValues = 
percentileData[PercentileNames::DistributionValues].array_items();
-obj.order = distributionValues.size();
+obj.order = static_cast(distributionValues.size());
 obj.percentiles.resize(obj.order);
 for(int i = 0; i < obj.order; ++i)
 {
@@ -127,7 +127,7 @@
 if(!percentileData.empty())
 {
 JsonArray percentageValues = 
percentileData[PercentileNames::DistributionIndex].array_items();
-int order = percentageValues.size();
+int order = static_cast(percentageValues.size());
 percentages.resize(order);
 for(int i = 0; i < order; ++i)
 {
@@ -165,7 +165,7 @@
 obj.sPx = jsonData[BezierCurveNames::KneePointX].int_value();
 obj.sPy = jsonData[BezierCurveNames::KneePointY].int_value();
 JsonArray anchorValues = 
data[BezierCurveNames::AnchorsTag].array_items();
-obj.order = anchorValues.size();
+obj.order = static_cast(anchorValues.size());
 obj.coeff.resize(obj.order);
 for(int i = 0; i < obj.order; ++i)
 {
@@ -489,7 +489,7 @@
 Json lumObj = fileData[frame][LuminanceNames::TagName];
 LuminanceParameters luminanceData;
 if(!((isLLCJson && mPimpl->luminanceParamFromLLCJson(lumObj, 
luminanceData)) ||
-!(isLLCJson && mPimpl->luminanceParamFromJson(lumObj, 
luminanceData
+!(mPimpl->luminanceParamFromJson(lumObj, luminanceData) && 
isLLCJson)))
 {
 std::cout << "error parsing luminance parameters frame: " << w << 
std::endl;
 }
@@ -559,7 +559,7 @@
 if (w == 0)
 {
 if(!((isLLCJson && 
mPimpl->bezierCurveFromLLCJson(fileData[frame][BezierCurveNames::TagName], 
curveData)) ||
-!(isLLCJson && 
mPimpl->bezierCurveFromJson(fileData[frame][BezierCurveNames::TagName], 
curveData
+
!(mPimpl->bezierCurveFromJson(fileData[frame][BezierCurveNames::TagName], 
curveData) && isLLCJson)))
 {
 toneMappingFlag = 0;
 }
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1529069445 -19800
#  Fri Jun 15 19:00:45 2018 +0530
# Node ID 18eaffdd36384d04c907bdd9c3fd9962d95af66d
# Parent  7763d20f092a208904b3ae3ec1762441d1573696
Fix HDR10+ LLC JSON support

diff -r 7763d20f092a -r 18eaffdd3638 source/dynamicHDR10/metadataFromJson.cpp
--- a/source/dynamicHDR10/metadataFromJson.cpp	Thu Jul 12 12:14:00 2018 +0530
+++ b/source/dynamicHDR10/metadataFromJson.cpp	Fri Jun 15 19:00:45 2018 +0530
@@ -88,7 +88,7 @@
 if(!percentileData.empty())
 {
 JsonArray distributionValues = percentileData[PercentileNames::DistributionValues].array_items();
-obj.order = distributionValues.size();
+obj.order = static_cast(distributionValues.size());
 obj.percentiles.resize(obj.order);
 for(int i = 0; i < obj.order; ++i)
 {
@@ -127,7 +127,7 @@
 if(!percentileData.empty())
 {
 JsonArray percentageValues = percentileData[PercentileNames::DistributionIndex].array_items();
-int order = percentageValues.size();
+int order = static_cast(percentageValues.size());
 percentages.resize(order);
 for(int i = 0; i < order; ++i)
 {
@@ -165,7 +165,7 @@
 obj.sPx = jsonData[BezierCurveNames::KneePointX].int_value();
 obj.sPy = jsonData[BezierCurveNames::KneePointY].int_value();
 JsonArray anchorValues = data[BezierCurveNames::AnchorsTag].array_items();
-obj.order = anchorValues.size();
+obj.order = static_cast(anchorValues.size());
 obj.coeff.resize(obj.order);
 for(int i = 0; i < obj.order; ++i)
 {
@@ -489,7 +489,7 @@
 Json lumObj = fileData[frame][LuminanceNames::TagName];
 LuminanceParameters luminanceData;
 if(!((isLLCJson && mPimpl->luminanceParamFromLLCJson(lumObj, luminanceData)) ||
-!(isLLCJson && mPimpl->luminanceParamFromJson(lumObj, luminanceData
+!(mPimpl->luminanceParamFromJson(lumObj, luminanceData) && 

[x265] [PATCH] Fix build warnings in linux

2018-07-05 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1530793686 -19800
#  Thu Jul 05 17:58:06 2018 +0530
# Node ID f377b028f4a91715372a6241fc80e78a672dbd06
# Parent  d65e3a557a20c0a67dd6dd7ad4cfb4b679ccd937
Fix build warnings in linux

diff -r d65e3a557a20 -r f377b028f4a9 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppThu Jun 14 16:27:32 2018 +0800
+++ b/source/encoder/encoder.cppThu Jul 05 17:58:06 2018 +0530
@@ -4740,9 +4740,8 @@
 void Encoder::readUserSeiFile(x265_sei_payload& seiMsg, int curPoc)
 {
 char line[1024];
-while (!feof(m_naluFile))
+while (fgets(line, sizeof(line), m_naluFile))
 {
-fgets(line, sizeof(line), m_naluFile);
 int poc = atoi(strtok(line, " "));
 char *prefix = strtok(NULL, " ");
 int nalType = atoi(strtok(NULL, "/"));
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1530793686 -19800
#  Thu Jul 05 17:58:06 2018 +0530
# Node ID f377b028f4a91715372a6241fc80e78a672dbd06
# Parent  d65e3a557a20c0a67dd6dd7ad4cfb4b679ccd937
Fix build warnings in linux

diff -r d65e3a557a20 -r f377b028f4a9 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu Jun 14 16:27:32 2018 +0800
+++ b/source/encoder/encoder.cpp	Thu Jul 05 17:58:06 2018 +0530
@@ -4740,9 +4740,8 @@
 void Encoder::readUserSeiFile(x265_sei_payload& seiMsg, int curPoc)
 {
 char line[1024];
-while (!feof(m_naluFile))
+while (fgets(line, sizeof(line), m_naluFile))
 {
-fgets(line, sizeof(line), m_naluFile);
 int poc = atoi(strtok(line, " "));
 char *prefix = strtok(NULL, " ");
 int nalType = atoi(strtok(NULL, "/"));
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Rename usersei-file to nalu-file

2018-06-22 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1529648256 -19800
#  Fri Jun 22 11:47:36 2018 +0530
# Node ID 8d1092f478c4ded9c6bd62a72501a99dc28bcec1
# Parent  656b5b442f0b636f5e56048886e1fbaa1c59d3e5
Rename usersei-file to nalu-file

diff -r 656b5b442f0b -r 8d1092f478c4 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Mon Jun 11 19:44:51 2018 +0530
+++ b/doc/reST/cli.rst  Fri Jun 22 11:47:36 2018 +0530
@@ -2136,7 +2136,7 @@
Maximum luma value allowed for input pictures. Any values above max-luma
are clipped.  No default.
 
-.. option:: --usersei-file 
+.. option:: --nalu-file 
 
 Text file containing userSEI in POC order : 
/
 Parse the input file specified and inserts SEI messages into the 
bitstream. 
diff -r 656b5b442f0b -r 8d1092f478c4 source/common/param.cpp
--- a/source/common/param.cpp   Mon Jun 11 19:44:51 2018 +0530
+++ b/source/common/param.cpp   Fri Jun 22 11:47:36 2018 +0530
@@ -302,7 +302,7 @@
 param->bDisableLookahead = 0;
 param->bCopyPicToFrame = 1;
 param->maxAUSizeFactor = 1;
-param->userSeiFile = NULL;
+param->naluFile = NULL;
 
 /* DCT Approximations */
 param->bLowPassDct = 0;
@@ -1049,7 +1049,7 @@
OPT("pic-struct") p->pictureStructure = atoi(value);
 OPT("chunk-start") p->chunkStart = atoi(value);
 OPT("chunk-end") p->chunkEnd = atoi(value);
-OPT("usersei-file") p->userSeiFile = strdup(value);
+OPT("nalu-file") p->naluFile = strdup(value);
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r 656b5b442f0b -r 8d1092f478c4 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppMon Jun 11 19:44:51 2018 +0530
+++ b/source/encoder/encoder.cppFri Jun 22 11:47:36 2018 +0530
@@ -79,7 +79,7 @@
 m_threadPool = NULL;
 m_analysisFileIn = NULL;
 m_analysisFileOut = NULL;
-m_seiFile = NULL;
+m_naluFile = NULL;
 m_offsetEmergency = NULL;
 m_iFrameNum = 0;
 m_iPPSQpMinus26 = 0;
@@ -413,19 +413,19 @@
 
 m_emitCLLSEI = p->maxCLL || p->maxFALL;
 
-if (m_param->userSeiFile)
+if (m_param->naluFile)
 {
-m_seiFile = x265_fopen(m_param->userSeiFile, "r");
-if (!m_seiFile)
+m_naluFile = x265_fopen(m_param->naluFile, "r");
+if (!m_naluFile)
 {
-x265_log_file(NULL, X265_LOG_ERROR, "%s file not found or Failed 
to open\n", m_param->userSeiFile);
+x265_log_file(NULL, X265_LOG_ERROR, "%s file not found or Failed 
to open\n", m_param->naluFile);
 m_aborted = true;
 }
 else
- m_enableUserSei = 1;
+ m_enableNal = 1;
 }
 else
- m_enableUserSei = 0;
+ m_enableNal = 0;
 
 #if ENABLE_HDR10_PLUS
 if (m_bToneMap)
@@ -797,8 +797,8 @@
 }
 X265_FREE(temp);
  }
-if (m_seiFile)
-fclose(m_seiFile);
+if (m_naluFile)
+fclose(m_naluFile);
 if (m_param)
 {
 if (m_param->csvfpt)
@@ -943,7 +943,7 @@
 * Format of the file : / */
 x265_sei_payload seiMsg;
 seiMsg.payload = NULL;
-if (m_enableUserSei)
+if (m_enableNal)
 readUserSeiFile(seiMsg, m_pocLast);
 if (pic_in->bitDepth < 8 || pic_in->bitDepth > 16)
 {
@@ -1030,8 +1030,8 @@
 if (m_bToneMap && toneMap.payload)
 toneMapEnable = 1;
 int numPayloads = pic_in->userSEI.numPayloads + toneMapEnable;
-if (m_enableUserSei && seiMsg.payload)
-numPayloads += m_enableUserSei;
+if (m_enableNal && seiMsg.payload)
+numPayloads += m_enableNal;
 inFrame->m_userSEI.numPayloads = numPayloads;
 
 if (inFrame->m_userSEI.numPayloads)
@@ -1047,7 +1047,7 @@
 x265_sei_payload input;
 if ((i == (numPayloads - 1)) && toneMapEnable)
 input = toneMap;
-else if (m_enableUserSei)
+else if (m_enableNal)
 input = seiMsg;
 else
 input = pic_in->userSEI.payloads[i];
@@ -4739,9 +4739,9 @@
 void Encoder::readUserSeiFile(x265_sei_payload& seiMsg, int curPoc)
 {
 char line[1024];
-while (!feof(m_seiFile))
+while (!feof(m_naluFile))
 {
-fgets(line, sizeof(line), m_seiFile);
+fgets(line, sizeof(line), m_naluFile);
 int poc = atoi(strtok(line, " "));
 char *prefix = strtok(NULL, " ");
 int nalType = atoi(strtok(NULL, "/"));
diff -r 656b5b442f0b -r 8d1092f478c4 source/encoder/encoder.h
--- a/source/encoder/encoder.h  Mon Jun 11 19:44:51 2018 +0530
+++ b/source/encoder/encoder.h  Fri Jun 22 11:47:36 2018 +0530
@@ -169,7 +169,7 @@
 Frame* m_exportedPic;
 FILE*  m_analysisFileIn;
 FILE*  m_analysisFileOut;
-FILE*  m_seiFile;
+FILE*  m_naluFile;
 x265_param*m_param;
 x265_param*

Re: [x265] [PATCH] CEA 608/708 Support

2018-06-21 Thread Indumathi Ravichandran
Okay. Will rename and send the patch tomorrow.

On Wed, Jun 20, 2018 at 8:45 PM, Alex Giladi  wrote:

> I would rename the "usersei-file" option into something like "nalu-file",
> as the input file format allows arbitrary NAL units rather than only SEIs
> (despite only prefix SEIs being implemented).
>
>
> On Wed, Jun 20, 2018 at 4:43 AM,  wrote:
>
>> # HG changeset patch
>> # User induma...@multicorewareinc.com
>> # Date 1528726491 -19800
>> #  Mon Jun 11 19:44:51 2018 +0530
>> # Node ID e1dd8424a3bd5f9f61f4a73aec6f2aee27591772
>> # Parent  a8a5ccf5aaf7e04e439a216e5c396991c6b76999
>> CEA 608/708 Support
>>
>> Parse the SEI messages from text file and insert it into the userSEI with
>> cli option.
>>
>> diff -r a8a5ccf5aaf7 -r e1dd8424a3bd doc/reST/cli.rst
>> --- a/doc/reST/cli.rst  Wed Jun 13 09:54:27 2018 +0530
>> +++ b/doc/reST/cli.rst  Mon Jun 11 19:44:51 2018 +0530
>> @@ -2135,6 +2135,12 @@
>>
>> Maximum luma value allowed for input pictures. Any values above
>> max-luma
>> are clipped.  No default.
>> +
>> +.. option:: --usersei-file 
>> +
>> +Text file containing userSEI in POC order :
>> /
>> +Parse the input file specified and inserts SEI messages into the
>> bitstream.
>> +Currently, we support only PREFIX SEI messages. This is an
>> "application-only" feature.
>>
>>  .. option:: --atc-sei 
>>
>> diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/CMakeLists.txt
>> --- a/source/CMakeLists.txt Wed Jun 13 09:54:27 2018 +0530
>> +++ b/source/CMakeLists.txt Mon Jun 11 19:44:51 2018 +0530
>> @@ -29,7 +29,7 @@
>>  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 161)
>> +set(X265_BUILD 162)
>>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>> "${PROJECT_BINARY_DIR}/x265.def")
>>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
>> diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/common/param.cpp
>> --- a/source/common/param.cpp   Wed Jun 13 09:54:27 2018 +0530
>> +++ b/source/common/param.cpp   Mon Jun 11 19:44:51 2018 +0530
>> @@ -302,6 +302,7 @@
>>  param->bDisableLookahead = 0;
>>  param->bCopyPicToFrame = 1;
>>  param->maxAUSizeFactor = 1;
>> +param->userSeiFile = NULL;
>>
>>  /* DCT Approximations */
>>  param->bLowPassDct = 0;
>> @@ -1048,6 +1049,7 @@
>> OPT("pic-struct") p->pictureStructure = atoi(value);
>>  OPT("chunk-start") p->chunkStart = atoi(value);
>>  OPT("chunk-end") p->chunkEnd = atoi(value);
>> +OPT("usersei-file") p->userSeiFile = strdup(value);
>>  else
>>  return X265_PARAM_BAD_NAME;
>>  }
>> diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/encoder/encoder.cpp
>> --- a/source/encoder/encoder.cppWed Jun 13 09:54:27 2018 +0530
>> +++ b/source/encoder/encoder.cppMon Jun 11 19:44:51 2018 +0530
>> @@ -79,6 +79,7 @@
>>  m_threadPool = NULL;
>>  m_analysisFileIn = NULL;
>>  m_analysisFileOut = NULL;
>> +m_seiFile = NULL;
>>  m_offsetEmergency = NULL;
>>  m_iFrameNum = 0;
>>  m_iPPSQpMinus26 = 0;
>> @@ -412,6 +413,20 @@
>>
>>  m_emitCLLSEI = p->maxCLL || p->maxFALL;
>>
>> +if (m_param->userSeiFile)
>> +{
>> +m_seiFile = x265_fopen(m_param->userSeiFile, "r");
>> +if (!m_seiFile)
>> +{
>> +x265_log_file(NULL, X265_LOG_ERROR, "%s file not found or
>> Failed to open\n", m_param->userSeiFile);
>> +m_aborted = true;
>> +}
>> +else
>> + m_enableUserSei = 1;
>> +}
>> +else
>> + m_enableUserSei = 0;
>> +
>>  #if ENABLE_HDR10_PLUS
>>  if (m_bToneMap)
>>  m_numCimInfo = m_hdr10plus_api->hdr10plus_jso
>> n_to_movie_cim(m_param->toneMapFile, m_cim);
>> @@ -782,6 +797,8 @@
>>  }
>>  X265_FREE(temp);
>>   }
>> +if (m_seiFile)
>> +fclose(m_seiFile);
>>  if (m_param)
>>  {
>>  if (m_param->csvfpt)
>> @@ -922,7 +939,14 @@
>>  }
>>  }
>>  #endif
>> -
>> +/* seiMsg will contain SEI messages specified in a fixed file format in
>> POC order.
>> +* Format of the file : /> TYPE> */
>> +x265_sei_payload seiMsg;
>> +seiMsg.payload = NULL;
>> +if (m_enableUserSei)
>> +{
>> +seiMsg = readUserSeiFile(m_pocLast);
>> +}
>>  if (pic_in->bitDepth < 8 || pic_in->bitDepth > 16)
>>  {
>>  x265_log(m_param, X265_LOG_ERROR, "Input bit depth (%d) must
>> be between 8 and 16\n",
>> @@ -1008,6 +1032,8 @@
>>  if (m_bToneMap && toneMap.payload)
>>  toneMapEnable = 1;
>>  int numPayloads = pic_in->userSEI.numPayloads + toneMapEnable;
>> +if (m_enableUserSei && seiMsg.payload)
>> +numPayloads += m_enableUserSei;
>>  inFrame->m_userSEI.numPayloads = 

[x265] [PATCH] CEA 608/708 Support

2018-06-20 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1528726491 -19800
#  Mon Jun 11 19:44:51 2018 +0530
# Node ID 156d02c66102813b3c72d3f6c8be5fc083c6a1f3
# Parent  a8a5ccf5aaf7e04e439a216e5c396991c6b76999
CEA 608/708 Support

Parse the SEI messages from text file and insert it into the userSEI with cli 
option.

diff -r a8a5ccf5aaf7 -r 156d02c66102 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Wed Jun 13 09:54:27 2018 +0530
+++ b/doc/reST/cli.rst  Mon Jun 11 19:44:51 2018 +0530
@@ -2135,6 +2135,12 @@
 
Maximum luma value allowed for input pictures. Any values above max-luma
are clipped.  No default.
+
+.. option:: --usersei-file 
+
+Text file containing userSEI in POC order : 
/
+Parse the input file specified and inserts SEI messages into the 
bitstream. 
+Currently, we support only PREFIX SEI messages. This is an 
"application-only" feature.
 
 .. option:: --atc-sei 
 
diff -r a8a5ccf5aaf7 -r 156d02c66102 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Jun 13 09:54:27 2018 +0530
+++ b/source/CMakeLists.txt Mon Jun 11 19:44:51 2018 +0530
@@ -29,7 +29,7 @@
 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 161)
+set(X265_BUILD 162)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r a8a5ccf5aaf7 -r 156d02c66102 source/common/param.cpp
--- a/source/common/param.cpp   Wed Jun 13 09:54:27 2018 +0530
+++ b/source/common/param.cpp   Mon Jun 11 19:44:51 2018 +0530
@@ -302,6 +302,7 @@
 param->bDisableLookahead = 0;
 param->bCopyPicToFrame = 1;
 param->maxAUSizeFactor = 1;
+param->userSeiFile = NULL;
 
 /* DCT Approximations */
 param->bLowPassDct = 0;
@@ -1048,6 +1049,7 @@
OPT("pic-struct") p->pictureStructure = atoi(value);
 OPT("chunk-start") p->chunkStart = atoi(value);
 OPT("chunk-end") p->chunkEnd = atoi(value);
+OPT("usersei-file") p->userSeiFile = strdup(value);
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r a8a5ccf5aaf7 -r 156d02c66102 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppWed Jun 13 09:54:27 2018 +0530
+++ b/source/encoder/encoder.cppMon Jun 11 19:44:51 2018 +0530
@@ -79,6 +79,7 @@
 m_threadPool = NULL;
 m_analysisFileIn = NULL;
 m_analysisFileOut = NULL;
+m_seiFile = NULL;
 m_offsetEmergency = NULL;
 m_iFrameNum = 0;
 m_iPPSQpMinus26 = 0;
@@ -412,6 +413,20 @@
 
 m_emitCLLSEI = p->maxCLL || p->maxFALL;
 
+if (m_param->userSeiFile)
+{
+m_seiFile = x265_fopen(m_param->userSeiFile, "r");
+if (!m_seiFile)
+{
+x265_log_file(NULL, X265_LOG_ERROR, "%s file not found or Failed 
to open\n", m_param->userSeiFile);
+m_aborted = true;
+}
+else
+ m_enableUserSei = 1;
+}
+else
+ m_enableUserSei = 0;
+
 #if ENABLE_HDR10_PLUS
 if (m_bToneMap)
 m_numCimInfo = 
m_hdr10plus_api->hdr10plus_json_to_movie_cim(m_param->toneMapFile, m_cim);
@@ -782,6 +797,8 @@
 }
 X265_FREE(temp);
  }
+if (m_seiFile)
+fclose(m_seiFile);
 if (m_param)
 {
 if (m_param->csvfpt)
@@ -922,7 +939,12 @@
 }
 }
 #endif
-
+/* seiMsg will contain SEI messages specified in a fixed file format in POC 
order.
+* Format of the file : / */
+x265_sei_payload seiMsg;
+seiMsg.payload = NULL;
+if (m_enableUserSei)
+readUserSeiFile(seiMsg, m_pocLast);
 if (pic_in->bitDepth < 8 || pic_in->bitDepth > 16)
 {
 x265_log(m_param, X265_LOG_ERROR, "Input bit depth (%d) must be 
between 8 and 16\n",
@@ -1008,6 +1030,8 @@
 if (m_bToneMap && toneMap.payload)
 toneMapEnable = 1;
 int numPayloads = pic_in->userSEI.numPayloads + toneMapEnable;
+if (m_enableUserSei && seiMsg.payload)
+numPayloads += m_enableUserSei;
 inFrame->m_userSEI.numPayloads = numPayloads;
 
 if (inFrame->m_userSEI.numPayloads)
@@ -1023,6 +1047,8 @@
 x265_sei_payload input;
 if ((i == (numPayloads - 1)) && toneMapEnable)
 input = toneMap;
+else if (m_enableUserSei)
+input = seiMsg;
 else
 input = pic_in->userSEI.payloads[i];
 int size = inFrame->m_userSEI.payloads[i].payloadSize = 
input.payloadSize;
@@ -1033,6 +1059,8 @@
 }
 if (toneMap.payload)
 x265_free(toneMap.payload);
+if (seiMsg.payload)
+x265_free(seiMsg.payload);
 }
 
 if (pic_in->quantOffsets != NULL)
@@ -4706,6 +4734,52 @@
 

Re: [x265] [PATCH] CEA 608/708 Support

2018-06-20 Thread Indumathi Ravichandran
Please ignore this patch. I will resend with some changes.

Thanks,
Indumathi R

On Wed, Jun 20, 2018 at 2:13 PM,  wrote:

> # HG changeset patch
> # User induma...@multicorewareinc.com
> # Date 1528726491 -19800
> #  Mon Jun 11 19:44:51 2018 +0530
> # Node ID e1dd8424a3bd5f9f61f4a73aec6f2aee27591772
> # Parent  a8a5ccf5aaf7e04e439a216e5c396991c6b76999
> CEA 608/708 Support
>
> Parse the SEI messages from text file and insert it into the userSEI with
> cli option.
>
> diff -r a8a5ccf5aaf7 -r e1dd8424a3bd doc/reST/cli.rst
> --- a/doc/reST/cli.rst  Wed Jun 13 09:54:27 2018 +0530
> +++ b/doc/reST/cli.rst  Mon Jun 11 19:44:51 2018 +0530
> @@ -2135,6 +2135,12 @@
>
> Maximum luma value allowed for input pictures. Any values above
> max-luma
> are clipped.  No default.
> +
> +.. option:: --usersei-file 
> +
> +Text file containing userSEI in POC order :
> /
> +Parse the input file specified and inserts SEI messages into the
> bitstream.
> +Currently, we support only PREFIX SEI messages. This is an
> "application-only" feature.
>
>  .. option:: --atc-sei 
>
> diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/CMakeLists.txt
> --- a/source/CMakeLists.txt Wed Jun 13 09:54:27 2018 +0530
> +++ b/source/CMakeLists.txt Mon Jun 11 19:44:51 2018 +0530
> @@ -29,7 +29,7 @@
>  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 161)
> +set(X265_BUILD 162)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
> "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/common/param.cpp
> --- a/source/common/param.cpp   Wed Jun 13 09:54:27 2018 +0530
> +++ b/source/common/param.cpp   Mon Jun 11 19:44:51 2018 +0530
> @@ -302,6 +302,7 @@
>  param->bDisableLookahead = 0;
>  param->bCopyPicToFrame = 1;
>  param->maxAUSizeFactor = 1;
> +param->userSeiFile = NULL;
>
>  /* DCT Approximations */
>  param->bLowPassDct = 0;
> @@ -1048,6 +1049,7 @@
> OPT("pic-struct") p->pictureStructure = atoi(value);
>  OPT("chunk-start") p->chunkStart = atoi(value);
>  OPT("chunk-end") p->chunkEnd = atoi(value);
> +OPT("usersei-file") p->userSeiFile = strdup(value);
>  else
>  return X265_PARAM_BAD_NAME;
>  }
> diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cppWed Jun 13 09:54:27 2018 +0530
> +++ b/source/encoder/encoder.cppMon Jun 11 19:44:51 2018 +0530
> @@ -79,6 +79,7 @@
>  m_threadPool = NULL;
>  m_analysisFileIn = NULL;
>  m_analysisFileOut = NULL;
> +m_seiFile = NULL;
>  m_offsetEmergency = NULL;
>  m_iFrameNum = 0;
>  m_iPPSQpMinus26 = 0;
> @@ -412,6 +413,20 @@
>
>  m_emitCLLSEI = p->maxCLL || p->maxFALL;
>
> +if (m_param->userSeiFile)
> +{
> +m_seiFile = x265_fopen(m_param->userSeiFile, "r");
> +if (!m_seiFile)
> +{
> +x265_log_file(NULL, X265_LOG_ERROR, "%s file not found or
> Failed to open\n", m_param->userSeiFile);
> +m_aborted = true;
> +}
> +else
> + m_enableUserSei = 1;
> +}
> +else
> + m_enableUserSei = 0;
> +
>  #if ENABLE_HDR10_PLUS
>  if (m_bToneMap)
>  m_numCimInfo = m_hdr10plus_api->hdr10plus_
> json_to_movie_cim(m_param->toneMapFile, m_cim);
> @@ -782,6 +797,8 @@
>  }
>  X265_FREE(temp);
>   }
> +if (m_seiFile)
> +fclose(m_seiFile);
>  if (m_param)
>  {
>  if (m_param->csvfpt)
> @@ -922,7 +939,14 @@
>  }
>  }
>  #endif
> -
> +/* seiMsg will contain SEI messages specified in a fixed file format in
> POC order.
> +* Format of the file : / TYPE> */
> +x265_sei_payload seiMsg;
> +seiMsg.payload = NULL;
> +if (m_enableUserSei)
> +{
> +seiMsg = readUserSeiFile(m_pocLast);
> +}
>  if (pic_in->bitDepth < 8 || pic_in->bitDepth > 16)
>  {
>  x265_log(m_param, X265_LOG_ERROR, "Input bit depth (%d) must
> be between 8 and 16\n",
> @@ -1008,6 +1032,8 @@
>  if (m_bToneMap && toneMap.payload)
>  tone

[x265] [PATCH] CEA 608/708 Support

2018-06-20 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1528726491 -19800
#  Mon Jun 11 19:44:51 2018 +0530
# Node ID e1dd8424a3bd5f9f61f4a73aec6f2aee27591772
# Parent  a8a5ccf5aaf7e04e439a216e5c396991c6b76999
CEA 608/708 Support

Parse the SEI messages from text file and insert it into the userSEI with cli 
option.

diff -r a8a5ccf5aaf7 -r e1dd8424a3bd doc/reST/cli.rst
--- a/doc/reST/cli.rst  Wed Jun 13 09:54:27 2018 +0530
+++ b/doc/reST/cli.rst  Mon Jun 11 19:44:51 2018 +0530
@@ -2135,6 +2135,12 @@
 
Maximum luma value allowed for input pictures. Any values above max-luma
are clipped.  No default.
+
+.. option:: --usersei-file 
+
+Text file containing userSEI in POC order : 
/
+Parse the input file specified and inserts SEI messages into the 
bitstream. 
+Currently, we support only PREFIX SEI messages. This is an 
"application-only" feature.
 
 .. option:: --atc-sei 
 
diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Jun 13 09:54:27 2018 +0530
+++ b/source/CMakeLists.txt Mon Jun 11 19:44:51 2018 +0530
@@ -29,7 +29,7 @@
 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 161)
+set(X265_BUILD 162)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/common/param.cpp
--- a/source/common/param.cpp   Wed Jun 13 09:54:27 2018 +0530
+++ b/source/common/param.cpp   Mon Jun 11 19:44:51 2018 +0530
@@ -302,6 +302,7 @@
 param->bDisableLookahead = 0;
 param->bCopyPicToFrame = 1;
 param->maxAUSizeFactor = 1;
+param->userSeiFile = NULL;
 
 /* DCT Approximations */
 param->bLowPassDct = 0;
@@ -1048,6 +1049,7 @@
OPT("pic-struct") p->pictureStructure = atoi(value);
 OPT("chunk-start") p->chunkStart = atoi(value);
 OPT("chunk-end") p->chunkEnd = atoi(value);
+OPT("usersei-file") p->userSeiFile = strdup(value);
 else
 return X265_PARAM_BAD_NAME;
 }
diff -r a8a5ccf5aaf7 -r e1dd8424a3bd source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppWed Jun 13 09:54:27 2018 +0530
+++ b/source/encoder/encoder.cppMon Jun 11 19:44:51 2018 +0530
@@ -79,6 +79,7 @@
 m_threadPool = NULL;
 m_analysisFileIn = NULL;
 m_analysisFileOut = NULL;
+m_seiFile = NULL;
 m_offsetEmergency = NULL;
 m_iFrameNum = 0;
 m_iPPSQpMinus26 = 0;
@@ -412,6 +413,20 @@
 
 m_emitCLLSEI = p->maxCLL || p->maxFALL;
 
+if (m_param->userSeiFile)
+{
+m_seiFile = x265_fopen(m_param->userSeiFile, "r");
+if (!m_seiFile)
+{
+x265_log_file(NULL, X265_LOG_ERROR, "%s file not found or Failed 
to open\n", m_param->userSeiFile);
+m_aborted = true;
+}
+else
+ m_enableUserSei = 1;
+}
+else
+ m_enableUserSei = 0;
+
 #if ENABLE_HDR10_PLUS
 if (m_bToneMap)
 m_numCimInfo = 
m_hdr10plus_api->hdr10plus_json_to_movie_cim(m_param->toneMapFile, m_cim);
@@ -782,6 +797,8 @@
 }
 X265_FREE(temp);
  }
+if (m_seiFile)
+fclose(m_seiFile);
 if (m_param)
 {
 if (m_param->csvfpt)
@@ -922,7 +939,14 @@
 }
 }
 #endif
-
+/* seiMsg will contain SEI messages specified in a fixed file format in POC 
order.
+* Format of the file : / */
+x265_sei_payload seiMsg;
+seiMsg.payload = NULL;
+if (m_enableUserSei)
+{
+seiMsg = readUserSeiFile(m_pocLast);
+}
 if (pic_in->bitDepth < 8 || pic_in->bitDepth > 16)
 {
 x265_log(m_param, X265_LOG_ERROR, "Input bit depth (%d) must be 
between 8 and 16\n",
@@ -1008,6 +1032,8 @@
 if (m_bToneMap && toneMap.payload)
 toneMapEnable = 1;
 int numPayloads = pic_in->userSEI.numPayloads + toneMapEnable;
+if (m_enableUserSei && seiMsg.payload)
+numPayloads += m_enableUserSei;
 inFrame->m_userSEI.numPayloads = numPayloads;
 
 if (inFrame->m_userSEI.numPayloads)
@@ -1023,6 +1049,8 @@
 x265_sei_payload input;
 if ((i == (numPayloads - 1)) && toneMapEnable)
 input = toneMap;
+else if (m_enableUserSei)
+input = seiMsg;
 else
 input = pic_in->userSEI.payloads[i];
 int size = inFrame->m_userSEI.payloads[i].payloadSize = 
input.payloadSize;
@@ -1033,6 +1061,8 @@
 }
 if (toneMap.payload)
 x265_free(toneMap.payload);
+if (seiMsg.payload)
+x265_free(seiMsg.payload);
 }
 
 if (pic_in->quantOffsets != NULL)
@@ 

Re: [x265] [PATCH] Add VMAF suppport to report per frame and aggregate VMAF score

2018-04-23 Thread Indumathi Ravichandran
Currently, we are not supporting VMAF in Windows, since it's not generating
library files. We can try using MSYS/MinGW64 to add support for Windows in
future.

On Mon, Apr 23, 2018 at 7:45 PM, Glenn Odagawa 
wrote:

> GOOD QUESTION!
>
>
>
>
>
>
> Glenn S. Odagawa & Quilo
> Chicago, IL
> +1 (773) 747-7546
> www.TheLayeredMix.co.nf-Website hosted on Norfolk Island
>
> -Original Message- From: Mario *LigH* Rohkrämer
> Sent: Monday, April 23, 2018 7:55 AM
> To: Development for x265
> Subject: Re: [x265] [PATCH] Add VMAF suppport to report per frame and
> aggregate VMAF score
>
>
> Mario Rohkrämer schrieb am 12.04.2018 um 18:25:
>
>> Am 12.04.2018, 13:13 Uhr, schrieb :
>>
>> +.. Note::
>>> +
>>> +When setting ENABLE_LIBVMAF cmake option to ON, it is recommended to
>>> +also set ENABLE_SHARED to OFF to prevent build problems.
>>> +We only need the static library from these builds.
>>> +
>>> +Binaries build with windows will not have VMAF support.
>>>
>>
>>
>> Can you explain why support for Windows builds is not (yet?) possible?
>>
>> I do remember that MABS is able to compile ffmpeg including VMAF, and
>> also I do remember that it compiled only for x86-64 architecture due to
>> some specific EMMS intrinsics. But, of course, MABS pulls the whole libvmaf
>> source to do so. You will probably not want to require that. But it might
>> not be too hard in MSYS/MinGW64 if an experienced user does it manually?
>>
>
>
> Still curious...
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] doc: update cli.rst for vmaf

2018-04-17 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1523965217 -19800
#  Tue Apr 17 17:10:17 2018 +0530
# Node ID 2b2914134de41d9573270aa9cb95d7a5b017
# Parent  7305220d469b0c262ef9742d90419ff85832d233
doc: update cli.rst for vmaf

diff -r 7305220d469b -r 2b2914134de4 doc/reST/api.rst
--- a/doc/reST/api.rst  Fri Apr 13 13:51:32 2018 +0530
+++ b/doc/reST/api.rst  Tue Apr 17 17:10:17 2018 +0530
@@ -411,7 +411,7 @@
 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::
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Add VMAF suppport to report per frame and aggregate VMAF score

2018-04-17 Thread Indumathi Ravichandran
On Tue, Apr 17, 2018 at 12:46 PM, Deepthi Nandakumar <
deepthipnandaku...@gmail.com> wrote:

> Thanks. My question is, why not calculate the full VMAF metrics at the end
> of encode, and write in the per-frame VMAF metric into your CSV file (if
> the file is incrementally written, you might need to do some weird pointer
> math, moving to the end of each line etc).
>
If we call compute_vmaf API at the end of encode, it will return aggregate
vmaf score for the given input. It will not give you the frame level vmaf
scores. We can get the frame level scores dumped to a file by specifying
-log_path and -log_fmt options. The log file generated will be in POC order
and not in the Encode Order. We can read from that log file and dump the
frame level scores in CSV file, but this scenario will not be efficient for
inputs with more frames like movies.

>
> Isnt that a better solution than the current one - where you're not only
> calculating VMAF twice, once each for per-frame and per-sequence, but your
> per-frame metric isn't even accurate, because you've left out the motion
> component.
>
We agree that frame level vmaf scores is not accurate, but it can be a
reference since it includes spatial scores.

>
> VMAF calculation one frame at a time should be used when the file has only
> one frame.
>
> On Tue, Apr 17, 2018 at 11:52 AM, Indumathi Ravichandran <
> induma...@multicorewareinc.com> wrote:
>
>>
>>
>> On Tue, Apr 17, 2018 at 6:44 AM, Deepthi Nandakumar <
>> deepthipnandaku...@gmail.com> wrote:
>>
>>> I cannot find the implementation of compute_vmaf in the patch attached.
>>>
>> compute_vmaf is an API function exposed by libvmaf and we have integrated
>> libvmaf into libx265.
>>
>>> I'm not sure why the libvmaf interface for a single frame  doesnt
>>> include the motion component?
>>>
>> Spatial score of any frame X requires its source and recon YUVS. Whereas
>> temporal score of frame 'X' requires the source YUVs of frames X and X-1(
>> in POC order ). Since we are just passing the source and recon YUVs of any
>> particular frame, it doesn't include motion score in it. Even if we buffer
>> the recons and give source and recon of X and X-1 to VMAF, it will only
>> return a single aggregare VMAF score ( Again it is not specific to that
>> frame).
>>
>>> Can you point me to this code and vmaf API description?
>>>
>> Refer this link for VMAF API description : https://github.com/Netflix/vma
>> f#usage-through-libvmaf
>>
>>>
>>> On Mon, Apr 16, 2018 at 5:26 PM, Aruna Matheswaran <
>>> ar...@multicorewareinc.com> wrote:
>>>
>>>>
>>>>
>>>> On Mon, Apr 16, 2018 at 4:00 PM, Ashok Kumar Mishra <
>>>> as...@multicorewareinc.com> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Mon, Apr 16, 2018 at 3:33 PM, Deepthi Nandakumar <
>>>>> deepthipnandaku...@gmail.com> wrote:
>>>>>
>>>>>> Not sure I understand - are you saying you write the frame level VMAF
>>>>>> score into the CSV file, and then read it back again to compute the mean?
>>>>>>
>>>>>
>>>>> Yes, now I sense something wrong in our code. If we are computing per
>>>>> frame vmaf score,  we can take the mean of vmaf scores of all frames to 
>>>>> get
>>>>> the aggregate vmaf score.
>>>>> So file reads are not required. I was thinking in a different way that
>>>>> a user may be interested in either frame level or file level vmaf score.
>>>>>
>>>>> Is it the aggregate vmaf score is same as the mean of per frame vmaf
>>>>> scores of all the frames in a file or there are some other methods used to
>>>>> calculate aggregate vmaf score for a file?
>>>>>
>>>>
>>>> The frame level score we get from the vmaf library by passing just a
>>>> source frame and its recon isn't actually a vmaf score as it doesn't
>>>> include the motion component of vmaf. When we pass the whole source and
>>>> recon yuvs to the vmaf library, it will compute per frame vmaf scores
>>>> (which includes motion component in its computation) and give out the mean
>>>> vmaf score of all the frames as the aggregate score. Therefore, we are
>>>> passing the source and recon yuv files to get the aggregate vmaf score
>>>> instead of just averaging the frame level scores.
>>>>
>>>>>
>>>>>
>>>>

Re: [x265] [PATCH] Add VMAF suppport to report per frame and aggregate VMAF score

2018-04-17 Thread Indumathi Ravichandran
On Tue, Apr 17, 2018 at 6:44 AM, Deepthi Nandakumar <
deepthipnandaku...@gmail.com> wrote:

> I cannot find the implementation of compute_vmaf in the patch attached.
>
compute_vmaf is an API function exposed by libvmaf and we have integrated
libvmaf into libx265.

> I'm not sure why the libvmaf interface for a single frame  doesnt include
> the motion component?
>
Spatial score of any frame X requires its source and recon YUVS. Whereas
temporal score of frame 'X' requires the source YUVs of frames X and X-1(
in POC order ). Since we are just passing the source and recon YUVs of any
particular frame, it doesn't include motion score in it. Even if we buffer
the recons and give source and recon of X and X-1 to VMAF, it will only
return a single aggregare VMAF score ( Again it is not specific to that
frame).

> Can you point me to this code and vmaf API description?
>
Refer this link for VMAF API description :
https://github.com/Netflix/vmaf#usage-through-libvmaf

>
> On Mon, Apr 16, 2018 at 5:26 PM, Aruna Matheswaran <
> ar...@multicorewareinc.com> wrote:
>
>>
>>
>> On Mon, Apr 16, 2018 at 4:00 PM, Ashok Kumar Mishra <
>> as...@multicorewareinc.com> wrote:
>>
>>>
>>>
>>> On Mon, Apr 16, 2018 at 3:33 PM, Deepthi Nandakumar <
>>> deepthipnandaku...@gmail.com> wrote:
>>>
 Not sure I understand - are you saying you write the frame level VMAF
 score into the CSV file, and then read it back again to compute the mean?

>>>
>>> Yes, now I sense something wrong in our code. If we are computing per
>>> frame vmaf score,  we can take the mean of vmaf scores of all frames to get
>>> the aggregate vmaf score.
>>> So file reads are not required. I was thinking in a different way that a
>>> user may be interested in either frame level or file level vmaf score.
>>>
>>> Is it the aggregate vmaf score is same as the mean of per frame vmaf
>>> scores of all the frames in a file or there are some other methods used to
>>> calculate aggregate vmaf score for a file?
>>>
>>
>> The frame level score we get from the vmaf library by passing just a
>> source frame and its recon isn't actually a vmaf score as it doesn't
>> include the motion component of vmaf. When we pass the whole source and
>> recon yuvs to the vmaf library, it will compute per frame vmaf scores
>> (which includes motion component in its computation) and give out the mean
>> vmaf score of all the frames as the aggregate score. Therefore, we are
>> passing the source and recon yuv files to get the aggregate vmaf score
>> instead of just averaging the frame level scores.
>>
>>>
>>>

 On Mon, Apr 16, 2018 at 3:24 PM, Ashok Kumar Mishra <
 as...@multicorewareinc.com> wrote:

>
>
> On Mon, Apr 16, 2018 at 2:42 PM, Deepthi Nandakumar <
> deepthipnandaku...@gmail.com> wrote:
>
>> Why are file reads required to compute vmaf? The recon and original
>> yuv sources are available.
>>
>
> File reads are required when you compute vmaf score of the complete
> file, and it is not required for frame level vmaf score.
>
>>
>> Why floating point reads?
>>
>
> I believe there is no floating point reads, the vmaf score is floating
> point. Correct me if I am wrong.
>
>
>>
>> On Thu, Apr 12, 2018 at 5:31 PM, Ashok Kumar Mishra <
>> as...@multicorewareinc.com> wrote:
>>
>>>
>>>
>>> On Thu, Apr 12, 2018 at 4:43 PM, 
>>> wrote:
>>>
 # HG changeset patch
 # User IndumathiR
 # Date 1518528290 -19800
 #  Tue Feb 13 18:54:50 2018 +0530
 # Node ID 27e3b161cd8b59ad1cae67a96e11e3e0506d5017
 # Parent  04a337abd70de269cef7d9655365f3a3ebde02aa
 Add VMAF suppport to report per frame and aggregate VMAF score

 diff -r 04a337abd70d -r 27e3b161cd8b doc/reST/api.rst
 --- a/doc/reST/api.rst  Thu Apr 12 15:10:59 2018 +0530
 +++ b/doc/reST/api.rst  Tue Feb 13 18:54:50 2018 +0530
 @@ -398,7 +398,30 @@
  * release library static allocations, reset configured
 CTU size */
 void x265_cleanup(void);

 +VMAF (Video Multi-Method Assessment Fusion)
 +==

 +If you set the ENABLE_LIBVMAF cmake option to ON, then x265 will
 report per frame
 +and aggregate VMAF score for the given input and dump the scores
 in csv file.
 +The user also need to specify the :option:`--recon` in command
 line to get the VMAF scores.
 +
 +/* x265_calculate_vmafScore:
 + *returns VMAF score for the input video.
 + *This api must be called only after encoding was done. */
 +double x265_calculate_vmafscore(x265_param*, x265_vmaf_data*);
 +
 +/* x265_calculate_vmaf_framelevelscore:
 + * 

[x265] [PATCH] Fix warnings related to VMAF

2018-04-13 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1523607692 -19800
#  Fri Apr 13 13:51:32 2018 +0530
# Node ID 7305220d469b0c262ef9742d90419ff85832d233
# Parent  07defe235cde1949c55464952ee1dbdc10baf5e4
Fix warnings related to VMAF

diff -r 07defe235cde -r 7305220d469b source/x265.h
--- a/source/x265.h Thu Apr 12 16:57:19 2018 +0530
+++ b/source/x265.h Fri Apr 13 13:51:32 2018 +0530
@@ -614,7 +614,7 @@
 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
  *
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Add VMAF suppport to report per frame and aggregate VMAF score

2018-04-12 Thread indumathi
# HG changeset patch
# User IndumathiR
# Date 1518528290 -19800
#  Tue Feb 13 18:54:50 2018 +0530
# Node ID ca4a690f5036951da78441a4c70577a5977b1e0e
# Parent  593e63cda903370af926711c0ba05ce37d045c90
Add VMAF suppport to report per frame and aggregate VMAF score

diff -r 593e63cda903 -r ca4a690f5036 doc/reST/api.rst
--- a/doc/reST/api.rst  Thu Apr 05 17:16:07 2018 +0530
+++ b/doc/reST/api.rst  Tue Feb 13 18:54:50 2018 +0530
@@ -398,7 +398,30 @@
 * release library static allocations, reset configured CTU size */
void x265_cleanup(void);
 
+VMAF (Video Multi-Method Assessment Fusion)
+==
 
+If you set the ENABLE_LIBVMAF cmake option to ON, then x265 will report per 
frame
+and aggregate VMAF score for the given input and dump the scores in csv file.
+The user also need to specify the :option:`--recon` in command line to get the 
VMAF scores.
+ 
+/* x265_calculate_vmafScore:
+ *returns VMAF score for the input video.
+ *This api must be called only after encoding was done. */
+double x265_calculate_vmafscore(x265_param*, x265_vmaf_data*);
+
+/* x265_calculate_vmaf_framelevelscore:
+ *returns VMAF score for each frame in a given input video. */
+double x265_calculate_vmaf_framelevelscore(x265_vmaf_framedata*);
+
+.. Note::
+
+When setting ENABLE_LIBVMAF cmake option to ON, it is recommended to
+also set ENABLE_SHARED to OFF to prevent build problems.  
+We only need the static library from these builds.
+
+Binaries build with windows will not have VMAF support.
+  
 Multi-library Interface
 ===
 
diff -r 593e63cda903 -r ca4a690f5036 source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Apr 05 17:16:07 2018 +0530
+++ b/source/CMakeLists.txt Tue Feb 13 18:54:50 2018 +0530
@@ -29,7 +29,7 @@
 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 157)
+set(X265_BUILD 158)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
@@ -109,6 +109,11 @@
 if(NO_ATOMICS)
 add_definitions(-DNO_ATOMICS=1)
 endif(NO_ATOMICS)
+find_library(VMAF vmaf)
+option(ENABLE_LIBVMAF "Enable VMAF" OFF)
+if(ENABLE_LIBVMAF)
+add_definitions(-DENABLE_LIBVMAF)
+endif()
 endif(UNIX)
 
 if(X64 AND NOT WIN32)
@@ -536,6 +541,9 @@
 if(EXTRA_LIB)
 target_link_libraries(x265-static ${EXTRA_LIB})
 endif()
+if(ENABLE_LIBVMAF)
+target_link_libraries(x265-static ${VMAF})
+endif()
 install(TARGETS x265-static
 LIBRARY DESTINATION ${LIB_INSTALL_DIR}
 ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
diff -r 593e63cda903 -r ca4a690f5036 source/common/picyuv.h
--- a/source/common/picyuv.hThu Apr 05 17:16:07 2018 +0530
+++ b/source/common/picyuv.hTue Feb 13 18:54:50 2018 +0530
@@ -72,6 +72,7 @@
 pixel   m_maxChromaVLevel;
 pixel   m_minChromaVLevel;
 double  m_avgChromaVLevel;
+double  m_vmafScore;
 x265_param *m_param;
 
 PicYuv();
diff -r 593e63cda903 -r ca4a690f5036 source/encoder/api.cpp
--- a/source/encoder/api.cppThu Apr 05 17:16:07 2018 +0530
+++ b/source/encoder/api.cppTue Feb 13 18:54:50 2018 +0530
@@ -31,6 +31,10 @@
 #include "nal.h"
 #include "bitcost.h"
 
+#if ENABLE_LIBVMAF
+#include "libvmaf.h"
+#endif
+
 /* multilib namespace reflectors */
 #if LINKED_8BIT
 namespace x265_8bit {
@@ -302,13 +306,34 @@
 encoder->fetchStats(outputStats, statsSizeBytes);
 }
 }
+#if ENABLE_LIBVMAF
+void x265_vmaf_encoder_log(x265_encoder* enc, int argc, char **argv, 
x265_param *param, x265_vmaf_data *vmafdata)
+{
+if (enc)
+{
+Encoder *encoder = static_cast(enc);
+x265_stats stats;   
+stats.aggregateVmafScore = x265_calculate_vmafscore(param, vmafdata);
+if(vmafdata->reference_file)
+fclose(vmafdata->reference_file);
+if(vmafdata->distorted_file)
+fclose(vmafdata->distorted_file);
+if(vmafdata)
+x265_free(vmafdata);
+encoder->fetchStats(, sizeof(stats));
+int padx = encoder->m_sps.conformanceWindow.rightOffset;
+int pady = encoder->m_sps.conformanceWindow.bottomOffset;
+x265_csvlog_encode(encoder->m_param, , padx, pady, argc, argv);
+}
+}
+#endif
 
 void x265_encoder_log(x265_encoder* enc, int argc, char **argv)
 {
 if (enc)
 {
 Encoder *encoder = static_cast(enc);
-x265_stats stats;
+x265_stats stats;   
 encoder->fetchStats(, sizeof(stats));
 int padx = encoder->m_sps.conformanceWindow.rightOffset;
 int pady = encoder->m_sps.conformanceWindow.bottomOffset;
@@ -457,7 +482,13 @@
 _csvlog_frame,
   

[x265] [PATCH] Fix Visual Studio version check

2017-11-10 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1510215603 -19800
#  Thu Nov 09 13:50:03 2017 +0530
# Node ID 165a46c3e0bef164c01b9e348c8bc2704f9c9285
# Parent  bd438ce108435deb4f0063fca9a9e14a75e8de38
Fix Visual Studio version check

diff -r bd438ce10843 -r 165a46c3e0be build/vc15-x86/build-all.bat
--- a/build/vc15-x86/build-all.bat  Wed Nov 08 16:18:29 2017 +0530
+++ b/build/vc15-x86/build-all.bat  Thu Nov 09 13:50:03 2017 +0530
@@ -1,5 +1,5 @@
 @echo off
-if "%VS120COMNTOOLS%" == "" (
+if "%VS150COMNTOOLS%" == "" (
   msg "%username%" "Visual Studio 15 not detected"
   exit 1
 )
@@ -7,7 +7,7 @@
   call make-solutions.bat
 )
 if exist x265.sln (
-  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
+  call "%VS150COMNTOOLS%\..\..\VC\vcvarsall.bat"
   MSBuild /property:Configuration="Release" x265.sln
   MSBuild /property:Configuration="Debug" x265.sln
   MSBuild /property:Configuration="RelWithDebInfo" x265.sln
diff -r bd438ce10843 -r 165a46c3e0be build/vc15-x86_64/build-all.bat
--- a/build/vc15-x86_64/build-all.bat   Wed Nov 08 16:18:29 2017 +0530
+++ b/build/vc15-x86_64/build-all.bat   Thu Nov 09 13:50:03 2017 +0530
@@ -1,5 +1,5 @@
 @echo off
-if "%VS120COMNTOOLS%" == "" (
+if "%VS150COMNTOOLS%" == "" (
   msg "%username%" "Visual Studio 15 not detected"
   exit 1
 )
@@ -7,7 +7,7 @@
   call make-solutions.bat
 )
 if exist x265.sln (
-  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
+  call "%VS150COMNTOOLS%\..\..\VC\vcvarsall.bat"
   MSBuild /property:Configuration="Release" x265.sln
   MSBuild /property:Configuration="Debug" x265.sln
   MSBuild /property:Configuration="RelWithDebInfo" x265.sln
diff -r bd438ce10843 -r 165a46c3e0be build/vc15-x86_64/multilib.bat
--- a/build/vc15-x86_64/multilib.batWed Nov 08 16:18:29 2017 +0530
+++ b/build/vc15-x86_64/multilib.batThu Nov 09 13:50:03 2017 +0530
@@ -1,10 +1,10 @@
 @echo off
-if "%VS120COMNTOOLS%" == "" (
+if "%VS150COMNTOOLS%" == "" (
   msg "%username%" "Visual Studio 15 not detected"
   exit 1
 )
 
-call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
+call "%VS150COMNTOOLS%\..\..\VC\vcvarsall.bat"
 
 @mkdir 12bit
 @mkdir 10bit
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Add Visual Studio 2017 build folders

2017-11-01 Thread indumathi
# HG changeset patch
# User induma...@multicorewareinc.com
# Date 1509355125 -19800
#  Mon Oct 30 14:48:45 2017 +0530
# Node ID 3c60dace95b0137b3ab14975eaa722e0e203835c
# Parent  df2de6ea407dde32cf957779e0b2e19624163268
Add Visual Studio 2017 build folders

diff -r df2de6ea407d -r 3c60dace95b0 build/vc15-x86/build-all.bat
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/build/vc15-x86/build-all.bat  Mon Oct 30 14:48:45 2017 +0530
@@ -0,0 +1,14 @@
+@echo off
+if "%VS120COMNTOOLS%" == "" (
+  msg "%username%" "Visual Studio 15 not detected"
+  exit 1
+)
+if not exist x265.sln (
+  call make-solutions.bat
+)
+if exist x265.sln (
+  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
+  MSBuild /property:Configuration="Release" x265.sln
+  MSBuild /property:Configuration="Debug" x265.sln
+  MSBuild /property:Configuration="RelWithDebInfo" x265.sln
+)
diff -r df2de6ea407d -r 3c60dace95b0 build/vc15-x86/make-solutions.bat
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/build/vc15-x86/make-solutions.bat Mon Oct 30 14:48:45 2017 +0530
@@ -0,0 +1,6 @@
+@echo off
+::
+:: run this batch file to create a Visual Studio solution file for this 
project.
+:: See the cmake documentation for other generator targets
+::
+cmake -G "Visual Studio 15" ..\..\source && cmake-gui ..\..\source
diff -r df2de6ea407d -r 3c60dace95b0 build/vc15-x86_64/build-all.bat
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/build/vc15-x86_64/build-all.bat   Mon Oct 30 14:48:45 2017 +0530
@@ -0,0 +1,14 @@
+@echo off
+if "%VS120COMNTOOLS%" == "" (
+  msg "%username%" "Visual Studio 15 not detected"
+  exit 1
+)
+if not exist x265.sln (
+  call make-solutions.bat
+)
+if exist x265.sln (
+  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
+  MSBuild /property:Configuration="Release" x265.sln
+  MSBuild /property:Configuration="Debug" x265.sln
+  MSBuild /property:Configuration="RelWithDebInfo" x265.sln
+)
diff -r df2de6ea407d -r 3c60dace95b0 build/vc15-x86_64/make-solutions.bat
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/build/vc15-x86_64/make-solutions.bat  Mon Oct 30 14:48:45 2017 +0530
@@ -0,0 +1,6 @@
+@echo off
+::
+:: run this batch file to create a Visual Studio solution file for this 
project.
+:: See the cmake documentation for other generator targets
+::
+cmake -G "Visual Studio 15 Win64" ..\..\source && cmake-gui ..\..\source
diff -r df2de6ea407d -r 3c60dace95b0 build/vc15-x86_64/multilib.bat
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/build/vc15-x86_64/multilib.batMon Oct 30 14:48:45 2017 +0530
@@ -0,0 +1,44 @@
+@echo off
+if "%VS120COMNTOOLS%" == "" (
+  msg "%username%" "Visual Studio 15 not detected"
+  exit 1
+)
+
+call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
+
+@mkdir 12bit
+@mkdir 10bit
+@mkdir 8bit
+
+@cd 12bit
+cmake -G "Visual Studio 15 Win64" ../../../source -DHIGH_BIT_DEPTH=ON 
-DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON
+if exist x265.sln (
+  MSBuild /property:Configuration="Release" x265.sln
+  copy/y Release\x265-static.lib ..\8bit\x265-static-main12.lib
+)
+
+@cd ..\10bit
+cmake -G "Visual Studio 15 Win64" ../../../source -DHIGH_BIT_DEPTH=ON 
-DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF
+if exist x265.sln (
+  MSBuild /property:Configuration="Release" x265.sln
+  copy/y Release\x265-static.lib ..\8bit\x265-static-main10.lib
+)
+
+@cd ..\8bit
+if not exist x265-static-main10.lib (
+  msg "%username%" "10bit build failed"
+  exit 1
+)
+if not exist x265-static-main12.lib (
+  msg "%username%" "12bit build failed"
+  exit 1
+)
+cmake -G "Visual Studio 15 Win64" ../../../source 
-DEXTRA_LIB="x265-static-main10.lib;x265-static-main12.lib" -DLINKED_10BIT=ON 
-DLINKED_12BIT=ON
+if exist x265.sln (
+  MSBuild /property:Configuration="Release" x265.sln
+  :: combine static libraries (ignore warnings caused by winxp.cpp hacks)
+  move Release\x265-static.lib x265-static-main.lib
+  LIB.EXE /ignore:4006 /ignore:4221 /OUT:Release\x265-static.lib 
x265-static-main.lib x265-static-main10.lib x265-static-main12.lib
+)
+
+pause
diff -r df2de6ea407d -r 3c60dace95b0 source/CMakeLists.txt
--- a/source/CMakeLists.txt Mon Oct 09 17:42:44 2017 +0530
+++ b/source/CMakeLists.txt Mon Oct 30 14:48:45 2017 +0530
@@ -187,6 +187,11 @@
 if(MSVC AND (MSVC_VERSION LESS 1800) AND ENABLE_HDR10_PLUS)
 message(FATAL_ERROR "MSVC version 12.0 or above required to support 
hdr10plus")
 endif()
+if(WIN32 AND (MSVC_VERSION GREATER 1800))
+   if(CMAKE_VERSION VERSION_LESS 3.7)
+   message(FATAL_ERROR "cmake version not compatible for VS 2017. 
Update the cmake to versions 3.7 or above")
+   endif()
+endif()
 if(GCC)
 add_definitions(-Wall -Wextra -Wshadow)
 add_definitions(-D__STDC_LIMIT_MACROS=1)
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel