Re: [x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-04 Thread Mario *LigH* Rohkrämer

But it is not yet listed in the full help.
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-03 Thread Ashok Kumar Mishra
On Mon, Apr 2, 2018 at 6:31 PM,  wrote:

> # HG changeset patch
> # User Santhoshini Sekar 
> # Date 1522673234 -19800
> #  Mon Apr 02 18:17:14 2018 +0530
> # Node ID 6337356c86a4f5a49f275eb466d6fae32e6eb145
> # Parent  946f82dbf4e80cb272f43a32a78ba2b186469845
> introduce new CLI single-sei to write all SEI messages in one single NAL
>
> diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
> --- a/doc/reST/cli.rst
> +++ b/doc/reST/cli.rst
> @@ -2221,6 +2221,10 @@
>  .. option:: --idr-recovery-sei, --no-idr-recoveery-sei
>  Emit RecoveryPoint info as sei in bitstream for each IDR frame.
> Default disabled.
>
> +.. option:: --single-sei, --no-single-sei
> +Emit SEI messages in a single NAL unit instead of multiple NALs.
> Default disabled.
> +When HRD SEI is enabled the HM decoder will throw a warning.
> +
>  DCT Approximations
>  =
>
> diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
> --- a/source/CMakeLists.txt
> +++ b/source/CMakeLists.txt
> @@ -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 156)
> +set(X265_BUILD 157)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
> "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> diff --git a/source/common/param.cpp b/source/common/param.cpp
> --- a/source/common/param.cpp
> +++ b/source/common/param.cpp
> @@ -301,6 +301,7 @@
>  /* DCT Approximations */
>  param->bLowPassDct = 0;
>  param->bMVType = 0;
> +param->bSingleSeiNal = 0;
>  }
>
>  int x265_param_default_preset(x265_param* param, const char* preset,
> const char* tune)
> @@ -1017,6 +1018,7 @@
>  OPT("radl") p->radl = atoi(value);
>  OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
>  OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
> +OPT("single-sei") p->bSingleSeiNal = atobool(value);
>  else
>  return X265_PARAM_BAD_NAME;
>  }
> @@ -1382,6 +1384,14 @@
>  if (param->masteringDisplayColorVolume || param->maxFALL ||
> param->maxCLL)
>  param->bEmitHDRSEI = 1;
>
> +bool isSingleSEI = ((param->bEmitHRDSEI || param->bEmitInfoSEI ||
> param->decodedPictureHashSEI ||
> + param->masteringDisplayColorVolume ||
> param->maxCLL || param->maxFALL ||
> + param->bEmitHDRSEI ||
> param->bEmitIDRRecoverySEI) && param->bSingleSeiNal);
> +if (!isSingleSEI)
> +{
> +param->bSingleSeiNal = 0;
> +x265_log(param, X265_LOG_WARNING, "None of the SEI messages are
> enabled. Diabling Single SEI NAL\n");
> +}
>  return check_failed;
>  }
>
> @@ -1528,6 +1538,7 @@
>  TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");
>  TOOLOPT(param->rc.bStatWrite, "stats-write");
>  TOOLOPT(param->rc.bStatRead,  "stats-read");
> +TOOLOPT(param->bSingleSeiNal, "single-sei");
>  #if ENABLE_HDR10_PLUS
>  TOOLOPT(param->toneMapFile != NULL, "dhdr10-info");
>  #endif
> @@ -1751,6 +1762,7 @@
>  s += sprintf(s, " copy-pic=%d", p->bCopyPicToFrame);
>  s += sprintf(s, " max-ausize-factor=%.1f", p->maxAUSizeFactor);
>  BOOL(p->bDynamicRefine, "dynamic-refine");
> +BOOL(p->bSingleSeiNal, "single-sei");
>  #undef BOOL
>  return buf;
>  }
> diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp
> +++ b/source/encoder/encoder.cpp
> @@ -2289,26 +2289,26 @@
>  sbacCoder.codePPS(m_pps, (m_param->maxSlices <= 1), m_iPPSQpMinus26);
>  bs.writeByteAlignment();
>  list.serialize(NAL_UNIT_PPS, bs);
> -
> +if (m_param->bSingleSeiNal)
> +bs.resetBits();
>  if (m_param->bEmitHDRSEI)
>  {
>  SEIContentLightLevel cllsei;
>  cllsei.max_content_light_level = m_param->maxCLL;
>  cllsei.max_pic_average_light_level = m_param->maxFALL;
> -bs.resetBits();
> +if (!m_param->bSingleSeiNal)
> +bs.resetBits();
>  cllsei.write(bs, m_sps);
> -bs.writeByteAlignment();
> -list.serialize(NAL_UNIT_PREFIX_SEI, bs);
> -
> +cllsei.alignAndSerialize(bs, false, m_param->bSingleSeiNal,
> NAL_UNIT_PREFIX_SEI, list);
>  if (m_param->masteringDisplayColorVolume)
>  {
>  SEIMasteringDisplayColorVolume mdsei;
>  if (mdsei.parse(m_param->masteringDisplayColorVolume))
>  {
> -bs.resetBits();
> +if (!m_param->bSingleSeiNal)
> +bs.resetBits();
>  mdsei.write(bs, m_sps);
> -bs.writeByteAlignment();
> -list.serialize(NAL_UNIT_PREFIX_SEI, bs);
> +mdsei.alignAndSerialize(bs, false,
> m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, list);
>  }

[x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-02 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar 
# Date 1522673234 -19800
#  Mon Apr 02 18:17:14 2018 +0530
# Node ID 6337356c86a4f5a49f275eb466d6fae32e6eb145
# Parent  946f82dbf4e80cb272f43a32a78ba2b186469845
introduce new CLI single-sei to write all SEI messages in one single NAL

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -2221,6 +2221,10 @@
 .. option:: --idr-recovery-sei, --no-idr-recoveery-sei
 Emit RecoveryPoint info as sei in bitstream for each IDR frame. Default 
disabled.
 
+.. option:: --single-sei, --no-single-sei
+Emit SEI messages in a single NAL unit instead of multiple NALs. Default 
disabled.
+When HRD SEI is enabled the HM decoder will throw a warning.
+
 DCT Approximations
 =
 
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -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 156)
+set(X265_BUILD 157)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -301,6 +301,7 @@
 /* DCT Approximations */
 param->bLowPassDct = 0;
 param->bMVType = 0;
+param->bSingleSeiNal = 0;
 }
 
 int x265_param_default_preset(x265_param* param, const char* preset, const 
char* tune)
@@ -1017,6 +1018,7 @@
 OPT("radl") p->radl = atoi(value);
 OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
 OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
+OPT("single-sei") p->bSingleSeiNal = atobool(value);
 else
 return X265_PARAM_BAD_NAME;
 }
@@ -1382,6 +1384,14 @@
 if (param->masteringDisplayColorVolume || param->maxFALL || param->maxCLL)
 param->bEmitHDRSEI = 1;
 
+bool isSingleSEI = ((param->bEmitHRDSEI || param->bEmitInfoSEI || 
param->decodedPictureHashSEI ||
+ param->masteringDisplayColorVolume || param->maxCLL 
|| param->maxFALL || 
+ param->bEmitHDRSEI || param->bEmitIDRRecoverySEI) && 
param->bSingleSeiNal);
+if (!isSingleSEI)
+{
+param->bSingleSeiNal = 0;
+x265_log(param, X265_LOG_WARNING, "None of the SEI messages are 
enabled. Diabling Single SEI NAL\n");
+}
 return check_failed;
 }
 
@@ -1528,6 +1538,7 @@
 TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");
 TOOLOPT(param->rc.bStatWrite, "stats-write");
 TOOLOPT(param->rc.bStatRead,  "stats-read");
+TOOLOPT(param->bSingleSeiNal, "single-sei");
 #if ENABLE_HDR10_PLUS
 TOOLOPT(param->toneMapFile != NULL, "dhdr10-info");
 #endif
@@ -1751,6 +1762,7 @@
 s += sprintf(s, " copy-pic=%d", p->bCopyPicToFrame);
 s += sprintf(s, " max-ausize-factor=%.1f", p->maxAUSizeFactor);
 BOOL(p->bDynamicRefine, "dynamic-refine");
+BOOL(p->bSingleSeiNal, "single-sei");
 #undef BOOL
 return buf;
 }
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2289,26 +2289,26 @@
 sbacCoder.codePPS(m_pps, (m_param->maxSlices <= 1), m_iPPSQpMinus26);
 bs.writeByteAlignment();
 list.serialize(NAL_UNIT_PPS, bs);
-
+if (m_param->bSingleSeiNal)
+bs.resetBits();
 if (m_param->bEmitHDRSEI)
 {
 SEIContentLightLevel cllsei;
 cllsei.max_content_light_level = m_param->maxCLL;
 cllsei.max_pic_average_light_level = m_param->maxFALL;
-bs.resetBits();
+if (!m_param->bSingleSeiNal)
+bs.resetBits();
 cllsei.write(bs, m_sps);
-bs.writeByteAlignment();
-list.serialize(NAL_UNIT_PREFIX_SEI, bs);
-
+cllsei.alignAndSerialize(bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, list);
 if (m_param->masteringDisplayColorVolume)
 {
 SEIMasteringDisplayColorVolume mdsei;
 if (mdsei.parse(m_param->masteringDisplayColorVolume))
 {
-bs.resetBits();
+if (!m_param->bSingleSeiNal)
+bs.resetBits();
 mdsei.write(bs, m_sps);
-bs.writeByteAlignment();
-list.serialize(NAL_UNIT_PREFIX_SEI, bs);
+mdsei.alignAndSerialize(bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, list);
 }
 else
 x265_log(m_param, X265_LOG_WARNING, "unable to parse mastering 
display color volume info\n");
@@ -2328,15 +2328,13 @@
 "Copyright 2013-2018 (c) Multicoreware, Inc - "
 "http://x265.org - options: %s",
   

Re: [x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-02 Thread Santhoshini Sekar
Thanks for pointing it out. Will correct and resend.

On Mon, Apr 2, 2018 at 6:24 PM, Mario Rohkrämer  wrote:

> Am 02.04.2018, 14:49 Uhr, schrieb :
>
> +When HRD SEI is enabled the HM decoder will through a warning.
>>
> *throw
>
> --
>
> Fun and success!
> Mario *LigH* Rohkrämer
> mailto:cont...@ligh.de
> ___
> 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


Re: [x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-02 Thread Mario Rohkrämer

Am 02.04.2018, 14:49 Uhr, schrieb :


+When HRD SEI is enabled the HM decoder will through a warning.

*throw

--

Fun and success!
Mario *LigH* Rohkrämer
mailto:cont...@ligh.de
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] introduce new CLI single-sei to write all SEI messages in one single NAL

2018-04-02 Thread santhoshini
# HG changeset patch
# User Santhoshini Sekar 
# Date 1522673234 -19800
#  Mon Apr 02 18:17:14 2018 +0530
# Node ID e1b4fca6b9f7f916c11c69e5ec439857d71f58c6
# Parent  946f82dbf4e80cb272f43a32a78ba2b186469845
introduce new CLI single-sei to write all SEI messages in one single NAL

diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst
--- a/doc/reST/cli.rst
+++ b/doc/reST/cli.rst
@@ -2221,6 +2221,10 @@
 .. option:: --idr-recovery-sei, --no-idr-recoveery-sei
 Emit RecoveryPoint info as sei in bitstream for each IDR frame. Default 
disabled.
 
+.. option:: --single-sei, --no-single-sei
+Emit SEI messages in a single NAL unit instead of multiple NALs. Default 
disabled.
+When HRD SEI is enabled the HM decoder will through a warning.
+
 DCT Approximations
 =
 
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -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 156)
+set(X265_BUILD 157)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -301,6 +301,7 @@
 /* DCT Approximations */
 param->bLowPassDct = 0;
 param->bMVType = 0;
+param->bSingleSeiNal = 0;
 }
 
 int x265_param_default_preset(x265_param* param, const char* preset, const 
char* tune)
@@ -1017,6 +1018,7 @@
 OPT("radl") p->radl = atoi(value);
 OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
 OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
+OPT("single-sei") p->bSingleSeiNal = atobool(value);
 else
 return X265_PARAM_BAD_NAME;
 }
@@ -1382,6 +1384,14 @@
 if (param->masteringDisplayColorVolume || param->maxFALL || param->maxCLL)
 param->bEmitHDRSEI = 1;
 
+bool isSingleSEI = ((param->bEmitHRDSEI || param->bEmitInfoSEI || 
param->decodedPictureHashSEI ||
+ param->masteringDisplayColorVolume || param->maxCLL 
|| param->maxFALL || 
+ param->bEmitHDRSEI || param->bEmitIDRRecoverySEI) && 
param->bSingleSeiNal);
+if (!isSingleSEI)
+{
+param->bSingleSeiNal = 0;
+x265_log(param, X265_LOG_WARNING, "None of the SEI messages are 
enabled. Diabling Single SEI NAL\n");
+}
 return check_failed;
 }
 
@@ -1528,6 +1538,7 @@
 TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao");
 TOOLOPT(param->rc.bStatWrite, "stats-write");
 TOOLOPT(param->rc.bStatRead,  "stats-read");
+TOOLOPT(param->bSingleSeiNal, "single-sei");
 #if ENABLE_HDR10_PLUS
 TOOLOPT(param->toneMapFile != NULL, "dhdr10-info");
 #endif
@@ -1751,6 +1762,7 @@
 s += sprintf(s, " copy-pic=%d", p->bCopyPicToFrame);
 s += sprintf(s, " max-ausize-factor=%.1f", p->maxAUSizeFactor);
 BOOL(p->bDynamicRefine, "dynamic-refine");
+BOOL(p->bSingleSeiNal, "single-sei");
 #undef BOOL
 return buf;
 }
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2289,26 +2289,26 @@
 sbacCoder.codePPS(m_pps, (m_param->maxSlices <= 1), m_iPPSQpMinus26);
 bs.writeByteAlignment();
 list.serialize(NAL_UNIT_PPS, bs);
-
+if (m_param->bSingleSeiNal)
+bs.resetBits();
 if (m_param->bEmitHDRSEI)
 {
 SEIContentLightLevel cllsei;
 cllsei.max_content_light_level = m_param->maxCLL;
 cllsei.max_pic_average_light_level = m_param->maxFALL;
-bs.resetBits();
+if (!m_param->bSingleSeiNal)
+bs.resetBits();
 cllsei.write(bs, m_sps);
-bs.writeByteAlignment();
-list.serialize(NAL_UNIT_PREFIX_SEI, bs);
-
+cllsei.alignAndSerialize(bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, list);
 if (m_param->masteringDisplayColorVolume)
 {
 SEIMasteringDisplayColorVolume mdsei;
 if (mdsei.parse(m_param->masteringDisplayColorVolume))
 {
-bs.resetBits();
+if (!m_param->bSingleSeiNal)
+bs.resetBits();
 mdsei.write(bs, m_sps);
-bs.writeByteAlignment();
-list.serialize(NAL_UNIT_PREFIX_SEI, bs);
+mdsei.alignAndSerialize(bs, false, m_param->bSingleSeiNal, 
NAL_UNIT_PREFIX_SEI, list);
 }
 else
 x265_log(m_param, X265_LOG_WARNING, "unable to parse mastering 
display color volume info\n");
@@ -2328,15 +2328,13 @@
 "Copyright 2013-2018 (c) Multicoreware, Inc - "
 "http://x265.org - options: %s",